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


PHP Mage_Sales_Model_Order_Shipment::sendUpdateEmail方法代码示例

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


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

示例1: sendUpdateEmail

 public function sendUpdateEmail($notifyCustomer = true, $comment = '')
 {
     Mage::app()->setCurrentStore($this->getStoreId());
     if (Mage::getStoreConfig('transactional/shipment/enabled')) {
         try {
             if (!Mage::helper('sales')->canSendNewShipmentEmail($this->getStoreId())) {
                 return $this;
             }
             $order = $this->getOrder();
             $customerEmail = $order->getCustomerEmail();
             $orderNumber = $order->getIncrementId();
             $subTotal = $order->formatPriceTxt($order->getSubtotal());
             $taxTotal = $order->formatPriceTxt($order->getTaxAmount());
             $shipTotal = $order->formatPriceTxt($order->getShippingAmount());
             $grandTotal = $order->formatPriceTxt($order->getGrandTotal());
             $discAmount = $order->formatPriceTxt($order->getBaseDiscountAmount());
             $billingAddress = $order->getBillingAddress();
             $billFirstName = $billingAddress->getFirstname();
             $billLastName = $billingAddress->getLastname();
             $billAddress1 = $billingAddress->getStreet(1);
             $billAddress2 = $billingAddress->getStreet(2);
             $billCity = $billingAddress->getCity();
             $billCounty = $billingAddress->getRegion();
             $billPostCode = $billingAddress->getPostcode();
             $billCountry = $billingAddress->getCountry();
             $shippingAddress = $order->getShippingAddress();
             $shipFirstName = $shippingAddress->getFirstname();
             $shipLastName = $shippingAddress->getLastname();
             $shipAddress1 = $shippingAddress->getStreet(1);
             $shipAddress2 = $shippingAddress->getStreet(2);
             $shipCity = $shippingAddress->getCity();
             $shipCounty = $shippingAddress->getRegion();
             $shipPostCode = $shippingAddress->getPostcode();
             $shipCountry = $shippingAddress->getCountry();
             $payment = $order->getPayment();
             $paymentMethod = $payment->getMethodInstance()->getTitle();
             $paymentLastFourDigits = $payment->getCcLast4();
             $paymentCard = $payment->getCcType();
             $shippingMethod = $order->getShippingDescription();
             $orderLineItems = '';
             $htmlTemplate = Mage::getStoreConfig('transactional/shipment/lineItemsHtml');
             foreach ($order->getAllVisibleItems() as $item) {
                 $productModel = Mage::getModel('catalog/product')->load($item->getProductId());
                 $productType = $productModel->getTypeId();
                 $children = $item->getChildren();
                 $childrenCount = count($children);
                 if (Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE == $productType && $childrenCount > 0) {
                     $productModel = Mage::getModel('catalog/product')->load($children[0]->getProductId());
                 }
                 $product = Mage::helper('transactional/product')->getProductEntity($productModel, false, false, false);
                 $prodGiftMessage = Mage::helper('giftmessage/message')->getGiftMessage($item->getGiftMessageId())->getData('message');
                 if ($prodGiftMessage != '') {
                     $prodGiftMsgStr = 'Gift Message: ' . $prodGiftMessage;
                 } else {
                     $prodGiftMsgStr = '';
                 }
                 $tags = array('[IMAGE_URL]', '[TITLE]', '[SKU]', '[QUANTITY]', '[PRICE]', '[LINE_ITEM_TOTAL]', '[LINK_URL]', '[GIFT_MSG]');
                 $values = array($product['image'], $product['name'], $product['sku'], number_format($item->getQtyOrdered(), 0), $order->formatPriceTxt($item->getPrice()), $order->formatPriceTxt($item->getRowTotal()), $product['url_path'], $prodGiftMsgStr);
                 $tmpHtml = str_replace($tags, $values, $htmlTemplate);
                 $orderLineItems = $orderLineItems . $tmpHtml;
             }
             $tracks = $this->getAllTracks();
             if (count($tracks) > 0) {
                 $trackingNumber = $tracks[0]->getNumber();
                 $trackingLink = Mage::helper('shipping')->getTrackingPopUpUrlByOrderId($order->getId());
             }
             Mage::helper('transactional')->sendShipmentEmail($customerEmail, $orderNumber, $trackingNumber, $trackingLink, $subTotal, $shipTotal, $taxTotal, $discAmount, $grandTotal, $billFirstName, $billLastName, $billAddress1, $billAddress2, $billCity, $billCounty, $billPostCode, $billCountry, $shipFirstName, $shipLastName, $shipAddress1, $shipAddress2, $shipCity, $shipCounty, $shipPostCode, $shipCountry, $paymentMethod, $shippingMethod, $paymentLastFourDigits, $paymentCard, $orderLineItems);
             return $this;
         } catch (Exception $ex) {
             return parent::sendUpdateEmail($notifyCustomer, $comment);
         }
     }
     return parent::sendUpdateEmail($notifyCustomer, $comment);
 }
开发者ID:RxOuchy,项目名称:LDS_Client_Solutions,代码行数:74,代码来源:Shipment.php


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