// Fix on product association deletion
This commit is contained in:
+1
-1
@@ -2300,7 +2300,7 @@ class CartCore extends ObjectModel
|
||||
}
|
||||
|
||||
$cache[(int)$dontAutoSeletectOptions] = $delivery_option;
|
||||
|
||||
|
||||
return $delivery_option;
|
||||
}
|
||||
|
||||
|
||||
@@ -1185,9 +1185,8 @@ abstract class ObjectModelCore
|
||||
public function hasMultishopEntries()
|
||||
{
|
||||
if (!Shop::isTableAssociated($this->def['table']) || !Shop::isFeatureActive())
|
||||
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) > 1);
|
||||
return false;
|
||||
return (bool)Db::getInstance()->getValue('SELECT COUNT(*) FROM `'._DB_PREFIX_.$this->def['table'].'_shop` WHERE `'.$this->def['primary'].'` = '.(int)$this->id);
|
||||
}
|
||||
|
||||
public function isMultishop()
|
||||
|
||||
+1
-4
@@ -650,7 +650,7 @@ class ProductCore extends ObjectModel
|
||||
StockAvailable::removeProductFromStockAvailable($this->id);
|
||||
|
||||
$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 ($this->hasMultishopEntries())
|
||||
return true;
|
||||
@@ -659,8 +659,6 @@ class ProductCore extends ObjectModel
|
||||
if (!$result ||
|
||||
!GroupReduction::deleteProductReduction($this->id) ||
|
||||
!$this->deleteCategories(true) ||
|
||||
!$this->deleteImages() ||
|
||||
!$this->deleteProductAttributes() ||
|
||||
!$this->deleteProductFeatures() ||
|
||||
!$this->deleteTags() ||
|
||||
!$this->deleteCartProducts() ||
|
||||
@@ -670,7 +668,6 @@ class ProductCore extends ObjectModel
|
||||
!SpecificPrice::deleteByProductId((int)$this->id) ||
|
||||
!$this->deletePack() ||
|
||||
!$this->deleteProductSale() ||
|
||||
!$this->deleteSceneProducts() ||
|
||||
!$this->deleteSearchIndexes() ||
|
||||
!$this->deleteAccessories() ||
|
||||
!$this->deleteFromAccessories() ||
|
||||
|
||||
@@ -1938,7 +1938,7 @@ class AdminControllerCore extends Controller
|
||||
* @param integer $limit Row count in LIMIT clause
|
||||
*/
|
||||
public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
|
||||
{
|
||||
{
|
||||
/* Manage default params values */
|
||||
$use_limit = true;
|
||||
if ($limit === false)
|
||||
|
||||
Reference in New Issue
Block a user