X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Shop by Price for xcart 4.3.1 (https://forum.x-cart.com/showthread.php?t=52819)

ShishaPipeUK 03-14-2010 12:01 PM

Shop by Price for xcart 4.3.1
 
Below is the code for x-cart 4.3.1 to search for products using there price value.

Place this in xcart/skin1/customer/shop_by_price.tpl

Code:


{*
$Id: shop_by_price.tpl,v 1.20 2009/04/23 11:35:03 max Exp $
vim: set ts=2 sw=2 sts=2 et:
*}
{capture name=price}
<table width="101%"  border="0">
  <tr>
    <td><form style="margin-top: 0; margin-bottom: 0" method="POST" action="search.php" name="productsearch_price_5">
<input type="hidden" name="mode" value="search">
<input type="hidden" name="posted_data[price_min]" value="0">
<input type="hidden" name="posted_data[price_max]" value="5">
<a class="VertMenuItems" href="javascript:document.productsearch_price_5.submit()" >ё0-ё5</a>
</form>
</td>
    <td><form style="margin-top: 0; margin-bottom: 0" method="POST" action="search.php" name="productsearch_price_10">
<input type="hidden" name="mode" value="search" />
<input type="hidden" name="posted_data[price_min]" value="5" />
<input type="hidden" name="posted_data[price_max]" value="10" />
<a class="VertMenuItems" href="javascript:document.productsearch_price_10.submit()" >ё5-ё10</a>
    </form></td>
    <td><form style="margin-top: 0; margin-bottom: 0" method="POST" action="search.php" name="productsearch_price_15">
<input type="hidden" name="mode" value="search">
<input type="hidden" name="posted_data[price_min]" value="10">
<input type="hidden" name="posted_data[price_max]" value="15">
<a class="VertMenuItems" href="javascript:document.productsearch_price_15.submit()" >ё10-ё15</a>
</form> </td>
  </tr>
  <tr>
    <td><form style="margin-top: 0; margin-bottom: 0" method="POST" action="search.php" name="productsearch_price_20">
<input type="hidden" name="mode" value="search">
<input type="hidden" name="posted_data[price_min]" value="15">
<input type="hidden" name="posted_data[price_max]" value="20">
<a class="VertMenuItems" href="javascript:document.productsearch_price_20.submit()" >ё15-ё20</a>
</form> </td>
    <td><form style="margin-top: 0; margin-bottom: 0" method="POST" action="search.php" name="productsearch_price_25">
        <input type="hidden" name="mode" value="search" />
        <input type="hidden" name="posted_data[price_min]" value="20" />
        <input type="hidden" name="posted_data[price_max]" value="25" />
<a class="VertMenuItems" href="javascript:document.productsearch_price_25.submit()" >ё20-ё25</a>
    </form></td>
    <td><form style="margin-top: 0; margin-bottom: 0" method="POST" action="search.php" name="productsearch_price_30">
<input type="hidden" name="mode" value="search">
<input type="hidden" name="posted_data[price_min]" value="25">
<input type="hidden" name="posted_data[price_max]" value="30">
<a class="VertMenuItems" href="javascript:document.productsearch_price_30.submit()" >ё25-ё30</a>
</form> </td>
  </tr>
  <tr>
    <td><form style="margin-top: 0; margin-bottom: 0" method="POST" action="search.php" name="productsearch_price_35">
<input type="hidden" name="mode" value="search">
<input type="hidden" name="posted_data[price_min]" value="30">
<input type="hidden" name="posted_data[price_max]" value="35">
<a class="VertMenuItems" href="javascript:document.productsearch_price_35.submit()" >ё30-ё35</a>
</form> </td>
    <td><form style="margin-top: 0; margin-bottom: 0" method="POST" action="search.php" name="productsearch_price_40">
        <input type="hidden" name="mode" value="search" />
        <input type="hidden" name="posted_data[price_min]" value="35" />
        <input type="hidden" name="posted_data[price_max]" value="40" />
<a class="VertMenuItems" href="javascript:document.productsearch_price_40.submit()" >ё35-ё40</a>
    </form></td>
    <td><form style="margin-top: 0; margin-bottom: 0" method="POST" action="search.php" name="productsearch_price_45">
<input type="hidden" name="mode" value="search">
<input type="hidden" name="posted_data[price_min]" value="40">
<input type="hidden" name="posted_data[price_max]" value="45">
<a class="VertMenuItems" href="javascript:document.productsearch_price_45.submit()" >ё40-ё45</a>
</form> </td>
  </tr>
 
  <tr>
    <td><form style="margin-top: 0; margin-bottom: 0" method="POST" action="search.php" name="productsearch_price_50">
<input type="hidden" name="mode" value="search">
<input type="hidden" name="posted_data[price_min]" value="45">
<input type="hidden" name="posted_data[price_max]" value="50">
<a class="VertMenuItems" href="javascript:document.productsearch_price_50.submit()" >ё45-ё50</a>
</form></td>
    <td><form style="margin-top: 0; margin-bottom: 0" method="POST" action="search.php" name="productsearch_price_55">
        <input type="hidden" name="mode" value="search" />
        <input type="hidden" name="posted_data[price_min]" value="50" />
        <input type="hidden" name="posted_data[price_max]" value="55" />
<a class="VertMenuItems" href="javascript:document.productsearch_price_55.submit()" >ё50-ё55</a>
    </form></td>
    <td><form style="margin-top: 0; margin-bottom: 0" method="POST" action="search.php" name="productsearch_price_60">
<input type="hidden" name="mode" value="search">
<input type="hidden" name="posted_data[price_min]" value="55">
<input type="hidden" name="posted_data[price_max]" value="60">
<a class="VertMenuItems" href="javascript:document.productsearch_price_60.submit()" >ё55-ё60</a>
</form></td>
  </tr>
 
  <tr>
    <td><form style="margin-top: 0; margin-bottom: 0" method="POST" action="search.php" name="productsearch_price_65">
<input type="hidden" name="mode" value="search">
<input type="hidden" name="posted_data[price_min]" value="60">
<input type="hidden" name="posted_data[price_max]" value="65">
<a class="VertMenuItems" href="javascript:document.productsearch_price_65.submit()" >ё60-ё65</a>
</form></td>
    <td><form style="margin-top: 0; margin-bottom: 0" method="POST" action="search.php" name="productsearch_price_70">
        <input type="hidden" name="mode" value="search" />
        <input type="hidden" name="posted_data[price_min]" value="65" />
        <input type="hidden" name="posted_data[price_max]" value="70" />
<a class="VertMenuItems" href="javascript:document.productsearch_price_70.submit()" >ё65-ё70</a>
</form></td>
    <td><form style="margin-top: 0; margin-bottom: 0" method="POST" action="search.php" name="productsearch_price_75">
<input type="hidden" name="mode" value="search">
<input type="hidden" name="posted_data[price_min]" value="70">
<input type="hidden" name="posted_data[price_max]" value="75">
<a class="VertMenuItems" href="javascript:document.productsearch_price_75.submit()" >ё70-ё75</a>
</form></td>
  </tr>
 
  <tr>
    <td><form style="margin-top: 0; margin-bottom: 0" method="POST" action="search.php" name="productsearch_price_80">
<input type="hidden" name="mode" value="search">
<input type="hidden" name="posted_data[price_min]" value="75">
<input type="hidden" name="posted_data[price_max]" value="80">
<a class="VertMenuItems" href="javascript:document.productsearch_price_80.submit()" >ё75-ё80</a>
</form></td>
    <td><form style="margin-top: 0; margin-bottom: 0" method="POST" action="search.php" name="productsearch_price_85">
        <input type="hidden" name="mode" value="search" />
        <input type="hidden" name="posted_data[price_min]" value="80" />
        <input type="hidden" name="posted_data[price_max]" value="85" />
<a class="VertMenuItems" href="javascript:document.productsearch_price_85.submit()" >ё80-ё85</a>
</form></td>
    <td><form style="margin-top: 0; margin-bottom: 0" method="POST" action="search.php" name="productsearch_price_90">
<input type="hidden" name="mode" value="search">
<input type="hidden" name="posted_data[price_min]" value="85">
<input type="hidden" name="posted_data[price_max]" value="90">
<a class="VertMenuItems" href="javascript:document.productsearch_price_90.submit()" >ё85-ё90</a>
</form></td>
  </tr>
 
    <tr>
    <td><form style="margin-top: 0; margin-bottom: 0" method="POST" action="search.php" name="productsearch_price_95">
<input type="hidden" name="mode" value="search">
<input type="hidden" name="posted_data[price_min]" value="90">
<input type="hidden" name="posted_data[price_max]" value="95">
<a class="VertMenuItems" href="javascript:document.productsearch_price_95.submit()" >ё90-ё95</a>
</form></td>
    <td><form style="margin-top: 0; margin-bottom: 0" method="POST" action="search.php" name="productsearch_price_100">
        <input type="hidden" name="mode" value="search" />
        <input type="hidden" name="posted_data[price_min]" value="95" />
        <input type="hidden" name="posted_data[price_max]" value="100" />
<a class="VertMenuItems" href="javascript:document.productsearch_price_100.submit()" >ё95-ё100</a>
</form></td>
    <td><form style="margin-top: 0; margin-bottom: 0" method="POST" action="search.php" name="productsearch_price">
<input type="hidden" name="mode" value="search">
<input type="hidden" name="posted_data[price_min]" value="100">
<input type="hidden" name="posted_data[price_max]" value="100000">
<a class="VertMenuItems" href="javascript:document.productsearch_price.submit()" >ё100 +</a>
</form></td>
  </tr>
</table>
{/capture}
{include file="customer/menu_dialog.tpl" title=$lng.lbl_Shop_by_Price content=$smarty.capture.price additional_class="menu-bestsellers"}


Once uploaded you can change your xcart/skin1/customer/home.tpl by adding the code below.


Code:

{include file="customer/shop_by_price.tpl"}

You can see this at www.nightscene.co.uk/shop/home.php

Pyro 03-14-2010 12:10 PM

Re: Shop by Price for xcart 4.3.1
 
Thanks for sharing!

This may be able to put this to good use.

Pyro 03-14-2010 02:50 PM

Re: Shop by Price for xcart 4.3.1
 
Just a question, is there a way to make this so that it works per category?

For example, if I visit a category, I would like the "shop by price" to only take that category into consideration. Can this mod be made to do that? By the look of it, if you click a price when your in a category of your demo price, it shows the everything within that price range of all categories.


Thanks in advance

ShishaPipeUK 03-14-2010 03:09 PM

Re: Shop by Price for xcart 4.3.1
 
The default search engine does this, you can see this at http://www.nightscene.co.uk/shop/search.php

This mod is for all products and so that customers have a easy click with regard to price.

mudebate 07-24-2010 06:16 PM

Re: Shop by Price for xcart 4.3.1
 
Hi,

I know this is a persistent question related to shop by price modifications, but has anyone gotten this to work for the category the shopper is currenlty vieweing?

For example, if I am looking at category "Widgets" I would like my shop my price to drill down only within the category I am currenlty in, not all products.

I'm thinking there must be a way to may the search execute for only the category the user is currenlty in, but cannot figur eout ho wto make it work. Anyone have any luck with this?

I'm looking to do this for a site build on 4.3 that I have not taken live yet

Thanks!

minfinger 09-24-2010 10:00 AM

Re: Shop by Price for xcart 4.3.1
 
I'm trying to use this in 4.3.2 A side from needing to change the Monetary symbol.

I can't figure out how to get "Shop by Price" To appear in the title. I added the Label lbl_Shop_by_Price, but it's not picking it up.

Any help on this?

http://www.mikeinfinger.com/demos/xcart/home.php

mekon 08-10-2012 02:39 AM

Re: Shop by Price for xcart 4.3.1
 
Can confirm this works in 4.5.2

Also, I didn't want tables so here's a css version:

Code:

{* $Id: shop_by_price.tpl,v 1.20 2009/04/23 11:35:03 max Exp $ vim: set ts=2 sw=2 sts=2 et: *} {capture name=price}

<div class="shopbyprice_link">
<form style="margin-top: 0; margin-bottom: 0" method="POST" action="search.php" name="productsearch_price_5">
                <input type="hidden" name="mode" value="search">
                <input type="hidden" name="posted_data[price_min]" value="0">
                <input type="hidden" name="posted_data[price_max]" value="40"> <a class="VertMenuItems" href="javascript:document.productsearch_price_5.submit()" >ё0-ё40</a>
            </form>
</div>


<div class="shopbyprice_link">
            <form style="margin-top: 0; margin-bottom: 0" method="POST" action="search.php" name="productsearch_price_10">
                <input type="hidden" name="mode" value="search" />
                <input type="hidden" name="posted_data[price_min]" value="40" />
                <input type="hidden" name="posted_data[price_max]" value="80" /> <a class="VertMenuItems" href="javascript:document.productsearch_price_10.submit()" >ё40-ё80</a>
            </form>
</div>



<div class="shopbyprice_link">
            <form style="margin-top: 0; margin-bottom: 0" method="POST" action="search.php" name="productsearch_price_15">
                <input type="hidden" name="mode" value="search">
                <input type="hidden" name="posted_data[price_min]" value="80">
                <input type="hidden" name="posted_data[price_max]" value="120"> <a class="VertMenuItems" href="javascript:document.productsearch_price_15.submit()" >ё80-ё120</a>
            </form>
</div>




<div class="shopbyprice_link">
            <form style="margin-top: 0; margin-bottom: 0" method="POST" action="search.php" name="productsearch_price_20">
                <input type="hidden" name="mode" value="search">
                <input type="hidden" name="posted_data[price_min]" value="120">
                <input type="hidden" name="posted_data[price_max]" value="160"> <a class="VertMenuItems" href="javascript:document.productsearch_price_20.submit()" >ё120-ё160</a>
            </form>
</div>



<div class="shopbyprice_link">
            <form style="margin-top: 0; margin-bottom: 0" method="POST" action="search.php" name="productsearch_price_25">
                <input type="hidden" name="mode" value="search" />
                <input type="hidden" name="posted_data[price_min]" value="160" />
                <input type="hidden" name="posted_data[price_max]" value="220" /> <a class="VertMenuItems" href="javascript:document.productsearch_price_25.submit()" >ё160-ё220</a>
            </form>
</div>



<div class="shopbyprice_link">
            <form style="margin-top: 0; margin-bottom: 0" method="POST" action="search.php" name="productsearch_price_30">
                <input type="hidden" name="mode" value="search">
                <input type="hidden" name="posted_data[price_min]" value="220">
                <input type="hidden" name="posted_data[price_max]" value="500"> <a class="VertMenuItems" href="javascript:document.productsearch_price_30.submit()" >ё220-ё500</a>
            </form>
</div>



 {/capture} {include file="customer/menu_dialog.tpl" title=$lng.lbl_Shop_by_Price content=$smarty.capture.price additional_class="menu-shopbyprice"}



And the CSS I used:

Code:

.shopbyprice_link {
 width: 60px;
 height: 20px;
 float: left;
 margin-right: 30px;
 padding-top: 10px;
}

.shopbyprice_link a:link, .shopbyprice_link a:visited {
 text-decoration: none;
 font-weight: bold;
 color: #000; 
}



All times are GMT -8. The time now is 05:39 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.