Forums / Bug Reports / [Done v1.3.10] Best Sellers link missing cPath param

[Done v1.3.10] Best Sellers link missing cPath param

Locked

Views: 6,757

Results 1 to 3 of 3
This thread is locked. New replies are disabled.
18 Nov 2008, 3:28 AM
#1
kiddo avatar

kiddo

Totally Zenned

Join Date:
Jul 2006
Location:
SF Bay Area
Posts:
837
Plugin Contributions:
1

[Done v1.3.10] Best Sellers link missing cPath param

ZC 138 - newest. Bug Demo is new out of box and default demo database. No mods.

Forgive if this has been posted, but I search many ways and not find any info.

Anyway...

When the Best sellers side box is displayed, the links are missing the cPath Param. This seems no big deal, but if you also display the category icon on the page, clicking on it takes you to the homepage instead of the category. You can see this clearly here:

http://www.bellaknobs.com/test/

and clicking on any of the Best Seller Links. The correct item will be displayed, but then click on the category icon will fail to display the category.

Since I can't find any mention of this anywhere, I make small patch that makes this work right.

Here is code that replace tpl_best_sellers.php

<?php /** * Side Box Template * * @package templateSystem * @copyright Copyright 2003-2005 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license <http://www.zen-cart.com/license/2_0.txt> GNU Public License V2.0 * @version $Id: tpl_best_sellers.php 2982 2006-02-07 07:56:41Z birdbrain $ */ $content = ''; $content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent">' . "\n"; $content .= '<div class="wrapper">' . "\n" . '<ol>' . "\n"; for ($i=1; $i<=sizeof($bestsellers_list); $i++) { // kiddo mod $cpath = zen_get_product_path($bestsellers_list[$i]['id']); $content .= '<li><a href="' . zen_href_link(zen_get_info_page($bestsellers_list[$i]['id']), 'products_id=' . $bestsellers_list[$i]['id']) . "&cPath=" . $cpath . '">' . zen_trunc_string($bestsellers_list[$i]['name'], BEST_SELLERS_TRUNCATE, BEST_SELLERS_TRUNCATE_MORE) . '</a></li>' . "\n"; } $content .= '</ol>' . "\n"; $content .= '</div>' . "\n"; $content .= '</div>'; ?>

Then this now makes the category icon link work properly since you pass the proper cPath arg.

If this is already known or there is a better way to fix, sorry to waste your time.

PS: I think I see this same problem with the Quick Reorder Box too.

PPS: I can only leave the bug example install up a few days so if it's gone soon, sic transit gloria mundi.

20 Nov 2008, 11:35 AM
#2
website_rob avatar

website_rob

Inactive

Join Date:
Oct 2006
Location:
Alberta, Canada
Posts:
4,572
Plugin Contributions:
0

Re: [Done v1.3.10] Best Sellers link missing cPath param

This same bug was also brought up earlier this year and, since no patch has been yet issued, can only presume it will be corrected in a future release.

Until then your workaround should be a good solution.

Thanks for sharing. :smile:

The learning is in the doing.

Potent Products

20 Nov 2008, 6:45 PM
#3
kiddo avatar

kiddo

Totally Zenned

Join Date:
Jul 2006
Location:
SF Bay Area
Posts:
837
Plugin Contributions:
1

Re: [Done v1.3.10] Best Sellers link missing cPath param

Thank you for the pointer to that other post. I look at that and see that the fix proposed there does seem to work better than fixing the individual sideboxes.

But I am confused a bit too. In that post, Dr. Byte says that all the side boxen (except Best Sellers) have been updated in 138 to send the cPath arg.

However, I see this missing in a number of side boxes including the Shopping Cart side box. I would think that is one of the more important side boxes.

The tpl_modules_category_icon_display.php is coded to expect the cPath arg passed, but the other posters fix seems to negate the need for that with no ill effects. (but note I have not tested all possibilities)

Below is the code complete with the more elegant fix from HiPCTech

<?php /** * Module Template * * @package templateSystem * @copyright Copyright 2003-2007 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license <http://www.zen-cart.com/license/2_0.txt> GNU Public License V2.0 * @version $Id: tpl_modules_category_icon_display.php 6216 2007-04-17 06:09:57Z ajeh $ */ require(DIR_WS_MODULES . zen_get_module_directory(FILENAME_CATEGORY_ICON_DISPLAY)); ?> <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>

Thank you for the link and comment.