当前位置: 首页>>代码示例>>PHP>>正文


PHP Mage_Sales_Model_Order_Shipment::getAllItems方法代码示例

本文整理汇总了PHP中Mage_Sales_Model_Order_Shipment::getAllItems方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Order_Shipment::getAllItems方法的具体用法?PHP Mage_Sales_Model_Order_Shipment::getAllItems怎么用?PHP Mage_Sales_Model_Order_Shipment::getAllItems使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mage_Sales_Model_Order_Shipment的用法示例。


在下文中一共展示了Mage_Sales_Model_Order_Shipment::getAllItems方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: processOrder

 private function processOrder(Ess_M2ePro_Model_Order $order, Mage_Sales_Model_Order_Shipment $shipment, array $trackingDetails = array())
 {
     if ($order->isSingle() || !$order->isComponentModeEbay() || count($shipment->getAllItems()) != 1) {
         return $order->getChildObject()->updateShippingStatus($trackingDetails);
     }
     // combined eBay orders only
     $shipmentItems = $shipment->getAllItems();
     $shipmentItem = reset($shipmentItems);
     /** @var $shipmentItem Mage_Sales_Model_Order_Shipment_Item */
     $additionalData = $shipmentItem->getOrderItem()->getAdditionalData();
     $additionalData = is_string($additionalData) ? @unserialize($additionalData) : array();
     if (empty($additionalData['ebay_item_id']) || empty($additionalData['ebay_transaction_id'])) {
         return $order->getChildObject()->updateShippingStatus($trackingDetails);
     }
     $itemToShip = null;
     foreach ($order->getItemsCollection()->getItems() as $item) {
         /** @var $item Ess_M2ePro_Model_Order_Item */
         if ($item->getChildObject()->getItemId() == $additionalData['ebay_item_id'] || $item->getChildObject()->getTransactionId() == $additionalData['ebay_transaction_id']) {
             $itemToShip = $item;
             break;
         }
     }
     if (is_null($itemToShip)) {
         return $order->getChildObject()->updateShippingStatus($trackingDetails);
     }
     $params = array();
     if (count($trackingDetails) > 0) {
         $params['tracking_number'] = $trackingDetails['tracking_number'];
         $params['carrier_code'] = Mage::helper('M2ePro/Component_Ebay')->getCarrierTitle($trackingDetails['carrier_code'], $trackingDetails['carrier_title']);
     }
     /** @var $dispatcher Ess_M2ePro_Model_Connector_Server_Ebay_OrderItem_Dispatcher */
     $dispatcher = Mage::getModel('M2ePro/Connector_Server_Ebay_OrderItem_Dispatcher');
     $action = Ess_M2ePro_Model_Connector_Server_Ebay_OrderItem_Dispatcher::ACTION_UPDATE_STATUS;
     return $dispatcher->process($action, $itemToShip, $params);
 }
开发者ID:xiaoguizhidao,项目名称:beut,代码行数:35,代码来源:Shipment.php

示例2: getShipmentWeight

 public function getShipmentWeight(Mage_Sales_Model_Order_Shipment $shipment)
 {
     $shipmentWeight = 0;
     foreach ($shipment->getAllItems() as $item) {
         $shipmentWeight += $item->getWeight() * $item->getQty();
     }
     return $shipmentWeight;
 }
开发者ID:GabrielCC,项目名称:zitec-dpd-master,代码行数:8,代码来源:Data.php

示例3: getItemsToShip

 private function getItemsToShip(Ess_M2ePro_Model_Order $order, Mage_Sales_Model_Order_Shipment $shipment)
 {
     $productTypesNotAllowedByDefault = array(Mage_Catalog_Model_Product_Type::TYPE_BUNDLE, Mage_Catalog_Model_Product_Type::TYPE_GROUPED);
     $items = array();
     $allowedItems = array();
     foreach ($shipment->getAllItems() as $shipmentItem) {
         /** @var $shipmentItem Mage_Sales_Model_Order_Shipment_Item */
         $orderItem = $shipmentItem->getOrderItem();
         $parentOrderItemId = $orderItem->getParentItemId();
         if (!is_null($parentOrderItemId)) {
             !in_array($parentOrderItemId, $allowedItems) && ($allowedItems[] = $parentOrderItemId);
             continue;
         }
         if (!in_array($orderItem->getProductType(), $productTypesNotAllowedByDefault)) {
             $allowedItems[] = $orderItem->getId();
         }
         $additionalData = $orderItem->getAdditionalData();
         $additionalData = is_string($additionalData) ? @unserialize($additionalData) : array();
         $itemId = $transactionId = null;
         $orderItemDataIdentifier = Ess_M2ePro_Helper_Data::CUSTOM_IDENTIFIER;
         if (isset($additionalData['ebay_item_id']) && isset($additionalData['ebay_transaction_id'])) {
             // backward compatibility with versions 5.0.4 or less
             $itemId = $additionalData['ebay_item_id'];
             $transactionId = $additionalData['ebay_transaction_id'];
         } elseif (isset($additionalData[$orderItemDataIdentifier]['items'])) {
             if (!is_array($additionalData[$orderItemDataIdentifier]['items']) || count($additionalData[$orderItemDataIdentifier]['items']) != 1) {
                 return null;
             }
             if (isset($additionalData[$orderItemDataIdentifier]['items'][0]['item_id'])) {
                 $itemId = $additionalData[$orderItemDataIdentifier]['items'][0]['item_id'];
             }
             if (isset($additionalData[$orderItemDataIdentifier]['items'][0]['transaction_id'])) {
                 $transactionId = $additionalData[$orderItemDataIdentifier]['items'][0]['transaction_id'];
             }
         }
         if (is_null($itemId) || is_null($transactionId)) {
             continue;
         }
         $item = Mage::helper('M2ePro/Component_Ebay')->getCollection('Order_Item')->addFieldToFilter('order_id', $order->getId())->addFieldToFilter('item_id', $itemId)->addFieldToFilter('transaction_id', $transactionId)->getFirstItem();
         if (!$item->getId()) {
             continue;
         }
         $items[$orderItem->getId()] = $item;
     }
     $resultItems = array();
     foreach ($items as $orderItemId => $item) {
         if (!in_array($orderItemId, $allowedItems)) {
             continue;
         }
         $resultItems[] = $item;
     }
     return $resultItems;
 }
