Results 1 to 8 of 8
  1. #1

    Default Product info with no cPath causes link problems

    Found a small bug. When I have a product info page with no cPath in the URL, the link to the main category won't have the right cPath, causing it to essentially link to my home page. Simple solution:

    Rewrote /includes/templates/template_default/templates/tpl_modules_category_icon_display.php to fix the problem. See below:

    <?php
    $importcPath = $_GET['cPath'];
    if ($importcPath == '')
    $usecPath = $categories_cPath;
    else
    $usecPath = $importcPath;
    ?>
    <div align="<?php echo $align; ?>" id="categoryIcon" class="categoryIcon"><?php echo '<a href="' . zen_href_link(FILENAME_DEFAULT, 'cPath=' . $usecPath , 'NONSSL') . '">' . $category_icon_display_image . $category_icon_display_name . '</a>'; ?></div>

    Then, make a small change in /includes/modules/category_icon_display.php on line 16 add this line:
    $categories_cPath = $cPath;

    That's it! Hope that helps!
    Last edited by srturner47; 20 Apr 2008 at 02:57 AM.

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

    Default Re: Product info with no cPath causes link problems - Solution in Post

    What version are you running?

    Your solution would only handle some issues ...

    In the current version the active categories_id is used and when not known the master_categories_id is used to set the path ...

    Do you have something out of date or perhaps more details about where or when this is happening on your site?

    Can you reproduce it in the Classic Template?
    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!]
    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!

  3. #3

    Default Re: Product info with no cPath causes link problems

    I am using 1.3.8.

    To reproduce the problem, click on a link from the "Customers who bought this product also purchased..."

    When you get to the product, click on the Category Name Link right below the breadcrumb. It should take you to the homepage.

    I preserved the path from Zen cart with a simple if statement when I rewrote /includes/templates/template_default/templates/tpl_modules_category_icon_display.php, so it should still have active categories_id unless none was specified in the link, indicating that the master_categories_id should be used. The fix seems to function like this for me at least. :)

  4. #4
    Join Date
    Aug 2004
    Location
    Saint Petersburg, Russia
    Posts
    1,786
    Plugin Contributions
    13

    Default Re: Product info with no cPath causes link problems

    /includes/templates/template_default/templates/tpl_modules_category_icon_display.php
    Find
    Code:
    <div align="<?php echo $align; ?>" id="categoryIcon" class="categoryIcon"><?php echo '<a href="' . zen_href_link(FILENAME_DEFAULT, 'cPath=' . $_GET['cPath'], 'NONSSL') . '">' . $category_icon_display_image . $category_icon_display_name .  '</a>'; ?></div>
    Replace by
    Code:
    <div align="<?php echo $align; ?>" id="categoryIcon" class="categoryIcon"><?php echo '<a href="' . zen_href_link(FILENAME_DEFAULT, 'cPath=' . $cPath, 'NONSSL') . '">' . $category_icon_display_image . $category_icon_display_name .  '</a>'; ?></div>

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

    Default Re: Product info with no cPath causes link problems

    There is an issue on the Also Purchased centerbox ... nice catch ...

    The Also Purchased is not using either the cPath or the master_categories_id ...

    cPath is only correct if the product resides in that category ... otherwise the master_categories_id is the better choice ...

    There is the arguement that Also Purchased if using the master_categories_id will get the customer to look at other categories ... so which is the better choice for that particular centerbox?

    You have to be careful and not send the customer to an invalid cPath with a product ... as the link will take the customer to that cPath with the products_id you selected but ... this breaks the navigation now as the products_id has no relationship to that categories_id and you will get the: Sorry no Products in this category when using previous/next and the listing will take you to the current cPath and that doesn't show the products_id you were just looking at ...

    So ... we will give this a think or three and post the solution we will be using in a future release in the fixes for v1.3.8 ...

    Thanks for breaking down the method to reproduce this one ...
    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!]
    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!

  6. #6

    Default Re: Product info with no cPath causes link problems

    Just a thought -- Obviously the Also Purchased problem should be fixed somehow, but I also think that there should be a default behavior when neither cPath nor master category are specified in the URL. (Probably Master Category) Why? There are tons of mods for Zen Cart that did not code in a master category or a cPath for their links. I found two mods on my install that have this behavior. I actually found this problem with the cross sell mod, so at first I thought this was a problem with one of my mods. Then I realized Zen Cart had the same behavior with the Also Purchased feature. Later, I found this problem with another, less popular, mod that I am using. I'm sure there are hundreds more out there.

    Just my 2 cents. :)

    Thanks for the great work with Zen Cart!

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

    Default Re: Product info with no cPath causes link problems

    That is more or less what I was saying ...

    Also Purchased are a group of unrelated products that are only related by virtue that they were purchased together ...

    Being such, master_categories_id is rather ideal to use as this leads customers to other categories that they may not have otherwise explored and encourages additional spontaneous purchases ...

    Thanks for the info!
    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!]
    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!

  8. #8
    Join Date
    Jul 2009
    Location
    Roswell, NM, USA
    Posts
    97
    Plugin Contributions
    0

    Default Re: Product info with no cPath causes link problems

    I was having an issue where anything in the What's New sidebox and the Specials sidebox were showing cpath=0 which caused the sub cat link to return to the main page, etc. There was no cpath to pass on.

    The reason was I had not manually set the "master category" for those products. I had used the oscommerce import mod to transfer everything so there were no masters defined. As soon as I went in and set them it cured the issue.

    So lesson learned if you get the cpath=0 or cpath= it just might be that it isn't defined,

    Blessings,
    Krisann

    Keywords: cpath=0 subcategory links master category

 

 

Similar Threads

  1. v151 Problems with product info page
    By barendfaber in forum Templates, Stylesheets, Page Layout
    Replies: 13
    Last Post: 25 Nov 2013, 04:40 AM
  2. v139h Problems with product info display background
    By barendfaber in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 13 Aug 2012, 11:03 AM
  3. Strange Bug with Category cPath link
    By kaylala in forum General Questions
    Replies: 8
    Last Post: 4 Dec 2010, 04:40 AM
  4. Image causes problems with the store.
    By FragaGeddon in forum Setting Up Categories, Products, Attributes
    Replies: 3
    Last Post: 9 Aug 2010, 05:45 AM
  5. Easy Populate causes problems to Multiple Categories Link Manager
    By milobloom in forum All Other Contributions/Addons
    Replies: 9
    Last Post: 12 Aug 2006, 02:36 PM

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