本文整理汇总了PHP中Mage_Sales_Model_Order_Shipment::getUdropshipVendor方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Order_Shipment::getUdropshipVendor方法的具体用法?PHP Mage_Sales_Model_Order_Shipment::getUdropshipVendor怎么用?PHP Mage_Sales_Model_Order_Shipment::getUdropshipVendor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Order_Shipment
的用法示例。
在下文中一共展示了Mage_Sales_Model_Order_Shipment::getUdropshipVendor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendVendorComment
/**
* 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;
}