Results 1 to 3 of 3

Hybrid View

  1. #1
    Join Date
    May 2010
    Location
    Athens, Greece
    Posts
    292
    Plugin Contributions
    0

    help question Help on amending the tpl_modules_listing_display_order.php file

    I have read and read and read lots of threads but couldn't find an answer in the forums or in the book. Could somebody please help?

    What I'm trying to do: when I display any of the "New Products", Featured Products" or "All Products" listings, there is a "Sort by:" drop-down box on top of the listed products with "Date added - new to old" as default and the rest of the options listed in this order when one clicks on the down arrow:

    Product name
    Product name - descending
    Price - low to high
    Price - high to low
    Date added - new to old
    Date added - old to new

    There was also a "Model" option which I removed by deleting the <option value="5".......> line from the tpl_modules_listing_display_order.php file and renumbering the two remaining options.

    From:

    Code:
    <div id="sorter">
    <label for="disp-order-sorter"><?php echo TEXT_INFO_SORT_BY; ?></label>
    <?php
      echo zen_draw_form('sorter_form', zen_href_link($_GET['main_page']), 'get');
      echo zen_draw_hidden_field('main_page', $_GET['main_page']);
    //  echo zen_draw_hidden_field('disp_order', $_GET['disp_order']);
      echo zen_hide_session_id();
    ?>
        <select name="disp_order" onchange="this.form.submit();" id="disp-order-sorter">
    <?php if ($disp_order != $disp_order_default) { ?>
        <option value="<?php echo $disp_order_default; ?>" <?php echo ($disp_order == $disp_order_default ? 'selected="selected"' : ''); ?>><?php echo PULL_DOWN_ALL_RESET; ?></option>
    <?php } // reset to store default ?>
        <option value="1" <?php echo ($disp_order == '1' ? 'selected="selected"' : ''); ?>><?php echo TEXT_INFO_SORT_BY_PRODUCTS_NAME; ?></option>
        <option value="2" <?php echo ($disp_order == '2' ? 'selected="selected"' : ''); ?>><?php echo TEXT_INFO_SORT_BY_PRODUCTS_NAME_DESC; ?></option>
        <option value="3" <?php echo ($disp_order == '3' ? 'selected="selected"' : ''); ?>><?php echo TEXT_INFO_SORT_BY_PRODUCTS_PRICE; ?></option>
        <option value="4" <?php echo ($disp_order == '4' ? 'selected="selected"' : ''); ?>><?php echo TEXT_INFO_SORT_BY_PRODUCTS_PRICE_DESC; ?></option>
        <option value="5" <?php echo ($disp_order == '5' ? 'selected="selected"' : ''); ?>><?php echo TEXT_INFO_SORT_BY_PRODUCTS_MODEL; ?></option>
        <option value="6" <?php echo ($disp_order == '6' ? 'selected="selected"' : ''); ?>><?php echo TEXT_INFO_SORT_BY_PRODUCTS_DATE_DESC; ?></option>
        <option value="7" <?php echo ($disp_order == '7' ? 'selected="selected"' : ''); ?>><?php echo TEXT_INFO_SORT_BY_PRODUCTS_DATE; ?></option>
        </select></form></div>
    To:

    Code:
    <div id="sorter">
    <label for="disp-order-sorter"><?php echo TEXT_INFO_SORT_BY; ?></label>
    <?php
      echo zen_draw_form('sorter_form', zen_href_link($_GET['main_page']), 'get');
      echo zen_draw_hidden_field('main_page', $_GET['main_page']);
    //  echo zen_draw_hidden_field('disp_order', $_GET['disp_order']);
      echo zen_hide_session_id();
    ?>
        <select name="disp_order" onchange="this.form.submit();" id="disp-order-sorter">
    <?php if ($disp_order != $disp_order_default) { ?>
        <option value="<?php echo $disp_order_default; ?>" <?php echo ($disp_order == $disp_order_default ? 'selected="selected"' : ''); ?>><?php echo PULL_DOWN_ALL_RESET; ?></option>
    <?php } // reset to store default ?>
        <option value="1" <?php echo ($disp_order == '1' ? 'selected="selected"' : ''); ?>><?php echo TEXT_INFO_SORT_BY_PRODUCTS_NAME; ?></option>
        <option value="2" <?php echo ($disp_order == '2' ? 'selected="selected"' : ''); ?>><?php echo TEXT_INFO_SORT_BY_PRODUCTS_NAME_DESC; ?></option>
        <option value="3" <?php echo ($disp_order == '3' ? 'selected="selected"' : ''); ?>><?php echo TEXT_INFO_SORT_BY_PRODUCTS_PRICE; ?></option>
        <option value="4" <?php echo ($disp_order == '4' ? 'selected="selected"' : ''); ?>><?php echo TEXT_INFO_SORT_BY_PRODUCTS_PRICE_DESC; ?></option>
        <option value="5" <?php echo ($disp_order == '5' ? 'selected="selected"' : ''); ?>><?php echo TEXT_INFO_SORT_BY_PRODUCTS_DATE_DESC; ?></option>
        <option value="6" <?php echo ($disp_order == '6' ? 'selected="selected"' : ''); ?>><?php echo TEXT_INFO_SORT_BY_PRODUCTS_DATE; ?></option>
        </select></form></div>
    Now, it appears that the products are always (sorted and) listed in the order: "Date added - new to old" even when I re-arrange the <option...> lines in the file and make the desired "Price: low to high" appear first in the drop-down box.

    Is there something missing to have the products displayed in ascending price order by default please?

    Any help will be much appreciated with my thanks in advance.

  2. #2
    Join Date
    Feb 2010
    Posts
    154
    Plugin Contributions
    0

    Default Re: Help on amending the tpl_modules_listing_display_order.php file

    Athens,

    In your Zencart Admin menu, go to Configuration => New Listing

    In there you can specify which sort order you want to be the default one.

  3. #3
    Join Date
    May 2010
    Location
    Athens, Greece
    Posts
    292
    Plugin Contributions
    0

    Default Re: Help on amending the tpl_modules_listing_display_order.php file

    Thank you Celtic, I was overlooking the obvious and had confused it with the other settings above it (Display Image, Quantity etc).

    All sorted now with my gratitude to you for the quick reply. Cheers!

 

 

Similar Threads

  1. Replies: 2
    Last Post: 28 Mar 2013, 10:53 PM
  2. Home page failed to display after amending html_output.php
    By gamenano in forum General Questions
    Replies: 3
    Last Post: 29 Jun 2009, 02:36 AM
  3. Replies: 10
    Last Post: 8 Jan 2009, 09:10 PM
  4. File uploads are disabled in the php.ini configuration file
    By stanleymog in forum General Questions
    Replies: 2
    Last Post: 19 Aug 2008, 01:24 PM
  5. Replies: 5
    Last Post: 15 Jan 2007, 06:23 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