Datafeedr Support Forums

Datafeedr Support Forums (/index.php)
-   Questions (/forumdisplay.php?f=67)
-   -   Auto reload of the categories (/showthread.php?t=3586)

digitalcow January 11th, 2011 06:21 AM

Auto reload of the categories
 
Would this possible

I have set up pages on my site to be sortable by price/product name and also to allow the user to change how many products they see in the listings. At the moment you need to select the drop down for the option you wish to use and then click on the go button to the right. As many other websites would auto reload without needing the user to click 'go' it could give the user the impression that the option doesn't work.

Therefore, would it be possible to have it so that the reload is activated when an option is selected?

Eric January 11th, 2011 08:35 AM

If you are using code like this for generating your drop down menus...
Code:

<select name="ppp" class="dfppp">
        <option value="12"<?php if (@$_GET['ppp']==12) {echo ' selected="selected"';}?>>12</option>
        <option value="24"<?php if (@$_GET['ppp']==24) {echo ' selected="selected"';}?>>24</option>
        <option value="36"<?php if (@$_GET['ppp']==36) {echo ' selected="selected"';}?>>36</option>
        <option value="48"<?php if (@$_GET['ppp']==48) {echo ' selected="selected"';}?>>48</option>
</select>

... then you could easily apply this technique: http://snippets.dzone.com/posts/show/785

Eric

digitalcow January 11th, 2011 10:19 AM

thanks, should have realised that this was controlled by the code rather than the factory

ayorofrance January 14th, 2011 11:52 AM

Great tip!

ayorofrance January 15th, 2011 06:24 PM

Hi Eric,

Has the template code for the sorting template been updated recently?

I now get this code:
Code:

<div class="dffltrs">
  <form method="get">
    <span class="dflside">
      Products per page:
      <?php echo datafeedr_tools()->form_select("ppp",
        array(
        "12" => "12",
        "24" => "24",
        "36" => "36",
        "48" => "48",
        )); ?>
    </span>
    <span class="dfrside">
      Sort by:
      <?php echo datafeedr_tools()->form_select("sort",
        array(
        "price"  => "Price (low to high)",
        "-price"  => "Price (high to low)",
        "name"    => "Product Name (a - z)",
        "-name"  => "Product Name (z - a)",
        )); ?>
      <input type="submit" value="Go" class="dfsbmt" />
    </span>
    <div class="clearingdiv">&nbsp;</div>
  </form>
</div>

Will I have to revert back to the 'old' code to use the auto-submit?

Are there any drawbacks to using the old code?

Thanks!

Eric January 15th, 2011 06:52 PM

Quote:

Originally Posted by ayorofrance (Post 16784)
Has the template code for the sorting template been updated recently?

Will I have to revert back to the 'old' code to use the auto-submit?

Are there any drawbacks to using the old code?

Hi

Yes, the template code has changed but it does exactly the same things as the old code. We just tried to simplify the code that you saw.

There are no drawbacks to using the old code. They do the same thing.

You will have to use the old code if you want to apply the auto submit modification for now. Here's the code in case anyone is looking for it:

Code:

<div class="dffltrs">
  <form method="get"> 
    <span class="dflside">
      Products per page:
      <select name="ppp" class="dfppp">
        <option value="12"<?php if (@$_GET['ppp']=='12') {echo ' selected="selected"';}?>>12</option>
        <option value="24"<?php if (@$_GET['ppp']=='24') {echo ' selected="selected"';}?>>24</option>
        <option value="36"<?php if (@$_GET['ppp']=='36') {echo ' selected="selected"';}?>>36</option>
        <option value="48"<?php if (@$_GET['ppp']=='48') {echo ' selected="selected"';}?>>48</option>
      </select>
    </span>
    <span class="dfrside">
      Sort by:
      <select name="sort" class="dfsort">
        <option value="price"<?php if (@$_GET['sort']=='price') {echo ' selected="selected"';}?>>Price (low to high)</option>
        <option value="-price"<?php if (@$_GET['sort']=='-price') {echo ' selected="selected"';}?>>Price (high to low)</option>
        <option value="name"<?php if (@$_GET['sort']=='name') {echo ' selected="selected"';}?>>Product Name (a - z)</option>   
        <option value="-name"<?php if (@$_GET['sort']=='-name') {echo ' selected="selected"';}?>>Product Name (z - a)</option>   
      </select>
      <input type="submit" value="Go" class="dfsbmt" />
    </span>
    <div class="clearingdiv">&nbsp;</div>
  </form>
</div>


jackrock November 10th, 2011 04:13 PM

Hi, I applied the above code to my default store category, and it doesn't automatically update. I still have to click "Go" as before.

http://www.wirelessheadphones.cc/sto...ss-headphones/

Eric November 10th, 2011 04:19 PM

Quote:

Originally Posted by jackrock (Post 25805)
Hi, I applied the above code to my default store category, and it doesn't automatically update. I still have to click "Go" as before.

http://www.wirelessheadphones.cc/sto...ss-headphones/

The above code has nothing to do with auto submitting the form. To auto submit, try this:

http://www.htmlgoodies.com/beyond/ja...mit-Button.htm

jackrock November 10th, 2011 05:50 PM

Where do I put this code (assuming this is the right code)?:

<select name='myfield' onchange='this.form.submit()'>
<option selected>Milk</option>
<option>Coffee</option>
<option>Tea</option>
</select>
<noscript><input type="submit" value="Submit"></noscript>

Eric November 10th, 2011 05:52 PM

Quote:

Originally Posted by jackrock (Post 25819)
Where do I put this code (assuming this is the right code)?:

<select name='myfield' onchange='this.form.submit()'>
<option selected>Milk</option>
<option>Coffee</option>
<option>Tea</option>
</select>
<noscript><input type="submit" value="Submit"></noscript>

This has been addressed here: /showthread.php?t=3786


All times are GMT -5. The time now is 12:55 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.