// Fix on product association deletion
This commit is contained in:
@@ -1186,8 +1186,7 @@ abstract class ObjectModelCore
|
|||||||
{
|
{
|
||||||
if (!Shop::isTableAssociated($this->def['table']) || !Shop::isFeatureActive())
|
if (!Shop::isTableAssociated($this->def['table']) || !Shop::isFeatureActive())
|
||||||
return false;
|
return false;
|
||||||
//check if there is more than one entries in associated shop table
|
return (bool)Db::getInstance()->getValue('SELECT COUNT(*) FROM `'._DB_PREFIX_.$this->def['table'].'_shop` WHERE `'.$this->def['primary'].'` = '.(int)$this->id);
|
||||||
return (bool)(Db::getInstance()->getValue('SELECT COUNT(*) FROM `'._DB_PREFIX_.$this->def['table'].'_shop` WHERE `'.$this->def['primary'].'` = '.(int)$this->id) > 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isMultishop()
|
public function isMultishop()
|
||||||
|
|||||||
+1
-4
@@ -650,7 +650,7 @@ class ProductCore extends ObjectModel
|
|||||||
StockAvailable::removeProductFromStockAvailable($this->id);
|
StockAvailable::removeProductFromStockAvailable($this->id);
|
||||||
|
|
||||||
$result = parent::delete();
|
$result = parent::delete();
|
||||||
|
$result &= ($this->deleteProductAttributes() && $this->deleteImages() && $this->deleteSceneProducts());
|
||||||
// If there are still entries in product_shop, don't remove completly the product
|
// If there are still entries in product_shop, don't remove completly the product
|
||||||
if ($this->hasMultishopEntries())
|
if ($this->hasMultishopEntries())
|
||||||
return true;
|
return true;
|
||||||
@@ -659,8 +659,6 @@ class ProductCore extends ObjectModel
|
|||||||
if (!$result ||
|
if (!$result ||
|
||||||
!GroupReduction::deleteProductReduction($this->id) ||
|
!GroupReduction::deleteProductReduction($this->id) ||
|
||||||
!$this->deleteCategories(true) ||
|
!$this->deleteCategories(true) ||
|
||||||
!$this->deleteImages() ||
|
|
||||||
!$this->deleteProductAttributes() ||
|
|
||||||
!$this->deleteProductFeatures() ||
|
!$this->deleteProductFeatures() ||
|
||||||
!$this->deleteTags() ||
|
!$this->deleteTags() ||
|
||||||
!$this->deleteCartProducts() ||
|
!$this->deleteCartProducts() ||
|
||||||
@@ -670,7 +668,6 @@ class ProductCore extends ObjectModel
|
|||||||
!SpecificPrice::deleteByProductId((int)$this->id) ||
|
!SpecificPrice::deleteByProductId((int)$this->id) ||
|
||||||
!$this->deletePack() ||
|
!$this->deletePack() ||
|
||||||
!$this->deleteProductSale() ||
|
!$this->deleteProductSale() ||
|
||||||
!$this->deleteSceneProducts() ||
|
|
||||||
!$this->deleteSearchIndexes() ||
|
!$this->deleteSearchIndexes() ||
|
||||||
!$this->deleteAccessories() ||
|
!$this->deleteAccessories() ||
|
||||||
!$this->deleteFromAccessories() ||
|
!$this->deleteFromAccessories() ||
|
||||||
|
|||||||
Reference in New Issue
Block a user