Insert article price in shipment.pdf Magento 1.9

56 Views Asked by At

I am unable to insert the selling price of an item in the shipment pdf

I add

$page->drawText($item->getPrice(), $x + 5, $this->y, 'UTF-8');

However, I do not have the price including VAT but the price excluding VAT How to add the ttc price or the total of the line please?

1

There are 1 best solutions below

1
groutz On

thank for this help.here is the current code : How to adapt it to add the ttc price at the end?

        foreach ($shipment->getItemsCollection() as $item) {
        /**
         * @var Mage_Sales_Model_Order_Shipment_Item $item
         */
        $page->setFillColor(new Zend_Pdf_Color_GrayScale(0.85));
        $page->setLineColor(new Zend_Pdf_Color_GrayScale(0.5));
        $page->setLineWidth(0.5);
        $page->drawRectangle($x + 420, $this->y - 8, $page->getWidth() - 50, $this->y + 12);
        $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
        $page->drawRectangle(50, $this->y - 8, $page->getWidth() - 50, $this->y + 12, Zend_Pdf_Page::SHAPE_DRAW_STROKE);
        $page->drawLine($x + 70, $this->y + 12, $x + 70, $this->y - 8);
        $page->drawLine($x + 350, $this->y + 12, $x + 350, $this->y - 8);
        $page->drawLine($x + 420, $this->y + 12, $x + 420, $this->y - 8);
        $page->drawText($item->getSku(), $x + 5, $this->y, 'UTF-8');
        $page->drawText(strlen($item->getName()) > 50 ? substr($item->getName(), 0, 52) . "..." : $item->getName(), $x + 75, $this->y, 'UTF-8');

        $product = Mage::getModel('catalog/product')->load($item->getProductId());
        if ($product->getId()) {
            $size = $product->getAttributeText('size') ?: $product->getData('size_label');
            $page->drawText($size, $x + 355, $this->y, 'UTF-8');
        }
        $page->drawText('', $x + 425, $this->y, 'UTF-8');
        $this->y -= 20;
    }`**enter code here**`