开发者ID:newedge-media,项目名称:iwantmymeds,代码行数:53,代码来源:Handler.php

示例4: getItemsToShip

 /**
  * @param Ess_M2ePro_Model_Order          $order
  * @param Mage_Sales_Model_Order_Shipment $shipment
  *
  * @return Ess_M2ePro_Model_Order_Item[]
  */
 private function getItemsToShip(Ess_M2ePro_Model_Order $order, Mage_Sales_Model_Order_Shipment $shipment)
 {
     $shipmentItems = $shipment->getAllItems();
     $orderItemDataIdentifier = Ess_M2ePro_Helper_Data::CUSTOM_IDENTIFIER;
     $items = array();
     foreach ($shipmentItems as $shipmentItem) {
         $additionalData = $shipmentItem->getOrderItem()->getAdditionalData();
         $additionalData = is_string($additionalData) ? @unserialize($additionalData) : array();
         if (!isset($additionalData[$orderItemDataIdentifier]['items'][0]['order_item_id'])) {
             continue;
         }
         $id = $additionalData[$orderItemDataIdentifier]['items'][0]['order_item_id'];
         $item = $order->getItemsCollection()->getItemByColumnValue('play_order_item_id', $id);
         if (is_null($item)) {
             continue;
         }
         $items[] = $item;
     }
     return $items;
 }
开发者ID:ppkowalski,项目名称:M2E,代码行数:26,代码来源:Handler.php

示例5: getItemToShip

 /**
  * @param Ess_M2ePro_Model_Order          $order
  * @param Mage_Sales_Model_Order_Shipment $shipment
  *
  * @return null|Ess_M2ePro_Model_Order_Item
  */
 private function getItemToShip(Ess_M2ePro_Model_Order $order, Mage_Sales_Model_Order_Shipment $shipment)
 {
     if ($order->isSingle()) {
         return null;
     }
     $shipmentItems = $shipment->getAllItems();
     if (count($shipmentItems) != 1) {
         return null;
     }
     /** @var $shipmentItem Mage_Sales_Model_Order_Shipment_Item */
     $shipmentItem = reset($shipmentItems);
     $additionalData = $shipmentItem->getOrderItem()->getAdditionalData();
     $additionalData = is_string($additionalData) ? @unserialize($additionalData) : array();
     $itemId = $transactionId = null;
     $orderItemDataIdentifier = Ess_M2ePro_Helper_Data::CUSTOM_IDENTIFIER;
     if (isset($additionalData['ebay_item_id']) && isset($additionalData['ebay_transaction_id'])) {
         // backward compatibility with versions 5.0.4 or less
         $itemId = $additionalData['ebay_item_id'];
         $transactionId = $additionalData['ebay_transaction_id'];
     } elseif (isset($additionalData[$orderItemDataIdentifier]['items'])) {
         if (!is_array($additionalData[$orderItemDataIdentifier]['items']) || count($additionalData[$orderItemDataIdentifier]['items']) != 1) {
             return null;
         }
         if (isset($additionalData[$orderItemDataIdentifier]['items'][0]['item_id'])) {
             $itemId = $additionalData[$orderItemDataIdentifier]['items'][0]['item_id'];
         }
         if (isset($additionalData[$orderItemDataIdentifier]['items'][0]['transaction_id'])) {
             $transactionId = $additionalData[$orderItemDataIdentifier]['items'][0]['transaction_id'];
         }
     }
     if (is_null($itemId) || is_null($transactionId)) {
         return null;
     }
     $item = Mage::helper('M2ePro/Component_Ebay')->getCollection('Order_Item')->addFieldToFilter('order_id', $order->getId())->addFieldToFilter('item_id', $itemId)->addFieldToFilter('transaction_id', $transactionId)->getFirstItem();
     return $item->getId() ? $item : null;
 }
