Beispiel #1
0
 /**
  * Draw one line - rma item
  *
  * @param Enterprise_Rma_Model_Item $item
  * @param Zend_Pdf_Page $page
  */
 protected function _drawRmaItem($item, $page)
 {
     $shift = 0;
     foreach (Mage::helper('core/string')->str_split($item->getProductName(), 40, true, true) as $key => $part) {
         $page->drawText($part, $this->getProductNameX(), $this->y - $shift, 'UTF-8');
         $shift += 10;
     }
     $shift = 0;
     foreach (Mage::helper('core/string')->str_split($item->getProductSku(), 18) as $key => $part) {
         $page->drawText($part, $this->getProductSkuX(), $this->y - $shift, 'UTF-8');
         $shift += 10;
     }
     $condition = Mage::helper('core/string')->str_split($this->_getOptionAttributeStringValue($item->getCondition()), 25);
     $page->drawText($condition[0], $this->getConditionX(), $this->y, 'UTF-8');
     $resolution = Mage::helper('core/string')->str_split($this->_getOptionAttributeStringValue($item->getResolution()), 25);
     $page->drawText($resolution[0], $this->getResolutionX(), $this->y, 'UTF-8');
     $page->drawText(Mage::helper('enterprise_rma')->parseQuantity($item->getQtyRequested(), $item), $this->getQtyRequestedX(), $this->y, 'UTF-8');
     $page->drawText(Mage::helper('enterprise_rma')->getQty($item), $this->getQtyX(), $this->y, 'UTF-8');
     $status = Mage::helper('core/string')->str_split($item->getStatusLabel(), 25);
     $page->drawText($status[0], $this->getStatusX(), $this->y, 'UTF-8');
     $productOptions = $item->getOptions();
     if (is_array($productOptions) && !empty($productOptions)) {
         $this->_drawCustomOptions($productOptions, $page);
     }
     $this->y -= 10;
 }
Beispiel #2
0
 /**
  * Get Qty by status
  *
  * @param Enterprise_Rma_Model_Item $item
  * @return int|float
  */
 public function getQty($item)
 {
     $qty = $item->getQtyRequested();
     if ($item->getQtyApproved() && $item->getStatus() == Enterprise_Rma_Model_Rma_Source_Status::STATE_APPROVED) {
         $qty = $item->getQtyApproved();
     } elseif ($item->getQtyReturned() && ($item->getStatus() == Enterprise_Rma_Model_Rma_Source_Status::STATE_RECEIVED || $item->getStatus() == Enterprise_Rma_Model_Rma_Source_Status::STATE_REJECTED)) {
         $qty = $item->getQtyReturned();
     } elseif ($item->getQtyAuthorized() && $item->getStatus() == Enterprise_Rma_Model_Rma_Source_Status::STATE_AUTHORIZED) {
         $qty = $item->getQtyAuthorized();
     }
     return $this->parseQuantity($qty, $item);
 }
Beispiel #3
0
 /**
  * Add needed data (Product name) to RMA item during create process
  *
  * @param Enterprise_Rma_Model_Item $item
  */
 protected function _populateItemWithProductData($item)
 {
     if ($this->getProductId()) {
         $orderItem = Mage::getModel('sales/order_item')->load($this->getProductId());
         if ($orderItem && $orderItem->getId()) {
             $item->setProductAdminName(Mage::helper('enterprise_rma')->getAdminProductName($orderItem));
         }
     }
 }