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)
-   -   Adding Extra Fields to product list page (https://forum.x-cart.com/showthread.php?t=36163)

dpm 12-14-2007 04:02 AM

Adding Extra Fields to product list page
 
Can anyone tell me why I cant add the extra fields code to products_t.tpl

{if $active_modules.Extra_Fields ne ""}
{include file="modules/Extra_Fields/product.tpl"}
{/if}


The code works fine in product.tpl. I checked the if statement and it works. In the "modules/Extra_Fields/product.tpl" template there doesnt seem to be any fields required to make this work.

Any ideas would be greatly appreciated!

-dpm

balinor 12-14-2007 04:18 AM

Re: Adding Extra Fields to product list page
 
Afraid it isn't that easy. Have a look here:

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

dpm 12-14-2007 09:55 AM

Re: Adding Extra Fields to product list page
 
Yikes... This has been an issue sicne 04... It's now 2008... One would think it would be standard by now... =/

Jonjolt1 12-17-2007 06:17 AM

Re: Adding Extra Fields to product list page
 
I'll get you the code to make it work for you, I'm at work now and can't grab it atm.

dpm 12-17-2007 08:58 AM

Re: Adding Extra Fields to product list page
 
Much appreciated! :)

-dpm

Jonjolt1 12-19-2007 04:02 PM

Re: Adding Extra Fields to product list page
 
in products.php
After:
PHP Code:

if (!empty($active_modules["Subscriptions"])) {
    include 
$xcart_dir."/modules/Subscriptions/subscription.php";


Paste this
PHP Code:

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_fields].active='Y' AND $sql_tbl[extra_field_values].productid = '$v[productid]'");
}



This is an example of what I use in skin1/customer/main/products.tpl or products_t.tpl (Whichever you use) after the product description

PHP Code:

<ul class="ProductDescUL">
{foreach 
from=$products[product].extra_fields item="ef"}
{if 
$ef.value ne ''}
<
li class="ProductDescLI"><span class="Bold">{$ef.field}:</span> {$ef.value}</li>
{/if}
{/foreach}
 </
ul


dpm 12-20-2007 05:52 AM

Re: Adding Extra Fields to product list page
 
Thanks mate! Works perfectly.

-dpm

project_digital2 12-20-2007 06:09 AM

Re: Adding Extra Fields to product list page
 
Will this work in the cart.tpl?


All times are GMT -8. The time now is 06:23 AM.

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