开发者ID:technomagegithub,项目名称:magento,代码行数:42,代码来源:Handler.php

示例6: getItemsToShip

 /**
  * @param Ess_M2ePro_Model_Order          $order
  * @param Mage_Sales_Model_Order_Shipment $shipment
  *
  * @throws LogicException
  *
  * @return array
  */
 private function getItemsToShip(Ess_M2ePro_Model_Order $order, Mage_Sales_Model_Order_Shipment $shipment)
 {
     $shipmentItems = $shipment->getAllItems();
     $orderItemDataIdentifier = Ess_M2ePro_Helper_Data::CUSTOM_IDENTIFIER;
     $items = array();
     foreach ($shipmentItems as $shipmentItem) {
         $additionalData = $shipmentItem->getOrderItem()->getAdditionalData();
         $additionalData = is_string($additionalData) ? @unserialize($additionalData) : array();
         if (!isset($additionalData[$orderItemDataIdentifier]['items'])) {
             continue;
         }
         if (!is_array($additionalData[$orderItemDataIdentifier]['items'])) {
             continue;
         }
         $qtyAvailable = (int) $shipmentItem->getQty();
         foreach ($additionalData[$orderItemDataIdentifier]['items'] as $data) {
             if ($qtyAvailable <= 0) {
                 continue;
             }
             if (!isset($data['order_item_id'])) {
                 continue;
             }
             $item = $order->getItemsCollection()->getItemByColumnValue('amazon_order_item_id', $data['order_item_id']);
             if (is_null($item)) {
                 continue;
             }
             $qty = $item->getChildObject()->getQtyPurchased();
             if ($qty > $qtyAvailable) {
                 $qty = $qtyAvailable;
             }
             $items[] = array('qty' => $qty, 'amazon_order_item_id' => $data['order_item_id']);
             $qtyAvailable -= $qty;
         }
     }
     return $items;
 }
开发者ID:newedge-media,项目名称:iwantmymeds,代码行数:44,代码来源:Handler.php

示例7: generateDocuments

 public static function generateDocuments(Mage_Sales_Model_Order_Shipment $shipment)
 {
     $result = array();
     if ($shipment->getDcOrderId() && Mage::getStoreConfig('dc_charge_extension/dccharge/create-documents')) {
         $helper = Mage::helper('dccharge');
         $params = array();
         $params['calculation_id'] = $shipment->getDcOrderId();
         $params['output_currency'] = $shipment->getOrder()->getOrderCurrencyCode();
         $params['seller_first_name'] = Mage::getStoreConfig('dc_charge_extension/dccharge/seller-first-name');
         $params['seller_last_name'] = Mage::getStoreConfig('dc_charge_extension/dccharge/seller-last-name');
         $params['seller_country'] = Mage::getStoreConfig('dc_charge_extension/dccharge/seller-country');
         $params['seller_address_line_1'] = Mage::getStoreConfig('dc_charge_extension/dccharge/seller-address-line');
         $params['seller_city'] = Mage::getStoreConfig('dc_charge_extension/dccharge/seller-city');
         $params['seller_zip'] = Mage::getStoreConfig('dc_charge_extension/dccharge/seller-postcode');
         $params['seller_phone'] = Mage::getStoreConfig('dc_charge_extension/dccharge/seller-phone');
         $params['shipment_invoice_no'] = $shipment->getIncrementId();
         $params['shipment_date'] = $shipment->getCreatedAt();
         $params['shipment_number_parcels'] = 1;
         $params['shipment_total_actual_weight'] = 0;
         foreach ($shipment->getAllItems() as $item) {
             $orderItem = $item->getOrderItem();
             $product = Mage::getModel('catalog/product')->load($orderItem->getProductId());
             if ($orderItem->getParentItemId() || !$orderItem->getQuoteItemId() || $product->isVirtual()) {
                 continue;
             }
             $itemWeightInKG = 0;
             if ($item->getWeight()) {
                 $weigthUnit = Mage::getStoreConfig('dc_charge_extension/dccharge/weight-unit');
                 $weight = Mage::getStoreConfig('dc_charge_extension/dccharge/allow-override-products-weight') ? Mage::getStoreConfig('dc_charge_extension/dccharge/overridden-products-weight') : $item->getWeight();
                 if ($weigthUnit == 'lb') {
                     $itemWeightInKG = round($weight * 0.45359237, 2);
                 } else {
                     $itemWeightInKG = $weight;
                 }
             }
             $params['shipment_total_actual_weight'] += $itemWeightInKG * $item->getQty();
         }
         $params['shipment_currency_sale'] = $shipment->getOrder()->getOrderCurrencyCode();
         if ($shipment->getDeliveryDutyType() == Dutycalculator_Charge_Helper_Data::DC_DELIVERY_TYPE_DDP) {
             $params['shipment_incoterms'] = 'DDP';
         } elseif ($shipment->getDeliveryDutyType() == Dutycalculator_Charge_Helper_Data::DC_DELIVERY_TYPE_DDU) {
             $params['shipment_incoterms'] = 'DAP';
         } else {
             $params['shipment_incoterms'] = '';
         }
         $shippingAddress = $shipment->getShippingAddress();
         $billingAddress = $shipment->getBillingAddress();
         $params['shipto_first_name'] = $shippingAddress->getFirstname();
         $params['shipto_last_name'] = $shippingAddress->getLastname();
         $params['shipto_address_line_1'] = $shippingAddress->getStreet(-1);
         $params['shipto_city'] = $shippingAddress->getCity();
         $params['shipto_zip'] = $shippingAddress->getPostcode();
         $params['shipto_country'] = $shippingAddress->getCountryId();
         $params['shipto_phone'] = $shippingAddress->getTelephone();
         $params['soldto_first_name'] = $billingAddress->getFirstname();
         $params['soldto_last_name'] = $billingAddress->getLastname();
         $params['soldto_address_line_1'] = $billingAddress->getStreet(-1);
         $params['soldto_city'] = $billingAddress->getCity();
         $params['soldto_zip'] = $billingAddress->getPostcode();
         $params['soldto_country'] = $billingAddress->getCountryId();
         $params['soldto_phone'] = $billingAddress->getTelephone();
         $params['print_first_name'] = Mage::getStoreConfig('dc_charge_extension/dccharge/seller-first-name');
         $params['print_last_name'] = Mage::getStoreConfig('dc_charge_extension/dccharge/seller-last-name');
         $params['print_date'] = date('Y-m-d');
         $rawXml = $helper->sendRequest('documents', $params);
         try {
             if (stripos($rawXml, '<?xml') === false) {
                 throw new Exception($rawXml);
             }
             $answer = new SimpleXMLElement($rawXml);
             $commercialInvoice = current($answer->xpath('commercial-invoice'));
             $packingList = current($answer->xpath('packing-list'));
             $result['commercial_invoice_url'] = (string) $commercialInvoice->url;
             $result['packing_list_url'] = (string) $packingList->url;
         } catch (Exception $ex) {
             Mage::logException($ex);
         }
     }
     return $result;
 }
