View Single Post
  #3  
Old 09-07-2009, 02:48 AM
 
Ordorica Ordorica is offline
 

Member
  
Join Date: May 2009
Posts: 14
 

Default Re: Extra Fields 4.2.x on Products_list.tpl

Hi lkrivoshiev,

Thank you so much for your reply. With your help I have managed to achieve what I was attempting. My results are posted here for the benefit of others.

In home.php I made the following changes.

Added:

Code:
if((isset($products)) && (is_array($products))){ foreach ($products as $product){ $custom_extra_fields[$product['productid']] = func_query("SELECT exvalues.* , exfields.field FROM $sql_tbl[extra_field_values] as exvalues, $sql_tbl[extra_fields] as exfields WHERE exvalues.productid='".intval($product['productid'])."' AND exvalues.fieldid=exfields.fieldid"); } } if (isset($custom_extra_fields)) $smarty->assign('custom_extra_fields',$custom_extra_fields);

before the line:
if ($active_modules["Bestsellers"])

In products_list.tpl I added the following code to display the desired extra field data:

Code:
{foreach from=$custom_extra_fields item="exfields"} {foreach from=$exfields item="cur_exfiled"} {if $product.productid eq $cur_exfiled.productid && $cur_exfiled.fieldid eq '11'} {if $cur_exfiled.value eq ">5"} <tr> <td>Stock: </td> <td><img src="/skin1/images/quantity/qty_gt5.gif" alt=" " title=" " border="0" height="11" width="40"></a></td> </tr> {/if} {if $cur_exfiled.value eq "5"} <tr> <td>Stock: </td> <td><img src="/skin1/images/quantity/qty_5.gif" alt=" " title=" " border="0" height="11" width="40"></a></td> </tr> {/if} {if $cur_exfiled.value eq "4"} <tr> <td>Stock: </td> <td><img src="/skin1/images/quantity/qty_4.gif" alt=" " title=" " border="0" height="11" width="40"></a></td> </tr> {/if} {if $cur_exfiled.value eq "3"} <tr> <td>Stock: </td> <td><img src="/skin1/images/quantity/qty_3.gif" alt=" " title=" " border="0" height="11" width="40"></a></td> </tr> {/if} {if $cur_exfiled.value eq "2"} <tr> <td>Stock: </td> <td><img src="/skin1/images/quantity/qty_2.gif" alt=" " title=" " border="0" height="11" width="40"></a></td> </tr> {/if} {if $cur_exfiled.value eq "1"} <tr> <td>Stock: </td> <td><img src="/skin1/images/quantity/qty_1.gif" alt=" " title=" " border="0" height="11" width="40"></a></td> </tr> {/if} {if $cur_exfiled.value eq "0"} <tr> <td>Stock: </td> <td>BY ORDER</td> </tr> {/if} {/if} {/foreach} {/foreach}

the above code was added before the line:
{if $product.appearance.buy_now_enabled}

Thanks again, much appreciated.
__________________
X-Cart Version 4.3.1 Gold
Firetank Featured Product and Feed Manager
BCSE Product Importer Pro
Apache version 2.2.11 (Unix)
MySQL version 5.0.77-community
PHP version 5.2.8


Reply With Quote