diff --git a/core/lib/Thelia/Action/Product.php b/core/lib/Thelia/Action/Product.php index 2ef61a268..9cef94218 100644 --- a/core/lib/Thelia/Action/Product.php +++ b/core/lib/Thelia/Action/Product.php @@ -269,7 +269,14 @@ class Product extends BaseAction implements EventSubscriberInterface $product = $event->getProduct(); // Delete all product feature relations - FeatureProductQuery::create()->filterByProduct($product)->delete($con); + if(null !== $featureProducts = FeatureProductQuery::create()->findByProductId($product->getId())){ + /** @var \Thelia\Model\FeatureProduct $featureProduct */ + foreach($featureProducts as $featureProduct){ + $eventDelete = new FeatureProductDeleteEvent($product->getId(), $featureProduct->getFeatureId()); + + $event->getDispatcher()->dispatch(TheliaEvents::PRODUCT_FEATURE_DELETE_VALUE, $eventDelete); + } + } // Delete all product attributes sale elements ProductSaleElementsQuery::create()->filterByProduct($product)->delete($con); diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/TheliaLoop.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/TheliaLoop.php index bf3538002..e041b1d15 100644 --- a/core/lib/Thelia/Core/Template/Smarty/Plugins/TheliaLoop.php +++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/TheliaLoop.php @@ -215,12 +215,15 @@ class TheliaLoop extends AbstractSmartyPlugin */ public function theliaElseloop($params, $content, /** @noinspection PhpUnusedParameterInspection */ $template, &$repeat) { - // When encountering close tag, check if loop has results. - if ($repeat === false) { - return $this->checkEmptyLoop($params) ? $content : ''; + //Block the smarty interpretation in the elseloop + if ($content === null) { + if ( ! $this->checkEmptyLoop($params)){ + $repeat = false; + return ''; + } } - return ''; + return $content; } /**