Results 1 to 5 of 5
  1. #1
    Join Date
    May 2010
    Posts
    2
    Plugin Contributions
    0

    Default Add sort by in specials page

    Help!!!
    How to add sort by in specials page,Please see our page and code as below, we added it,but the sort by result is wrong.Thanks in advance.
    http://www.formydeal.com/specials.html

    code:
    <?php
    /**
    * Specials
    *
    * @package page
    * @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: main_template_vars.php 6912 2007-09-02 02:23:45Z drbyte $
    */

    if (MAX_DISPLAY_SPECIAL_PRODUCTS > 0 ) {
    $specials_query_raw = "SELECT p.products_id, p.products_image, pd.products_name,
    p.master_categories_id
    FROM (" . TABLE_PRODUCTS . " p
    LEFT JOIN " . TABLE_SPECIALS . " s on p.products_id = s.products_id
    LEFT JOIN " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id )
    WHERE p.products_id = s.products_id and p.products_id = pd.products_id and p.products_status = '1'
    AND s.status = 1
    AND pd.language_id = :languagesID
    ORDER BY s.specials_date_added DESC";

    $specials_query_raw = $db->bindVars($specials_query_raw, ':languagesID', $_SESSION['languages_id'], 'integer');
    $specials_split = new splitPageResults($specials_query_raw, MAX_DISPLAY_SPECIAL_PRODUCTS);
    $specials = $db->Execute($specials_split->sql_query);
    $row = 0;
    $col = 0;
    $list_box_contents = array();
    $title = '';

    $num_products_count = $specials->RecordCount();
    if ($num_products_count) {
    if ($num_products_count < SHOW_PRODUCT_INFO_COLUMNS_SPECIALS_PRODUCTS || SHOW_PRODUCT_INFO_COLUMNS_SPECIALS_PRODUCTS==0 ) {
    $col_width = floor(100/$num_products_count);
    } else {
    $col_width = floor(100/SHOW_PRODUCT_INFO_COLUMNS_SPECIALS_PRODUCTS);
    }

    $list_box_contents = array();
    while (!$specials->EOF) {

    $products_price = zen_get_products_display_price($specials->fields['products_id']);
    $specials->fields['products_name'] = zen_get_products_name($specials->fields['products_id']);
    $list_box_contents[$row][$col] = array('params' => 'class="specialsListBoxContents"' . ' ' . 'style="width:' . $col_width . '%;"',
    'text' => '<a href="' . zen_href_link(zen_get_info_page($specials->fields['products_id']), 'cPath=' . zen_get_generated_category_path_rev($specials->fields['master_categories_id']) . '&products_id=' . $specials->fields['products_id']) . '">' . (($specials->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) ? '' : zen_image(DIR_WS_IMAGES . $specials->fields['products_image'], $specials->fields['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>') . '<br /><a href="' . zen_href_link(zen_get_info_page($specials->fields['products_id']), 'cPath=' . zen_get_generated_category_path_rev($specials->fields['master_categories_id']) . '&products_id=' . $specials->fields['products_id']) . '">' . $specials->fields['products_name'] . '</a><br />' . $products_price);
    $col ++;
    if ($col > (SHOW_PRODUCT_INFO_COLUMNS_SPECIALS_PRODUCTS - 1)) {
    $col = 0;
    $row ++;
    }
    $specials->MoveNext();
    }
    require($template->get_template_dir('tpl_specials_default.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_specials_default.php');
    }
    }
    ?>

    <?php
    /**
    * Specials
    *
    * @package page
    * @copyright Copyright 2003-2006 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: header_php.php 3000 2006-02-09 21:11:37Z wilt $
    */

    require(DIR_WS_MODULES . zen_get_module_directory('require_languages.php'));
    $breadcrumb->add(NAVBAR_TITLE);
    if (MAX_DISPLAY_SPECIAL_PRODUCTS > 0 ) {
    $disp_order_default = PRODUCT_ALL_LIST_SORT_DEFAULT;
    require(DIR_WS_MODULES . zen_get_module_directory(FILENAME_LISTING_DISPLAY_ORDER));
    $order_by = isset($order_by) ? $order_by : 'ORDER BY s.specials_date_added DESC';
    if (MAX_DISPLAY_SPECIAL_PRODUCTS > 0 ) {
    $listing_sql = "SELECT p.products_id, p.products_image, pd.products_name,
    p.master_categories_id
    FROM (" . TABLE_PRODUCTS . " p
    LEFT JOIN " . TABLE_SPECIALS . " s on p.products_id = s.products_id
    LEFT JOIN " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id )
    WHERE p.products_id = s.products_id and p.products_id = pd.products_id and p.products_status = '1'
    AND s.status = 1
    AND pd.language_id = :languagesID
    ORDER BY s.specials_date_added DESC";

    $listing_sql = $db->bindVars($listing_sql, ':languagesID', $_SESSION['languages_id'], 'integer');
    //check to see if we are in normal mode ... not showcase, not maintenance, etc
    $show_submit = zen_run_normal();

    $define_list = array('PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL,
    'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME,
    'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER,
    'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE,
    'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY,
    'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT,
    'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE);

    /* ,
    'PRODUCT_LIST_BUY_NOW' => PRODUCT_LIST_BUY_NOW);
    */
    asort($define_list);
    reset($define_list);
    $column_list = array();
    foreach ($define_list as $key => $value)
    {
    if ($value > 0) $column_list[] = $key;
    }
    }
    }
    ?>
    Last edited by mcsehack; 7 Jun 2010 at 03:35 AM.

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

    Default Re: Add sort by in specials page

    Help

  3. #3
    Join Date
    Nov 2008
    Posts
    36
    Plugin Contributions
    0

    Default Re: Add sort by in specials page

    Hi !

    I made that modification but is not working.
    The sort by optinos not appear in my specials page.
    What ken i do to work ?

  4. #4
    Join Date
    Mar 2014
    Posts
    22
    Plugin Contributions
    0

    Default Re: Add sort by in specials page

    I know this is an old thread, but in case anyone is looking to do this, it's really too freaking easy... #1, delete the main_template_vars.php from your catalog/includes/modules/pages/specials folder and off your site. Then open the header_php.php in that same folder, select all code in that file, and replace it with the following code:

    <?php
    /*
    * Specials Products header_php.php
    *
    * @package page
    * @copyright Copyright 2003-2006 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: header_php.php 6912 2007-09-02 02:23:45Z drbyte $ reworked by VacuumWarlock
    */
    require(DIR_WS_MODULES . zen_get_module_directory('require_languages.php'));
    $breadcrumb->add(NAVBAR_TITLE);
    // display order dropdown
    $disp_order_default = PRODUCT_ALL_LIST_SORT_DEFAULT;

    require(DIR_WS_MODULES . zen_get_module_directory(FILENAME_LISTING_DISPLAY_ORDER));

    $featured_products_array = array();

    $listing_sql = "SELECT p.products_id, p.products_type, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name, p.products_model, p.products_quantity, p.products_weight, p.product_is_call,
    p.product_is_always_free_shipping, p.products_qty_box_status,
    p.master_categories_id, m.manufacturers_id
    FROM (" . TABLE_PRODUCTS . " p
    LEFT JOIN " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " .
    TABLE_PRODUCTS_DESCRIPTION . " pd
    LEFT JOIN " . TABLE_SPECIALS . " s on pd.products_id = s.products_id )
    WHERE p.products_status = 1 and p.products_id = s.products_id and s.status = 1
    AND p.products_id = s.products_id and pd.products_id and pd.language_id = :languagesID " .
    $order_by;

    $listing_sql = $db->bindVars($listing_sql, ':languagesID', $_SESSION['languages_id'], 'integer');
    $featured_products_split = new splitPageResults($featured_products_query_raw, MAX_DISPLAY_SPECIAL_PRODUCTS);

    //check to see if we are in normal mode ... not showcase, not maintenance, etc
    $show_submit = zen_run_normal();

    $define_list = array('PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL,
    'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME,
    'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER,
    'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE,
    'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY,
    'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT,
    'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE);

    /* ,
    'PRODUCT_LIST_BUY_NOW' => PRODUCT_LIST_BUY_NOW);
    */
    asort($define_list);
    reset($define_list);
    $column_list = array();
    foreach ($define_list as $key => $value)
    {
    if ($value > 0) $column_list[] = $key;
    }
    ?>

    upload file into directory above and bam there it is...

    I'm not a coder, I'm a vacuum repair man

  5. #5
    Join Date
    May 2008
    Posts
    402
    Plugin Contributions
    0

    Default Re: Add sort by in specials page

    Tried this and it didn't work. All of the products disappeared. Also just curious why we have to delete main_template_vars.php and not just add this code to that.

 

 

Similar Threads

  1. v150 Specials page sort filter
    By buildingblocks in forum Setting Up Specials and SaleMaker
    Replies: 0
    Last Post: 9 Jan 2015, 03:59 PM
  2. v151 Add Sort by Product ID to Specials Page in Admin Panel | Possible?
    By sportbiker in forum Customization from the Admin
    Replies: 1
    Last Post: 3 Jan 2015, 04:16 AM
  3. v151 Specials Page Manufactuers Sort By Name/Price Dropdown
    By pricediscrimination in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 3 Dec 2014, 07:58 PM
  4. Add Model Number to Specials Page
    By aimwilk in forum Templates, Stylesheets, Page Layout
    Replies: 9
    Last Post: 9 Oct 2013, 03:14 AM
  5. v151 How Do I Add Text to SPECIALS page?
    By Rick5150 in forum General Questions
    Replies: 6
    Last Post: 14 Jun 2013, 04:05 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