Results 1 to 7 of 7
  1. #1
    Join Date
    Feb 2009
    Posts
    34
    Plugin Contributions
    0

    customer issue Canonical link function

    Hi Guys,

    I have for some unavoidable reason - duplicate products and duplicate categories in my website. I need to modify the canonical function so that the search engine indexes only one url.

    I found the canonical function code - but for some reason whenever I try to modify - the website goes down.

    The actual zen cart code is:
    1)
    Here - I need to check if the product id is greater than 2000 then the canonical url to should point to the URL of the product id minus 1000. So if the current product id is 2646 - the rel canonical tag should point to 1646.

    If product id is lesser than 2000 then the function is unchanged.

    /**
    * for products (esp those linked to multiple categories):
    */
    case (strstr($current_page, '_info') && isset($_GET['products_id'])):
    $canonicalLink = zen_href_link($current_page, ($includeCPath ? 'cPath=' . zen_get_generated_category_path_rev(zen_get_products_category_id($_GET['products_id'])) . '&' : '') . 'products_id=' . $_GET['products_id'], 'NONSSL', false);
    break;
    /**


    2)

    Here - I need to check if the product id is greater than 200 then the canonical url to should point to the URL of the cateogory id minus 100. So if the current category id is 264 - the rel canonical tag should point to 164.

    If product id is lesser than 2000 then the function is unchanged.

    * for product listings:
    */
    case ($current_page == 'index' && isset($_GET['cPath'])):
    $canonicalLink = zen_href_link($current_page, zen_get_all_get_params($excludeParams), 'NONSSL', false);
    break;
    /**

    I know this sounds simple - I cant figure out what wrong I am attempting to do :)

  2. #2
    Join Date
    Jan 2004
    Posts
    58,243
    Blog Entries
    3
    Plugin Contributions
    106

    Default Re: Canonical link function

    Quote Originally Posted by mithaimate View Post
    I have for some unavoidable reason - duplicate products and duplicate categories in my website.
    Please explain. How did you end up with actual duplicate products? And why aren't you deleting the actual duplicates so that the problem you're trying to "fix" doesn't actually exist in the first place?
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donations always welcome: www.zen-cart.com/donate

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Feb 2009
    Posts
    34
    Plugin Contributions
    0

    Default Re: Canonical link function

    Quote Originally Posted by DrByte View Post
    Please explain. How did you end up with actual duplicate products? And why aren't you deleting the actual duplicates so that the problem you're trying to "fix" doesn't actually exist in the first place?
    Hi Dr Byte,

    It is always a pleasure to see your response. I will put down a concise background.

    URL: http://goo.gl/11C4h

    The client wanted to have two prices for every product depending on the shipping destination. And also wanted to have the ability to set sales/discounts etc on both the prices.

    So we replicated all the products and categories - one for Price 1 and one for Price 2. Hence we ended up with two category pages (id's) and product id's for every product.

    Hence I need to canonicalize.

  4. #4
    Join Date
    Feb 2009
    Posts
    34
    Plugin Contributions
    0

    Default Re: Canonical link function

    anybody ?

  5. #5
    Join Date
    Jan 2004
    Posts
    58,243
    Blog Entries
    3
    Plugin Contributions
    106

    Default Re: Canonical link function

    Quote Originally Posted by mithaimate View Post
    The client wanted to have two prices for every product depending on the shipping destination. And also wanted to have the ability to set sales/discounts etc on both the prices.

    So we replicated all the products and categories - one for Price 1 and one for Price 2. Hence we ended up with two category pages (id's) and product id's for every product.

    Hence I need to canonicalize.
    Yikes. That's a very complicated scenario. I probably would have tackled it a very different way in order to eliminate all that duplication, improve efficiency, and minimize customer confusion, and avoid this extremely unique need for canonicalization.

    You'll need to write your own custom code for your own very specific unique requirements. Editing the /includes/init_includes/overrides/init_canonical.php would be one place to start, and probably also the /includes/modules/pages/product/main_template_vars.php etc. You'll have to get creative in building the correct remapping algorithm and pray it doesn't break when you add more products in the future.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donations always welcome: www.zen-cart.com/donate

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  6. #6
    Join Date
    Feb 2009
    Posts
    34
    Plugin Contributions
    0

    Default Re: Canonical link function

    Quote Originally Posted by DrByte View Post
    Yikes. That's a very complicated scenario. I probably would have tackled it a very different way in order to eliminate all that duplication, improve efficiency, and minimize customer confusion, and avoid this extremely unique need for canonicalization.

    You'll need to write your own custom code for your own very specific unique requirements. Editing the /includes/init_includes/overrides/init_canonical.php would be one place to start, and probably also the /includes/modules/pages/product/main_template_vars.php etc. You'll have to get creative in building the correct remapping algorithm and pray it doesn't break when you add more products in the future.
    Out of curiosity and better handling of this requirement next time .. what would you have done for this dual price requirement ? I am sure lot of others face this crazy requirement from this bosses / clients..

  7. #7
    Join Date
    Jan 2004
    Posts
    58,243
    Blog Entries
    3
    Plugin Contributions
    106

    Default Re: Canonical link function

    The answer to that really depends on the "why" behind what was done. There are various addons that handle multiple pricing, some that handle multiple stores in one, some that handle customer-buying-groups, and then there's custom coding to handle different prices in different currencies on one product.
    There's no one-size-fits-all answer to the general question you've posed.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donations always welcome: www.zen-cart.com/donate

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 

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
  •