X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Extra Fields 4.1.x products_t.tpl (https://forum.x-cart.com/showthread.php?t=25143)

davidsaldana 03-16-2008 01:50 PM

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

Duramax 6.6L 03-16-2008 03:20 PM

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.

davidsaldana 03-16-2008 03:45 PM

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

toltion 06-14-2008 03:03 PM

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.

TanyaG 07-17-2008 06:34 AM

Re: Extra Fields 4.1.x products_t.tpl
 
Can I use this code for product.tpl (4.1.9)?
Many thanks,

toltion 07-17-2008 07:28 AM

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

TanyaG 07-17-2008 07:36 AM

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,

qrichou 07-25-2008 09:42 AM

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

ChristineP 01-26-2009 08:14 AM

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


toltion 01-26-2009 08:23 AM

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}



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.