Magento Expert Forum - Improve your Magento experience

Results 1 to 4 of 4

Prevent generating 2 URLs when reindexing catalog URLs

  1. #1
    New member
    Join Date
    Apr 2014
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Prevent generating 2 URLs when reindexing catalog URLs

    Hello,

    ​I set “Use Categories Path for Product URLs” to “NO”, but when I reindex the Catalog URL Rewrites it creates for each product one regular url (domain.com/product_name.html) and one for each category path (domain.com/category_path/product_name.html).

    I’ve deleted all the product URL rewrites that contain category path, but when I reindex the Catalog URL Rewrites it creates them again. So, crawler module crawl all product urls that includes category path and it’s unnecessary. I can’t find to prevent to generating 2 urls when reindexing but it’ll be good if i can exclude them from crawling.

    Can you give an example regexp pattern to filter them. I’m not good at regexp and couldn’t find a solution.

    Thanks.

    View more threads in the same category:


  2. #2
    Administrator david's Avatar
    Join Date
    Nov 2012
    Posts
    261
    Thanks
    22
    Thanked 42 Times in 34 Posts

    Default

    Browse to this file app/code/core/Mage/Catalog/Model/Resource/Product/Collection.php

    At line 1100 and remove this part

    PHP Code:
    ->where('category_id = ? OR category_id IS NULL'$this->_urlRewriteCategory
    Let 's do it as override file, don't edit core file . Now reindex again to see if the duplicate URL generate again.

  3. #3
    New member
    Join Date
    Apr 2014
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by david View Post
    Browse to this file app/code/core/Mage/Catalog/Model/Resource/Product/Collection.php

    At line 1100 and remove this part

    PHP Code:
    ->where('category_id = ? OR category_id IS NULL'$this->_urlRewriteCategory
    Let 's do it as override file, don't edit core file . Now reindex again to see if the duplicate URL generate again.
    Hi, This is for which version of Magento? I use 1.8 but no such a code at line 1100

    There are similar codes but i don't know what should i do.

    Collection.php file of Magento 1.8.1 is here: http://pastebin.com/zqdTRR3v

    Thanks.

  4. #4
    Junior Member
    Join Date
    Apr 2014
    Posts
    42
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default

    It's a common issue when i update my catalog but thanks to you, now i can easily sort this out with you help. One thing more i want to know there are all the similar codes so how can i find which is relevant to me.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •