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)
-   -   Creating a 'From' price (https://forum.x-cart.com/showthread.php?t=8074)

carlisleglass 06-13-2004 11:44 PM

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.

GM 06-14-2004 07:11 AM

Nice one darrenkierman! Much better! Thanks! :D
(P.S. I like your popup tooltips. 8) very cool indeed!)

hood 09-21-2004 07:42 AM

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

Rayco 03-06-2005 11:31 AM

From Price
 
Anyone have this working in 4.xx namely 4.12. I can't seem to figure it out. Cheers Ray

carlisleglass 03-11-2005 04:52 AM

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)

Gio 04-15-2005 10:02 AM

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

carlisleglass 05-13-2005 01:38 AM

UPDATE: Version 4 has a variant option which kind of makes this mod obselete in this version.


All times are GMT -8. The time now is 08:25 AM.

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