开发者ID:Fishead-Communications,项目名称:dutycalculator_charge_import_duty,代码行数:80,代码来源:Importdutytaxes.php

示例8: confirmShipment

 /**
  * Confirm crating of shipment
  *
  * @param Mage_Sales_Model_Order_Shipment $shipment
  * @return Mage_AmazonPayments_Model_Api_Cba
  */
 public function confirmShipment($shipment)
 {
     $items = array();
     foreach ($shipment->getAllItems() as $item) {
         /* @var $item Mage_Sales_Model_Order_Shipment_Item */
         if ($item->getOrderItem()->getParentItemId()) {
             continue;
         }
         $items[] = array('id' => $item->getOrderItem()->getExtOrderItemId(), 'qty' => $item->getQty());
     }
     $carrierName = '';
     $shippingMethod = '';
     $trackNumber = '';
     /**
      * Magento track numbers is not connected with items.
      * Get only first track number
      */
     foreach ($shipment->getAllTracks() as $track) {
         $carrierName = $track->getTitle();
         $trackNumber = $track->getNumber();
         break;
     }
     if (preg_match("/\\((.+)\\)/", $shipment->getOrder()->getShippingDescription(), $_result)) {
         $shippingMethod = $_result[1];
     }
     $this->getDocumentApi()->confirmShipment($shipment->getOrder()->getExtOrderId(), $carrierName, $shippingMethod, $items, $trackNumber);
     $shipment->addComment(Mage::helper('amazonpayments')->__('Shipment was created with Checkout by Amazon.'));
     return $this;
 }
开发者ID:jauderho,项目名称:magento-mirror,代码行数:35,代码来源:Cba.php

