shopware-esd icon indicating copy to clipboard operation
shopware-esd copied to clipboard

Custom event

Open ChristopherDosin opened this issue 1 year ago • 1 comments

We use plugins for customized products. In this case, for example. These are stored separately in the shopping cart and therefore need a changed UUID. In the current version of your plugin, the following position is called in the CartSubscriber and causes a failed UUID check on these positions.

private function checkProductSerial(LineItem $lineItem, Context $context): void
{
if ($lineItem->getType() !== LineItem::PRODUCT_LINE_ITEM_TYPE) {
return;
}

$this->esdCartService->checkProductsWithSerialKey([$lineItem->getId()], $context);
}

We have now solved the customer's problem by excluding these products from the check by performing a UUID check ourselves and catching the exception.

private function checkProductSerial(LineItem $lineItem, Context $context): void
{
if ($lineItem->getType() !== LineItem::PRODUCT_LINE_ITEM_TYPE) {
return;
}

try {
Uuid::fromHexToBytes($lineItem->getId());
} catch (\Exception $e) {
return;
}

$this->esdCartService->checkProductsWithSerialKey([$lineItem->getId()], $context);
}

It would also be conceivable to install an event for which you can register to prevent the examination. Could you please consider something like this for your next plugin version?

ChristopherDosin avatar Mar 09 '23 06:03 ChristopherDosin