Jump to content

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.

Link to comment
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 2
Link to comment
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.

Link to comment
Share on other sites

  • 7 months later...
  • 1 year later...
  • 8 months later...

Quick question I managed to add the short description on the delivery slip. We also want to sort the product using the data in the short description.

This is done in /classes/order/OrderInvoice.php with the following code:

 public function getProductsDetail()
    {
        return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
        SELECT *
        FROM `' . _DB_PREFIX_ . 'order_detail` od
        LEFT JOIN `' . _DB_PREFIX_ . 'product` p
        ON p.id_product = od.product_id
        LEFT JOIN `' . _DB_PREFIX_ . 'product_shop` ps ON (ps.id_product = p.id_product AND ps.id_shop = od.id_shop)
        WHERE od.`id_order` = ' . (int) $this->id_order . '
        ' . ($this->id && $this->number ? ' AND od.`id_order_invoice` = ' . (int) $this->id : '') . ' ORDER BY od.`product_reference`');
    }

The short description information is located in ps_product_lang database. Does someone know how to change the query above?
Thanks!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...