示例#1
0
 public function getItemOptions()
 {
     $result = parent::getItemOptions();
     $item = $this->getOrderItem();
     if ($item->getProductType() != 'giftvoucher') {
         return $result;
     }
     if ($options = $item->getProductOptionByCode('info_buyRequest')) {
         foreach (Mage::helper('giftvoucher')->getGiftVoucherOptions() as $code => $label) {
             if ($options[$code]) {
                 $result[] = array('label' => $label, 'value' => $options[$code], 'option_value' => $options[$code]);
             }
         }
     }
     $giftVouchers = Mage::getModel('giftvoucher/giftvoucher')->getCollection()->addItemFilter($item->getId());
     if ($giftVouchers->getSize()) {
         $giftVouchersCode = array();
         foreach ($giftVouchers as $giftVoucher) {
             $currency = Mage::getModel('directory/currency')->load($giftVoucher->getCurrency());
             $balance = $giftVoucher->getBalance();
             if ($currency) {
                 $balance = $currency->format($balance, array(), false);
             }
             $giftVouchersCode[] = $giftVoucher->getGiftCode() . ' (' . $balance . ') ';
         }
         $codes = implode(' ', $giftVouchersCode);
         $result[] = array('label' => $this->__('Gift Voucher Code'), 'value' => $codes, 'option_value' => $codes);
     }
     return $result;
 }
示例#2
0
 /**
  * Prepare item html
  *
  * This method uses renderer for real product type
  *
  * @return string
  */
 protected function _toHtml()
 {
     if ($this->getItem()->getOrderItem()) {
         $item = $this->getItem()->getOrderItem();
     } else {
         $item = $this->getItem();
     }
     if ($productType = $item->getRealProductType()) {
         $renderer = $this->getRenderedBlock()->getItemRenderer($productType);
         $renderer->setItem($this->getItem());
         return $renderer->toHtml();
     }
     return parent::_toHtml();
 }
示例#3
0
 public function getItemOptions()
 {
     $result = parent::getItemOptions();
     $giftCardValue = '';
     $giftCardCollection = Mage::getModel('giftcard/giftcard')->getCollection()->addFieldToFilter('order_item_id', $this->getItem()->getOrderItemId());
     if ($giftCardCollection->count() > 0) {
         foreach ($giftCardCollection as $giftCard) {
             $giftCardValue .= $giftCard->getCode() . '<br/>';
         }
         $options = array(array('label' => Mage::helper('giftcard')->__('Gift Card'), 'value' => $giftCardValue));
         $result = array_merge($result, $options);
     }
     return $result;
 }
示例#4
0
 public function getItemOptions()
 {
     $result = parent::getItemOptions();
     if ($this->getItem()->getProductType() == MT_Giftcard_Model_Catalog_Product_Type::TYPE_GIFTCARD_PRODUCT) {
         $giftCardValue = '';
         $giftCardCollection = Mage::getModel('giftcard/giftcard')->getCollection()->addFieldToFilter('order_item_id', $this->getItem()->getId());
         if ($giftCardCollection->count() > 0) {
             foreach ($giftCardCollection as $giftCard) {
                 $giftCardValue .= $giftCard->getCode() . ' (' . Mage::helper('giftcard')->__($giftCard->getStatus()) . ')' . "\n";
             }
             $options = array(array('label' => Mage::helper('giftcard')->__('Gift Card'), 'value' => $giftCardValue));
             $result = array_merge($result, $options);
         }
     }
     return $result;
 }
示例#5
0
文件: Giftcard.php 项目: ahsanmage/vr
 public function getItemOptions()
 {
     $result = parent::getItemOptions();
     $giftCardValue = '';
     $giftCardCollection = Mage::getModel('giftcard/giftcard')->getCollection()->addFieldToFilter('order_item_id', $this->getItem()->getId());
     if ($giftCardCollection->count() > 0) {
         foreach ($giftCardCollection as $giftCard) {
             $giftCardValue .= $giftCard->getCode() . '(' . Mage::helper('giftcard')->__($giftCard->getStatus()) . ')<br/>';
         }
         $options = array(array('label' => Mage::helper('giftcard')->__('Gift Card'), 'value' => $giftCardValue));
         if ($giftCard->getStatus() == MT_Giftcard_Model_Giftcard::STATUS_PENDING) {
             $options[] = array('label' => Mage::helper('giftcard')->__('Note'), 'value' => Mage::helper('giftcard')->__('Please pay for gift card. After this, your gift cards will be active.'));
         }
         $result = array_merge($result, $options);
     }
     return $result;
 }
示例#6
0
 /**
  * Return gift card and custom options array
  *
  * @return array
  */
 public function getItemOptions()
 {
     return array_merge($this->_getGiftcardOptions(), parent::getItemOptions());
 }
示例#7
0
 /**
  * Rewrite needs for option format converting.
  *
  * @param mixed $optionValue
  * @return array
  */
 public function getFormatedOptionValue($optionValue)
 {
     $optionValue = $this->_getConvertedOptionValue($optionValue);
     return parent::getFormatedOptionValue($optionValue);
 }