Results 1 to 10 of 24

Hybrid View

  1. #1
    Join Date
    Nov 2003
    Posts
    1,987
    Plugin Contributions
    15

    Default [Done 1.3.6] products_new limt (1.3.5)

    Zen Cart 1.3.5

    I found a problem with the products_new time limit.

    There is an admin setting "New Product Listing - Limited to" (under max values). And I think this is meant to limit the products_new output.

    But it does not seem to work, and if I look in the header_php.php file for the products_new page it shows:
    Code:
      //$display_limit = zen_get_products_new_timelimit();
      $display_limit = zen_get_new_date_range();
    So it looks like is was changed to use zen_get_new_date_range() (or that someone was preparing to make it use zen_get_products_new_timelimit()).

    A look at zen_get_new_date_range() shows:
    Code:
    // build date range for new products
      function zen_get_new_date_range($time_limit = false) {
        if ($time_limit == false) {
          $time_limit = SHOW_NEW_PRODUCTS_LIMIT;
        }
    
        // 120 days; 24 hours; 60 mins; 60secs
        $date_range = time() - ($time_limit * 24 * 60 * 60);
    // echo 'Now:      '. date('Y-m-d') ."<br />";
    // echo $time_limit . ' Days: '. date('Ymd', $date_range) ."<br />";
        $zc_new_date = date('Ymd', $date_range);
        $new_range = ' and p.products_date_added >=' . $zc_new_date;
        return "";
        return $new_range;
      }
    This confirms that the formentioned admin setting indeed is meant to set the limit:
    Code:
          $time_limit = SHOW_NEW_PRODUCTS_LIMIT;
    But just before the actual value is returned another return is executed:
    Code:
        return "";
    Which causes the function to return an empty string of course (and products_new shows all products).

    I am not sure what the intention was, but if I comment out the return, or if I change header_php.php to use zen_get_products_new_timelimit(), it is possible to set the products_new time range again from admin.

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

    Default Re: products_new limt (1.3.5)

    Looks like you missed updating a file ...

    Look at the fixes in:
    http://www.zen-cart.com/forum/showthread.php?t=45377

    There is one for that function too ... be careful not to delete the function below it ...
    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!

  3. #3
    Join Date
    Nov 2003
    Posts
    1,987
    Plugin Contributions
    15

    Default Re: products_new limt (1.3.5)

    Ok, thanks Ajeh!

    I searched that thread for products_new ..... so I did not find it. The shop indeed is a stock 1.3.5 shop.

    I was triyng to figure something out about 1.2.7 for someone, and never expected to bump into a 1.3.5 bug while doing that

    Seems strange though that zen_get_products_new_timelimit is not being used, that function seems to do exactly the same, after a small modification.

  4. #4
    Join Date
    Nov 2003
    Posts
    1,987
    Plugin Contributions
    15

    Default Re: products_new limt (1.3.5)

    I can not edit my posts anymore B.T.W., but I suppose that is just me? (when I click edit nothing happens)

    edit: when I copy and paste the edit url, it works though

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

    Default Re: products_new limt (1.3.5)

    The "same" vs speed is two different things ...

    The new function utilizes a different method of "date math" to pass through a data base of 1000s of records in .05 to .5 seconds vs 45-200 seconds ...

    Use the new function with the fix ...
    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
    Nov 2003
    Posts
    1,987
    Plugin Contributions
    15

    Default Re: products_new limt (1.3.5)

    Nice speed improvement indeed

    It seems more logical that the zen_get_new_date_range() would have been replaced by the current zen_get_products_new_timelimit() code then. But I assume that is related to some compatibility issue.

    But thanks for the explanation, I certainly overlooked the speed issue.

 

 

Similar Threads

  1. index.php?main_page=products_new
    By enzo-ita in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 19 Jun 2016, 09:50 AM
  2. products_new not updating
    By wrickspam in forum Setting Up Categories, Products, Attributes
    Replies: 11
    Last Post: 16 Dec 2011, 02:46 PM
  3. Limt # of items to be sold?
    By vwebworld in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 20 Jul 2007, 09:10 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