From 782c8efa9da2dc2d7b412e770ef49867563db8cc Mon Sep 17 00:00:00 2001 From: aryaantony92 <97134765+aryaantony92@users.noreply.github.com> Date: Wed, 13 Sep 2023 12:15:09 +0200 Subject: [PATCH] Fix demo bo display (#543) * Fix the BO display in the home page * Fix the display of objects in the renderlet * Use getInt for id * Add fallback for frontend and backend * Small optimisation --- src/Controller/ProductController.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Controller/ProductController.php b/src/Controller/ProductController.php index de5812ec..9ac57f5b 100644 --- a/src/Controller/ProductController.php +++ b/src/Controller/ProductController.php @@ -216,9 +216,11 @@ public function listingAction(Request $request, HeadTitle $headTitleHelper, Brea public function productTeaserAction(Request $request, Factory $ecommerceFactory): Response { $paramsBag = []; - if ($request->attributes->get('type') === 'object') { + $type = $request->attributes->get('type')?:$request->query->get('type'); + if ($type === 'object') { AbstractObject::setGetInheritedValues(true); - $product = AbstractProduct::getById($request->attributes->getInt('id')); + $id = $request->attributes->getInt('id')?:$request->query->getInt('id'); + $product = AbstractProduct::getById($id); if ($product instanceof Car && $product->getObjectType() === Car::OBJECT_TYPE_VIRTUAL_CAR) { throw new \Exception('Virtual products are not allowed in product teasers.'); }