short desc in Invoice

hi,

can anyone guide me how to add short description in invoice that goes to customers as an email,

i want product short description to come next to its name

thank you

anyone knows how to do it?

i tried inserting {$product:short_description} in invoices.tpl

but no luck, pls help

guys any help? or comments are appreciated

i really need this

thank you

is it really impossible to achive what i’m looking for?

no replies from anyone :frowning:

Try {$oi.short_description}

hi tbirnseth,

thank u so much for ur reply

i tried what u have suggested but it did not work

Sorry, it should. have you added {debug} to the end of your invoice.tpl file to see what variables are used in your specific situation?

thnk you again

i used {debug} inside invoice.tpl

{oi} variable doesnt have product descitpion array



i found {$prod_descr} but it did not print anything in invoices

Since the descriptions for a product are not part of any order, it is unlikely that you will find an existing variable that has the content you desire.



It would take custom development to add the descriptions to the order product information.

oh ok,

thank you again

do you think you can guide me how to do it?

perhaps some how to do guide, links will help.



btw do i have to modify .php file in order to get the data i’m looking for?

Sorry, the work isn’t hard but the background needed is more than I can post.

thnk you again,

what is the best way to fix problem? how do u propose to go about it?

i’ll appreciate any help regarding the same.

any quick fix? if there is any

rather than tinkering with the code, since my site is live :slight_smile:

First off, it’s not a “fix”. Nothing is broken.



To “enhance” your store to include the description in the email template you will need to capture the description in a controller such as addon/my_changes/controllers/customer/checkout.post.php and pass the info as a variable to the “view” (the template engine). I would get the current “products” variable from the view and then add a “description” element for each product. Then, reassign the variable to the view.



Then you need to modify skins//mail/invoice.tpl to use the variable you created above.

To do this “right”, you should modify the code so that short_description is captured in cscart_order_details.extras. It would then be accessible in the email template via $oi.short_description and remain available if the product was subsequently deleted from the store.



just my 2¢

Glen

@Glen - you are correct. Too bad they don’t provide a hook for exactly this purpose.

I would add a hook to core.fn.cart.php at about line 557 (2.1.2 just above the db_query()) of fn_set_hook(“order_details”, $order_details).



Then in your fn_my_changes_order_details(&$details) you can look up the description(s) and set it/them to whatever you want.

thank you for reply.

this is little tough for me to understand everything you guys have mentioned, my sincere apologies for lack of cs-cart knowledge.

i was trying hooks, taking help from [URL=“http://docs.cs-cart.com/common.php?dispatch=docs/view&node_name=addon-connection”]http://docs.cs-cart.com/common.php?dispatch=docs/view&node_name=addon-connection[/URL]



but then i saw ur post and tried to follow you



@tbirnseth

i did not get this part “fn_my_changes_order_details(&$details)”

got no clue how and where to do it, in which file i shud add this function?



@sixnin9 - thnk u for ur reply…do you think u can point me to the file i need to modify so i can get product short description in cscart_order_details.extras

[quote]

i did not get this part “fn_my_changes_order_details(&$details)”

got no clue how and where to do it, in which file i shud add this function?

[/quote]



There are template hooks and what are more commonly known as controller hooks (or PHP hooks). To do what I disucssed, you would:


  1. Add the following line to core/fn.cart.php at at about line 557.


fn_set_hook('order_details', $order_details);


Just above this line:


db_query("INSERT INTO ?:order_details ?e", $order_details);




2) Put the following line in your addons/my_changes/init.php (if file doesn’t exist, create it)


fn_register_hooks('order_details');




3) Add a function named fn_my_changes_order_details in addons/my_changes/func.php (if file doesn’t exist, create it). The declartion of this function should look like below and I’ve given you and example of how to add an “extra” field:


function fn_my_changes_order_details(&$details) {
$details['extra']['my_new_extra_field'] = "my new extra value";
}


The ‘&’ in the “&$details” is important.

thnk you for ur reply and such a explanatory post

i have followed every steps (all 3) as u have mentioned and then i put {debug} in invoice.tpl

but i couldnt find variable i’m looking for.

i think i made mistake somewhere or i missed further step

do a


file_put_contents("./debug.log", date("r"). "\n". print_r($details['extra'],true), FILE_APPEND);


at the end of your fn_my_changes_order_details(&$details) function. This will at least tell you that the hook is being called and you can verify that the info you want in the extras field is in fact there.

The debug.log file should be in your root directory.