Merge pull request #545 from Yochima/yochima-branch
Use now the dispatcher to delete feature_product when we change the temp... fixed : elseloop executed even if loop is empty
This commit is contained in:
@@ -269,7 +269,14 @@ class Product extends BaseAction implements EventSubscriberInterface
|
|||||||
$product = $event->getProduct();
|
$product = $event->getProduct();
|
||||||
|
|
||||||
// Delete all product feature relations
|
// 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
|
// Delete all product attributes sale elements
|
||||||
ProductSaleElementsQuery::create()->filterByProduct($product)->delete($con);
|
ProductSaleElementsQuery::create()->filterByProduct($product)->delete($con);
|
||||||
|
|||||||
@@ -215,12 +215,15 @@ class TheliaLoop extends AbstractSmartyPlugin
|
|||||||
*/
|
*/
|
||||||
public function theliaElseloop($params, $content, /** @noinspection PhpUnusedParameterInspection */ $template, &$repeat)
|
public function theliaElseloop($params, $content, /** @noinspection PhpUnusedParameterInspection */ $template, &$repeat)
|
||||||
{
|
{
|
||||||
// When encountering close tag, check if loop has results.
|
//Block the smarty interpretation in the elseloop
|
||||||
if ($repeat === false) {
|
if ($content === null) {
|
||||||
return $this->checkEmptyLoop($params) ? $content : '';
|
if ( ! $this->checkEmptyLoop($params)){
|
||||||
|
$repeat = false;
|
||||||
|
return '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
return $content;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user