Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Shop By Price Rate Topic   - - - - -

 
  • roban
  • Senior Member
  • Moderators
  • Join Date: 23-Oct 06
  • 1132 posts

Posted 04 June 2007 - 02:18 PM #1

I would like to have a mod whereby a customer can view products by price. I know they can be sorted by price but what I'd like to have is a side box.

$10.00 - $100.00
$101.00 - $200.00
$201.00 - $300.00

And so on

 
  • SWS
  • Senior Member
  • Members
  • Join Date: 30-Oct 06
  • 798 posts

Posted 04 June 2007 - 02:44 PM #2

Ive been thinking about this too..

It would be easy to make a "hack" for this, but to do it properly would require more work.

For instance 0 - £10 with an ugly url would be :
http://www.car-audio...0&button=Search

£10 to £50 would be :
http://www.car-audio...0&button=Search

Etc, however I realise it would be much better if it only displayed price ranges which are available etc.
[SIZE=3][/SIZE]

 
  • roban
  • Senior Member
  • Moderators
  • Join Date: 23-Oct 06
  • 1132 posts

Posted 04 June 2007 - 03:01 PM #3

It would be perfect for a jewelry site I'm working on. I'll request a quote and see where it takes us.

 
  • zardos
  • Senior Member
  • Members
  • Join Date: 08-Feb 06
  • 1062 posts

Posted 04 June 2007 - 03:10 PM #4

Here is a start for that mod if someone has time to play with it. Then add an include in main.tpl.

{capture name=menu}

<form style="margin-top: 0; margin-bottom: 0" method="POST" action="search.php" name="productsearchform1">
<input type="hidden" name="mode" value="search">
<input type="hidden" name="posted_data[price_min]" value="1">
<input type="hidden" name="posted_data[price_max]" value="100">
$1-$100
</form>

<form style="margin-top: 0; margin-bottom: 0" method="POST" action="search.php" name="productsearchform2">
<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="250">
$100-$250
</form>

<form style="margin-top: 0; margin-bottom: 0" method="POST" action="search.php" name="productsearchform3">
<input type="hidden" name="mode" value="search">
<input type="hidden" name="posted_data[price_min]" value="250">
<input type="hidden" name="posted_data[price_max]" value="500">
$250-$500
</form>

<form style="margin-top: 0; margin-bottom: 0" method="POST" action="search.php" name="productsearchform4">
<input type="hidden" name="mode" value="search">
<input type="hidden" name="posted_data[price_min]" value="500">
<input type="hidden" name="posted_data[price_max]" value="1000">
$500-$1000
</form>

<form style="margin-top: 0; margin-bottom: 0" method="POST" action="search.php" name="productsearchform5">
<input type="hidden" name="mode" value="search">
<input type="hidden" name="posted_data[price_min]" value="1000">
<input type="hidden" name="posted_data[price_max]" value="10000">
$1000-$10000
</form>

{/capture} 
{include file="common_templates/sidebox.tpl" title=$lang.shop_by_price content=$smarty.capture.sidebox icon="sidebox_icon_help.gif"}


 
  • abinop
  • Member
  • Members
  • Join Date: 01-Apr 07
  • 57 posts

Posted 05 June 2007 - 05:51 AM #5

Hello to all,
this is my proposition:

1. Go to admin panel->Languages and create a variable price_ranges with a value like "Price ranges" or something like that.
2. Go at the end of /init.php and add the following:

$smarty->assign('price_ranges', 
		array(
		  "1"=>"100",
		  "101"=>"200",
		  "201"=>"300",
		  "301"=>"400",
		  "401"=>"1000"
		  ));

You can of course change these values to whatever ranges fit your needs.

3. Create a file called price_ranges.tpl in /skins/YOURSKIN/customer/side_boxes with the following contents:

{capture name="sidebox"}

{foreach from=$price_ranges key='price_from' item='price_to'}
<a href="{$index_script}?{$target_name}=products&mode=search&type=extended&match=any&price_from={$price_from}&price_to={$price_to}" class="sidebox-link">{$currencies.$secondary_currency.symbol}{$price_from}-{$currencies.$secondary_currency.symbol}{$price_to}</a>
<br />
{/foreach}

{/capture}
{include file="common_templates/sidebox.tpl" title=$lang.price_ranges content=$smarty.capture.sidebox}

4. On /skins/YOURSKIN/customer/main.tpl, after {**[/ADDONS_DATA]**} (around line 27) add the following line

{include file="side_boxes/price_ranges.tpl"}


I hope this seems helpful,
Alexandros

 
  • roban
  • Senior Member
  • Moderators
  • Join Date: 23-Oct 06
  • 1132 posts

Posted 05 June 2007 - 09:16 AM #6

Alexandros. This works perfectly. Just what I wanted and I am sure this will be of service to many. IMO this kind of help is what makes CS-Cart the best. You can see it at work at www.signaturediamondgems.com. Thank you.

 
  • zardos
  • Senior Member
  • Members
  • Join Date: 08-Feb 06
  • 1062 posts

