Smarty Variables On Checkout Complete

Hello

I try to write code for a loop on checkout complete. My code at the moment is:

1. Product ID is ok.
2. Price is ok.
3. Quantity is ok
4. Category isnt ok. I need to show category id of each product but i cant. Any idea?
5. Payout istnt ok. I need to show number based on category ID.
Any help is more than welcome
Thanks

What do you mean by "ok" and "not ok"? Can you please post here raw output of your code?

ok means that is ok and i dont need to change anything.

Here is output:

test("addItem", {
id: "63544"
,price: "40.22"
,quantity: "1"
,category: ""
,payout: "1"
});
test("addItem", {
id: "58856"
,price: "0.63"
,quantity: "6"
,category: ""
,payout: "1"
});

Consider dumping the contents of $product variable in the foreach cycle: {$product|fn_print_r}, so you'll be able to view its internal structure.

Already did this but hasnt info that i need:

[item_id] => 3001273677
[order_id] => 67068
[product_id] => 63544
[product_code] => V32517
[price] => 40.22
[amount] => 1
[extra] => Array
(
[product_options] => Array
(
)
[unlimited_download] => N
[no_installments_nbgdatacash] => N
[no_installments] => N
[product] => Canon Pixma iP2850 Color Inkjet Printer 8745B006AA
[company_id] => 1
[is_edp] => N
[edp_shipping] => N
[discount] => 0
[base_price] => 40.22
[stored_price] => N
)
[product] => Canon Pixma iP2850 Color Inkjet Printer 8745B006AA
[product_status] => A
[deleted_product] =>
[discount] => 0
[company_id] => 1
[base_price] => 40.22
[original_price] => 40.22
[cart_id] => 3001273677
[tax_value] => 0
[subtotal] => 40.22
[display_subtotal] => 40.22
[shipped_amount] => 0
[shipment_amount] => 1
[is_accessible] => 1
[shared_product] => 1

Update:

Price is ok with this smarty:

price: {math equation="x / y" x=$product.price y=1.24 format="%.2f"}

Try to use:

{$_pdata = $product.product_id|fn_get_product_data:$auth}
....
category: "{$_pdata.main_category|fn_get_category_name}"

Not sure what do you mean by payout

ecom thanks

i can see now category name but not id.

Category ID is in $_pdata.main_category

i tried this:

category: "{$_pdata.main_category.category_id}"

but doesnt work

Please try

...
,category:"{$_pdata.main_category}"
...

The final code should be:

{$_pdata = $product.product_id|fn_get_product_data:$auth}
....
category: "{$_pdata.main_category}"