示例9: buildMap

 /**
  * @param Mage_Sales_Model_Order_Shipment $shipment
  * @return array
  */
 public function buildMap(Mage_Sales_Model_Order_Shipment $shipment)
 {
     $map = array('packingslip_id_label' => $this->getSalesHelper()->__('Packingslip # '), 'order_id_label' => $this->getSalesHelper()->__('Order # '), 'order_date_label' => $this->getSalesHelper()->__('Order Date: '), 'billing_address_label' => $this->getSalesHelper()->__('Sold to:'), 'shipping_address_label' => $this->getSalesHelper()->__('Ship to:'), 'payment_method_label' => $this->getSalesHelper()->__('Payment Method:'), 'shipping_method_label' => $this->getSalesHelper()->__('Shipping Method:'), 'products_qty_label' => $this->getSalesHelper()->__('Qty'), 'products_label' => $this->getSalesHelper()->__('Products'), 'products_sku_label' => $this->getSalesHelper()->__('SKU'));
     $order = $shipment->getOrder();
     $billingAddress = $order->getBillingAddress();
     $map['packingslip_id'] = $shipment->getIncrementId();
     $map['order_id'] = Mage::getStoreConfigFlag(Mage_Sales_Model_Order_Pdf_Shipment::XML_PATH_SALES_PDF_SHIPMENT_PUT_ORDER_ID, $order->getStoreId()) ? $order->getRealOrderId() : 'N/A';
     $map['order_date'] = $this->getCoreHelper()->formatDate($order->getCreatedAtStoreDate(), 'medium', false);
     $map['billing_name'] = $billingAddress->getFirstname() . ' ' . $billingAddress->getLastname();
     $map['billing_street'] = $billingAddress->getStreetFull();
     $map['billing_city'] = $billingAddress->getCity();
     $map['billing_zip'] = $billingAddress->getPostcode();
     $map['billing_country'] = $billingAddress->getCountryModel()->getIso2Code();
     $map['billing_phone'] = $billingAddress->getTelephone();
     $shippingAddress = $order->getShippingAddress();
     $map['shipping_name'] = $shippingAddress->getFirstname() . ' ' . $shippingAddress->getLastname();
     $map['shipping_street'] = $shippingAddress->getStreetFull();
     $map['shipping_city'] = $shippingAddress->getCity();
     $map['shipping_zip'] = $shippingAddress->getPostcode();
     $map['shipping_country'] = $shippingAddress->getCountry();
     $map['shipping_phone'] = $shippingAddress->getTelephone();
     $map['payment_method'] = $paymentInfo = $this->getPaymentHelper()->getInfoBlock($order->getPayment())->setIsSecureMode(true)->toHtml();
     $map['shipping_method'] = $order->getShippingDescription();
     $map['shipping_charges'] = '(' . $this->getSalesHelper()->__('Total Shipping Charges') . ' ' . $order->formatPriceTxt($order->getShippingAmount()) . ')';
     $map['products_data'] = '';
     foreach ($shipment->getAllItems() as $item) {
         if ($item->getOrderItem()->getParentItem()) {
             continue;
         }
         $map['products_data'] .= $this->drawItem($item, $order);
     }
     return $map;
 }
开发者ID:swisspost-yellowcube,项目名称:magento-yellowcube,代码行数:37,代码来源:Shipment.php

