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)
-   -   Manipulate product extra fields display (https://forum.x-cart.com/showthread.php?t=66137)

Paulw 02-15-2013 02:26 AM

Manipulate product extra fields display
 
I hope someone can help. The template /common_files/modules/Extra_Fields/product.tpl

is as follows:

{foreach from=$extra_fields item=v}
{if $v.active eq "Y" and $v.field_value}
<tr>
<td class="property-name">{$v.field}</td>
<td class="property-value" colspan="2">{$v.field_value}</td>
</tr>
{/if}
{/foreach}

What i'm looking to do is to only display certain extra fields on the product details page. I've therefore created a new tpl called: /common_files/modules/Extra_Fields/product2.tpl

Then I'm stuck as I can't work out how to display two extra fields. I've tried:


{if $product.extra_fields}
{foreach from=$product.extra_fields item=extra_field name=extra_fields}
{* Display the Availability and Delivery fields *}
{if $extra_field.service_name eq "SERVICE_NAME02"}
<br><b>{$extra_field.value}</b>
{/if}
{if $extra_field.service_name eq "SERVICE_NAME05"}
<br>{$extra_field.value} <br><br>{/if}
{/foreach}
{/if}

but it doesn't show up on the product details page. The same code on the subcateogires page /common_files/customer/main/products_t.tpl does show up correctly?

Where am I going wrong please?

pauldodman 02-15-2013 02:40 AM

Re: Manipulate product extra fields display
 
Try using
{if $v.field eq "NAMEHERE"}
instead of the service name bit.

Paulw 02-15-2013 03:25 AM

Re: Manipulate product extra fields display
 
Thanks for the reply, how do you change this if you want 2 to show instead of one? is there an "or" statement you can use? On second thoughts that wouldn't work, you would simply right another if statement! Sorry for not thinking before typing!

carpeperdiem 02-15-2013 05:15 AM

Re: Manipulate product extra fields display
 
This thread may help you?

http://forum.x-cart.com/showthread.php?t=65220

Paulw 02-15-2013 05:39 AM

Re: Manipulate product extra fields display
 
The last thing I'm trying to do is change the text in an particular extra field dependant on stock levels i.e if out of stock it would read "stock arriving soon" and if in stock it would read "In stock".

I would just use the following code to display stock levels on the page:
{if $product.appearance.empty_stock}
<b><p class="message">Stock arriving soon</p></b>
{else} <b><p class="message">In stock</p></b>{/if}

But i'm using a pre-order / back order mod which allows customers to purchase if stock levels are 0 and this in turn makes the website read "in Stock" for back order purchases when actually it's not in stock, so a little confusing for the customer.

carpeperdiem 02-15-2013 06:32 AM

Re: Manipulate product extra fields display
 
Quote:

Originally Posted by Paulw
The last thing I'm trying to do is change the text in an particular extra field dependant on stock levels i.e if out of stock it would read "stock arriving soon" and if in stock it would read "In stock".


Do you need to use an extra field for stock level display?
This thread may point you in the right direction:

http://forum.x-cart.com/showthread.php?t=65938


All times are GMT -8. The time now is 03:37 PM.

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