/** * Join url rewrite table to collection * * @param Mage_Catalog_Model_Resource_Category_Flat_Collection $collection * @param int $storeId * @return Mage_Catalog_Helper_Category_Url_Rewrite|Mage_Catalog_Helper_Category_Url_Rewrite_Interface */ public function joinTableToCollection(Mage_Catalog_Model_Resource_Category_Flat_Collection $collection, $storeId) { if ($this->_helper()->OptimizeCategoriesLeftJoin($storeId)) { $collection->getSelect()->joinLeft(array('url_rewrite' => $collection->getTable('urlindexer/url_rewrite')), 'url_rewrite.category_id = main_table.entity_id AND url_rewrite.is_system = 1 ' . ' AND ' . $collection->getConnection()->quoteInto('url_rewrite.store_id = ?', $storeId) . ' AND ' . $collection->getConnection()->quoteInto('url_rewrite.id_path LIKE ?', 'category/%'), array('request_path')); return $this; } return parent::joinTableToCollection($collection, $storeId); }
/** * Join url rewrite table to collection * * @param Mage_Catalog_Model_Resource_Category_Flat_Collection $collection * @param int $storeId * @return Mage_Catalog_Helper_Category_Url_Rewrite|Mage_Catalog_Helper_Category_Url_Rewrite_Interface */ public function joinTableToCollection(Mage_Catalog_Model_Resource_Category_Flat_Collection $collection, $storeId) { $collection->getSelect()->joinLeft(array('url_rewrite' => $collection->getTable('core/url_rewrite')), 'url_rewrite.category_id = main_table.entity_id AND url_rewrite.is_system = 1 ' . ' AND ' . $collection->getConnection()->quoteInto('url_rewrite.store_id = ?', $storeId) . ' AND ' . $collection->getConnection()->quoteInto('url_rewrite.id_path LIKE ?', 'category/%'), array('request_path')); return $this; }
/** * Join url rewrite table to flat collection * * @param Mage_Catalog_Model_Resource_Category_Flat_Collection $collection * @param int $storeId * @return Enterprise_Catalog_Helper_Category_UrlRewrite */ public function joinTableToCollection(Mage_Catalog_Model_Resource_Category_Flat_Collection $collection, $storeId) { $requestPath = $this->_connection->getIfNullSql('url_rewrite.request_path', 'default_ur.request_path'); $collection->getSelect()->joinLeft(array('url_rewrite_category' => $collection->getTable('enterprise_catalog/category')), 'url_rewrite_category.category_id = main_table.entity_id' . ' AND ' . $collection->getConnection()->quoteInto('url_rewrite_category.store_id = ?', $storeId), array(''))->joinLeft(array('url_rewrite' => $collection->getTable('enterprise_urlrewrite/url_rewrite')), 'url_rewrite_category.url_rewrite_id = url_rewrite.url_rewrite_id AND url_rewrite.is_system = 1', array(''))->joinLeft(array('default_urc' => $collection->getTable('enterprise_catalog/category')), 'default_urc.category_id = main_table.entity_id AND default_urc.store_id = 0', array(''))->joinLeft(array('default_ur' => $collection->getTable('enterprise_urlrewrite/url_rewrite')), 'default_ur.url_rewrite_id = default_urc.url_rewrite_id AND default_ur.is_system = 1', array('request_path' => $requestPath)); return $this; }