Hi Guys,
I have searched the forum and looked at
http://forum.x-cart.com/showthread.php?t=25143&highlight=extra+field in detail but I still can't get my extra fields to show in products_list.tpl
I have made the following change to products.php:
Code:
include $xcart_dir."/modules/Subscriptions/subscription.php";
}
if (!empty($active_modules["Extra_Fields"]) && !empty($products)) {
foreach($products as $k => $v) {
$products[$k]["extra_fields"] = func_query("SELECT $sql_tbl[extra_fields].field as field, $sql_tbl[extra_field_values].value as value, $sql_tbl[extra_fields].service_name as service_name FROM $sql_tbl[extra_fields], $sql_tbl[extra_field_values] WHERE $sql_tbl[extra_field_values].fieldid = $sql_tbl[extra_fields].fieldid AND $sql_tbl[extra_field_values].productid = '$v[productid]'");
}
}
$smarty->assign("cat_products", $products);
$smarty->assign("navigation_script", "home.php?cat=$cat&sort=$sort&sort_direction=$sort_direction");
...and I have added the following code to products_list.tpl:
Code:
{if $active_modules.Special_Offers ne "" && $product.use_special_price ne ""}
{include file="modules/Special_Offers/customer/product_special_price.tpl"}
{/if}
{else}
<span class="price">{$lng.lbl_enter_your_price}</span><br />
{$lng.lbl_enter_your_price_note}
{/if}
{/if}
{if $extra_fields[field].field eq "Stock Availability (Approx.)" && $extra_fields[field].field_value ne ""}
{if $extra_fields[field].field_value eq ">5"}
<tr>
<td width="30%">{$extra_fields[field].field}</td>
<td><img src="/skin1/images/quantity/qty_gt5.gif" alt=" " title=" " border="0" height="11" width="40"></a></td>
</tr>
{/if}
{if $extra_fields[field].field_value eq "5"}
<tr>
<td width="30%">{$extra_fields[field].field}</td>
<td><img src="/skin1/images/quantity/qty_5.gif" alt=" " title=" " border="0" height="11" width="40"></a></td>
</tr>
{/if}
{if $extra_fields[field].field_value eq "4"}
<tr>
<td width="30%">{$extra_fields[field].field}</td>
<td><img src="/skin1/images/quantity/qty_4.gif" alt=" " title=" " border="0" height="11" width="40"></a></td>
</tr>
{/if}
{if $extra_fields[field].field_value eq "3"}
<tr>
<td width="30%">{$extra_fields[field].field}</td>
<td><img src="/skin1/images/quantity/qty_3.gif" alt=" " title=" " border="0" height="11" width="40"></a></td>
</tr>
{/if}
{if $extra_fields[field].field_value eq "2"}
<tr>
<td width="30%">{$extra_fields[field].field}</td>
<td><img src="/skin1/images/quantity/qty_2.gif" alt=" " title=" " border="0" height="11" width="40"></a></td>
</tr>
{/if}
{if $extra_fields[field].field_value eq "1"}
<tr>
<td width="30%">{$extra_fields[field].field}</td>
<td><img src="/skin1/images/quantity/qty_1.gif" alt=" " title=" " border="0" height="11" width="40"></a></td>
</tr>
{/if}
{if $extra_fields[field].field_value eq "0"}
<tr>
<td width="30%">{$extra_fields[field].field}</td>
<td>BY ORDER</a></td>
</tr>
{/if}
{if $extra_fields[field].field_value eq ""}
<tr>
<td width="30%">{$extra_fields[field].field}</td>
<td>BY ORDER</a></td>
</tr>
{/if}
{/if}
{if $product.appearance.buy_now_enabled}
{include file="customer/main/buy_now.tpl"}
{/if}
{/if}
</div>
The extra fields works fine on my product details page so I have used the same code in the products_list.tpl but I can't get the extra fields to appear.
I would really appreciate some help on this.