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

Custom If Then statement?

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 08-05-2003, 05:31 PM
 
elabdesigns elabdesigns is offline
 

Advanced Member
  
Join Date: May 2003
Location: Mount Airy, NC
Posts: 66
 

Default 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
Reply With Quote
  #2  
Old 08-06-2003, 02:06 AM
  TelaFirma's Avatar 
TelaFirma TelaFirma is offline
 

X-Adept
  
Join Date: Nov 2002
Location: North Carolina USA
Posts: 930
 

Default

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
Reply With Quote
  #3  
Old 08-06-2003, 03:32 AM
 
elabdesigns elabdesigns is offline
 

Advanced Member
  
Join Date: May 2003
Location: Mount Airy, NC
Posts: 66
 

Default

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
Reply With Quote
  #4  
Old 08-06-2003, 08:31 AM
 
walteis walteis is offline
 

Advanced Member
  
Join Date: Jan 2003
Location: USA
Posts: 65
 

Default

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
Reply With Quote
  #5  
Old 08-06-2003, 04:44 PM
 
elabdesigns elabdesigns is offline
 

Advanced Member
  
Join Date: May 2003
Location: Mount Airy, NC
Posts: 66
 

Default

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
Reply With Quote
  #6  
Old 08-06-2003, 05:28 PM
 
elabdesigns elabdesigns is offline
 

Advanced Member
  
Join Date: May 2003
Location: Mount Airy, NC
Posts: 66
 

Default 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
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



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 01:42 AM.

   

 
X-Cart forums © 2001-2020