![]() |
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 |
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. |
Re: Extra Fields 4.1.x products_t.tpl
Quote:
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 |
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. |
Re: Extra Fields 4.1.x products_t.tpl
Can I use this code for product.tpl (4.1.9)?
Many thanks, |
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 |
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, |
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 |
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:
|
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} |
All times are GMT -8. The time now is 08:16 PM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.