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

Creating a 'From' price

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 06-13-2004, 11:44 PM
  carlisleglass's Avatar 
carlisleglass carlisleglass is offline
 

eXpert
  
Join Date: Aug 2003
Location: Carlisle, UK
Posts: 316
 

Default Creating a 'From' price

Say you have a stock item which is available in 5 sizes, currently you would need to put the cheapest item in first and try to work out the price differences between them, which is a) confusing the admin and b) confusing to the customer. This mod will allow you to show a 'From' price for this stock item, and make all option prices absolute (бё1.99) rather than addition prices (+бё0.39).

======

Heres an example of the mod - http://shop.cglass.co.uk/customer/search.php?substring=yacht+varnish - Click on view to see the full product page with it on as well !

Firstly make sure that the 'Extra Fields' module is switched on by going into the module list and checking that a check tick is on it.

Now create a extra fields called 'From (бё)' (or literally anything you want to describe it). Also make sure its the first extra field you have, the show box is not checked, and the default value is left blank.

Now to the templates ... where the price is displayed (definantly: /customer/main/product.tpl and /customer/main/products.tpl) you will have to use the following logic to create the 'from .....' display:

Code:
{if $products[product].price eq 0 and $products[product].param00 eq ""} Call for Price {else} {if $products[product].param00 eq ""} from бё{$products[product].param00} {else} {include file="currency.tpl" value=$products[product].price} {/if} {/if}

To remove the + from the product options if its a from price, do the following change in /modules/Product_Options/customer_options.tpl
Code:
{$options[option].surcharge|value_sign:"1"}
to
Code:
{if $product.param00 eq ""}{$options[option].surcharge|value_sign:"1"}{/if}

And finally how to use this modification, when adding or modifying products.

* If the product has a set price, or if the product options is an addition to the set price, leave the 'From' box empty.
* If the product has various sizes (for example) at different prices, make the product price 0.00, put the cheapest item price in the From box and then put the product options as their actual price.
__________________
Darren Kierman
Carlisle Glass (http://www.carlisleglass.co.uk/)
... running X-Cart Gold 4.4.5 [unix]
Reply With Quote
  #2  
Old 06-14-2004, 07:11 AM
 
GM GM is offline
 

eXpert
  
Join Date: Mar 2004
Location: Canada
Posts: 293
 

Default

Nice one darrenkierman! Much better! Thanks!
(P.S. I like your popup tooltips. very cool indeed!)
__________________
v. 4.0.14 (GM Style)
O.S. Linux
Build Your Own Diamond Ring
Reply With Quote
  #3  
Old 09-21-2004, 07:42 AM
 
hood hood is offline
 

Newbie
  
Join Date: Feb 2004
Posts: 3
 

Default

Hi darrenkierman

This is great just what I'm looking for. But having a problem with then getting the correct right price passed to the cart. As the cart is looking for

Code:
{include file="currency.tpl" value=$products[product].price}

Which is set to 0.00 as per the mod instructions and the lowest price is hel it the extra field. The actual value required to be passed to the cart sits with the product option

e.g.

Black бё25.00
Red бё27.00

how did you solve this issue?
Lost of mods in the cart area of our site

Any help in this would be great
thanks
Hood
__________________
xcart v3.4.12
PHP 4.2.3
MySQL server 3.23.54
Apache/1.3.27 (Unix)
Reply With Quote
  #4  
Old 03-06-2005, 11:31 AM
 
Rayco Rayco is offline
 

Member
  
Join Date: Jul 2004
Posts: 21
 

Default From Price

Anyone have this working in 4.xx namely 4.12. I can't seem to figure it out. Cheers Ray
__________________
Rayco
XCart 4.0.8 Dev
Mysql 4.0.20 Standard
Linux(i686) 2.4.27
Reply With Quote
  #5  
Old 03-11-2005, 04:52 AM
  carlisleglass's Avatar 
carlisleglass carlisleglass is offline
 

eXpert
  
Join Date: Aug 2003
Location: Carlisle, UK
Posts: 316
 

Default

To get this to work in V4.0.12 :

$products[product].param00 becomes $extra_fields[0].field_value
that is if the extra field is first in the list.


In product_options do this :

change{include file="currency.tpl" value=$o.price_modifier display_sign=1} to {if $extra_fields[0].field_value eq ""}{include file="currency.tpl" value=$o.price_modifier display_sign=1}{else}{include file="currency.tpl" value=$o.price_modifier display_sign=0}{/if}


I must add i have only been able to do this in product.tpl (and not products.tpl)
__________________
Darren Kierman
Carlisle Glass (http://www.carlisleglass.co.uk/)
... running X-Cart Gold 4.4.5 [unix]
Reply With Quote
  #6  
Old 04-15-2005, 10:02 AM
 
Gio Gio is offline
 

Member
  
Join Date: Mar 2005
Posts: 23
 

Default

I'm still a little confused on the 4.012 mod... can you show me all the code changes you're making to the mod??

Thanks
__________________
4.0.18
Reply With Quote
  #7  
Old 05-13-2005, 01:38 AM
  carlisleglass's Avatar 
carlisleglass carlisleglass is offline
 

eXpert
  
Join Date: Aug 2003
Location: Carlisle, UK
Posts: 316
 

Default

UPDATE: Version 4 has a variant option which kind of makes this mod obselete in this version.
__________________
Darren Kierman
Carlisle Glass (http://www.carlisleglass.co.uk/)
... running X-Cart Gold 4.4.5 [unix]
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 12:50 AM.

   

 
X-Cart forums © 2001-2020