Datafeedr Support Forums  

Go Back   Datafeedr Support Forums > Current Version (V3) Forum > Questions
Home Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Important - The support forums are now in "read-only" mode as we transition to an alternative help desk solution. Feel free to contact us here with any of your questions or search the forums for an existing solution.
 
 
Thread Tools Search this Thread Display Modes
  #1  
Old April 12th, 2011, 12:36 PM
patagonia patagonia is offline
 
Join Date: May 2009
Posts: 506
Default Tutorial on Page Listings

Eric is there already a tutorial (as I can't find one) on how to add to pages, a drop down box, for the customer, so they can change the products viewed to another value?

At the moment I have most pages set to display 18 or 24 products, but I would like an "ALL" option for the customers, so they can view all on one page if they like. Or other increments too.

Can you point me in the right direction please?
  #2  
Old April 12th, 2011, 01:33 PM
Eric's Avatar
Eric Eric is offline
Datafeedr Team
 
Join Date: Feb 2008
Posts: 16,902
Default

Hi

This code allows you to expose a drop down filter to allow your users to change the number of products displayed on a page:

PHP Code:
<form method="get">
    Products per page:
    <?php echo datafeedr_tools()->form_select("ppp",
        array(
        
"12" => "12 products",
        
"24" => "24 products",
        
"36" => "36 products",
        
"48" => "48 products",
    )); 
?>
</form>
The most you can do is 99 products per page. There is no "All" option as that could result in your visitors overloading your server by putting in 5000 or more.

Eric
  #3  
Old April 12th, 2011, 08:23 PM
patagonia patagonia is offline
 
Join Date: May 2009
Posts: 506
Default

So I found the proper sorting template in the product tags:

PHP 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>
However two things:
1. When I click "go" on the live website, the resulting page is no longer 3 columns, but one big ugly column. How do I get it to display on the same page, with the same layout?

2. Instead of the GO button, I want to add the code like you guys use, to make it submit on the change, ie: location.href=jump1.myjumpbox.options[selectedIndex].value
But how do I put that in the code above?

Many thanks
  #4  
Old April 12th, 2011, 08:25 PM
Eric's Avatar
Eric Eric is offline
Datafeedr Team
 
Join Date: Feb 2008
Posts: 16,902
Default

Hi

1. What's the URL of that page?

2. You currently can't use the javascript with the form_select() function. You'll have to write your own drop down using raw HTML in order to use the javascript form submitter.

Eric
  #5  
Old April 12th, 2011, 08:35 PM
patagonia patagonia is offline
 
Join Date: May 2009
Posts: 506
Default

1. Hmm, I just put the code back on the page to send to you and it now works fine, displaying the 3 columns. Sorry don't know what I did wrong before!

2. So how do I write it manually, so I add the javascript?
I was looking at this source code:

PHP Code:
<form name="jump1"
<
select name="myjumpbox"

 
OnChange="location.href=jump1.myjumpbox.options[selectedIndex].value"
<
option value="http://bestcontactlensprices.com/" selected>Please Select Your Lens Brand...

<
option value="http://bestcontactlensprices.com/category/acuvue">Acuvue

<option value="http://bestcontactlensprices.com/category/air-optix">Air Optix

<option value="http://bestcontactlensprices.com/category/avaira">Avaira


</select
</
form
But stuck as to what to write in the values.
  #6  
Old April 12th, 2011, 08:47 PM
Eric's Avatar
Eric Eric is offline
Datafeedr Team
 
Join Date: Feb 2008
Posts: 16,902
Default

For the products per page, you need something like this:

HTML Code:
<form name="jump1" method="get"> 
	<select name="ppp" onchange="this.form.submit()"> 
		<option value="" selected>Products per page...</option>
		<option value="12">12</option>
		<option value="24">24</option>
		<option value="48">48</option>
	</select> 
</form>
  #7  
Old April 12th, 2011, 09:38 PM
patagonia patagonia is offline
 
Join Date: May 2009
Posts: 506
Default

Thanks Eric. I have the functionality working, but the layout has gone a bit skewif. I can not see how this same code, as provided in the sort template, doesn't work. Any ideas?

PHP Code:
<div class="dffltrs">
<
form name="jump1" method="get"
<
span class="dflside">
<
select name="ppp" onchange="this.form.submit()"
    <
option value="" selected>Products per page...</option>
    <
option value="12">12</option>
    <
option value="24">24</option>
    <
option value="48">48</option>
    <
option value="48">96</option>
</
select
</
span>
</
form>

<
form name="jump2" method="get"
<
span class="dfrside">
<
select name="sort" onchange="this.form.submit()"
    <
option value="" selected>Sort by...</option>
    <
option value="price">Price (low to high)</option>
    <
option value="-price" selected>Price (high to low)</option>
    <
option value="name">Product Name (z)</option>
    <
option value="-name">Product Name (a)</option>
</
select
</
span>
</
form>
</
div
Attached Thumbnails
Click image for larger version

Name:	sorting.gif
Views:	188
Size:	3.4 KB
ID:	387  
  #8  
Old April 13th, 2011, 08:08 AM
Eric's Avatar
Eric Eric is offline
Datafeedr Team
 
Join Date: Feb 2008
Posts: 16,902
Default

Hi

It's different code in that you have 2 <form> elements instead of one. You could try placing the <form> tags inside the <span> tags to see if that aligns it correctly.

Eric
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
New Tutorial Videos Eric News & Announcements 0 February 1st, 2011 10:48 PM


All times are GMT -5. The time now is 08:33 PM.


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