Hi,
I have created a new custom field (Checkbox) in the product page (dispatch=products.update) and I'm able to edit this field and store the data in the cscart_products table in the database. Also, the value of this field is still visible in I do {fn_print_r($product_data)} in the product page.
Now, I want to edit this value in the Products --> Products (dispatch=products.manage) page. I'm creating the following 2 .tpl files inside my addon's folder on the backend:
/hooks/products/manage_body.post.tpl
/hooks/products/manage_head.post.tpl
and with that i added the the checkbox and the header on each product.
The problem now is that can't change the value of this checkbox now and i think that is because when I do {fn_print_r($product)} inside the manage_body.post.tpl it prints all the product values/fields but not my custom value.
How do I add my custom value in the product array so I can edit it?
Hello
Please show content file /hooks/products/manage_body.post.tpl
Best regards
Robert
That is the content of /hooks/products/manage_body.post.tpl
{include file="buttons/update_for_all.tpl" display=$show_update_for_all object_id='ds_disable_skroutz_xml' name="update_all_vendors[ds_disable_skroutz_xml]"}
{fn_print_r($product)}
Hello
Did you check on database that value from this fiels is save?
Connect in your addon to hook "get_products" and modify the $fields (add your field from database)
fn_set_hook('get_products', $params, $fields, $sortings, $condition, $join, $sorting, $group_by, $lang_code, $having);
Best regards
Robert
Thank you a lot for you replay again.
In the init.php file in my addon, when i register the hook i get "Service Unavailable".
init.php file:
if (!defined(‘BOOTSTRAP’)) { die(‘Access denied’); }
fn_register_hooks(
‘update_product_post’,
‘get_products’
);
I already had the "update_product_post" hook registered so, i just added the "get_products"
I also cleared cache manualy
I found that the error happend because i didn't call the function fn_my_addon_get_products() in the fun.php.
I added it and it seems that works fine.
Problem sloved!
Thank you a lot for your help soft-solid!