Results 1 to 8 of 8
  1. #1
    Join Date
    May 2008
    Posts
    261
    Plugin Contributions
    0

    Default customer sidebox per page

    hi, everyone,

    Does anybody can help me to fix this problem?

    I just want to enabe certain sidebox for certain page.
    for example: only need best_seller sidebox for contact us page.
    firstly, i disabled whole left & right sidebox for contact_us page by adding following code to
    includes\templates\my_templates\contact_us\tpl_main_page.php
    HTML Code:
    if ($current_page_base == 'contact_us') {
    $flag_disable_right = true;
    $flag_disable_left = true;
    then, i pasted code from D:\my website\includes\modules\sideboxes\best_sellers.php
    to contact_us page through Admin--Tools---Page define editor,
    HTML Code:
    <?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 $
    * @version $Id: tpl_best_sellers.php 2982 2007-12-15 21:00:00 TRUST IT - www.trustit.ca - [email protected] $
    */
    
    // test if box should display
    $show_best_sellers= false;
    
    if (isset($_GET['products_id'])) {
        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) {
      if (isset($current_category_id) && ($current_category_id > 0)) {
       $best_sellers_query = "select distinct p.products_id, p.products_image, pd.products_name, p.products_price, 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 '" . (int)$current_category_id . "' in (c.categories_id, c.parent_id)
                  order by p.products_ordered desc, pd.products_name
                  limit " . MAX_DISPLAY_BESTSELLERS;
    
       $best_sellers = $db->Execute($best_sellers_query);
    
      } else {
       $best_sellers_query = "select distinct p.products_id, p.products_image, pd.products_name, p.products_price, 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'];
       $bestsellers_list[$rows]['image'] = $best_sellers->fields['products_image'];
        $bestsellers_list[$rows]['price'] = $best_sellers->fields['products_price'];
        $best_sellers->MoveNext();
       }
    
       $left_corner = false;
       $right_corner = false;
       $right_arrow = false;
       $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);
      }
    }
    ?>
    when open contact_us page in browser, error occured:
    could you please help to check how to fix it? thanks.
    Warning: main(includes/templates/my_templates/contact_us//php) [function.main]: failed to open stream: No such file or directory in includes\languages\english\html_includes\my_templates\define_contact_us.php on line 84

  2. #2
    Join Date
    May 2008
    Posts
    261
    Plugin Contributions
    0

    Default Re: customer sidebox per page

    hi,

    i know have to modify the following code:
    HTML Code:
    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);
      }
    }
    ?>
    but do not know exactly how to modify.

    could you please check? many appreciated.

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

    Default Re: customer sidebox per page

    To not show the best sellers sidebox on the contact_us page you can edit the sidebox module for it with this code:
    Code:
    // don't show on contact_us page
    if ($current_page_base == 'contact_us') {
        $show_best_sellers= false;
    }
    Put it above this line:
    Code:
      if ($show_best_sellers == true) {
    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!

  4. #4
    Join Date
    May 2008
    Posts
    261
    Plugin Contributions
    0

    Default Re: customer sidebox per page

    Hi, Ajeh,

    anyhow many thanks for your suggestion.
    maybe you misunderstand, sorry for my confusion.

    I just want to enabe certain sidebox for certain page.
    for example: to enable bestseller sidebox only for contact_us page.

    and the following is how i enable it:
    firstly, i disabled whole left & right sidebox for contact_us page by adding following code to
    includes\templates\my_templates\contact_us\tpl_main_page.php
    HTML Code:
    if ($current_page_base == 'contact_us') {
    $flag_disable_right = true;
    $flag_disable_left = true;
    then, i pasted code from \includes\modules\sideboxes\best_sellers.php
    to contact_us page through Admin--Tools---Page define editor,

    HTML Code:
    <?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 $
    * @version $Id: tpl_best_sellers.php 2982 2007-12-15 21:00:00 TRUST IT - www.trustit.ca - [email protected] $
    */
    
    // test if box should display
    $show_best_sellers= false;
    
    if (isset($_GET['products_id'])) {
        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) {
      if (isset($current_category_id) && ($current_category_id > 0)) {
       $best_sellers_query = "select distinct p.products_id, p.products_image, pd.products_name, p.products_price, 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 '" . (int)$current_category_id . "' in (c.categories_id, c.parent_id)
                  order by p.products_ordered desc, pd.products_name
                  limit " . MAX_DISPLAY_BESTSELLERS;
    
       $best_sellers = $db->Execute($best_sellers_query);
    
      } else {
       $best_sellers_query = "select distinct p.products_id, p.products_image, pd.products_name, p.products_price, 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'];
       $bestsellers_list[$rows]['image'] = $best_sellers->fields['products_image'];
        $bestsellers_list[$rows]['price'] = $best_sellers->fields['products_price'];
        $best_sellers->MoveNext();
       }
    
       $left_corner = false;
       $right_corner = false;
       $right_arrow = false;
       $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);
      }
    }
    ?>
    as last, when open contact_us page in browser,
    error occured:

    Warning: main(includes/templates/my_templates/contact_us//php) [function.main]: failed to open stream: No such file or directory in includes\languages\english\html_includes\my_templates\define_contact_us.php on line 84

    any further question??
    this errors definitely resulted from the code
    HTML Code:
    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);
      }
    }
    ?>
    could you please hele how to modify?

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

    Default Re: customer sidebox per page

    You are doing way too much work for this ...

    Just work with the sidebox module itself ...

    To enable it for only the contact_us page use the code like this:
    Code:
    // don't show on contact_us page
    if ($current_page_base == 'contact_us') {
    // show it
        $show_best_sellers= true;
    } else {
    // do not show it
        $show_best_sellers= false;
    }
      
      if ($show_best_sellers == true) {
    Now it can only show on contact_us ...
    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
    Join Date
    May 2008
    Posts
    261
    Plugin Contributions
    0

    Default Re: customer sidebox per page

    hi, Ajeh,

    Great, it works. how genious you are.


    Another question about the best_seller sidebox, can you please help for me at www.topalways.com??

    on the main page, i disabled right column. then paste the best_seller side box code at the top right of the main page, which uses the mould $column_box_default,

    now i want to make the bestseller sidebox wider, but it agree with the width of $column_box_default,

    Is it possible to fix this problem? mayn appreciated.

  7. #7
    Join Date
    May 2008
    Posts
    261
    Plugin Contributions
    0

    Default Re: customer sidebox per page

    Anybody there?
    Could you please help me to check what is the problem?

    Many thanks in advance.

  8. #8
    Join Date
    May 2008
    Posts
    261
    Plugin Contributions
    0

    Default Re: customer sidebox per page

    hi, Ajeh,

    are you there? could you please help to check above problem?

    appreciated.

 

 

Similar Threads

  1. Sidebox width varies per page??HELP!
    By ecommercefree in forum Templates, Stylesheets, Page Layout
    Replies: 7
    Last Post: 12 Dec 2010, 06:45 PM
  2. per customer with per category discount
    By jrush in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 2
    Last Post: 15 Dec 2008, 09:45 PM
  3. How do you setup per customer per item pricing??
    By mhebert in forum Setting Up Categories, Products, Attributes
    Replies: 3
    Last Post: 21 Sep 2007, 05:00 AM
  4. Sidebox/header changes per page
    By shackle in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 7 Aug 2007, 11:38 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