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); }