Zen Cart Logo

Best seller mod

Locked

Views: 1,480

Results 1 to 3 of 3
This thread is locked. New replies are disabled.
29 Sep 2006, 4:19 PM
#1
ctcentralinfo avatar

ctcentralinfo

Totally Zenned

Join Date:
Apr 2005
Posts:
853
Plugin Contributions:
0

Best seller mod

The folks that designed my site designed this mod, but it doesn't seem to be working correctly.
The Japanese Product Electronics category is showing up, but how do I get
Anime Merchandise, Books Japanese, Electronic Media, and Japanese Magazine
to show up as well?

http://www.books-japan-online.com/test/best_sellers.html

This is the code:

<?php /** * tpl_page_2_default.php * * @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_page_2_default.php 3464 2006-04-19 00:07:26Z ajeh $ */ ?> <div class="centerColumn" id="pageTwo"> <h1 id="pageTwoHeading"><?php echo HEADING_TITLE; ?></h1> <div id="pageTwoMainContent" class="content"> <?php /** * load the html_define for the page_2 default */ require($define_page); ?> <?php $best_id = '8'; $best_sellers_category = "select categories_name from ". TABLE_CATEGORIES_DESCRIPTION ." where categories_id = '" . $best_id . "' and language_id = '" . (int)$_SESSION['languages_id'] . "'";
  $best_category = $db->Execute($best_sellers_category);
  $best_category_id = $best_category->fields['categories_name'];
  echo '<BR /><BR /><b>' . $best_category_id . '</b><br /><br />';
  
  $best_sellers_query2 = "select distinct p.products_id, pd.products_name, p.products_ordered
                         from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, "
                                . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c
                         where p.products_status = '1'
                         and p.products_ordered > 0
                         and p.products_id = pd.products_id
                         and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
                         and p.products_id = p2c.products_id
                         and p2c.categories_id = c.categories_id
                         and '". $best_id ."' in (c.categories_id, c.parent_id)
                         order by p.products_ordered desc, pd.products_name
                         limit 10";

  $best_sellers2 = $db->Execute($best_sellers_query2);
  $rows = 0;
  while (!$best_sellers2->EOF) {
    $rows++;
    $bestsellers_list2[$rows]['id'] = $best_sellers2->fields['products_id'];
    $bestsellers_list2[$rows]['name']  = $best_sellers2->fields['products_name'];
    $best_sellers2->MoveNext();
  }

for ($i=1; $i<=sizeof($bestsellers_list2); $i++) {
echo $content2 = $i . '. <a href="' . zen_href_link(zen_get_info_page($bestsellers_list2[$i]['id']), 'products_id=' . $bestsellers_list2[$i]['id']) . '">' . zen_trunc_string($bestsellers_list2[$i]['name'], '200', '...') . '</a><br />';
}
?>
<br /><br />

</div> <div class="buttonRow back"><?php echo zen_back_link() . zen_image_button(BUTTON_IMAGE_BACK, BUTTON_BACK_ALT) . '</a>'; ?></div> </div>
29 Sep 2006, 6:03 PM
#2
ctcentralinfo avatar

ctcentralinfo

Totally Zenned

Join Date:
Apr 2005
Posts:
853
Plugin Contributions:
0

Re: Best seller mod

I was messing around with the mod and I figured something out the best seller list responds to the category id list. The categories are as follows:

11 Anime Merchandise

4 Books Japanese

135 Electronic Media

7 Japanese Magazines

8 Japanese Product Electronics

I copied the php section of the tpl_best_sellers_default.php and just deplicated it but changed $best_id = '11'
and got the category to show up, but I am also getting japanese elctronic showing up. How do I get products only from that category to show up?

http://www.books-japan-online.com/test/best_sellers.html

29 Sep 2006, 11:00 PM
#3
ctcentralinfo avatar

ctcentralinfo

Totally Zenned

Join Date:
Apr 2005
Posts:
853
Plugin Contributions:
0

Re: Best seller mod

Can anyone give me advice on what I should do?