2015-08-24 78 views

回答

0

在文件/app/code/core/Mage/Sales/Model/Order/Pdf/abstract.php。編輯以下功能行號577.

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

     foreach ($totals as $total) { 
      $total->setOrder($order) 
       ->setSource($source); 

      if ($total->canDisplay()) { 
       $total->setFontSize(10); 
       foreach ($total->getTotalsForDisplay() as $totalData) { 
         $j = $i+1 ;     




     $lineBlock['lines'][] = array(

         array(
          'text'  => $totalData['label'], 
          'feed'  => 475, 
          'align'  => 'right', 
          'font_size' => $totalData['font_size'], 
          'font'  => 'bold' 
         ), 
         array(
          'text'  => $totalData['amount'], 
          'feed'  => 565, 
          'align'  => 'right', 
          'font_size' => $totalData['font_size'], 
          'font'  => 'bold' 
         ), 
        ); 


        if($totalData['label']=='Subtotal:'){ 
       $abc = preg_replace("/[^0-9,.]/", "", $totalData['amount']);    
       $getval = str_replace(array(','), '' , $abc); 
       $getsubval = ($getval*10)/100; 
       $formattedPrice = Mage::helper('core')->currency($getsubval, true, false); 




         if($j==2){ 

        $lineBlock['lines'][] = array(
         array(
          'text'  => '10% Tax Added', 
          'feed'  => 475, 
          'align'  => 'right', 
          'font_size' => $totalData['font_size'], 
          'font'  => 'bold' 
         ), 
         array(
          'text'  => $formattedPrice, 
          'feed'  => 565, 
          'align'  => 'right', 
          'font_size' => '', 
          'font'  => 'bold' 
         ), 
        ); 
        } 


        } 

       } 
      } 
     } 

     $this->y -= 20; 
     $page = $this->drawLineBlocks($page, array($lineBlock)); 
     return $page; 
    } 

    /** 
    * Parse item description 
    * 
    * @param Varien_Object $item 
    * @return array 
    */ 
    protected function _parseItemDescription($item) 
    { 
     $matches = array(); 
     $description = $item->getDescription(); 
     if (preg_match_all('/<li.*?>(.*?)<\/li>/i', $description, $matches)) { 
      return $matches[1]; 
     } 

     return array($description); 
    } 

    /** 
    * Before getPdf processing 
    */ 
    protected function _beforeGetPdf() { 
     $translate = Mage::getSingleton('core/translate'); 

     $translate->setTranslateInline(false); 
    }