Example #1
0
 public function getOrderOptions()
 {
     $result = array();
     if ($options = $this->getItem()->getProductOptions()) {
         $startDateLabel = $this->getItem()->getIsVirtual() ? $this->__("Subscription start:") : $this->__("First delivery:");
         if (isset($options['info_buyRequest'])) {
             $periodTypeId = @$options['info_buyRequest']['aw_sarp_subscription_type'];
             $periodStartDate = @$options['info_buyRequest']['aw_sarp_subscription_start'];
             if ($periodTypeId && $periodStartDate) {
                 $result[] = array('label' => $this->__('Subscription type:'), 'value' => Mage::getModel('sarp/period')->load($periodTypeId)->getName());
                 $result[] = array('label' => $startDateLabel, 'value' => $periodStartDate);
             }
         }
         $result = array_merge($result, parent::getOrderOptions());
     }
     return $result;
 }
 protected function _orderedProductDetails($order_id)
 {
     $order = Mage::getModel('sales/order')->load($order_id);
     foreach ($order->getItemsCollection() as $item) {
         $options = $item->getProductOptions();
         if ($item->getProductType() == "downloadable") {
             $obj = new Mage_Downloadable_Block_Adminhtml_Sales_Items_Column_Downloadable_Name();
             foreach ($options['links'] as $links) {
                 $this->_purchased = Mage::getModel('downloadable/link_purchased')->load($order_id, 'order_id');
                 $purchasedItem = Mage::getModel('downloadable/link_purchased_item')->getCollection()->addFieldToFilter('order_item_id', $item->getId());
                 $this->_purchased->setPurchasedItems($purchasedItem);
                 foreach ($this->_purchased->getPurchasedItems() as $_link) {
                     $links_value[] = $_link->getLinkTitle() . '(' . $_link->getNumberOfDownloadsUsed() . ' / ' . ($_link->getNumberOfDownloadsBought() ? $_link->getNumberOfDownloadsBought() : Mage::helper('downloadable')->__('U')) . ')';
                 }
                 $info = array(array('label' => $obj->getLinksTitle(), 'value' => implode(',', $links_value)));
             }
         } else {
             $result = array();
             if ($options = $item->getProductOptions()) {
                 if (isset($options['options'])) {
                     $result = array_merge($result, $options['options']);
                 }
                 if (isset($options['additional_options'])) {
                     $result = array_merge($result, $options['additional_options']);
                 }
                 if (!empty($options['attributes_info'])) {
                     $result = array_merge($options['attributes_info'], $result);
                 }
             }
             $info = array();
             if ($result) {
                 foreach ($result as $_option) {
                     $info[] = array('label' => $_option['label'], 'value' => $_option['value']);
                 }
             }
         }
         $skus = '';
         $product = Mage::getModel('catalog/product')->load($item->getProductId());
         if ($item->getParentItem()) {
             continue;
         }
         if ($_options = $this->_getItemOptions($item)) {
             $skus = $_options;
         }
         $products_detail[] = array('product_id' => $item->getProductId(), 'name' => $item->getName(), 'sku' => $item->getSku(), 'unit_price' => Mage::helper('mobileassistant')->getPrice($item->getOriginalPrice()), 'ordered_qty' => round($item->getQtyOrdered(), 2), 'row_total' => Mage::helper('mobileassistant')->getPrice($item->getRowTotal()), 'options' => $skus ? $skus : '', 'image' => $product->getImage() ? Mage::helper('catalog/image')->init($product, 'image', $product->getImage())->resize(300, 330)->keepAspectRatio(true)->constrainOnly(true)->__toString() : 'N/A', 'attribute_info' => $info ? $info : '');
     }
     return $products_detail;
 }