Skip to content

Mage_Bundle_Model_Resource_Price_Index might use wrong event params #4981

@Hanmac

Description

@Hanmac

While looking at the Indexer Code, i noticed this Event:

Mage::dispatchEvent('catalog_product_prepare_index_select', [
'website' => $website,
'select' => $select,
'bind' => $bind,
]);

the problem is, that all the other instances of this Event uses this Params instead:

Mage::dispatchEvent('catalog_product_prepare_index_select', [
'select' => $select,
'entity_field' => new Zend_Db_Expr('e.entity_id'),
'website_field' => new Zend_Db_Expr('cw.website_id'),
'store_field' => new Zend_Db_Expr('cs.store_id'),
]);

And the Only instance in Magento there it is used, also checks for these exact params:

$select = $observer->getEvent()->getSelect();
$entity = $observer->getEvent()->getEntityField();
$website = $observer->getEvent()->getWebsiteField();

So shouldn't it crash in the CatalogInventory there?

$select->join(
['ciss' => $this->getMainTable()],
"ciss.product_id = {$entityField} AND ciss.website_id = {$websiteField}",
[],
);
$select->where('ciss.stock_status = ?', Mage_CatalogInventory_Model_Stock_Status::STATUS_IN_STOCK);

I try to find a way to trigger the Error in the Price_Index function.

If it is really an error, it got unnoticed for 16+ years.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions