Use now the dispatcher to delete feature_product when we change the template of a product
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 != $feature_products = FeatureProductQuery::create()->findByProductId($product->getId())){
|
||||||
|
/** @var \Thelia\Model\FeatureProduct $feature_product */
|
||||||
|
foreach($feature_products as $feature_product){
|
||||||
|
$event_delete = new FeatureProductDeleteEvent($product->getId(), $feature_product->getFeatureId());
|
||||||
|
|
||||||
|
$event->getDispatcher()->dispatch(TheliaEvents::PRODUCT_FEATURE_DELETE_VALUE, $event_delete);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Delete all product attributes sale elements
|
// Delete all product attributes sale elements
|
||||||
ProductSaleElementsQuery::create()->filterByProduct($product)->delete($con);
|
ProductSaleElementsQuery::create()->filterByProduct($product)->delete($con);
|
||||||
|
|||||||
Reference in New Issue
Block a user