Skip to content

Commit

Permalink
[bug-OpenMage#303] Slow queries with MySQL 5.7 in Mage_Catalog_Helper…
Browse files Browse the repository at this point in the history
…_Category_Url_Rewrite

Fixes: OpenMage#295
  • Loading branch information
tmotyl authored and edannenberg committed Feb 11, 2019
1 parent acf9665 commit e2cbc70
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/code/core/Mage/Catalog/Helper/Category/Url/Rewrite.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public function joinTableToEavCollection(Mage_Eav_Model_Entity_Collection_Abstra
array('request_path'),
"{{table}}.is_system=1 AND " .
"{{table}}.store_id='{$storeId}' AND " .
"{{table}}.category_id IS NOT NULL AND " .
"{{table}}.id_path LIKE 'category/%'",
'left'
);
Expand All @@ -94,6 +95,7 @@ public function joinTableToCollection(Mage_Catalog_Model_Resource_Category_Flat_
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 url_rewrite.category_id IS NOT NULL'.
' AND ' . $collection->getConnection()->quoteInto('url_rewrite.id_path LIKE ?', 'category/%'),
array('request_path')
);
Expand All @@ -114,6 +116,7 @@ public function joinTableToSelect(Varien_Db_Select $select, $storeId)
'url_rewrite.category_id=main_table.entity_id AND url_rewrite.is_system=1 AND ' .
$this->_connection->quoteInto('url_rewrite.store_id = ? AND ',
(int)$storeId) .
'url_rewrite.category_id IS NOT NULL AND '.
$this->_connection->prepareSqlCondition('url_rewrite.id_path', array('like' => 'category/%')),
array('request_path' => 'url_rewrite.request_path'));
return $this;
Expand Down

0 comments on commit e2cbc70

Please sign in to comment.