diff --git a/app/code/core/Mage/Catalog/Model/Indexer/Url.php b/app/code/core/Mage/Catalog/Model/Indexer/Url.php index d66d6e5f924..630bd82a8fb 100644 --- a/app/code/core/Mage/Catalog/Model/Indexer/Url.php +++ b/app/code/core/Mage/Catalog/Model/Indexer/Url.php @@ -183,19 +183,19 @@ protected function _registerProductEvent(Mage_Index_Model_Event $event) $dataChange = false; $products = []; - if (is_a($product, Mage_Catalog_Model_Product_Action::class)) { + if ($product instanceof Mage_Catalog_Model_Product_Action) { $attributesData = $product->getData('attributes_data'); $productsIds = $product->getData('product_ids'); $dataChange = isset($attributesData['status']) && isset($productsIds) && count($productsIds) > 0; if ($dataChange) { $products = Mage::getModel('catalog/product')->getCollection() - ->addFieldToFilter('entity_id', array('in'=> $productsIds)); + ->addFieldToFilter('entity_id', ['in'=> $productsIds]); } else { return; } } - if (is_a($product, Mage_Catalog_Model_Product::class)) { + if ($product instanceof Mage_Catalog_Model_Product) { $dataChange = ( $product->dataHasChangedFor('url_key') diff --git a/app/code/core/Mage/Catalog/Model/Resource/Url.php b/app/code/core/Mage/Catalog/Model/Resource/Url.php index 5c7486f1a6c..3f74421cc71 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Url.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Url.php @@ -1101,7 +1101,7 @@ public function clearRewrites($storeId) $rewriteIds = $adapter->fetchCol($select, $bind); if ($rewriteIds) { - $where = array($this->getIdFieldName() . ' IN(?)' => $rewriteIds); + $where = [$this->getIdFieldName() . ' IN(?)' => $rewriteIds]; $adapter->delete($this->getMainTable(), $where); } @@ -1136,7 +1136,7 @@ public function clearDisabledCategory($categoryId, $storeId = null) $adapter = $this->_getWriteAdapter(); - $table = $this->getTable(array('catalog/category', 'int')); + $table = $this->getTable(['catalog/category', 'int']); $select = $adapter->select() ->from(['tur' => $this->getMainTable()], $this->getIdFieldName()) ->joinLeft( @@ -1185,7 +1185,7 @@ protected function getSelectToClearRewrites($adapter, $storeId) $bind = ['store_id' => $storeId]; $select = $adapter->select() - ->from(array('tur' => $this->getMainTable()), $this->getIdFieldName()) + ->from(['tur' => $this->getMainTable()], $this->getIdFieldName()) ->where('tur.store_id = :store_id') ->where('tur.is_system = 1'); @@ -1199,31 +1199,31 @@ protected function getSelectToClearRewrites($adapter, $storeId) // (either to other category or deleted), so rewrite "category_id-product_id" is invalid if ($productUseCategories) { $select->joinLeft( - array('tcp' => $this->getTable('catalog/category_product')), + ['tcp' => $this->getTable('catalog/category_product')], 'tur.category_id = tcp.category_id AND tur.product_id = tcp.product_id', - array() + [] ) ->where('tcp.category_id IS NULL'); } } else { // Find products, cartegories and cartegory/product rewrites for disabled products or cartegories - $productTable = $this->getTable(array('catalog/product', 'int')); - $categoryTable = $this->getTable(array('catalog/category', 'int')); + $productTable = $this->getTable(['catalog/product', 'int']); + $categoryTable = $this->getTable(['catalog/category', 'int']); $select->joinLeft( ['cpei' => $productTable], 'cpei.entity_id = tur.product_id AND cpei.attribute_id = :product_status_attribute_id', [] ) ->joinLeft( - array('ccei1' => $categoryTable), + ['ccei1' => $categoryTable], 'ccei1.attribute_id = :is_active_category_attribute_id AND ccei1.store_id = 0 AND ccei1.entity_id = tur.category_id', - array() + [] ) ->joinLeft( - array('ccei2' => $categoryTable), + ['ccei2' => $categoryTable], 'ccei2.attribute_id = :is_active_category_attribute_id AND ccei2.store_id = :store_id AND ccei2.entity_id = tur.category_id', - array() + [] ); $productStatusAttributeId = Mage::getSingleton('eav/config') ->getAttribute(Mage_Catalog_Model_Product::ENTITY, 'status'); @@ -1240,9 +1240,9 @@ protected function getSelectToClearRewrites($adapter, $storeId) if ($productUseCategories) { $select ->joinLeft( - array('tcp' => $this->getTable('catalog/category_product')), + ['tcp' => $this->getTable('catalog/category_product')], 'tcp.category_id = tur.category_id AND tcp.product_id = tur.product_id', - array() + [] ); // product_is_disabled OR (category is disabled) OR (cartegory/product rewrite AND product were moved away from the category) $where ='(cpei.value = 2 OR (IF(ccei2.value_id > 0, ccei2.value, ccei1.value) = 0) OR (tur.category_id IS NOT NULL AND tur.product_id IS NOT NULL AND tcp.category_id IS NULL))'; diff --git a/app/code/core/Mage/Catalog/Model/Url.php b/app/code/core/Mage/Catalog/Model/Url.php index 722000e63aa..49b598feebc 100644 --- a/app/code/core/Mage/Catalog/Model/Url.php +++ b/app/code/core/Mage/Catalog/Model/Url.php @@ -498,7 +498,7 @@ public function refreshProductRewrite($productId, $storeId = null) $product = $this->getResource()->getProduct($productId, $storeId, $this->createForDisabled); if (!$product) { // Product doesn't belong to this store - clear all its url rewrites including root one - $this->getResource()->clearProductRewrites($productId, $storeId, array()); + $this->getResource()->clearProductRewrites($productId, $storeId, []); return $this; }