Zen Cart Logo
If this is your first visit, check our documentation. To post, register or login.
Forums / Configuring the Zen Cart Admin / Basic Configuration / Bestsellers sidebox not showing all bestsellers all the time

Bestsellers sidebox not showing all bestsellers all the time

Locked

Started by heather88 on 8 Apr 2007, 5:40 AM · Views: 4,315

Results 1 to 5 of 5
This thread is locked. New replies are disabled.
8 Apr 2007, 5:40 AM
#1
heather88 avatar

heather88

New Zenner

Join Date:
Mar 2007
Posts:
35
Plugin Contributions:
0

Post #1 by heather88

Is there any way to make the Bestsellers sidebox show all top 10 sellers no matter what page one is viewing? I notice that it shows all top 10 when you're on the main page, but when you're actually in a category it only shows whatever the best seller is for that category, and if you're in a category that doesn't include a bestseller, the sidebox disappears altogether. I'd like the box to show all top 10 all the time - is that possible? Thanks for your help.....

20 Aug 2007, 11:20 PM
#2
marcps avatar

marcps

Zen Follower

Join Date:
Feb 2005
Posts:
92
Plugin Contributions:
0

Post #2 by marcps

I have a worse problem - I only get best sellers in certain categories - and then they are for products that have not yet been sold.

Go here - http://www.partystore.co.uk/

no best sellers

Go here - http://www.partystore.co.uk/index.php?main_page=index&cPath=100_1941

best sellers appears but we have no sales for the item that it says is a best seller.

I have now installed images in best sellers to see if this new module will fix it - but it gives the same results.

Any ideas - anyone?

Marc

Regards
Marc P Summers
https://www.monkeydesignhouse.com

27 Aug 2007, 11:25 PM
#3
alanekilauea avatar

alanekilauea

New Zenner

Join Date:
Jul 2007
Posts:
17
Plugin Contributions:
0

Post #3 by alanekilauea

I modified my bestsellers side box and it now shows the top best sellers on the listing pages regardless of category but it is causing an error on the product detail page.

Fatal error: Call to a member function on a non-object in xxxxx\includes\modules\sideboxes\htd_default\best_sellers.php on line 46

I deleted lines 33 thru 49 of the module, now the block reads:

  if ($show_best_sellers == true) {
    
      $best_sellers_query = "select distinct p.products_id, pd.products_name, p.products_ordered
                             from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
                             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'] . "'
                             order by p.products_ordered desc, pd.products_name
                             limit " . MAX_DISPLAY_BESTSELLERS;

      $best_sellers = $db->Execute($best_sellers_query);
    }

What am I doing wrong, please?

Thanks!
Alane

27 Aug 2007, 11:44 PM
#4
alanekilauea avatar

alanekilauea

New Zenner

Join Date:
Jul 2007
Posts:
17
Plugin Contributions:
0

Post #4 by alanekilauea

OK never mind, I fixed it! Sooo if you want to have the store's best sellers display on all pages, regardless of category you can use this code in your module sideboxes override:

<?php
/**
 * best_sellers sidebox - displays selected number of (usu top ten) best selling products
 *
 * @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: best_sellers.php 2718 2005-12-28 06:42:39Z drbyte $
 */

// test if box should display
  $show_best_sellers= false;

 if (isset($_SESSION['customer_id'])) {
      $check_query = "select count(*) as count
                      from " . TABLE_CUSTOMERS_INFO . "
                      where customers_info_id = '" . (int)$_SESSION['customer_id'] . "'
                      and global_product_notifications = '1'";

      $check = $db->Execute($check_query);

      if ($check->fields['count'] > 0) {
        $show_best_sellers= true;
      }
    
  } else {
    $show_best_sellers= true;
  }

  if ($show_best_sellers == true) {
    
      $best_sellers_query = "select distinct p.products_id, pd.products_name, p.products_ordered
                             from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
                             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'] . "'
                             order by p.products_ordered desc, pd.products_name
                             limit " . MAX_DISPLAY_BESTSELLERS;

      $best_sellers = $db->Execute($best_sellers_query);
    }

    if ($best_sellers->RecordCount() >= MIN_DISPLAY_BESTSELLERS) {
      $title =  BOX_HEADING_BESTSELLERS;
      $box_id =  'bestsellers';
      $rows = 0;
      while (!$best_sellers->EOF) {
        $rows++;
        $bestsellers_list[$rows]['id'] = $best_sellers->fields['products_id'];
        $bestsellers_list[$rows]['name']  = $best_sellers->fields['products_name'];
        $best_sellers->MoveNext();
      }

      $title_link = false;
      require($template->get_template_dir('tpl_best_sellers.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_best_sellers.php');
      $title =  BOX_HEADING_BESTSELLERS;
      require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
    }
?>
6 Jul 2008, 11:50 PM
#5
exoticcorpse avatar

exoticcorpse

New Zenner

Join Date:
Jan 2008
Posts:
35
Plugin Contributions:
0

Post #5 by exoticcorpse

Be careful with the above mod - once you make 10 sales it causes a crash