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

Extra Fields 4.1.x products_t.tpl

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #11  
Old 03-16-2008, 01:50 PM
  davidsaldana's Avatar 
davidsaldana davidsaldana is offline
 

Senior Member
  
Join Date: Oct 2005
Posts: 187
 

Default Re: Extra Fields 4.1.x products_t.tpl

I got this to work in 4.1.9. The only problem is that you are not able to set the order. Its not using the service name nor the order by function. It must just be pulling the info straight from the database in the order it was added. Really need a way to fix this. Anyone have any ideas?

Also, need a way to not show some extra fields. Tried to hardcode, but couldnt get it to work.

-DS
__________________
4.4
Code:
Hello World
Reply With Quote
  #12  
Old 03-16-2008, 03:20 PM
 
Duramax 6.6L Duramax 6.6L is offline
 

X-Adept
  
Join Date: Dec 2006
Posts: 865
 

Default Re: Extra Fields 4.1.x products_t.tpl

When you set up the extra fields, you can select the position of the extra field.

If you number them the way you want, they should show up in that order.
__________________
Xcart 5.1.6 Building New Store
Xcart4.6.4 Gold Plus
Xcart 4.6.4 Platinum
Smart Template,
Mail Chimp Upgrade
Checkout One (One Page Checkout)
Checkout One X-Payments Connector
Checkout One Deluxe Tools
Call For Price
On Sale Module
Buy Together Module
MAP Price MOD
Reply With Quote
  #13  
Old 03-16-2008, 03:45 PM
  davidsaldana's Avatar 
davidsaldana davidsaldana is offline
 

Senior Member
  
Join Date: Oct 2005
Posts: 187
 

Default Re: Extra Fields 4.1.x products_t.tpl

Quote:
Originally Posted by Duramax 6.6L
When you set up the extra fields, you can select the position of the extra field.

If you number them the way you want, they should show up in that order.

This is true, for the product pages, but not for this mod. they are showing up in the order they were entered into the database.

-ds
__________________
4.4
Code:
Hello World
Reply With Quote
  #14  
Old 06-14-2008, 03:03 PM
 
toltion toltion is offline
 

Advanced Member
  
Join Date: Jun 2007
Posts: 39
 

Default Re: Extra Fields 4.1.x products_t.tpl

Just add "ORDER BY $sql_tbl[extra_fields].orderby")" to the end of the SQL query in products.php to use the sort order -

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, $sql_tbl[extra_fields].active as active 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]' ORDER BY $sql_tbl[extra_fields].orderby");
}
}

I also added "$sql_tbl[extra_fields].active as active FROM $sql_tbl[extra_fields]," so I can still specify to show the field value if it's active right on the .tpl.
__________________
X-Cart Gold 4.1.9
Gift Registry/Special Offers
Advanced mini-cart
XC-SEO
Mulltiple Category/Product Templates
Also bought/recently viewed
Feedback reviewer/viewer bundle
Marketing Manager Pro bundle
many more mods
Reply With Quote
  #15  
Old 07-17-2008, 06:34 AM
 
TanyaG TanyaG is offline
 

Advanced Member
  
Join Date: Nov 2007
Posts: 94
 

Default Re: Extra Fields 4.1.x products_t.tpl

Can I use this code for product.tpl (4.1.9)?
Many thanks,
__________________
Tanya

x-cart version: 4.1.7 4.1.9. 4.2
Reply With Quote
  #16  
Old 07-17-2008, 07:28 AM
 
toltion toltion is offline
 

Advanced Member
  
Join Date: Jun 2007
Posts: 39
 

Default Re: Extra Fields 4.1.x products_t.tpl

Product.tpl is already set up to show extra fields, the code is meant for other templates that show products but don't show extra fields (by default).

And the code does work for 4.1.9.

Tony
__________________
X-Cart Gold 4.1.9
Gift Registry/Special Offers
Advanced mini-cart
XC-SEO
Mulltiple Category/Product Templates
Also bought/recently viewed
Feedback reviewer/viewer bundle
Marketing Manager Pro bundle
many more mods
Reply With Quote
  #17  
Old 07-17-2008, 07:36 AM
 
TanyaG TanyaG is offline
 

Advanced Member
  
Join Date: Nov 2007
Posts: 94
 

Default Re: Extra Fields 4.1.x products_t.tpl

Thank you very much Tony. I▓ve placed the code to product.php and product.tpl and all I▓ve got is:
1 : 1
Any ideas what I▓ve done wrong?
Many thanks,
__________________
Tanya

x-cart version: 4.1.7 4.1.9. 4.2
Reply With Quote
  #18  
Old 07-25-2008, 09:42 AM
 
qrichou qrichou is offline
 

Advanced Member
  
Join Date: Oct 2007
Posts: 39
 

Default Re: Extra Fields 4.1.x products_t.tpl

Hi,

I need to get this working in the cart i have added :

#
# Get products Extra field data
#
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]'");
}
}
$smarty->assign("products",$products);

to the cart.php and tried it in the include/cart_procsess.php but it does not show up in the view cart, anyone have any ideas?

Also added {$products[product].extra_fields[1].field}{$products[product].extra_fields[1].value} to the cart.tpl

Many Thanks
Reply With Quote
  #19  
Old 01-26-2009, 08:14 AM
 
ChristineP ChristineP is offline
 

eXpert
  
Join Date: Jul 2008
Posts: 310
 

Default Re: Extra Fields 4.1.x products_t.tpl

Am I understanding that X-Cart included the above code to product.tpl for extra fields? Without adding the above mod, I've tried calling out an extra field in my product.tpl as {$product.extra_fields.6.value}, but it doesn't work. Do you have a suggestion?

Quote:
Originally Posted by toltion
Product.tpl is already set up to show extra fields, the code is meant for other templates that show products but don't show extra fields (by default).

And the code does work for 4.1.9.

Tony
__________________
______________
version 4.1.9 Gold
Reply With Quote
  #20  
Old 01-26-2009, 08:23 AM
 
toltion toltion is offline
 

Advanced Member
  
Join Date: Jun 2007
Posts: 39
 

Default Re: Extra Fields 4.1.x products_t.tpl

Hi Christine,

You need to LOOP through the Extra fields and display the one using an {if} statement -

Code:
{section name=field loop=$extra_fields} {if $extra_fields[6].value ne ""} {$extra_fields[6].value} {/if} {/section}
__________________
X-Cart Gold 4.1.9
Gift Registry/Special Offers
Advanced mini-cart
XC-SEO
Mulltiple Category/Product Templates
Also bought/recently viewed
Feedback reviewer/viewer bundle
Marketing Manager Pro bundle
many more mods
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



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 01:56 AM.

   

 
X-Cart forums © 2001-2020