I am working an project that has two websites running on a single Magento platform.

One store is set to Romanian language the other is set to Hungarian, both stores sell only in Romania. Everything should be on the websites language, except the PDF invoice, which has to be on Romanian for both websites.

Problems when generating the PDF invoice from the Hungarian store:

  • the dates are displayed according to Hungarian standards: 2016 ápr. 22 instead of the Romanian standard: 22.04.2016. How can I set the format? This is the code from app/code/local/Mage/Sales/Model/Order/Pdf/Invoice.php

    $page->drawText(Mage::helper('sales')->__('Data: ') .
           Mage::helper('core')->formatDate($invoice->getCreatedAt(), 'medium',false), 250, 765, 'UTF-8');
  • The totals are displayed in Hungarian/English, yet I translated everywhere where I could find the totals. I actually need this part to be on Romanian, so how can I separate this from the rest of the totals? This is the code section from app/code/local/Mage/Sales/Model/Order/Pdf/Abstract.php:

     protected function insertTotals($page, $source){
        $order = $source->getOrder();
        $totals = $this->_getTotalsList($source);
        $lineBlock = array(
            'lines'  => array(),
            'height' => 12

    //draw total box $page->setLineColor(new Zend_Pdf_Color_Html('#000000')); $page->setFillColor(new Zend_Pdf_Color_GrayScale(1)); $page->drawRectangle(430, $this->y+16, 570, $this->y -54); $this->y +=5; $page->setFillColor(new Zend_Pdf_Color_GrayScale(0)); $this->_setFontRegular($page, 5); foreach ($totals as $total) { $total->setOrder($order) ->setSource($source); if ($total->canDisplay()) { foreach ($total->getTotalsForDisplay() as $totalData) { $lineBlock['lines'][] = array( array( 'text' => $totalData['label'], 'feed' => 510, 'align' => 'right', 'font_size' => $totalData['font_size'] - 2, 'font' => 'bold' ), array( 'text' => $totalData['amount'], 'feed' => 568, 'align' => 'right', 'font_size' => $totalData['font_size'] , 'font' => 'bold' ), ); } } }</code></pre>

1 Answer 1


Here is the workaround I found: in /app/code/local/Mage/Sales/Model/Order/Pdf/Abstract.php look for the section where the totals are displayed, in my case it looked something like this:

$lineBlock['lines'][] = array(
                        'text'      => $totalData['label'],
                        'feed'      => 510,
                        'align'     => 'right',
                        'font_size' => $totalData['font_size'] - 2,
                        'font'      => 'bold'
                        'text'      => $totalData['amount'],
                        'feed'      => 568,
                        'align'     => 'right',
                        'font_size' => $totalData['font_size'] ,
                        'font'      => 'bold'

Add the following line before this section:

if ($totalData['label']=='text that is displayed'){$totalData['label']='translation';}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.