Skip to content

Commit

Permalink
Remove const in Mage/Catalog/Model/Resource/Url.php
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcinNowakMacopedia committed Sep 27, 2022
1 parent 1a3ca0f commit 7efdb28
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions app/code/core/Mage/Catalog/Model/Resource/Url.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down Expand Up @@ -66,13 +62,26 @@ 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
*
*/
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();
}

/**
Expand Down Expand Up @@ -977,10 +986,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);
Expand Down

0 comments on commit 7efdb28

Please sign in to comment.