Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Creating Price Range Links

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 11-01-2010, 10:47 AM
 
nickff nickff is offline
 

Senior Member
  
Join Date: Aug 2010
Posts: 132
 

Default Creating Price Range Links

Hi All,

I've created a set of "price range links" that use static search URL's to display all products between 0-$200, $201-$500, etc.

The links function perfectly, but I'm trying to get them to have an 'active' class applied to them when you are on the appropriate page. I've attempted to access the 'price_min' and 'price_max' elements of the 'search_prefilled' array, but with no luck.

Here's my code:

HTML Code:
{foreach from=$search_prefilled item=s} {assign var='minimum_price' value=$s.price_min} {assign var='maximum_price' value=$s.price_max} {/foreach} <!-- Search by Price --> <ul id="norm"> <li {if $main eq 'search' && $maximum_price eq 199.99}class="active"{/if}> <a href="search.php?mode=search&including=all&by_title=off&by_descr=off&by_sku=off&search_in_subcategories=on&price_min=0.00&price_max=199.99"><$200</a> </li> <li {if $main eq 'search' && $maximum_price eq 500.99}class="active"{/if}> <a href="search.php?mode=search&including=all&by_title=off&by_descr=off&by_sku=off&search_in_subcategories=on&price_min=200.00&price_max=500.99">$200-$500</a> </li> <li {if $main eq 'search' && $maximum_price eq 1000.99}class="active"{/if}> <a href="search.php?mode=search&including=all&by_title=off&by_descr=off&by_sku=off&search_in_subcategories=on&price_min=501.00&price_max=1000.99">$501-$1000</a> </li> <li {if $main eq 'search' && $maximum_price eq 1000000.00}class="active"{/if}> <a href="search.php?mode=search&including=all&by_title=off&by_descr=off&by_sku=off&search_in_subcategories=on&price_min=1001.00&price_max=1000000.00">>$1000</a> </li> </ul>

If anyone has any ideas on how to get active classes to correctly appear for this type of link let me know. Thanks!
__________________
nick hoag
looking forward to the future
http://thefutureforward.com
xcart versions 4.2.x, 4.3.x, 4.4.x
Reply With Quote
  #2  
Old 11-02-2010, 07:52 AM
 
Snowrev Snowrev is offline
 

Member
  
Join Date: Oct 2010
Posts: 24
 

Default Re: Creating Price Range Links

What files should this code be added to? I want the price range to show up on the left side of light and lucid 3 column theme.

Great idea and thanks for the code.
__________________
John Centi
SNOWREV
SUBURBAN BLEND
X Cart 4.4.1
Reply With Quote
  #3  
Old 11-02-2010, 08:29 AM
 
nickff nickff is offline
 

Senior Member
  
Join Date: Aug 2010
Posts: 132
 

Default Re: Creating Price Range Links

Hi Snowrev,

Not sure what version you're using (might want to put it in your signature), but for 4.4 you'll probably want to put the code somewhere in common_files/customer/left_bar.tpl

I tend to use the 2-column layout so I'm not 100% on that. Try using the webmaster mode under tools to find the .tpl file that you are editing.
__________________
nick hoag
looking forward to the future
http://thefutureforward.com
xcart versions 4.2.x, 4.3.x, 4.4.x
Reply With Quote
  #4  
Old 11-02-2010, 08:39 AM
 
Snowrev Snowrev is offline
 

Member
  
Join Date: Oct 2010
Posts: 24
 

Default Re: Creating Price Range Links

Thank you.. I will try now and put the code there. Will this display all products on the site based on the price range?
__________________
John Centi
SNOWREV
SUBURBAN BLEND
X Cart 4.4.1
Reply With Quote
  #5  
Old 11-02-2010, 08:46 AM
 
nickff nickff is offline
 

Senior Member
  
Join Date: Aug 2010
Posts: 132
 

Default Re: Creating Price Range Links

Yes,

It will display all products across the site within those ranges.

You would need to add "&categoryid=2" to the query string in order to search a specific category at that price range, where "2" is the category you are wanting to search through.
__________________
nick hoag
looking forward to the future
http://thefutureforward.com
xcart versions 4.2.x, 4.3.x, 4.4.x
Reply With Quote
  #6  
Old 11-02-2010, 08:49 AM
 
Snowrev Snowrev is offline
 

Member
  
Join Date: Oct 2010
Posts: 24
 

Default Re: Creating Price Range Links

I tried the code and think its a great idea but I will need to apply it as a filter option for particular products for this site.. Let me know if you find out how to do it.. I tested the code but didnt get search results, does it automatically grab the item price? or do you have to insert the item price someone on the products detail page?
__________________
John Centi
SNOWREV
SUBURBAN BLEND
X Cart 4.4.1
Reply With Quote
  #7  
Old 11-02-2010, 08:50 AM
 
nickff nickff is offline
 

Senior Member
  
Join Date: Aug 2010
Posts: 132
 

Default Re: Creating Price Range Links

Make sure you don't already have some filter options set in your search boxes. Clear them all out then try the links (x-cart remembers past search filters by default).
__________________
nick hoag
looking forward to the future
http://thefutureforward.com
xcart versions 4.2.x, 4.3.x, 4.4.x
Reply With Quote
  #8  
Old 11-28-2010, 09:36 AM
 
mudebate mudebate is offline
 

Advanced Member
  
Join Date: Jan 2009
Posts: 62
 

Default Re: Creating Price Range Links

Quote:
search.php?mode=search&including=all&by_title=off& by_descr=off&by_sku=off&search_in_subcategories=on &price_min=0.00&price_max=199.99"><$200</a>


Is there a way to add a filter by manufacturer to the search string that anyone is aware of? I tried just adding &manufacturerid but it did not do the trick.

Drill by price works great though - Thanks for posting the code!
__________________
mudebate


X-cart 4.11 - One page checkout, category meta tags, manufacturer meta tags, a few others


X-cart 4.2, tabbed products menu



Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



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


All times are GMT -8. The time now is 07:47 AM.

   

 
X-Cart forums © 2001-2020