From 11755bceee77d494250ce79c3f89ff614762d206 Mon Sep 17 00:00:00 2001 From: Marcin Nowak Date: Tue, 27 Sep 2022 13:31:46 +0200 Subject: [PATCH] Remove const in Mage/Catalog/Model/Resource/Url.php --- .../core/Mage/Catalog/Model/Resource/Url.php | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/app/code/core/Mage/Catalog/Model/Resource/Url.php b/app/code/core/Mage/Catalog/Model/Resource/Url.php index 81aa88edf6c..2bfaa526aad 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Url.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Url.php @@ -27,10 +27,6 @@ */ class Mage_Catalog_Model_Resource_Url extends Mage_Core_Model_Resource_Db_Abstract { - const PRODUCT_ENTITY_TYPE_ID = 4; - const STATUS_ATTRIBUTE_ID = 96; - const DISABLED_PRODUCT_STATUS = 2; - /** * Stores configuration array * @@ -66,6 +62,16 @@ class Mage_Catalog_Model_Resource_Url extends Mage_Core_Model_Resource_Db_Abstra */ protected $_rootChildrenIds = []; + /** + * @var int + */ + protected $_productEntityTypeId; + + /** + * @var int + */ + protected $_statusAttributeId; + /** * Load core Url rewrite model * @@ -73,6 +79,9 @@ class Mage_Catalog_Model_Resource_Url extends Mage_Core_Model_Resource_Db_Abstra protected function _construct() { $this->_init('core/url_rewrite', 'url_rewrite_id'); + $this->_productEntityTypeId = Mage::getModel('eav/entity')->setType(Mage_Catalog_Model_Product::ENTITY)->getTypeId(); + $this->_statusAttributeId = Mage::getModel('catalog/resource_eav_attribute') + ->loadByCode($this->_productEntityTypeId, 'status')->getId(); } /** @@ -980,10 +989,10 @@ protected function _getProducts($productIds, $storeId, $entityId, &$lastEntityId if (!$withDisabled) { $select->join( ['cpei' => 'catalog_product_entity_int'], - 'cpei.entity_id = e.entity_id AND cpei.entity_type_id = ' . self::PRODUCT_ENTITY_TYPE_ID . ' AND cpei.attribute_id = ' . self::STATUS_ATTRIBUTE_ID, + 'cpei.entity_id = e.entity_id AND cpei.entity_type_id = ' . $this->_productEntityTypeId . ' AND cpei.attribute_id = ' . $this->_statusAttributeId, [] ); - $select->where('cpei.value <> ' . self::DISABLED_PRODUCT_STATUS); + $select->where('cpei.value <> ' . Mage_Catalog_Model_Product_Status::STATUS_DISABLED); } $rowSet = $adapter->fetchAll($select, $bind);