Posted 05 June 2007 - 09:42 AM #7

Thank Alexandros

Nice work

 
  • dominos_2004
  • Senior Member
  • Members
  • Join Date: 02-Jan 06
  • 257 posts

Posted 13 June 2007 - 04:13 AM #8

Works perfect.
Thank you.
But maybe you can tell us how to rewright by price urls?

Hello to all,
this is my proposition:

1. Go to admin panel->Languages and create a variable price_ranges with a value like "Price ranges" or something like that.
2. Go at the end of /init.php and add the following:

$smarty->assign('price_ranges', 
        array(
          "1"=>"100",
          "101"=>"200",
          "201"=>"300",
          "301"=>"400",
          "401"=>"1000"
          ));

You can of course change these values to whatever ranges fit your needs.

3. Create a file called price_ranges.tpl in /skins/YOURSKIN/customer/side_boxes with the following contents:

{capture name="sidebox"}
 
{foreach from=$price_ranges key='price_from' item='price_to'}
<a href="{$index_script}?{$target_name}=products&mode=search&type=extended&match=any&price_from={$price_from}&price_to={$price_to}" class="sidebox-link">{$currencies.$secondary_currency.symbol}{$price_from}-{$currencies.$secondary_currency.symbol}{$price_to}</a>
<br />
{/foreach}
 
{/capture}
{include file="common_templates/sidebox.tpl" title=$lang.price_ranges content=$smarty.capture.sidebox}

4. On /skins/YOURSKIN/customer/main.tpl, after {**[/ADDONS_DATA]**} (around line 27) add the following line

{include file="side_boxes/price_ranges.tpl"}


I hope this seems helpful,
Alexandros


CS-Cart 3.0.3

 
  • abinop
  • Member
  • Members
  • Join Date: 01-Apr 07
  • 57 posts

Posted 17 June 2007 - 04:11 PM #9

But maybe you can tell us how to rewright by price urls?


Sure,
add line

RewriteRule ^([^/]*/)?search-from-([0-9]+)-to-([0-9]+) $1index.php?target=products&mode=search&type=extended&match=any&price_from=$2&price_to=$3  [L]

to your .htaccess

and change

<a href="{$index_script}?{$target_name}=products&mode=search&type=extended&match=any&price_from={$price_from}&price_to={$price_to}" class="sidebox-link">{$currencies.$secondary_currency.symbol}{$price_from}-{$currencies.$secondary_currency.symbol}{$price_to}</a>

on file /YOURSKIN/customer/side_boxes/price_ranges.tpl (line 5)


to

<a href="search-from-{$price_from}-to-{$price_to}" class="sidebox-link">{$currencies.$secondary_currency.symbol}{$price_from}-{$currencies.$secondary_currency.symbol}{$price_to}</a>


Tell me if it works ok for you.

Alexandros

 
  • dominos_2004
  • Senior Member
  • Members
  • Join Date: 02-Jan 06
  • 257 posts

Posted 19 June 2007 - 03:10 AM #10

Thank you, works fine.
CS-Cart 3.0.3

 
  • lastninja
  • Junior Member
  • Members
  • Join Date: 25-Apr 07
  • 25 posts

Posted 04 August 2007 - 07:33 PM #11

thank abinop, i have two question

my first question is:

how can we show the price list as classified by categories?

example;

when we select $100-$150 it must show

x category (5) y category (1) z category (11) etc.

and my another question:

how can we show price list as "below $100" and "above $1000"

thanks again :D

 
  • paulesport
  • Senior Member
  • Members
  • Join Date: 23-Aug 07
  • 144 posts

Posted 27 August 2007 - 02:50 AM #12

Last Ninja, have you found a solution? Also, what does rewriting by price URL mean?

Lastly, can anyone tell me how to put the shop by price ranges in a drop down menu? Thanks!

 
  • paulesport
  • Senior Member
  • Members
  • Join Date: 23-Aug 07
  • 144 posts

Posted 24 September 2007 - 04:35 AM #13

Has anyone figured how to put the price ranges in a drop down menu? But more importantly....does any expert professional cscart person know how to set the language to "less than $50" instead of "$1 - $50" :confused: :confused:

 
  • Page
  • Senior Member
  • Members
  • Join Date: 06-Sep 07
  • 491 posts

Posted 24 September 2007 - 05:53 AM #14

Could this problem not also be sorted by creating a new category "By Price" with the required subcategories.

The item can then be put into the correct additional category.

Not ideal since if the price changed the category would have to be changed also. But it might suit for many.

 
  • coder
  • Senior Member
  • Members
  • Join Date: 19-Jun 07
  • 411 posts

Posted 12 January 2008 - 03:33 AM #15

Sure,
add line

