Skip to content

Commit

Permalink
Fix demo bo display (#543)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
aryaantony92 authored Sep 13, 2023
1 parent 3923ff4 commit 782c8ef
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Controller/ProductController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.');
}
Expand Down

0 comments on commit 782c8ef

Please sign in to comment.