-
- Faminor

-
Total Posts: 2
Joined: 2010-01-02
|
I am not sure why everyone ignored Mike Smullin’s post #33, but it solved the problem for me to the full extent. Through this I got the breadcrumbs, titles and navigation fixed. Before, if I entered the product page from search results or from a higher level category listing, Magento displayed incomplete breadcrumbs and url’s.
I believe, however, that the file in my Magento install differed from the file in the post. Also, if you don’t understand the diff files, just try to do this:
go to app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Collection.php
find this piece of code (in my revision it is line #825):
$select = $this->getConnection()->select()
->from($this->getTable(’core/url_rewrite’), array(’product_id’, ‘request_path’))
->where(’store_id=?’, Mage::app()->getStore()->getId())
->where(’is_system=?’, 1)
->where(’category_id=? OR category_id is NULL’, $this->_urlRewriteCategory)
->where(’product_id IN(?)’, $productIds)
->order(’category_id DESC’); // more priority is data with category id
$urlRewrites = array();
and replace it all with:
$select = $this->getConnection()->select()
->from($this->getTable(’core/url_rewrite’), array(’product_id’, ‘request_path’))
->where(’store_id=?’, Mage::app()->getStore()->getId())
->where(’is_system=?’, 1)
// excluding this clause to facilitate one URL per product, and one that includes the category
// if a product has multiple categories, the first one (by category_id) will be used
// in most cases you’ll probably only have one category because you only want one page per product for SEO reasons
// for maximum link juice, no possibility of duplicate content, and a less confusing store
// ->where(’category_id=? OR category_id is NULL’, $this->_urlRewriteCategory)
->where(’product_id IN(?)’, $productIds)
->order(’category_id DESC’); // more priority is data with category id
$urlRewrites = array();
For more check this out:
http://www.mikesmullin.com/development/use-categories-product-urls-magento-seo-without-duplicate-content/
|