示例10: _prepareItems

 /**
  * prepare item information 
  * 
  * @param Mage_Sales_Model_Order_Shipment $mOrderShipment 
  */
 private function _prepareItems($mOrderShipment)
 {
     $key = 0;
     $aOrderItem['nfe.total']['nfe.ICMSTot']['nfe.vProd'] = '0';
     $aOrderItem['nfe.total']['nfe.ICMSTot']['nfe.vNF'] = '0';
     /**
      * assign shipping values to items 
      */
     $nItems = count($mOrderShipment->getOrder()->getAllItems());
     if ($mOrderShipment->getOrder()->getShippingAmount()) {
         $vFrete = (string) number_format($mOrderShipment->getOrder()->getShippingAmount(), 2, '.', '');
         $vFreteParcial = number_format($vFrete / $nItems, 2, '.', '');
         for ($i = 0; $i < $nItems; $i++) {
             $arrFreteParcial[$i] = $vFreteParcial;
         }
         if ($vFreteParcial * $nItems < $vFrete) {
             $arrFreteParcial[0] += $vFrete - $vFreteParcial * $nItems;
         }
         if ($vFreteParcial * $nItems > $vFrete) {
             $arrFreteParcial[0] += $vFreteParcial * $nItems - $vFrete;
         }
         /**
          * format elements
          */
         for ($i = 0; $i < $nItems; $i++) {
             $arrFreteParcial[$i] = number_format($arrFreteParcial[$i], 2, '.', '');
         }
     }
     foreach ($mOrderShipment->getAllItems() as $_shipmentItem) {
         /**
          * load order item
          */
         $mOrderItem = Mage::getModel('sales/order_item')->load($_shipmentItem->getOrderItemId());
         $mProduct = Mage::getModel('catalog/product')->load($mOrderItem->getProductId());
         $cKey = $key;
         $aOrderItem[$cKey]['@nItem'] = ++$key;
         $aOrderItem[$cKey]['nfe.prod']['nfe.cProd'] = $_shipmentItem->getSku();
         $aOrderItem[$cKey]['nfe.prod']['nfe.cEAN'] = '';
         $aOrderItem[$cKey]['nfe.prod']['nfe.cEANTrib'] = '';
         $aOrderItem[$cKey]['nfe.prod']['nfe.xProd'] = trim($_shipmentItem->getName());
         $productPrice = $_shipmentItem->getPrice();
         $dDescTotal = 0;
         if ($mOrderItem->getDiscountAmount() > 0) {
             $dDescTotal = number_format($mOrderItem->getDiscountAmount() * ($_shipmentItem->getQty() / $mOrderItem->getQtyOrdered()), 2, '.', '');
         }
         $aOrderItem[$cKey]['nfe.prod']['nfe.vDesc'] = $dDescTotal;
         $diff = $mOrderShipment->getOrder()->getTotalPaid() - $mOrderShipment->getOrder()->getGrandTotal();
         $percent = $diff / $mOrderShipment->getOrder()->getGrandTotal();
         $productPrice = $productPrice * (1 + $percent);
         $aOrderItem[$cKey]['nfe.prod']['nfe.vProd'] = (string) number_format($productPrice * $_shipmentItem->getQty(), 2, '.', '');
         $aOrderItem[$cKey]['nfe.prod']['nfe.indTot'] = '1';
         /**
          * check CFOP code
          */
         $aOrderItem[$cKey]['nfe.prod']['nfe.CFOP'] = $this->getCustomerUf($mOrderShipment) == Mage::getStoreConfig('easynfe_nfe/emit/cuf') ? '5102' : '6108';
         $aOrderItem[$cKey]['nfe.prod']['nfe.NCM'] = (string) ($_shipmentItem->getNfeNcm() ? $_shipmentItem->getNfeNcm() : $mProduct->getNfeNcm());
         $aOrderItem[$cKey]['nfe.prod']['nfe.uCom'] = (string) ($_shipmentItem->getNfeUcom() ? $_shipmentItem->getNfeUcom() : $mProduct->getNfeUcom());
         $aOrderItem[$cKey]['nfe.prod']['nfe.qCom'] = (int) $_shipmentItem->getQty();
         $aOrderItem[$cKey]['nfe.prod']['nfe.vUnCom'] = (string) number_format($productPrice, 2, '.', '');
         $aOrderItem[$cKey]['nfe.prod']['nfe.uTrib'] = (string) ($_shipmentItem->getNfeUcom() ? $_shipmentItem->getNfeUcom() : $mProduct->getNfeUcom());
         $aOrderItem[$cKey]['nfe.prod']['nfe.qTrib'] = (int) $_shipmentItem->getQty();
         $aOrderItem[$cKey]['nfe.prod']['nfe.vUnTrib'] = (string) number_format($productPrice, 2, '.', '');
         $vFrete = 0;
         if ($arrFreteParcial[$cKey] > 0) {
             $vFrete = $arrFreteParcial[$cKey] * ($_shipmentItem->getQty() / $mOrderItem->getQtyOrdered()) * (1 + $percent);
             $aOrderItem[$cKey]['nfe.prod']['nfe.vFrete'] = (string) number_format($vFrete, 2, '.', '');
         }
         $vTotal = number_format($productPrice * $_shipmentItem->getQty(), 2, '.', '');
         /**
          * ICMS
          */
         $aOrderItem[$cKey]['nfe.imposto']['nfe.ICMS']['nfe.ICMSSN102']['nfe.orig'] = (string) ($_shipmentItem->getNfeOrig() ? $_shipmentItem->getNfeOrig() : '0');
         $aOrderItem[$cKey]['nfe.imposto']['nfe.ICMS']['nfe.ICMSSN102']['nfe.CSOSN'] = '102';
         /**
          * COFINS CST 99
          */
         $aOrderItem[$cKey]['nfe.imposto']['nfe.COFINS']['nfe.COFINSOutr']['nfe.CST'] = '99';
         $aOrderItem[$cKey]['nfe.imposto']['nfe.COFINS']['nfe.COFINSOutr']['nfe.vBC'] = '0';
         $aOrderItem[$cKey]['nfe.imposto']['nfe.COFINS']['nfe.COFINSOutr']['nfe.pCOFINS'] = '0';
         $aOrderItem[$cKey]['nfe.imposto']['nfe.COFINS']['nfe.COFINSOutr']['nfe.vCOFINS'] = '0';
         /**
          * PIS CST 99
          */
         $aOrderItem[$cKey]['nfe.imposto']['nfe.PIS']['nfe.PISOutr']['nfe.CST'] = '99';
         $aOrderItem[$cKey]['nfe.imposto']['nfe.PIS']['nfe.PISOutr']['nfe.vBC'] = '0';
         $aOrderItem[$cKey]['nfe.imposto']['nfe.PIS']['nfe.PISOutr']['nfe.pPIS'] = '0';
         $aOrderItem[$cKey]['nfe.imposto']['nfe.PIS']['nfe.PISOutr']['nfe.vPIS'] = '0';
         /**
          * sum items
          */
         $aOrderItem['nfe.total']['nfe.ICMSTot']['nfe.vProd'] += $vTotal;
         $aOrderItem['nfe.total']['nfe.ICMSTot']['nfe.vNF'] += $vTotal + $vFrete - $dDescTotal;
         $aOrderItem['nfe.total']['nfe.ICMSTot']['nfe.vDesc'] += $dDescTotal;
         if ($vFrete > 0) {
             $aOrderItem['nfe.total']['nfe.ICMSTot']['nfe.vFrete'] += $vFrete;
//.........这里部分代码省略.........
开发者ID:D12s11,项目名称:magento-easy-nfe-module,代码行数:101,代码来源:Nfe.php

示例11: _filterShipment

 /**
  * @param Mage_Sales_Model_Order_Shipment $shipment
  *
  * @return Bronto_Common_Model_Email_Template_Filter
  */
 protected function _filterShipment(Mage_Sales_Model_Order_Shipment $shipment)
 {
     $this->setStoreId($shipment->getOrder()->getStoreId());
     if (!in_array('shipment', $this->_filteredObjects)) {
         $index = 1;
         foreach ($shipment->getAllItems() as $item) {
             $_item = $item->getOrderItem();
             if (!$_item->getParentItem()) {
                 $this->_filterOrderItem($_item, $index);
                 $index++;
             }
         }
         $createdAt = $shipment->getCreatedAtStoreDate();
         if (empty($createdAt)) {
             // unset the blank string to force current timestamp
             $createdAt = null;
         }
         // Add Related Content
         $this->_items = $shipment->getAllItems();
         $this->setField('shipmentIncrementId', $shipment->getIncrementId());
         $this->setField('shipmentCreatedAt', Mage::helper('core')->formatDate($createdAt, 'long', true));
         // TODO: needed?
         $this->setField('shipmentItems', $this->_filterShipmentItems($shipment));
         $this->setField('shipmentTracking', $this->_getShipmentTrackingNumber($shipment, $shipment->getOrder()));
         $this->_filteredObjects[] = 'shipment';
     }
     return $this;
 }
开发者ID:bevello,项目名称:bevello,代码行数:33,代码来源:Filter.php

示例12: _prepareItems

 /**
  * prepare item information 
  * 
  * @param Mage_Sales_Model_Order_Shipment $mOrderShipment 
  */
 private function _prepareItems($mOrderShipment)
 {
     $key = 0;
     $aOrderItem['nfe.total']['nfe.ICMSTot']['nfe.vBC'] = 0;
     $aOrderItem['nfe.total']['nfe.ICMSTot']['nfe.vProd'] = 0;
     $aOrderItem['nfe.total']['nfe.ICMSTot']['nfe.vICMS'] = 0;
     $mShipping = $mOrderShipment->getOrder()->getShippingAddress();
     /**
      * assign shipping values to items 
      */
     $nItems = count($mOrderShipment->getOrder()->getAllItems());
     if ($mOrderShipment->getOrder()->getShippingAmount()) {
         $vFrete = (string) number_format($mOrderShipment->getOrder()->getShippingAmount(), 2, '.', '');
         $vFreteParcial = number_format($vFrete / $nItems, 2, '.', '');
         for ($i = 0; $i < $nItems; $i++) {
             $arrFreteParcial[$i] = $vFreteParcial;
         }
         if ($vFreteParcial * $nItems < $vFrete) {
             $arrFreteParcial[0] += $vFrete - $vFreteParcial * $nItems;
         }
         if ($vFreteParcial * $nItems > $vFrete) {
             $arrFreteParcial[0] += $vFreteParcial * $nItems - $vFrete;
         }
         /**
          * format elements
          */
         for ($i = 0; $i < $nItems; $i++) {
             $arrFreteParcial[$i] = number_format($arrFreteParcial[$i], 2, '.', '');
         }
     }
     foreach ($mOrderShipment->getAllItems() as $_shipmentItem) {
         /**
          * load order item
          */
         $mOrderItem = Mage::getModel('sales/order_item')->load($_shipmentItem->getOrderItemId());
         $mProduct = Mage::getModel('catalog/product')->load($mOrderItem->getProductId());
         $cKey = $key;
         $aOrderItem[$cKey]['@nItem'] = ++$key;
         $aOrderItem[$cKey]['nfe.prod']['nfe.cProd'] = $_shipmentItem->getSku();
         $aOrderItem[$cKey]['nfe.prod']['nfe.cEAN'] = '';
         $aOrderItem[$cKey]['nfe.prod']['nfe.cEANTrib'] = '';
         $aOrderItem[$cKey]['nfe.prod']['nfe.xProd'] = trim($_shipmentItem->getName());
         $productPrice = $_shipmentItem->getPrice();
         $dDescTotal = 0;
         if ($mOrderItem->getDiscountAmount() > 0) {
             $dDescTotal = number_format($mOrderItem->getDiscountAmount() * ($_shipmentItem->getQty() / $mOrderItem->getQtyOrdered()), 2, '.', '');
             $productPrice -= $dDescTotal / $_shipmentItem->getQty();
         }
         $diff = $mOrderShipment->getOrder()->getTotalPaid() - $mOrderShipment->getOrder()->getGrandTotal();
         $percent = $diff / $mOrderShipment->getOrder()->getGrandTotal();
         $productPrice = $productPrice * (1 + $percent);
         unset($aOrderItem[$cKey]['nfe.prod']['nfe.vDesc']);
         $aOrderItem[$cKey]['nfe.prod']['nfe.vProd'] = (string) number_format($productPrice * $_shipmentItem->getQty(), 2, '.', '');
         $aOrderItem[$cKey]['nfe.prod']['nfe.indTot'] = '1';
         $sCustomerUf = Mage::getModel('easynfe_nfe/directory_country_region')->load($mShipping->getRegionId(), 'region_id')->getId();
         /**
          * check CFOP code
          */
         $aOrderItem[$cKey]['nfe.prod']['nfe.CFOP'] = $sCustomerUf == Mage::getStoreConfig('easynfe_nfe/emit/cuf') ? '5102' : '6108';
         $aOrderItem[$cKey]['nfe.prod']['nfe.NCM'] = (string) ($_shipmentItem->getNfeNcm() ? $_shipmentItem->getNfeNcm() : $mProduct->getNfeNcm());
         $aOrderItem[$cKey]['nfe.prod']['nfe.uCom'] = (string) ($_shipmentItem->getNfeUcom() ? $_shipmentItem->getNfeUcom() : $mProduct->getNfeUcom());
         $aOrderItem[$cKey]['nfe.prod']['nfe.qCom'] = (int) $_shipmentItem->getQty();
         $aOrderItem[$cKey]['nfe.prod']['nfe.vUnCom'] = (string) number_format($productPrice, 2, '.', '');
         $aOrderItem[$cKey]['nfe.prod']['nfe.uTrib'] = (string) ($_shipmentItem->getNfeUcom() ? $_shipmentItem->getNfeUcom() : $mProduct->getNfeUcom());
         $aOrderItem[$cKey]['nfe.prod']['nfe.qTrib'] = (int) $_shipmentItem->getQty();
         $aOrderItem[$cKey]['nfe.prod']['nfe.vUnTrib'] = (string) number_format($productPrice, 2, '.', '');
         $vFrete = 0;
         if ($arrFreteParcial[$cKey] > 0) {
             $vFrete = $arrFreteParcial[$cKey] * ($_shipmentItem->getQty() / $mOrderItem->getQtyOrdered()) * (1 + $percent);
             $aOrderItem[$cKey]['nfe.prod']['nfe.vFrete'] = (string) number_format($vFrete, 2, '.', '');
         }
         $vTotal = number_format($productPrice * $_shipmentItem->getQty(), 2, '.', '');
         /**
          * ICMS 00
          */
         $aOrderItem[$cKey]['nfe.imposto']['nfe.ICMS']['nfe.ICMS00']['nfe.orig'] = (string) ($_shipmentItem->getNfeOrig() ? $_shipmentItem->getNfeOrig() : '0');
         $aOrderItem[$cKey]['nfe.imposto']['nfe.ICMS']['nfe.ICMS00']['nfe.CST'] = '00';
         $aOrderItem[$cKey]['nfe.imposto']['nfe.ICMS']['nfe.ICMS00']['nfe.modBC'] = '0';
         //a definir
         $aOrderItem[$cKey]['nfe.imposto']['nfe.ICMS']['nfe.ICMS00']['nfe.vBC'] = (string) number_format($vTotal + $vFrete, 2, '.', '');
         /**
          * ICMS fixed 18% 
          */
         $aOrderItem[$cKey]['nfe.imposto']['nfe.ICMS']['nfe.ICMS00']['nfe.pICMS'] = '18';
         $aOrderItem[$cKey]['nfe.imposto']['nfe.ICMS']['nfe.ICMS00']['nfe.vICMS'] = (string) number_format(($vTotal + $vFrete) * 0.18, 2, '.', '');
         /**
          * COFINS CST 01 - 7.60%
          */
         $pAliquotaCofins = '7.60';
         $aOrderItem[$cKey]['nfe.imposto']['nfe.COFINS']['nfe.COFINSAliq']['nfe.CST'] = '01';
         $aOrderItem[$cKey]['nfe.imposto']['nfe.COFINS']['nfe.COFINSAliq']['nfe.vBC'] = (string) number_format($vTotal + $vFrete, 2, '.', '');
         $aOrderItem[$cKey]['nfe.imposto']['nfe.COFINS']['nfe.COFINSAliq']['nfe.pCOFINS'] = $pAliquotaCofins;
         $aOrderItem[$cKey]['nfe.imposto']['nfe.COFINS']['nfe.COFINSAliq']['nfe.vCOFINS'] = (string) number_format(($vTotal + $vFrete) * ($pAliquotaCofins / 100), 2, '.', '');
         /**
          * PIS CST 01 - 1.65%
//.........这里部分代码省略.........
开发者ID:andrebellafronte,项目名称:magento-easy-nfe-module,代码行数:101,代码来源:Nfe.php

示例13: getAllItems

 /**
  * Get all items in the shipment. Hidden items will be excluded by default
  * but can be included using the `$includeHidden` argument.
  *
  * @param bool
  * @return Mage_Sales_Model_Order_Item[]
  */
 public function getAllItems($includeHidden = false)
 {
     // parent::getAllItems will include hidden and non-hidden items by default.
     // When hidden items are to be included, the whole array can simply be
     // returned. When hidden items should not be included, they need to
     // be filtered out of the list.
     $items = parent::getAllItems();
     return $includeHidden ? $items : $this->itemHelper->filterHiddenGiftItems($items);
 }
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:16,代码来源:Shipment.php


注:本文中的Mage_Sales_Model_Order_Shipment::getAllItems方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。