Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Extra Fields 4.2.x on Products_list.tpl

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 09-02-2009, 06:53 PM
 
Ordorica Ordorica is offline
 

Member
  
Join Date: May 2009
Posts: 14
 

Default Extra Fields 4.2.x on Products_list.tpl

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.
__________________
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
  #2  
Old 09-06-2009, 11:28 PM
 
lkrivoshiev lkrivoshiev is offline
 

Member
  
Join Date: Mar 2009
Posts: 16
 

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

Hi Ordorica, I had the same problem and QT helped me. Now it works. Anton Sologubov developed this mod. Here is the message:
================================================== ======
I've modified the following files to implement the modification you meant: * home.php * skin2/customer/main/products_list.tpl and looks that it works properly.
================================================== ======
Here I apply my modified files: home.php products_list.tpl

I think is better to extract the needed code. I hope this will help you.



Lyubomir Krivoshiev
www.computer-expert.bg
__________________
X-cart V4.2.3
X-RMA
X-magnifier
BCSE Product importer
...and many others
Reply With Quote

The following user thanks lkrivoshiev for this useful post:
Ordorica (09-07-2009)
  #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
  #4  
Old 05-12-2010, 05:37 PM
 
TheWrongGrape TheWrongGrape is offline
 

Advanced Member
  
Join Date: Nov 2002
Location: Los Angeles, CA
Posts: 68
 

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

Just wanted to add that I tried this and it's not working in 4.3.1.

Edit: Got it working now: http://forum.x-cart.com/showpost.php?p=287479&postcount=10
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 12:57 PM.

   

 
X-Cart forums © 2001-2020