RewriteRule ^([^/]*/)?search-from-([0-9]+)-to-([0-9]+) $1index.php?target=products&mode=search&type=extended&match=any&price_from=$2&price_to=$3  [L]

to your .htaccess

and change

<a href="{$index_script}?{$target_name}=products&mode=search&type=extended&match=any&price_from={$price_from}&price_to={$price_to}" class="sidebox-link">{$currencies.$secondary_currency.symbol}{$price_from}-{$currencies.$secondary_currency.symbol}{$price_to}</a>

on file /YOURSKIN/customer/side_boxes/price_ranges.tpl (line 5)


to

<a href="search-from-{$price_from}-to-{$price_to}" class="sidebox-link">{$currencies.$secondary_currency.symbol}{$price_from}-{$currencies.$secondary_currency.symbol}{$price_to}</a>


For all who want this code for 135

do all the steps as above but instead of

RewriteRule ^([^/]*/)?search-from-([0-9]+)-to-([0-9]+) $1index.php?target=products&mode=search&type=extended&match=any&price_from=$2&price_to=$3  [L]

use

RewriteRule ^([^/]*/)?search-from-([0-9]+)-to-([0-9]+)$ $1index.php?target=products&mode=search&type=extended&match=any&price_from=$2&price_to=$3  [L]

;-)

CS-CART: version 4.9.1


 
  • Lee Li Pop
  • Senior Member
  • Members
  • Join Date: 07-Mar 08
  • 941 posts

Posted 21 April 2008 - 09:11 PM #16

You can sort your results from lower to higher:

Change:

<a href="{$index_script}?{$target_name}=products&mode=search&type=extended&match=any&price_from={$price_from}&price_to={$price_to}" class="sidebox-link">{$currencies.$secondary_currency.symbol}{$price_from}-{$currencies.$secondary_currency.symbol}{$price_to}</a>

to:

<a href="{$index_script}?{$target_name}=products&mode=search&type=extended&match=any&price_from={$price_from}&price_to={$price_to}&sort_by=price&sort_order=asc" class="sidebox-link">{$currencies.$secondary_currency.symbol}{$price_from}-{$currencies.$secondary_currency.symbol}{$price_to}</a>

This is more in line according some consumer groups rules (and some local laws - especialy in Europe), wanting prices sorted from lowest to highest...



Lee Li Pop

 
  • zoom4267
  • Senior Member
  • Members
  • Join Date: 27-May 06
  • 847 posts

Posted 17 August 2008 - 05:29 PM #17

i came across this post and wanted to add this feature but where is the file?

/init.php

thanks
Lisa

http://www.skytopdesigns.com Web designs and Development

 
  • roban
  • Senior Member
  • Moderators
  • Join Date: 23-Oct 06
  • 1132 posts

Posted 17 August 2008 - 05:38 PM #18

In your root directory for your store

 
  • zoom4267
  • Senior Member
  • Members
  • Join Date: 27-May 06
  • 847 posts

Posted 17 August 2008 - 06:15 PM #19

my ftp program didnt go to the root, but i got it in the file manager

thanks


****awsome!!!***
Lisa

http://www.skytopdesigns.com Web designs and Development

 
  • pianofo
  • Junior Member
  • Members
  • Join Date: 29-Nov 07
  • 17 posts

Posted 03 October 2008 - 10:49 AM #20

Hello to all,
this is my proposition:

1. Go to admin panel->Languages and create a variable price_ranges with a value like "Price ranges" or something like that.
2. Go at the end of /init.php and add the following:

$smarty->assign('price_ranges', 
		array(
		  "1"=>"100",
		  "101"=>"200",
		  "201"=>"300",
		  "301"=>"400",
		  "401"=>"1000"
		  ));

You can of course change these values to whatever ranges fit your needs.

3. Create a file called price_ranges.tpl in /skins/YOURSKIN/customer/side_boxes with the following contents:

{capture name="sidebox"}

{foreach from=$price_ranges key='price_from' item='price_to'}
<a href="{$index_script}?{$target_name}=products&mode=search&type=extended&match=any&price_from={$price_from}&price_to={$price_to}" class="sidebox-link">{$currencies.$secondary_currency.symbol}{$price_from}-{$currencies.$secondary_currency.symbol}{$price_to}</a>
<br />
{/foreach}

{/capture}
{include file="common_templates/sidebox.tpl" title=$lang.price_ranges content=$smarty.capture.sidebox}

4. On /skins/YOURSKIN/customer/main.tpl, after {**[/ADDONS_DATA]**} (around line 27) add the following line

{include file="side_boxes/price_ranges.tpl"}


I hope this seems helpful,
Alexandros

Hi,

instead of sidebox with price ranges I get>

Warning: Smarty error: unable to read resource: "side_boxes/price.tpl" in /hermes/bosweb/web046/b465/sl.pianofo/forteshop.cz/classes/templater/Smarty.class.php on line 1095

Pls, help me