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)
-   -   Extra field in related products (https://forum.x-cart.com/showthread.php?t=48617)

nck-k 07-15-2009 02:54 AM

Extra field in related products
 
Hi,

If you take a look at http://www.medicalonlineshop.nl/tandpasta-whitening/safe-white-combi.html you see "Safe & White Combi Aanbieding!" as the title of the product.

Actually only "Safe & White Combi" is the title of the product and "Aanbieding" is an extra field that will be displayed whithin the title on the product page and categorypages.

Now at the bottom of the product page, there are some upselling/related products. Here you only see the title and not the extra field. I would like to also display the extra field here.

I use these codes:

related_products.tpl (that is included in product.tpl)
Code:

{* $Id: related_products.tpl,v 1.15.2.1 2007/05/02 06:05:39 max Exp $ *}
{if $product_links ne ""}
{capture name=dialog}
{section name=cat_num loop=$product_links}
<div class="product-display"> <a href="product.php?productid={$product_links[cat_num].productid}">{include file="product_thumbnail.tpl" productid=$product_links[cat_num].productid image_x=150 product=$product_links[cat_num].product tmbn_url=$product_links[cat_num].tmbn_url}</a> {if $active_modules.Special_Offers ne "" && $product_links[cat_num].have_offers && $usertype eq 'C'}
  {include file="modules/Special_Offers/customer/product_offer_thumb.tpl" product=$product_links[cat_num]}
  {/if} <a href="product.php?productid={$product_links[cat_num].productid}&amp;cat={$cat}&amp;page={$navigation_page}{if $featured eq 'Y'}&amp;featured{/if}" class="product-display-name">{$product_links[cat_num].product} <span>{section name=field loop=$product_links[cat_num].extra_fields}
  {if $product_links[cat_num].extra_fields[field].active eq "Y" && $product_links[cat_num].extra_fields[field].field_value && $product_links[cat_num].extra_fields[field].service_name eq "SERVICE_NAME01"}
  {$product_links[cat_num].extra_fields[field].field_value}
  {/if}
  {/section}</span></a>
  <div class="product-display-sum"> {if $product_links[cat_num].product_type eq "C"}
    {else}
    {if $active_modules.Subscriptions ne "" and ($product_links[cat_num].catalogprice gt 0 or $product_links[cat_num].sub_priceplan gt 0)}
    {else}
   
    {if ($config.General.unlimited_products ne "Y" && ($product_links[cat_num].avail le 0 or $product_links[cat_num].avail lt $product_links[cat_num].min_amount) && $product_links[cat_num].variantid) or ($product_links[cat_num].taxed_price ne 0 or ($product_links[cat_num].variantid && $product_links[cat_num].variants_has_price) or ($active_modules.Special_Offers ne "" and $product_links[cat_num].use_special_price ne ""))}
   
    {if $product_links[cat_num].taxed_price ne 0 or ($product_links[cat_num].variantid && $product_links[cat_num].variants_has_price)}
    {if $product_links[cat_num].list_price gt 0 and $product_links[cat_num].taxed_price lt $product_links[cat_num].list_price}
    {math equation="100-(price/lprice)*100" price=$product_links[cat_num].taxed_price lprice=$product_links[cat_num].list_price format="%3.0f" assign=discount}
   
   
    {if $discount gt 0} <span class="price">{include file="currency.tpl" value=$product_links[cat_num].list_price}</span> {/if}
   
    {/if}
   
    {if $active_modules.Special_Offers ne "" and $product_links[cat_num].use_special_price ne ""}
    {/if} <span class="price">{include file="currency.tpl" value=$product_links[cat_num].taxed_price}</span> <span class="price">{include file="customer/main/alter_currency_value.tpl" alter_currency_value=$product_links[cat_num].taxed_price}</span> {if $discount gt 0}{if $config.General.alter_currency_symbol ne ""},{/if} {$lng.lbl_save_price} {$discount}%{/if}
    {if $active_modules.Special_Offers ne "" and $product_links[cat_num].use_special_price ne ""}
   
    {/if}
    {if $product_links[cat_num].taxes} <br />
    <div class="PListTaxBox">{include file="customer/main/taxed_price.tpl" taxes=$product_links[cat_num].taxes is_subtax=true}</div>
    {/if}
    {/if}
    {if $active_modules.Special_Offers ne "" and $product_links[cat_num].use_special_price ne ""}
    {include file="modules/Special_Offers/customer/product_special_price.tpl" product=$product_links[cat_num]}
    {/if}
    {else} <font class="ProductPrice">{$lng.lbl_enter_your_price}</font> {/if}
    {/if}
   
    {/if} <span class="btw">Incl. BTW excl. verzendkosten</span> </div>
  <a href="product.php?productid={$product_links[cat_num].productid}&amp;cat={$cat}&amp;page={$navigation_page}{if $featured eq 'Y'}&amp;featured{/if}"><img src="/skin1/assets/themes/08/images/product-display-more.png" /></a>
  <div class="product-display-rating"> {include file="ratings/ratings_recom.tpl"} </div>
</div>
<!--<a href="product.php?productid={$product_links[cat_num].productid}" class="ItemsList">{$product_links[cat_num].product}</a>-->
{/section}
{/capture}
{include file="dialog_recom.tpl" title=$lng.lbl_related_products content=$smarty.capture.dialog}
{/if}


You see the code where i try to insert the extra field, but it doesn't work:

Code:

<span>{section name=field loop=$product_links[cat_num].extra_fields}
  {if $product_links[cat_num].extra_fields[field].active eq "Y" && $product_links[cat_num].extra_fields[field].field_value && $product_links[cat_num].extra_fields[field].service_name eq "SERVICE_NAME01"}
      {$product_links[cat_num].extra_fields[field].field_value}
  {/if}
  {/section}</span>


Can someone help me?

Thank you!

speedfreq 09-16-2009 10:44 AM

Re: Extra field in related products
 
Was anyone able to figure this out? I really need to add extra fields to related products, but am just having no luck. Anyone?

buckyreal 09-28-2009 11:06 AM

Re: Extra field in related products
 
I'm interested in doing this too... is it possible?

speedfreq 09-28-2009 11:21 AM

Re: Extra field in related products
 
This is what did it for me. Finally figured it out after a while of playing around...

changes made in /modules/Upselling_Products/related_products.tpl

{$product_links[cat_num].extra_fields[1].value}
{$product_links[cat_num].extra_fields[2].value}{$product_links[cat_num].extra_fields[3].value}

Those will list the first 3 extra fields values. If you want the field name I believe you sub in "field_value" for "value". You can also use a variable in a loop such as something like this:

<span>{section name=field loop=$product_links[cat_num].extra_fields}
{if $product_links[cat_num].extra_fields[field].active eq "Y" && $product_links[cat_num].extra_fields[field].field_value && $product_links[cat_num].extra_fields[field].service_name eq "SHORT_DESC"}
{$product_links[cat_num].extra_fields[field].field_value}
{/if}
{/section}</span>


All times are GMT -8. The time now is 06:34 PM.

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