Пример #1
0
 /**
  * Getter for order tracking numbers collection per shipment
  *
  * @param Mage_Sales_Model_Order_Shipment $shipment
  * @return array
  */
 public function getShipmentTracks($shipment)
 {
     $tracks = array();
     if (!empty($this->_tracks[$shipment->getId()])) {
         $tracks = $this->_tracks[$shipment->getId()];
     }
     return $tracks;
 }
Пример #2
0
 /**
  * Getter for order tracking numbers collection per shipment
  *
  * @param Mage_Sales_Model_Order_Shipment $shipment
  * @return array
  */
 public function getShipmentTracks($shipment)
 {
     return isset($this->_tracks[$shipment->getId()]) ? $this->_tracks[$shipment->getId()] : null;
 }
Пример #3
0
 /**
  * Getter for order tracking numbers collection per shipment
  *
  * @param Mage_Sales_Model_Order_Shipment $shipment
  * @return array
  */
 public function getShipmentTracks($shipment)
 {
     return $this->_tracks[$shipment->getId()];
 }
Пример #4
0
 /**
  * Send vendor comment to store owner
  *
  * @param Mage_Sales_Model_Order_Shipment $shipment
  * @param string $comment
  */
 public function sendVendorComment($shipment, $comment)
 {
     $order = $shipment->getOrder();
     $store = $order->getStore();
     $to = $store->getConfig('udropship/admin/vendor_comments_receiver');
     $subject = $store->getConfig('udropship/admin/vendor_comments_subject');
     $template = $store->getConfig('udropship/admin/vendor_comments_template');
     $vendor = $this->getVendor($shipment->getUdropshipVendor());
     $ahlp = Mage::getModel('adminhtml/url');
     if ($subject && $template && $vendor->getId()) {
         $toEmail = $store->getConfig('trans_email/ident_' . $to . '/email');
         $toName = $store->getConfig('trans_email/ident_' . $to . '/name');
         $data = array('vendor_name' => $vendor->getVendorName(), 'order_id' => $order->getIncrementId(), 'shipment_id' => $shipment->getIncrementId(), 'vendor_url' => $ahlp->getUrl('udropship/adminhtml_vendor/edit', array('id' => $vendor->getId())), 'order_url' => $ahlp->getUrl('adminhtml/sales_order/view', array('order_id' => $order->getId())), 'shipment_url' => $ahlp->getUrl('adminhtml/sales_order_shipment/view', array('shipment_id' => $shipment->getId(), 'order_id' => $order->getId())), 'comment' => $comment);
         if ($this->isUdpoActive() && ($po = Mage::helper('udpo')->getShipmentPo($shipment))) {
             $data['po_id'] = $po->getIncrementId();
             $data['po_url'] = $ahlp->getUrl('udpoadmin/order_po/view', array('udpo_id' => $po->getId(), 'order_id' => $order->getId()));
             $template = preg_replace('/{{isPoAvailable}}(.*?){{\\/isPoAvailable}}/s', '\\1', $template);
         } else {
             $template = preg_replace('/{{isPoAvailable}}.*?{{\\/isPoAvailable}}/s', '', $template);
         }
         foreach ($data as $k => $v) {
             $subject = str_replace('{{' . $k . '}}', $v, $subject);
             $template = str_replace('{{' . $k . '}}', $v, $template);
         }
         $mail = Mage::getModel('core/email')->setFromEmail($vendor->getEmail())->setFromName($vendor->getVendorName())->setToEmail($toEmail)->setToName($toName)->setSubject($subject)->setBody($template)->send();
         //mail('"'.$toName.'" <'.$toEmail.'>', $subject, $template, 'From: "'.$vendor->getVendorName().'" <'.$vendor->getEmail().'>');
     }
     Mage::helper('udropship')->addShipmentComment($shipment, $this->__($vendor->getVendorName() . ': ' . $comment));
     $shipment->getCommentsCollection()->save();
     return $this;
 }
Пример #5
0
 public function isMagentoShipmentCreatedByOrder(Mage_Sales_Model_Order_Shipment $magentoShipment)
 {
     $additionalData = $this->getAdditionalData();
     if (empty($additionalData['created_shipments_ids']) || !is_array($additionalData['created_shipments_ids'])) {
         return false;
     }
     return in_array($magentoShipment->getId(), $additionalData['created_shipments_ids']);
 }