Page 4 of 4 FirstFirst ... 234
Results 31 to 32 of 32
  1. #31
    Join Date
    Jul 2012
    Posts
    16,733
    Plugin Contributions
    17

    Default Re: Excluding Category from Bestsellers Sidebox

    And again as before, the sql query must be before the display of the results of what the sql query provides. (please review pages 1/2 about this issue that has been repeated.) again, the lack of information, though the file has been provided leads me to that being what is "broken"... broken can mean a lot of things, details help eliminate the issues...
    Quote Originally Posted by jmberman View Post
    Oh sorry! Thank you.

    Hmm well that's still broken:

    This is the whole file:


    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 $
     */
      $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++) {
        $content .= '<li><a href="' . zen_href_link(zen_get_info_page($bestsellers_list[$i]['id']), 'products_id=' . $bestsellers_list[$i]['id']) . '">' . 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>';
    ?>
    
    if (isset($current_category_id) && ($current_category_id > 0)) {
    $best_sellers_query = "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 '" . (int)$current_category_id . "' in (c.categories_id, c.parent_id))
    AND p.products_id NOT IN (SELECT products_id FROM " . TABLE_PRODUCTS_TO_CATEGORIES . " WHERE categories_id IN (34, 108, 58, 55))
    
    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, 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'] . "')
    AND p.products_id NOT IN (SELECT products_id FROM " . TABLE_PRODUCTS_TO_CATEGORIES . " WHERE categories_id IN (34, 108, 58, 55))
    
    order by p.products_ordered desc, pd.products_name
    limit " . MAX_DISPLAY_BESTSELLERS;
    
    $best_sellers = $db->Execute($best_sellers_query);
    }
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  2. #32
    Join Date
    Jul 2012
    Posts
    16,733
    Plugin Contributions
    17

    Default Re: Excluding Category from Bestsellers Sidebox

    Understanding that not a coder, generally speaking code is executed from top down... One caveat to this is that if code has a function in it, then the function can be located anywhere within the file not necessarily before it is used... That could change in the future as php continues to get modified, but it will be a huge change to how code is written if that is the case. It is fortunate though that the php parser supports this caveat. Javascript is becoming a little more stringent and there is still some leniency on it for now; however, there are tools that will identify issues if code is requested to be executed that has not been found above the point of request...

    Anyways, trying to help learn a little to maybe make you dangerous.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 
Page 4 of 4 FirstFirst ... 234

Similar Threads

  1. v151 Excluding currencies from sidebox
    By pititis in forum General Questions
    Replies: 0
    Last Post: 13 Jun 2013, 10:55 AM
  2. Excluding category from search
    By kgeoffrey in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 13 Jan 2009, 12:46 AM
  3. Excluding an item from bestsellers sidebox
    By Heather88 in forum Basic Configuration
    Replies: 4
    Last Post: 23 May 2007, 08:56 PM
  4. Excluding a category from the Categories sidebox
    By Heather88 in forum Basic Configuration
    Replies: 5
    Last Post: 23 Apr 2007, 09:48 PM
  5. Excluding 1 Category from New Products
    By libracorn in forum Setting Up Categories, Products, Attributes
    Replies: 19
    Last Post: 1 Oct 2006, 10:43 PM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR