Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 32
  1. #21
    Join Date
    May 2016
    Location
    Ohio
    Posts
    410
    Plugin Contributions
    0

    Default Re: Excluding Category from Bestsellers Sidebox

    This is the default sideboxes best seller file, should I start over from here?


    <?php
    /**
    * Side Box Template
    *
    * @package templateSystem
    * @copyright Copyright 2003-2018 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: Drbyte Sun Jan 7 21:28:50 2018 -0500 Modified in v1.5.6 $
    */
    $content = '';
    $content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent">' . "\n";
    $content .= '<div class="wrapper">' . "\n" . '<ol>' . "\n";
    for ($i=1, $j=sizeof($bestsellers_list); $i<$j; $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>';

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

    Default Re: Excluding Category from Bestsellers Sidebox

    If things went blank, then likely there is a debug log associated with it. That debug log would be found in the logs folder...

    Also, it would appear that the previous direction to place/update the sql code within the applicable includes/modules file was not followed... technically there is nothing about this request which has anything to do with the template file that is identified above. The way the data is presented is still the same. It is the data to be provided that is different.



    Also, the box may be empty depending on the category in which you are viewing that side box... if all of the product associated with that category fit into the exclusion list, then there will be nothing to display. So that is in part where the review/investigation may need to start.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #23
    Join Date
    May 2016
    Location
    Ohio
    Posts
    410
    Plugin Contributions
    0

    Default Re: Excluding Category from Bestsellers Sidebox

    I'm not a coder, I have an incredibly busy business I run, but it basically sounds like you don't want to tell me how to fix it or you want me to have to hire someone to fix it, and they'd charge like a lot of money when you could just tell me how to fix it lol..

    Can't someone just tell me please how to fix it without it being a brain teaser? :)

  4. #24
    Join Date
    Jul 2012
    Posts
    16,733
    Plugin Contributions
    17

    Default Re: Excluding Category from Bestsellers Sidebox

    Quote Originally Posted by jmberman View Post
    I'm not a coder, I have an incredibly busy business I run, but it basically sounds like you don't want to tell me how to fix it or you want me to have to hire someone to fix it, and they'd charge like a lot of money when you could just tell me how to fix it lol..

    Can't someone just tell me please how to fix it without it being a brain teaser? :)
    From the information that has been provided thus far, I don't see that there is an issue. As an individual not logged into the server, more information is needed in order to offer a fix... realize how aggravating this all can be, but to diagnose a problem, need to know the details of the problem as made available by those with access to the details...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  5. #25
    Join Date
    May 2016
    Location
    Ohio
    Posts
    410
    Plugin Contributions
    0

    Default Re: Excluding Category from Bestsellers Sidebox

    I thought I stated the issue clearly, but here it is again:

    I want to exclude several categories from the best seller side box.

    I had it working in an older version of Zen Cart, but I hired someone to upgrade Zen since my host was dropping the old outdated PHP that 1.54 was dependent upon... and now my bestseller sidebox exclusions are gone.


    categories to exclude: 108, 58, 34, 55

    :)

  6. #26
    Join Date
    Jul 2012
    Posts
    16,733
    Plugin Contributions
    17

    Default Re: Excluding Category from Bestsellers Sidebox

    Quote Originally Posted by jmberman View Post
    I thought I stated the issue clearly, but here it is again:

    I want to exclude several categories from the best seller side box.

    I had it working in an older version of Zen Cart, but I hired someone to upgrade Zen since my host was dropping the old outdated PHP that 1.54 was dependent upon... and now my bestseller sidebox exclusions are gone.


    categories to exclude: 108, 58, 34, 55

    :)
    Assuming that the only change that haredo had made to the original sql was to use the proper sql statement to consider multiple categories in the result, then his first rewrite is correct. Otherwise, if you just change the original in this one area from:
    Code:
    categories_id = 34
    To:
    Code:
    categories_id IN (34, 108, 58, 55)
    As I originally said, then the filter should work as requested. Whether it provides the actual data sought is still open to debate based on what the data actually includes (the other part of my discussion which I believe led to the consternation along with the description of relocating the sql statement into the modules directory).

    Beyond that, each time a change was made that provided an inaccurate result, there was a problem. Each of those problems has a different fix. The specific problem with each of those attempts was not provided. To correct the problem at each of those, information is/was needed. Right now I have no idea what the status of the file(s) are andam hoping thatthe siple fixprovided above will possibly be able to be applied and not have to start at square one again...
    Last edited by mc12345678; 16 Apr 2020 at 12:14 PM.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  7. #27
    Join Date
    May 2016
    Location
    Ohio
    Posts
    410
    Plugin Contributions
    0

    Default Re: Excluding Category from Bestsellers Sidebox

    This completely breaks the site

    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);
    }

  8. #28
    Join Date
    Jul 2012
    Posts
    16,733
    Plugin Contributions
    17

    Default Re: Excluding Category from Bestsellers Sidebox

    That would be because the direction was not followed...

    There should be two right closing parentheses at the area of the sql touched... right now there is just the one which doesn't close the statement(s) properly.

    Should read as:
    Code:
    IN (34, 108, 58, 55))
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  9. #29
    Join Date
    Jul 2012
    Posts
    16,733
    Plugin Contributions
    17

    Default Re: Excluding Category from Bestsellers Sidebox

    Quote Originally Posted by mc12345678 View Post
    That would be because the direction was not followed...

    There should be two right closing parentheses at the area of the sql touched... right now there is just the one which doesn't close the statement(s) properly.

    Should read as:
    Code:
    IN (34, 108, 58, 55))
    The direction could have possibly been easier to follow by starting from the right side of the directed replacement and working to the left or using a search and replace within your favorite text editor...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  10. #30
    Join Date
    May 2016
    Location
    Ohio
    Posts
    410
    Plugin Contributions
    0

    Default Re: Excluding Category from Bestsellers Sidebox

    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);
    }

 

 
Page 3 of 4 FirstFirst 1234 LastLast

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