From 0c89fef50cd5621a9ef423fdc0c6077bfd0f7bf7 Mon Sep 17 00:00:00 2001 From: JBleijenberg Date: Wed, 24 Oct 2012 12:10:30 +0300 Subject: [PATCH] Update app/code/core/Mage/Catalog/Model/Resource/Product/Collection.php joinUrlRewrite() tried to join on a non-existing column in `core_url_rewrite`. Before the fix, this join was done with the product entity_id, on the entity_id column of core_url_rewrite. This column does not exists in core_url_rewrite. I've changed to query to join on product_id in core_url_rewrite. It also used a conditional statement where type = 2. But column `type` does not exist in core_url_rewrite. I've removed this conditional statement. Before fix, Magento would throw an exception. After fix, it joins the correct columns --- .../core/Mage/Catalog/Model/Resource/Product/Collection.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/core/Mage/Catalog/Model/Resource/Product/Collection.php b/app/code/core/Mage/Catalog/Model/Resource/Product/Collection.php index 494ba62556c2e..47ad0ba2e3eda 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Product/Collection.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Product/Collection.php @@ -1091,9 +1091,9 @@ public function joinUrlRewrite() { $this->joinTable( 'core_url_rewrite', - 'entity_id=entity_id', + 'product_id=entity_id', array('request_path'), - '{{table}}.type = ' . Mage_Core_Model_Url_Rewrite::TYPE_PRODUCT, + null, 'left' );