Jump to content

Edit History

zunxunz

zunxunz


clarification

41 minutes ago, Daresh said:

There are methods to use, look for offsetSet method of the presented product.

Can you be a little more specific?


For instance, I'm looking to set 'show_price' to false for some specific products under certain conditions.

 

But
$params['presentedProduct']->offsetSet('show_price' false);

or 

$params['presentedProduct']['show_price'] = false;

will both raise an exception, since 'show_price' is 'blocked' by a getter on the ProductLazyArray.

 

PrestaShop\PrestaShop\Core\Exception\CoreException: Trying to set the index show_price of the LazyArray PrestaShop\PrestaShop\Adapter\Presenter\Product\ProductLazyArray already defined by a method is not allowed

zunxunz

zunxunz

15 minutes ago, Daresh said:

There are methods to use, look for offsetSet method of the presented product.

Can you be a little more specific?


For instance, I'm looking to set 'show_price' to false for some specific products under certain conditions.

 

But
offsetSet('show_price' false);

or 

$params['presentedProduct']['show_price'] = false;

will both raise an exception, since 'show_price' is 'blocked' by a getter on the ProductLazyArray.

 

PrestaShop\PrestaShop\Core\Exception\CoreException: Trying to set the index show_price of the LazyArray PrestaShop\PrestaShop\Adapter\Presenter\Product\ProductLazyArray already defined by a method is not allowed

×
×
  • Create New...