X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Custom If Then statement? (https://forum.x-cart.com/showthread.php?t=3894)

elabdesigns 08-05-2003 05:31 PM

Custom If Then statement?
 
Can anyone write a " If then " statement that will do the following:

If category=candles then price=not shown

The reason for this is, I only want the price shown in the product options drop down menu beside of the different attributes. This way the customer doesn't see a price until they view the different attributes in the drop down.

For example:

Warm Apple Pie Candle

Choose Size: [Dropdown]
26 oz Jar $20.99
16 oz Jar 16.99
Votive $1.50
Tart $100
Tea Lights $8.99

Quantity [Dropdown]

Add to cart [GO]

Please help, thanks.

Jay :wink:

TelaFirma 08-06-2003 02:06 AM

Go to your product.tpl and look for the code that reads

Code:

{if $product.price ne 0}
<font class=ProductDetailsTitle>{include file="currency.tpl" value=$product.price}</font><font class=MarketPrice> {include file="customer/main/alter_currency_value.tpl" alter_currency_value=$product.price}</font>{if $config.Taxes.use_vat eq "Y" and $product.vat gt "0"}, {$lng.lbl_including_vat} {$product.vat}%{/if}
{else}
<input type=text size=7 name=price>
{/if}


Comment out the else part (like this)

Code:

{if $product.price ne 0}
<font class=ProductDetailsTitle>{include file="currency.tpl" value=$product.price}</font><font class=MarketPrice> {include file="customer/main/alter_currency_value.tpl" alter_currency_value=$product.price}</font>{if $config.Taxes.use_vat eq "Y" and $product.vat gt "0"}, {$lng.lbl_including_vat} {$product.vat}%{/if}
{* Remove Input Box
{else}
<input type=text size=7 name=price>
*}
{/if}


Then just set the price of that item to $0.00

elabdesigns 08-06-2003 03:32 AM

You are right, I can just comment out the price. However, I have more than just those candles on my site. There are addtional individual products like candle accessories, gift baskets and more. Thats why I need the if then statement for I only what the candles category's prices to not show up.


Jay

walteis 08-06-2003 08:31 AM

Maybe something like this?

Code:


{if $product.category ne "Candles"}
{if $product.price ne 0}
<font class=ProductDetailsTitle>{include file="currency.tpl" value=$product.price}</font><font class=MarketPrice> {include file="customer/main/alter_currency_value.tpl" alter_currency_value=$product.price}</font>{if $config.Taxes.use_vat eq "Y" and $product.vat gt "0"}, {$lng.lbl_including_vat} {$product.vat}%{/if}
{else}
<input type=text size=7 name=price>
{/if}
{/if}


I didn't look at the xcart code too closely, but IIRC, category is in the product array.

Walt

elabdesigns 08-06-2003 04:44 PM

The way I have the code will cause two differnet messages to show up if the
Code:

{if $product.price ne 0 }
(which is one candle line) you will see one message (which will be a size chart graphic for that candle line) instead of the weight and price, or
Code:

{if $product.price ne 1 }
(which will be another line) you will see the other message(size chart). All I have to do to make this happen is make one candle lines price=0 and there other =1.

So can anyone fix the following code so that the two differnet messages will show if one price=0 and the other price=1?

Code:

{if $product.price ne 0 }
<tr><td class=ProductPriceConverting>
{$lng.lbl_price}:</td>
<td>

<font class=ProductDetailsTitle>{include file="currency.tpl" value=$product.price}</font><font class=MarketPrice> {include file="customer/main/alter_currency_value.tpl" alter_currency_value=$product.price}</font>{if $config.Taxes.use_vat eq "Y" and $product.vat gt "0"}, {$lng.lbl_including_vat} {$product.vat}%{/if}
{else}
{* <input type=text size=7 name=price> *}
<tr><td>
first size chart goes here</td>
<td>
{/if}
</td>
</tr>
{/if}

{if $product.price ne 1 }
<tr><td class=ProductPriceConverting>
{$lng.lbl_price}:</td>
<td>

<font class=ProductDetailsTitle>{include file="currency.tpl" value=$product.price}</font><font class=MarketPrice> {include file="customer/main/alter_currency_value.tpl" alter_currency_value=$product.price}</font>{if $config.Taxes.use_vat eq "Y" and $product.vat gt "0"}, {$lng.lbl_including_vat} {$product.vat}%{/if}
{else}
{* <input type=text size=7 name=price> *}
<tr><td>
second size chart goes here</td>
<td>
{/if}
</td>
</tr>
{/if}

{/if}
</table>


Thanks

elabdesigns 08-06-2003 05:28 PM

I solved it
 
Thanks to everyone who has viewed this post, I took it to the next step and now have solved by problem.

The code should be:

Code:

{if $product.price ne 0}
{if $product.price ne 1}
{if $product.weight ne "0.00"}<tr><td width=30%>{$lng.lbl_weight}</td><td nowrap>{$product.weight} {$config.General.weight_symbol}</td></tr>
{else}
{/if}
{/if}
{/if}
{if $active_modules.Extra_Fields ne ""}
{include file="modules/Extra_Fields/product.tpl"}
{/if}
{if $active_modules.Subscriptions ne "" and $subscription}
{include file="modules/Subscriptions/subscription_info.tpl"}
{else}
{if $product.price ne 0 }
{if $product.price ne 1}
<tr><td class=ProductPriceConverting>
{$lng.lbl_price}:</td>
<td>

<font class=ProductDetailsTitle>{include file="currency.tpl" value=$product.price}</font><font class=MarketPrice> {include file="customer/main/alter_currency_value.tpl" alter_currency_value=$product.price}</font>{if $config.Taxes.use_vat eq "Y" and $product.vat gt "0"}, {$lng.lbl_including_vat} {$product.vat}%{/if}
{else}
{* <input type=text size=7 name=price> *}
<tr><td>
{if $product.price eq 0 }
see size chart
{else if $product.price eq 1 }
see second size chart{/if}
</td>
<td>
{/if}
</td>
</tr>
{/if}
{/if}
</table>


Once I get the site up and going you will have to see this cool mod. Keep an eye out for it.


Jay


All times are GMT -8. The time now is 01:50 AM.

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