Results 1 to 9 of 9
  1. #1
    Join Date
    Jun 2008
    Posts
    187
    Plugin Contributions
    0

    help question $current_category_id incorrect on product page

    Hey guys,
    I have a problem with zencart defaulting to 'master category id' on a product page.
    for some reason our cart doesn't seem to follow the true path of $current_category_id.

    From a fresh install it seems that the $current_category_id is adeared to when clicking through to a product page.

    my problem is this
    e.g.

    i have product 235 - its in category 6(master) and category 7.

    I navigate from category 6 to the product and $current_category_id = 6 -Which is correct.

    I navigate from category 7 to the product page and $current_category_id = 6 - Which is incorrect.

    and weirder still the url structure takes the last place the product was copied to regardless of if the product came from the master category page.

    so for example product 789 is in category 111(master), 222, 333. I copied the product last to cat 333.

    I navigate from 111 to product and Url structure would be /shop/333/789.html.

    I navigate from 222 to product and Url structure would be /shop/333/789.html.

    I navigate from 333 to product and Url structure would be /shop/333/789.html.

    Clearly its somthing that has been messed about with before i arrived here, because its always done this and only now is it affecting functionality where i need 'current_category_id' to be correct so that my custom nav shows only in a certain category.

    At category level my custom nav shows fine because 'current_category_id' is still being adeared to but then when i click on the product from this cat it doesn't display my custom nav.

    guys i really need help with this, i just have no clue where to start.

    regards

    Andy.

  2. #2
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: $current_category_id incorrect on product page

    Zen Cart doesn't normally create URLs in the form of "/shop/333/789.html", so those URLs must be getting altered by a so-called SEO addon.

    Is there something wrong with your addon?
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    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
    Jun 2008
    Posts
    187
    Plugin Contributions
    0

    Default Re: $current_category_id incorrect on product page

    I've often asked this question but as i wasn't around when this module was installed i'm reluctant to tinker with it.

    But surely the seo module shouldn't be affecting the '$current_category_id' and even if it was it would mean it should default to the 'master category id' url.

    But Dr i think you may well be right about the seo module being broken to some extent, i just have to work out which of the two is being used. it's either 'ultimate-seo' or its 'magic-seo' is there a way to tell which one is being used?

    regards

    Andy.

  4. #4
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: $current_category_id incorrect on product page

    I would check if you have a switch to turn those off or something and then look at the Known Bug Fixes for v1.3.8 at:
    http://www.zen-cart.com/forum/showth...860#post610860

    and review the ones on master_categories_id or categories_id or cpath that have been posted to see if that clears up the problem ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  5. #5
    Join Date
    Jun 2008
    Posts
    187
    Plugin Contributions
    0

    Default Re: $current_category_id incorrect on product page

    Hello thanks for replying i've corrected:

    Problem: Sales made with Salemaker having trouble on some sales with Linked Products ...

    Problem: Looking up fields in products and products_description and looking up fields in categories and categories_description ...

    Problem: Lookup of fields in products or products_description by products_id in the Admin

    Symptom:
    There's a bug in v1.3.8 which only shows when you have
    Admin->Configuration->Layout Settings->Categories - Always Show on Main Page = 1

    However none of these seemed to have fixed the issue.

    Any other ideas?

    Andy.

  6. #6
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: $current_category_id incorrect on product page

    Turn off the SEO to see if this is contributing to the problem ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  7. #7
    Join Date
    Jun 2008
    Posts
    187
    Plugin Contributions
    0

    Default Re: $current_category_id incorrect on product page

    Heya ajeh,

    i've found out 2 things

    1) we have magic-seo installed

    2) its this thats knocking it out.

    when i temporarly removed this the 'current_category_id' worked correctly and also my orginal 'cpath' method for including my nav worked as well.

    Next step for me is contacting them ill update here with the outcome for the benefit on any other people who are encountering this problem

    regards

    Andy.

  8. #8
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: $current_category_id incorrect on product page

    Thanks for the information that your SEO is the issue ... let us know what you find out ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  9. #9
    Join Date
    Dec 2010
    Posts
    3
    Plugin Contributions
    0

    Default Re: $current_category_id incorrect on product page

    I've got the same trouble as topic starter has.
    I didn't found any solution on this forum. I've googled hard and as a result I've found this:
    ddmin.com/zen-cart_zen_get_products_category_id-bug/
    It is in Chinese, but google translated it pretty well:
    translate.google.com/translate?js=n&prev=_t&hl=en&ie=UTF-8&layout=2&eotf=1&sl=auto&tl=en&u=http%3A%2F%2Fwww.ddmin.com%2Fzen-cart_zen_get_products_category_id-bug%2F

    But in my situation variable $current_category_id wasn't NULL, but 4.
    In this case I didn't found anything better than disabling IF.
    So my zen_get_products_category_id function looks so:
    PHP Code:
      function zen_get_products_category_id($products_id) {
        global 
    $db;

    /* ori
        $the_products_category_query = "select products_id, master_categories_id from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'";
        $the_products_category = $db->Execute($the_products_category_query);

        return $the_products_category->fields['master_categories_id'];
    */
    //bof category icon display fix, by Yury
    //if (! $the_products_category->fields['master_categories_id']) {
        
    $d_p2c_cid $db->Execute('SELECT categories_id FROM `' TABLE_PRODUCTS_TO_CATEGORIES '` WHERE products_id="' $products_id '"')->fields['categories_id'];
        
    $the_products_category->fields['master_categories_id'] = $d_p2c_cid;
    //echo $d_p2c_cid;
    //}
        
    return $d_p2c_cid;
    //eof category icon display fix, by Yury
      

    The site is Ok now, there are no secretes with that. Here I am - http://cellchaos.com

    I'm tired with this fix, and now I don't wish to find out why my $current_category_id wasn't NULL
    Please let me know if there are better solutions...

 

 

Similar Threads

  1. selecting product category gives incorrect page titles
    By zmtak in forum General Questions
    Replies: 4
    Last Post: 30 Apr 2011, 02:11 AM
  2. incorrect path to product detail?
    By lorikay7 in forum General Questions
    Replies: 2
    Last Post: 13 Jun 2009, 05:06 PM
  3. Additional Sidebox Only to Appear in current_category_id
    By limelites in forum Addon Sideboxes
    Replies: 11
    Last Post: 22 Feb 2009, 10:37 PM
  4. product's price incorrect
    By jeanmichel in forum Setting Up Categories, Products, Attributes
    Replies: 4
    Last Post: 26 Oct 2006, 01:16 AM
  5. Product id incorrect in database
    By rgoetz in forum Managing Customers and Orders
    Replies: 4
    Last Post: 9 Aug 2006, 11:53 AM

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
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR