Jump to content
ivo71

Add $product.short_description to delivery slip pdf

Recommended Posts

Hi,

Can anybody help me with making changes to add the short product description to the delivery slip?
I found in what tpl file to edit it (/pdf/delivery-slip.product-tab.tpl), but I don't know what name of variable to use between the { }  or if the variable $product.short_description has to be defined in another file first?

Thanks.

Share this post


Link to post
Share on other sites

Yes, you need to add product data as well. See the getContent function in the /classes/pdf/HTMLTemplateDeliverySlip.php file. You can see template variables order, order_details, delivery_address and so on there.

Share this post


Link to post
Share on other sites

Would you be able to write the exact coding line to retrieve the short description from the database please?

Thanks.

Share this post


Link to post
Share on other sites

Just add the new field in the getcontent function override

    foreach ($order_details as &$order_detail) {
            $productObj = new Product($order_detail['product_id'], false, Context::getContext()->language->id, Context::getContext()->shop->id);
            $order_detail['product_description'] = $productObj->description;
        }

And then in the .tpl

<p>{$order_detail.product_description}</p>

 

  • Like 1

Share this post


Link to post
Share on other sites

Thanks, the coding works beautifully and even looks great in thedelivery slip, but it shows the full description, not the summary (short description).
Can you please let me know what variables to change to get the short description (summary description field)?

Many thanks for your help.

Share this post


Link to post
Share on other sites

Got it sorted already, just added _short to description and product_description :)

Thanks for all help.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More