The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Hot answers tagged

29

This an incompatibility issue between PHP Version 5.4.4 and zend Framwork . Fixed it by change in this function lib/Zend/Pdf/FileParserDataSource.php. change abstract public function __construct(); to abstract public function __construct($filePath);


16

Magento in versions before CE 1.9 / EE 1.14 is not compatible with PHP 5.4 out of the box, which causes this error. Anyways, there is an official patch for this.


13

It is pretty simple to change logo from Magento Admin. Goto to the backend of your website: 1) Goto System>>Configuration>>SALES>>Sales 2) Open the tab Invoices and Packing Slip Design and change the logo from there.


5

On the Front page, the print order action will not generate the PDF like Admin does. It will generate the HTML. We should take a look the print layouts under vendor/magento/module-sales/view/frontend/layout. For example: vendor/magento/module-sales/view/frontend/layout/sales_order_print.xml vendor/magento/module-sales/view/frontend/layout/...


3

Try below code in your observer, it'll work for you. public function checkproductinorder($Observer) { $order = $Observer->getEvent()->getOrder(); $items = $order->getAllItems(); $skus = array('600','800'); //product SKUs $skuList = array(); foreach ($items as $item) { if(in_array($item->getSku(), $skus)) { ...


3

To edit the packing list, or any other PDF docs such as invoice you need to override the files contained within Magento\Sales\Model\Order\Pdf For example if wanted to add the price to the packing list <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:...


2

There's a FREE Magento Extension for this: Print Product & Shopping Cart Page


2

There is a rule to add skin/frontend/package/theme/css/print.css. If the file exists in your theme it will automatically be added in your frontend. You could add this file and edit accordingly for print specific styles. Add a button on your productpage with window.print() as action and you are ready to go.


2

Magento invoice pdf design from class Mage_Sales_Model_Order_Pdf_Invoice and Mage_Sales_Model_Order_Pdf_Abstract and Zend PDF.You need customizayion on those classes. atwix has been describe in briefly.Please check at http://www.atwix.com/magento/customize-magento-pdf-invoice-and-packingslip/


2

You need to go on below class and override in local module then update size in setFontRegular method. Firstly, copy app/code/core/Mage/Sales/Model/Order/Pdf/Abstract.phpto app/code/local/Mage/Sales/Model/Order/Pdf/Abstract.phpto prevent overwrites during security upgrades. Then edit: protected function _setFontRegular($object, $size = 10) { $font = ...


2

Pradeep, I don't believe that the template filter system and the {{if}} directive supports operators (==). If you consult the class, Varien_Filter_Template, you would find that the ifDirective parser does not look for expression evaluation in the way you would expect. Specifically, line 248 calls $this->_getVariable, which according to your directive is ...


2

For the remove billing address in Print invoice i think you need to override below file in your custom module. vendor/magento/module-sales/Model/Order/Pdf/AbstractPdf.php And find code of /* Billing Address */ $billingAddress = $this->_formatAddress($this->addressRenderer->format($order->getBillingAddress(), 'pdf'));


2

Try this code public function checkproductinorder($Observer) { $order = $Observer->getEvent()->getOrder(); $items = $order->getAllItems(); $skus = array(); foreach ($items as $item) { if($item->getSku() == '600' || $item->getSku() == '800') { $skus[] = $item->getSku(); } } Mage::...


1

Magento does not have any default feature to print an Order. You could try installing extension. I have used one of the extension for my client, it gives you ability to print single order as well as bulk orders in a Pdf and most important its free ;-) Try installing https://store.fooman.co.nz/magento-extension-print-order-pdf-m2.html . Hope it finds you ...


1

try tp Add your data like this after setting your languages in the above code // --------------------------------------------------------- // set font $pdf->SetFont('times', 'BI', 12); // add a page $pdf->AddPage(); // set some text to print $txt = <<<EOD TCPDF Example 003 Custom page header and footer are defined by extending the TCPDF ...


1

I've manage to add custom attribute warehouse_location to Print on PDF an bellow are the class to overwrite : /vendor/magento/module-sales/Model/Order/Pdf/Items/Invoice/DefaultInvoice.php update draw() Method in my case: // draw Warehouse Location $lines[0][] = [ 'text' => $this->getWarehouseLocation($item), 'feed' => 240, ...


1

It's not only Arabic, but also all other double-byte characters. There is no silver bullet for solving this issue, because Zend Pdf cannot generate PDF without embedding true type font (and Magento uses single byte font by default). I always use my custom extension for changing PDF font file, but it uses overriding _setFont(Regular|Bold|Italic) methods (...


1

In checkout success page, the print link has been already available for register customer by default. In success.phtml file,there is a condition which will only work for logged in customer.


1

In your custom theme, search the xml file which include "em_variation.css" in head. There are many method to include css in header. So change it according to this. <reference name="head"> <action method="addCss"> <stylesheet>path/to_your/em_variation.css</stylesheet> </action> </reference> Or you can used ...


1

Magento uses different template for print view. You may check differences. It is very easy. Go to /app/design/frontend/your_package/your_theme/layout and look in sales.xml Try to compare sales_order_view and sales_order_print sections. For invoices, shipments, creditmemos it will be similar.


1

To me it sounds like a CSS issue, I suggest you look at this post to be able to view the print version of your page in your browser so you can inspect the content element and see if the content is not hidden by a CSS rule https://stackoverflow.com/questions/16105147/see-print-css-in-the-browser


1

The addEMItem is called in the theme layout file. It seems like your theme module rewrites the Html head block. Ensure the addEMItem function is declared in the rewritten block and ensure you don't have any other extension rewriting the same block which would result in a conflict.


1

you can use alternate way to create you own transaction email template with only required information like {{var order.getShippingAddress().format('html')}} {{var order.getShippingDescription()}} etc. you can use below event to send custom email to only your specific email address checkout_onepage_controller_success_action This returns just the ...


1

If all the information you need is already in the same page, then in the printer dialog just input the page number you need to print. For a more automated solution first checkout this extension as it might be what you need: https://github.com/firegento/firegento-pdf or if you want you can override the generation of the order pdf yourself. ...


1

You can add your custom css to print layout handle in a custom layout.xml or the sales.xml for example: <sales_order_print> <reference name="head"> <action method="addItem"><type>skin_css</type><name>css/custom_print.css</name></action> </reference> </sales_order_print>


1

I ended up using the insights supplied here to figure out a solution. I feel that I must mention that I also edited the packing slip template to remove any mention of prices and payment methods (not sure why they'd be on a packing slip anyhow) and we use an extension that allows printing the packing slip before shipping the order (again, I don't understand ...


1

Working with the Zend Pdf library is a nightmare. It is a paid extension but the Fooman Pdf Customiser makes it much easier to manipulate/style the PDF's. It uses the tcpdf library. Edit {{your-theme}}/template/fooman/pdfcustomiser/order/bottom.phtml and add the needed spacing to push to gift message on to a second page. Look for this code: $pdfHelper->...


1

Turned out to be a GIF image with the file name extension renamed to JPEG without the file type actually being converted.


1

For sure the local plugin you installed is the one giving the error. did you try to disable the plugin and then printing the invoice. If this solves it, this gives you a lot better perspective in solving it. Headers already sent mostly i due to code, or errors echoing before the page is generated. Thus multiple headers are send. Please check that first and ...


Only top voted, non community-wiki answers of a minimum length are eligible