check if pbject exists before deleting it
This commit is contained in:
@@ -73,8 +73,9 @@ class Category extends BaseCategory
|
|||||||
if($productsCategories) {
|
if($productsCategories) {
|
||||||
foreach ($productsCategories as $productCategory) {
|
foreach ($productsCategories as $productCategory) {
|
||||||
$product = $productCategory->getProduct();
|
$product = $productCategory->getProduct();
|
||||||
|
if($product) {
|
||||||
$product->delete($con);
|
$product->delete($con);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -143,7 +144,9 @@ class Category extends BaseCategory
|
|||||||
$subCategories = CategoryQuery::findAllChild($this->getId());
|
$subCategories = CategoryQuery::findAllChild($this->getId());
|
||||||
|
|
||||||
foreach($subCategories as $category) {
|
foreach($subCategories as $category) {
|
||||||
$category->setDispatcher($this->getDispatcher());
|
if (!is_null($this->dispatcher)) {
|
||||||
|
$category->setDispatcher($this->getDispatcher());
|
||||||
|
}
|
||||||
|
|
||||||
$category->delete();
|
$category->delete();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user