2012/07/30

magento print invoice PDF 繁體中文字型


因為PRINT 中文INVOICE PDF 會出現亂碼...

所以到了WINDOWS內的字型檔案, COPY出標楷體TTF 檔案

其他內置繁體字型可能容量太大而超出MEMORY LIMIT........

app/code/core/Mage/Sales/Model/Order/Pdf/Abstract.php

protected function _setFontRegular($object, $size = 7)
    {
     
         $font = Zend_Pdf_Font::fontWithPath(Mage::getBaseDir() . '/lib/LinLibertineFont/KAIU.TTF',(Zend_Pdf_Font::EMBED_SUPPRESS_EMBED_EXCEPTION |
                                                             Zend_Pdf_Font::EMBED_DONT_COMPRESS));
        $object->setFont($font, $size);
        return $font;
    }


2012/07/10

Mage_Checkout.cvs Click here to print a copy of your order confirmation


Meet the double quotes

Notice that in the example above, both strings are surrounded by double quotes. Both what happens when the string itself has quotes in it. This is for instance the case when the Magento shopping cart is visited, while it contains no items.
The solution is simple: Just use 2 double quotes instead of 1. The translation-line would look like the following:
"Click <a href="/"%s"">here</a> to continue shopping.", "Click <a href="/"%s"">here</a> to go back."