Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How can i make best sellers show on all pages?


Mastermind2008

Recommended Posts

you can install the module which will show the best sellers on all pages

Please read this line: Do you want to find all the answers to your questions? click here. As for contribution database it's located here!

8 people out of 10 don't bother to read installation manuals. I can recommend: if you can't read the installation manual, don't bother to install any contribution yourself.

Before installing contribution or editing/updating/deleting any files, do the full backup, it will save to you & everyone here on the forum time to fix your issues.

Any issues with oscommerce, I am here to help you.

Link to comment
Share on other sites

Hi

 

oscommerce v2.3.1

 

Dose anyone know how to get the front page 'best seller' onto the product page.

 

Thanks

 

Jlewis

Link to comment
Share on other sites

you can install the module which will show the best sellers on all pages

I knew that, but if a category doesn't have any sales it does not appear, and it also does not appear on product pages. I figured it out though myself.

Hi

 

oscommerce v2.3.1

 

Does anyone know how to get the front page 'best seller' onto the product page.

 

Thanks,

 

Jlewis

Yes, you have to comment out the sections shown below. Open bm_best_sellers.php which is located at: /includes/modules/boxes/bm_best_sellers.php and make it match below:

<?php
/*
 $Id$

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2010 osCommerce

 Released under the GNU General Public License
*/

 class bm_best_sellers {
   var $code = 'bm_best_sellers';
   var $group = 'boxes';
   var $title;
   var $description;
   var $sort_order;
   var $enabled = false;

   function bm_best_sellers() {
     $this->title = MODULE_BOXES_BEST_SELLERS_TITLE;
     $this->description = MODULE_BOXES_BEST_SELLERS_DESCRIPTION;

     if ( defined('MODULE_BOXES_BEST_SELLERS_STATUS') ) {
       $this->sort_order = MODULE_BOXES_BEST_SELLERS_SORT_ORDER;
       $this->enabled = (MODULE_BOXES_BEST_SELLERS_STATUS == 'True');

       $this->group = ((MODULE_BOXES_BEST_SELLERS_CONTENT_PLACEMENT == 'Left Column') ? 'boxes_column_left' : 'boxes_column_right');
     }
   }

   function execute() {
     global $HTTP_GET_VARS, $current_category_id, $languages_id, $oscTemplate;

    // if (!isset($HTTP_GET_VARS['products_id'])) {
     //  if (isset($current_category_id) && ($current_category_id > 0)) {
      //   $best_sellers_query = tep_db_query("select distinct p.products_id, pd.products_name 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)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and '" . (int)$current_category_id . "' in (c.categories_id, c.parent_id) order by p.products_ordered desc, pd.products_name limit " . MAX_DISPLAY_BESTSELLERS);  enoch
    //   } else {
         $best_sellers_query = tep_db_query("select distinct p.products_id, pd.products_name 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)$languages_id . "' order by p.products_ordered desc, pd.products_name limit " . MAX_DISPLAY_BESTSELLERS);
     //  }

       if (tep_db_num_rows($best_sellers_query) >= MIN_DISPLAY_BESTSELLERS) {
         $bestsellers_list = '<ol style="margin: 0; padding-left: 25px;">';
         while ($best_sellers = tep_db_fetch_array($best_sellers_query)) {
           $bestsellers_list .= '<li><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $best_sellers['products_id']) . '">' . $best_sellers['products_name'] . '</a></li>';
         }
         $bestsellers_list .= '</ol>';

         $data = '<div class="ui-widget infoBoxContainer">' .
                 '  <div class="ui-widget-header infoBoxHeading">' . MODULE_BOXES_BEST_SELLERS_BOX_TITLE . '</div>' .
                 '  <div class="ui-widget-content infoBoxContents">' . $bestsellers_list . '</div>' .
                 '</div>';

         $oscTemplate->addBlock($data, $this->group);
       //}
     }
   }

   function isEnabled() {
     return $this->enabled;
   }

   function check() {
     return defined('MODULE_BOXES_BEST_SELLERS_STATUS');
   }

   function install() {
     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Best Sellers Module', 'MODULE_BOXES_BEST_SELLERS_STATUS', 'True', 'Do you want to add the module to your shop?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Content Placement', 'MODULE_BOXES_BEST_SELLERS_CONTENT_PLACEMENT', 'Right Column', 'Should the module be loaded in the left or right column?', '6', '1', 'tep_cfg_select_option(array(\'Left Column\', \'Right Column\'), ', now())");
     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_BOXES_BEST_SELLERS_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");
   }

   function remove() {
     tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
   }

   function keys() {
     return array('MODULE_BOXES_BEST_SELLERS_STATUS', 'MODULE_BOXES_BEST_SELLERS_CONTENT_PLACEMENT', 'MODULE_BOXES_BEST_SELLERS_SORT_ORDER');
   }
 }
?>

 

This will show best sellers on all pages.

 

Hope this helps!

 

-Mastermind2008

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...