Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    Join Date
    May 2010
    Posts
    72
    Plugin Contributions
    0

    Default new monthly AND new weekly?

    So, I'd like to try and figure out how to display, on the front/index page, both a box of products that are new this month AND a box of products that are new this week. I want to display both of them to be in the center column. I'll display the monthly box in alphabetical order & the weekly box in order by date, so they won't look "the same" to customers.

    I figure the easiest thing would be to edit includes/modules/new_products.php (but not includes/templates/template_default/templates/tpl_modules_products_new_listing.php, as that doesn't govern the index page, correct?). I'm thinking I will duplicate part of the code that is already there in order to build a 2nd box that displays in the center column.

    My knowledge of php coding is a bit spotty, so I'm hoping to talk myself through it a bit here.

    Looks like in new_products.php I will have to hard code the MAX_DISPLAY_NEW_PRODUCTS variable in the clone box, as well as the $display_limit variable.

    Hmmm, I'm not sure exactly what should & shouldn't be duplicated, I guess. Anyone who is facile with php and would know how to point me a little bit further?

  2. #2
    Join Date
    May 2010
    Posts
    72
    Plugin Contributions
    0

    Default Re: new monthly AND new weekly

    Here's my 1st, somewhat crude attempt. It's doesn't throw an SQL error, but the result isn't what I'd hoped for either. I don't see both the monthly and weekly sections on the front page, just the weekly (latter) one.

    Code:
    <?php 
    /** 
     * new_products.php module 
     * 
     * @package modules 
     * @copyright Copyright 2003-2007 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: new_products.php 6424 2007-05-31 05:59:21Z ajeh $ 
     */ 
    if (!defined('IS_ADMIN_FLAG')) { 
      die('Illegal Access'); 
    } 
    
    // initialize vars 
    $categories_products_id_list = ''; 
    $list_of_products = ''; 
    $new_products_query = ''; 
    
    $display_limit = zen_get_new_date_range(); 
    
    if ( (($manufacturers_id > 0 && $_GET['filter_id'] == 0) || $_GET['music_genre_id'] > 0 || $_GET['record_company_id'] > 0) || (!isset($new_products_category_id) || $new_products_category_id == '0') ) { 
      $new_products_query = "select distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name, 
                                    p.products_date_added, p.products_price, p.products_type, p.master_categories_id 
                               from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd 
                               where p.products_id = pd.products_id 
                               and pd.language_id = '" . (int)$_SESSION['languages_id'] . "' 
                               and   p.products_status = 1 " . $display_limit; 
                                $new_products_query .= " ORDER BY products_date_added DESC 
                            LIMIT " . MAX_DISPLAY_NEW_PRODUCTS; 
    } else { 
      // get all products and cPaths in this subcat tree 
      $productsInCategory = zen_get_categories_products_list( (($manufacturers_id > 0 && $_GET['filter_id'] > 0) ? zen_get_generated_category_path_rev($_GET['filter_id']) : $cPath), false, true, 0, $display_limit); 
    
      if (is_array($productsInCategory) && sizeof($productsInCategory) > 0) { 
        // build products-list string to insert into SQL query 
        foreach($productsInCategory as $key => $value) { 
          $list_of_products .= $key . ', '; 
        } 
        $list_of_products = substr($list_of_products, 0, -2); // remove trailing comma 
    
        $new_products_query = "select distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name, 
                                      p.products_date_added, p.products_price, p.products_type, p.master_categories_id 
                               from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd 
                               where p.products_id = pd.products_id 
                               and pd.language_id = '" . (int)$_SESSION['languages_id'] . "' 
                               and p.products_id in (" . $list_of_products . ")"; 
                                
                               $new_products_query .= " ORDER BY products_date_added DESC 
                            LIMIT " . MAX_DISPLAY_NEW_PRODUCTS; 
      } 
    } 
    
    
    if ($new_products_query != '') $new_products = $db->Execute($new_products_query); 
    
    $row = 0; 
    $col = 0; 
    $list_box_contents = array(); 
    $title = ''; 
    
    $num_products_count = ($new_products_query == '') ? 0 : $new_products->RecordCount(); 
    
    // show only when 1 or more 
    if ($num_products_count > 0) { 
      if ($num_products_count < SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS || SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS == 0 ) { 
        $col_width = floor(100/$num_products_count); 
      } else { 
        $col_width = floor(100/SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS); 
      } 
    
      while (!$new_products->EOF) { 
        $products_price = zen_get_products_display_price($new_products->fields['products_id']); 
        if (!isset($productsInCategory[$new_products->fields['products_id']])) $productsInCategory[$new_products->fields['products_id']] = zen_get_generated_category_path_rev($new_products->fields['master_categories_id']); 
    
        $list_box_contents[$row][$col] = array('params' => 'class="centerBoxContentsNew centeredContent back"' . ' ' . 'style="width:' . $col_width . '%;"', 
        'text' => (($new_products->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) ? '' : '<a href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'cPath=' . $productsInCategory[$new_products->fields['products_id']] . '&products_id=' . $new_products->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $new_products->fields['products_image'], $new_products->fields['products_name'], IMAGE_PRODUCT_NEW_WIDTH, IMAGE_PRODUCT_NEW_HEIGHT) . '</a><br />') . '<a href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'cPath=' . $productsInCategory[$new_products->fields['products_id']] . '&products_id=' . $new_products->fields['products_id']) . '">' . $new_products->fields['products_name'] . '</a><br />' . $products_price); 
    
        $col ++; 
        if ($col > (SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS - 1)) { 
          $col = 0; 
          $row ++; 
        } 
        $new_products->MoveNext(); 
      } 
    
      if ($new_products->RecordCount() > 0) { 
        if (isset($new_products_category_id) && $new_products_category_id != 0) { 
          $category_title = zen_get_categories_name((int)$new_products_category_id); 
          $title = '<h2 class="centerBoxHeading">' . sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B')) . ($category_title != '' ? ' - ' . $category_title : '' ) . '</h2>'; 
        } else { 
          $title = '<h2 class="centerBoxHeading">' . sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B')) . '</h2>'; 
        } 
        $zc_show_new_products = true; 
      } 
    } 
    
    
    ?><?php
    
    $display_limit = ' and TO_DAYS(NOW()) - TO_DAYS(p.products_date_added) <= 7'; 
    
    if ( (($manufacturers_id > 0 && $_GET['filter_id'] == 0) || $_GET['music_genre_id'] > 0 || $_GET['record_company_id'] > 0) || (!isset($new_products_category_id) || $new_products_category_id == '0') ) { 
      $new_products_query = "select distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name, 
                                    p.products_date_added, p.products_price, p.products_type, p.master_categories_id 
                               from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd 
                               where p.products_id = pd.products_id 
                               and pd.language_id = '" . (int)$_SESSION['languages_id'] . "' 
                               and   p.products_status = 1 " . $display_limit; 
                                $new_products_query .= " ORDER BY products_date_added DESC 
                            LIMIT " . MAX_DISPLAY_NEW_PRODUCTS; 
    } else { 
      // get all products and cPaths in this subcat tree 
      $productsInCategory = zen_get_categories_products_list( (($manufacturers_id > 0 && $_GET['filter_id'] > 0) ? zen_get_generated_category_path_rev($_GET['filter_id']) : $cPath), false, true, 0, $display_limit); 
    
      if (is_array($productsInCategory) && sizeof($productsInCategory) > 0) { 
        // build products-list string to insert into SQL query 
        foreach($productsInCategory as $key => $value) { 
          $list_of_products .= $key . ', '; 
        } 
        $list_of_products = substr($list_of_products, 0, -2); // remove trailing comma 
    
        $new_products_query = "select distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name, 
                                      p.products_date_added, p.products_price, p.products_type, p.master_categories_id 
                               from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd 
                               where p.products_id = pd.products_id 
                               and pd.language_id = '" . (int)$_SESSION['languages_id'] . "' 
                               and p.products_id in (" . $list_of_products . ")"; 
                                
                               $new_products_query .= " ORDER BY products_date_added DESC 
                            LIMIT " . MAX_DISPLAY_NEW_PRODUCTS; 
      } 
    } 
    
    
    if ($new_products_query != '') $new_products = $db->Execute($new_products_query); 
    
    $row = 0; 
    $col = 0; 
    $list_box_contents = array(); 
    $title = ''; 
    
    $num_products_count = ($new_products_query == '') ? 0 : $new_products->RecordCount(); 
    
    // show only when 1 or more 
    if ($num_products_count > 0) { 
      if ($num_products_count < SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS || SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS == 0 ) { 
        $col_width = floor(100/$num_products_count); 
      } else { 
        $col_width = floor(100/SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS); 
      } 
    
      while (!$new_products->EOF) { 
        $products_price = zen_get_products_display_price($new_products->fields['products_id']); 
        if (!isset($productsInCategory[$new_products->fields['products_id']])) $productsInCategory[$new_products->fields['products_id']] = zen_get_generated_category_path_rev($new_products->fields['master_categories_id']); 
    
        $list_box_contents[$row][$col] = array('params' => 'class="centerBoxContentsNew centeredContent back"' . ' ' . 'style="width:' . $col_width . '%;"', 
        'text' => (($new_products->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) ? '' : '<a href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'cPath=' . $productsInCategory[$new_products->fields['products_id']] . '&products_id=' . $new_products->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $new_products->fields['products_image'], $new_products->fields['products_name'], IMAGE_PRODUCT_NEW_WIDTH, IMAGE_PRODUCT_NEW_HEIGHT) . '</a><br />') . '<a href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'cPath=' . $productsInCategory[$new_products->fields['products_id']] . '&products_id=' . $new_products->fields['products_id']) . '">' . $new_products->fields['products_name'] . '</a><br />' . $products_price); 
    
        $col ++; 
        if ($col > (SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS - 1)) { 
          $col = 0; 
          $row ++; 
        } 
        $new_products->MoveNext(); 
      } 
    
      if ($new_products->RecordCount() > 0) { 
        if (isset($new_products_category_id) && $new_products_category_id != 0) { 
          $category_title = zen_get_categories_name((int)$new_products_category_id); 
          $title = '<h2 class="centerBoxHeading">' . sprintf("New This Week", strftime('%B')) . ($category_title != '' ? ' - ' . $category_title : '' ) . '</h2>'; 
        } else { 
          $title = '<h2 class="centerBoxHeading">' . sprintf("New This Week", strftime('%B')) . '</h2>'; 
        } 
        $zc_show_new_products = true; 
      } 
    } 
    
    
    ?>
    Last edited by Ajeh; 26 Nov 2010 at 01:17 AM. Reason: just added the [CODE] tag for clarity ...

  3. #3
    Join Date
    May 2010
    Posts
    72
    Plugin Contributions
    0

    Default Re: new monthly AND new weekly

    I wonder if this snippet

    if ($new_products->RecordCount() > 0) {
    if (isset($new_products_category_id) && $new_products_category_id != 0)

    is my problem? I have a vague idea that resetting variable numbers is what's causing the code to write over the initial query/display so that only the 2nd query/display is actually rendered. Hmmmmm.

  4. #4
    Join Date
    May 2010
    Posts
    72
    Plugin Contributions
    0

    Default Re: new monthly AND new weekly

    Still haven't figured this out. I've tried changing some of the variables in the 2nd half of the new_products.php file (for example, $new_products_category_id is now $new_products_category_ida, but just during the 2nd iteration. Hasn't worked, unfortunately, and I'm out of ideas. Anybody?

  5. #5
    Join Date
    May 2010
    Posts
    72
    Plugin Contributions
    0

    Default Re: new monthly AND new weekly?

    Still trying to figure this out. If nobody knows enough php, any place you could recommend to get a better hold on it?

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

    Default Re: new monthly AND new weekly?

    You have made a clone of the new_products.php module, correct?

    Did you clone the tpl_modules_whats_new.php to call the cloned file that you made of new_products.php file?

    Did you then add the call to the tpl_modules_whats_new.php in all of the files where the original tpl_modules_whats_new.php is called?

    What does your completed clone of the new_products.php look like?
    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!

  7. #7
    Join Date
    May 2010
    Posts
    72
    Plugin Contributions
    0

    Default Re: new monthly AND new weekly?

    Thanks very much for your time & help, Ajeh.

    Nope, actually I did not clone the new_products.php. Since I only want the monthly new and weekly new lists to show up on the main index page & don't need it anyplace else, I was just editing the code in new_products.php. I wanted to get it to display 2 boxes instead of one. Does that not make sense, for some reason I've missed?

    The file I have currently looks like this:

    Code:
    <?php 
    /** 
     * new_products.php module 
     * 
     * @package modules 
     * @copyright Copyright 2003-2007 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: new_products.php 6424 2007-05-31 05:59:21Z ajeh $ 
     */ 
    if (!defined('IS_ADMIN_FLAG')) { 
      die('Illegal Access'); 
    } 
    
    // initialize vars 
    $categories_products_id_list = ''; 
    $list_of_products = ''; 
    $new_products_query = ''; 
    
    $display_limit = zen_get_new_date_range(); 
    
    if ( (($manufacturers_id > 0 && $_GET['filter_id'] == 0) || $_GET['music_genre_id'] > 0 || $_GET['record_company_id'] > 0) || (!isset($new_products_category_id) || $new_products_category_id == '0') ) { 
      $new_products_query = "select distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name, 
                                    p.products_date_added, p.products_price, p.products_type, p.master_categories_id 
                               from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd 
                               where p.products_id = pd.products_id 
                               and pd.language_id = '" . (int)$_SESSION['languages_id'] . "' 
                               and   p.products_status = 1 " . $display_limit; 
                                $new_products_query .= " ORDER BY products_date_added DESC 
                            LIMIT " . MAX_DISPLAY_NEW_PRODUCTS; 
    } else { 
      // get all products and cPaths in this subcat tree 
      $productsInCategory = zen_get_categories_products_list( (($manufacturers_id > 0 && $_GET['filter_id'] > 0) ? zen_get_generated_category_path_rev($_GET['filter_id']) : $cPath), false, true, 0, $display_limit); 
    
      if (is_array($productsInCategory) && sizeof($productsInCategory) > 0) { 
        // build products-list string to insert into SQL query 
        foreach($productsInCategory as $key => $value) { 
          $list_of_products .= $key . ', '; 
        } 
        $list_of_products = substr($list_of_products, 0, -2); // remove trailing comma 
    
        $new_products_query = "select distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name, 
                                      p.products_date_added, p.products_price, p.products_type, p.master_categories_id 
                               from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd 
                               where p.products_id = pd.products_id 
                               and pd.language_id = '" . (int)$_SESSION['languages_id'] . "' 
                               and p.products_id in (" . $list_of_products . ")"; 
                                
                               $new_products_query .= " ORDER BY products_date_added DESC 
                            LIMIT " . MAX_DISPLAY_NEW_PRODUCTS; 
      } 
    } 
    
    
    if ($new_products_query != '') $new_products = $db->Execute($new_products_query); 
    
    $row = 0; 
    $col = 0; 
    $list_box_contents = array(); 
    $title = ''; 
    
    $num_products_count = ($new_products_query == '') ? 0 : $new_products->RecordCount(); 
    
    // show only when 1 or more 
    if ($num_products_count > 0) { 
      if ($num_products_count < SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS || SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS == 0 ) { 
        $col_width = floor(100/$num_products_count); 
      } else { 
        $col_width = floor(100/SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS); 
      } 
    
      while (!$new_products->EOF) { 
        $products_price = zen_get_products_display_price($new_products->fields['products_id']); 
        if (!isset($productsInCategory[$new_products->fields['products_id']])) $productsInCategory[$new_products->fields['products_id']] = zen_get_generated_category_path_rev($new_products->fields['master_categories_id']); 
    
        $list_box_contents[$row][$col] = array('params' => 'class="centerBoxContentsNew centeredContent back"' . ' ' . 'style="width:' . $col_width . '%;"', 
        'text' => (($new_products->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) ? '' : '<a href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'cPath=' . $productsInCategory[$new_products->fields['products_id']] . '&products_id=' . $new_products->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $new_products->fields['products_image'], $new_products->fields['products_name'], IMAGE_PRODUCT_NEW_WIDTH, IMAGE_PRODUCT_NEW_HEIGHT) . '</a><br />') . '<a href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'cPath=' . $productsInCategory[$new_products->fields['products_id']] . '&products_id=' . $new_products->fields['products_id']) . '">' . $new_products->fields['products_name'] . '</a><br />' . $products_price); 
    
        $col ++; 
        if ($col > (SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS - 1)) { 
          $col = 0; 
          $row ++; 
        } 
        $new_products->MoveNext(); 
      } 
    
      if ($new_products->RecordCount() > 0) { 
        if (isset($new_products_category_id) && $new_products_category_id != 0) { 
          $category_title = zen_get_categories_name((int)$new_products_category_id); 
          $title = '<h2 class="centerBoxHeading">' . sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B')) . ($category_title != '' ? ' - ' . $category_title : '' ) . '</h2>'; 
        } else { 
          $title = '<h2 class="centerBoxHeading">' . sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B')) . '</h2>'; 
        } 
        $zc_show_new_products = true; 
      } 
    } 
    
    
    
    
    
    
    ?><?php
    
    $display_limita = ' and TO_DAYS(NOW()) - TO_DAYS(p.products_date_added) <= 7'; 
    
    if ( (($manufacturers_id > 0 && $_GET['filter_id'] == 0) || $_GET['music_genre_id'] > 0 || $_GET['record_company_id'] > 0) || (!isset($new_products_category_ida) || $new_products_category_ida == '0') ) { 
      $new_products_querya = "select distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name, 
                                    p.products_date_added, p.products_price, p.products_type, p.master_categories_id 
                               from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd 
                               where p.products_id = pd.products_id 
                               and pd.language_id = '" . (int)$_SESSION['languages_id'] . "' 
                               and   p.products_status = 1 " . $display_limita; 
                                $new_products_querya .= " ORDER BY products_date_added DESC 
                            LIMIT " . MAX_DISPLAY_NEW_PRODUCTS; 
    } else { 
      // get all products and cPaths in this subcat tree 
      $productsInCategorya = zen_get_categories_products_list( (($manufacturers_id > 0 && $_GET['filter_id'] > 0) ? zen_get_generated_category_path_rev($_GET['filter_id']) : $cPath), false, true, 0, $display_limita); 
    
      if (is_array($productsInCategorya) && sizeof($productsInCategorya) > 0) { 
        // build products-list string to insert into SQL query 
        foreach($productsInCategorya as $key => $value) { 
          $list_of_productsa .= $key . ', '; 
        } 
        $list_of_productsa = substr($list_of_productsa, 0, -2); // remove trailing comma 
    
        $new_products_querya = "select distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name, 
                                      p.products_date_added, p.products_price, p.products_type, p.master_categories_id 
                               from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd 
                               where p.products_id = pd.products_id 
                               and pd.language_id = '" . (int)$_SESSION['languages_id'] . "' 
                               and p.products_id in (" . $list_of_products . ")"; 
                                
                               $new_products_querya .= " ORDER BY products_date_added DESC 
                            LIMIT " . MAX_DISPLAY_NEW_PRODUCTS; 
      } 
    } 
    
    
    if ($new_products_querya != '') $new_products = $db->Execute($new_products_querya); 
    
    $row = 0; 
    $col = 0; 
    $list_box_contents = array(); 
    $title = ''; 
    
    $num_products_count = ($new_products_querya == '') ? 0 : $new_products->RecordCount(); 
    
    // show only when 1 or more 
    if ($num_products_count > 0) { 
      if ($num_products_count < SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS || SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS == 0 ) { 
        $col_width = floor(100/$num_products_count); 
      } else { 
        $col_width = floor(100/SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS); 
      } 
    
      while (!$new_products->EOF) { 
        $products_price = zen_get_products_display_price($new_products->fields['products_id']); 
        if (!isset($productsInCategorya[$new_products->fields['products_id']])) $productsInCategorya[$new_products->fields['products_id']] = zen_get_generated_category_path_rev($new_products->fields['master_categories_id']); 
    
        $list_box_contents[$row][$col] = array('params' => 'class="centerBoxContentsNew centeredContent back"' . ' ' . 'style="width:' . $col_width . '%;"', 
        'text' => (($new_products->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) ? '' : '<a href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'cPath=' . $productsInCategorya[$new_products->fields['products_id']] . '&products_id=' . $new_products->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $new_products->fields['products_image'], $new_products->fields['products_name'], IMAGE_PRODUCT_NEW_WIDTH, IMAGE_PRODUCT_NEW_HEIGHT) . '</a><br />') . '<a href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'cPath=' . $productsInCategorya[$new_products->fields['products_id']] . '&products_id=' . $new_products->fields['products_id']) . '">' . $new_products->fields['products_name'] . '</a><br />' . $products_price); 
    
        $col ++; 
        if ($col > (SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS - 1)) { 
          $col = 0; 
          $row ++; 
        } 
        $new_products->MoveNext(); 
      } 
    
      if ($new_products->RecordCount() > 0) { 
        if (isset($new_products_category_ida) && $new_products_category_ida!= 0) { 
          $category_title = zen_get_categories_name((int)$new_products_category_ida); 
          $title = '<h2 class="centerBoxHeading">' . sprintf("New This Week", strftime('%B')) . ($category_title != '' ? ' - ' . $category_title : '' ) . '</h2>'; 
        } else { 
          $title = '<h2 class="centerBoxHeading">' . sprintf("New This Week", strftime('%B')) . '</h2>'; 
        } 
        $zc_show_new_products = true; 
      } 
    } 
    
    
    ?>
    Last edited by Ajeh; 26 Nov 2010 at 03:18 AM. Reason: changed from quote to code for clearer reading

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

    Default Re: new monthly AND new weekly?

    All of the code in the new_product.php module is needed to build the default New Product module and that is called from the tpl_modules_whats_new.php which is called from the various files ...

    It would be easier to clone the new_product.php module and alter the:
    $display_limit = zen_get_new_date_range();

    to call just the last 7 days:
    $display_limit = zen_get_new_date_range(7);

    then make a clone of the tpl_modules_whats_new.php to call that so you can include it where you need it to show both the New Products of the Week and New Products of whatever date period you use ...
    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!

  9. #9
    Join Date
    May 2010
    Posts
    72
    Plugin Contributions
    0

    Default Re: new monthly AND new weekly?

    Okay- so it looks like the file that calls tpl_modules_whats_new.php is this one:

    tpl_index_default.php

    Is that in fact the file that "draws the box" on the index page?

  10. #10
    Join Date
    May 2010
    Posts
    72
    Plugin Contributions
    0

    Default Re: new monthly AND new weekly?

    So,
    1. I've made a copy of new_products.php with a new name
    2. In that new file, I changed the date range to
    $display_limit = zen_get_new_date_range(7);
    3. I've also made a copy of tpl_modules_whats_new.php with a new name.
    4. In this new file, I've changed
    FILENAME_NEW_PRODUCTS
    to reflect the new name of new_products.php
    5. I've added a line to includes/filenames.php, by cloning the line
    define('FILENAME_NEW_PRODUCTS', 'new_products.php');
    and adding the new name to the cloned line
    6. I'm now editing tpl_index_default.php. I cloned these lines:
    <?php require($template->get_template_dir('tpl_modules_whats_new.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_whats_new.php'); ?>
    <?php } ?>
    and in the cloned lines I used the new file names.

    I should be close now, but I'm still getting a blank center box on my index page.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v151 Arrangement of Featured Products, Monthly Specials, and New Products on Main Page
    By kelly60 in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 25 Nov 2014, 10:27 PM
  2. how to get rid of monthly specials and new products?
    By nyczhenry in forum Templates, Stylesheets, Page Layout
    Replies: 9
    Last Post: 10 Nov 2010, 10:54 PM
  3. Specials - weekly insted of monthly?
    By kannutt in forum Setting Up Specials and SaleMaker
    Replies: 11
    Last Post: 7 Nov 2008, 10:09 PM
  4. Time limiting purchases Daily/Weekly/Monthly
    By ookami in forum Customization from the Admin
    Replies: 0
    Last Post: 17 Aug 2008, 10:31 PM
  5. Layout on Main Page - Changing positions of 'new products' and 'monthly specials'.
    By binny25 in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 9 Nov 2006, 04:26 AM

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