public function getItemOptions() { $result = parent::getItemOptions(); $item = Mage::getModel('sales/order_item')->load($this->getItem()->getOrderItemId()); 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], 'print_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' => Mage::helper('giftvoucher')->__('Gift Voucher Code'), 'value' => $codes, 'print_value' => $codes); } return $result; }
public function getItemOptions() { $opts = $this->getItem()->getOrderItem()->getProductOptions(); $options = array(); if (@$opts['info_buyRequest']) { if ($opts['info_buyRequest'] && ($periodTypeId = @$opts['info_buyRequest']['aw_sarp_subscription_type']) && ($periodStartDate = @$opts['info_buyRequest']['aw_sarp_subscription_start'])) { $startDateLabel = $this->getItem()->getOrderItem()->getIsVirtual() ? "Subscription start:" : "First delivery:"; $options[] = array('label' => Mage::helper('sarp')->__('Subscription type:'), 'value' => Mage::getModel('sarp/period')->load($periodTypeId)->getName()); $options[] = array('label' => Mage::helper('sarp')->__($startDateLabel), 'value' => $periodStartDate); } } $options = array_merge($options, parent::getItemOptions()); return $options; }
/** * Draw item line * */ public function draw() { $order = $this->getOrder(); if (!$order->getDcOrderId() || $order->getDeliveryDutyType() == Dutycalculator_Charge_Helper_Data::DC_DELIVERY_TYPE_DDU || $order->getFailedCalculation()) { parent::draw(); } else { $item = $this->getItem(); $pdf = $this->getPdf(); $page = $this->getPage(); $lines = array(); // draw Product name $lines[0] = array(array('text' => Mage::helper('core/string')->str_split($item->getName(), 60, true, true), 'feed' => 35)); // draw SKU $lines[0][] = array('text' => Mage::helper('core/string')->str_split($this->getSku($item), 25), 'feed' => 255); // draw QTY $lines[0][] = array('text' => $item->getQty() * 1, 'feed' => 415); // draw Price $lines[0][] = array('text' => $order->formatPriceTxt($item->getPrice()), 'feed' => 375, 'font' => 'bold', 'align' => 'right'); // draw Tax $lines[0][] = array('text' => $order->formatPriceTxt($item->getTaxAmount() + $item->getSalesTax()), 'feed' => 480, 'font' => 'bold', 'align' => 'right'); $lines[0][] = array('text' => $order->formatPriceTxt($item->getImportDuty()), 'feed' => 520, 'font' => 'bold', 'align' => 'right'); // draw Subtotal $lines[0][] = array('text' => $order->formatPriceTxt($item->getRowTotal()), 'feed' => 565, 'font' => 'bold', 'align' => 'right'); // custom options $options = $this->getItemOptions(); if ($options) { foreach ($options as $option) { // draw options label $lines[][] = array('text' => Mage::helper('core/string')->str_split(strip_tags($option['label']), 70, true, true), 'font' => 'italic', 'feed' => 35); if ($option['value']) { $_printValue = isset($option['print_value']) ? $option['print_value'] : strip_tags($option['value']); $values = explode(', ', $_printValue); foreach ($values as $value) { $lines[][] = array('text' => Mage::helper('core/string')->str_split($value, 50, true, true), 'feed' => 40); } } } } $lineBlock = array('lines' => $lines, 'height' => 10); $page = $pdf->drawLineBlocks($page, array($lineBlock), array('table_header' => true)); $this->setPage($page); } }
public function getItemOptions() { $result = parent::getItemOptions(); $result = Mage::helper('aitcg/options')->replaceAitTemplateWithText($result); return $result; }