本文整理汇总了PHP中Varien_Event_Observer::getOrder方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Event_Observer::getOrder方法的具体用法?PHP Varien_Event_Observer::getOrder怎么用?PHP Varien_Event_Observer::getOrder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Event_Observer
的用法示例。
在下文中一共展示了Varien_Event_Observer::getOrder方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SendSmsOrderStatusChange
public function SendSmsOrderStatusChange(Varien_Event_Observer $observer)
{
$orderID = $observer->getOrder()->getIncrementId();
$msisdn = $observer->getOrder()->getBillingAddress()->getTelephone();
// Customer Mobile No
$status = $observer->getEvent()->getOrder()->getStatus();
$state = $observer->getEvent()->getOrder()->getState();
$paymethod = $observer->getEvent()->getOrder()->getPayment()->getMethodInstance()->getCode();
//START check status & generated SMS Code here your code
$sms = '';
if (!empty($status)) {
if ($status == 'pending' && ($paymethod == 'cashondelivery' || $paymethod == 'checkmo')) {
$sms = 'Your submitted order (#' . $orderID . ') is now in Pending status. Thank You.@SSLW';
} else {
if ($status == 'processing') {
$sms = 'Your invoice is generated. We are processing your order (#' . $orderID . '). Please keep patience.@SSLW';
} else {
if ($status == 'complete') {
$sms = 'Your order (#' . $orderID . ') is now on Delivery process. Soon you will receive your order.@SSLW';
} else {
exit;
}
}
}
// ALL Other status condition will be here..
//START SMS API Code here your code
//$msisdn2='0171767xxxx'; // Store Admin Mobile No
//$sms = 'Congrats! You have successfully Register. Thank You.@SSLW'; //May Change SMS Body here
if (!empty($sms)) {
$user = "UserID";
$pass = "UserPassword";
//if change login password isms.sslwireless.com then change new here
$sid = "StakeHolderName";
//Stake Holder Name here
$url = "http://sms.sslwireless.com/pushapi/dynamic/server.php";
$unique_id_1 = uniqid();
$unique_id_2 = uniqid();
$param = "user={$user}&pass={$pass}&sid={$sid}&";
$sms = "sms[0][0]={$msisdn}&sms[0][1]=" . urlencode($sms) . "&sms[0][2]=" . $unique_id_1 . "&sms[1][0]={$msisdn2}&sms[1][1]=" . urlencode($sms) . "&sms[1][2]=" . $unique_id_2 . "";
$data = $param . $sms . $sid;
$crl = curl_init();
curl_setopt($crl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($crl, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($crl, CURLOPT_URL, $url);
curl_setopt($crl, CURLOPT_HEADER, 0);
curl_setopt($crl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($crl, CURLOPT_POST, 1);
curl_setopt($crl, CURLOPT_POSTFIELDS, $data);
$response = curl_exec($crl);
curl_close($crl);
//echo $response;
}
//end sms body check
//END SMS API Code here your code
}
//End status Code here your code
/* else {
$sms = 'Dear customer, thank you for shopping online. Your Order ID is #'.$orderID.'. @PURNAVA.';
}*/
}
示例2: SendSmsOrderStatusChange
public function SendSmsOrderStatusChange(Varien_Event_Observer $observer)
{
$orderID = $observer->getOrder()->getIncrementId();
$msisdn = $observer->getOrder()->getBillingAddress()->getTelephone();
// Customer Mobile No
$status = $observer->getEvent()->getOrder()->getStatus();
$state = $observer->getEvent()->getOrder()->getState();
//START SMS API Code here your code
//$msisdn2='0171767xxxx'; // Store Admin Mobile No
$sms = 'The status of your OrderID #' . $orderID . ' changed to In ' . $status . '. Thank You @SSLW';
//May Change SMS Body here
$user = "UserID";
$pass = "UserPassword";
//if change login password isms.sslwireless.com then change new here
$sid = "StakeHolderName";
//Stake Holder Name here
$url = "http://sms.sslwireless.com/pushapi/dynamic/server.php";
$unique_id_1 = uniqid();
$unique_id_2 = uniqid();
$param = "user={$user}&pass={$pass}&sid={$sid}&";
$sms = "sms[0][0]={$msisdn}&sms[0][1]=" . urlencode($sms) . "&sms[0][2]=" . $unique_id_1 . "&sms[1][0]={$msisdn2}&sms[1][1]=" . urlencode($sms) . "&sms[1][2]=" . $unique_id_2 . "";
$data = $param . $sms . $sid;
$crl = curl_init();
curl_setopt($crl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($crl, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($crl, CURLOPT_URL, $url);
curl_setopt($crl, CURLOPT_HEADER, 0);
curl_setopt($crl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($crl, CURLOPT_POST, 1);
curl_setopt($crl, CURLOPT_POSTFIELDS, $data);
$response = curl_exec($crl);
curl_close($crl);
//echo $response;
//ENd SMS API Code here your code
}
示例3: placeOrder
/**
* Notify Sailthru that a purchase has been made. This automatically cancels
* any scheduled abandoned cart email.
*
* @param Varien_Event_Observer $observer
* @return
*/
public function placeOrder(Varien_Event_Observer $observer)
{
if ($this->_isEnabled && $observer->getOrder()->getCustomerEmail()) {
try {
$response = Mage::getModel('sailthruemail/client_purchase')->sendOrder($observer->getOrder());
} catch (Exception $e) {
Mage::logException($e);
}
}
return $this;
}
示例4: sendOrderStatus
/**
* Monitor order change event, sending order status to Touch Retail API system
*
* @param Varien_Event_Observer $observer
*/
public function sendOrderStatus(Varien_Event_Observer $observer)
{
if (Mage::helper('orderstatus')->isTouchRetailOrderStatusEnabled()) {
$order = $observer->getOrder();
$orderStatus = $observer->getOrder()->getStatus();
//var_dump($orderStatus);
$orderStatuses = in_array($orderStatus, explode(",", Mage::helper('orderstatus')->getOrderStatuses()));
if ($orderStatuses) {
$this->executeApiCall($order, $orderStatus);
}
}
}
示例5: processPostOrders
/**
* Scans order for product based post purchases
*
* @param Varien_Event_Observer $observer
* @return boolean
*/
public function processPostOrders($observer)
{
if ($observer->getOrder()) {
$appEmulation = Mage::getSingleton('core/app_emulation');
$emulatedInfo = $appEmulation->startEnvironmentEmulation($observer->getOrder()->getStoreId());
try {
$this->_processOrder($observer->getOrder());
} catch (Exception $e) {
$this->_helper->writeError("Failed to examine order: {$e->getMessage()}");
}
$appEmulation->stopEnvironmentEmulation($emulatedInfo);
}
}
示例6: decrementQuantities
/**
* event: sales_model_service_quote_submit_success
*/
public function decrementQuantities(Varien_Event_Observer $observer)
{
/** @var Mage_Sales_Model_Order $order */
$order = $observer->getOrder();
/** @var Mage_Sales_Model_Order_Item $item */
foreach ($order->getAllItems() as $item) {
$additionalData = array();
$serializedAdditionalData = $item->getAdditionalData();
if (!empty($serializedAdditionalData)) {
$additionalData = unserialize($serializedAdditionalData);
}
$orderedQty = $item->getQtyOrdered();
/** @var Webgriffe_Multiwarehouse_Model_Resource_Warehouse_Product_Collection $warehouseProducts */
$warehouseProducts = Mage::getModel('wgmulti/warehouse_product')->getCollection()->addProductIdFilter($item->getProductId())->addWarehousePositionOrder();
foreach ($warehouseProducts as $warehouseProduct) {
if ($warehouseProduct->getQty() >= $orderedQty) {
$warehouseProduct->setQty($warehouseProduct->getQty() - $orderedQty);
$additionalData[$warehouseProduct->getWarehouseId()] = $orderedQty;
break;
}
$additionalData[$warehouseProduct->getWarehouseId()] = $warehouseProduct->getQty();
$orderedQty -= $warehouseProduct->getQty();
$warehouseProduct->setQty(0);
}
$item->setAdditionalData(serialize($additionalData))->save();
$warehouseProducts->save();
}
}
示例7: salesOrderSaveAfter
public function salesOrderSaveAfter(Varien_Event_Observer $observer)
{
$order = $observer->getOrder();
$storeId = Mage::app()->getStore()->getStoreId();
// Check if the order status has changed
$originalOrderStatus = $order->getOrigData('status');
$orderStatus = $order->getStatus();
if ($originalOrderStatus !== $orderStatus) {
Mage::helper('canceledordernotification')->log('Order status has changed: ' . print_r($orderStatus, true));
$notificationStatuses = Mage::getStoreConfig('sales_email/order/order_status_notification_statuses');
$notificationStatuses = $notificationStatuses ? explode(',', $notificationStatuses) : array();
// Check if the new order status should trigger a notification
if (in_array($orderStatus, $notificationStatuses)) {
Mage::helper('canceledordernotification')->log('Order status is in list of notification statuses: ' . print_r(array($orderStatus, $notificationStatuses), true));
// Check if a recipient has been defined
if ($recipients = Mage::getStoreConfig('sales_email/order/copy_to', $storeId)) {
// Trigger the email(s)
foreach (explode(',', $recipients) as $recipient) {
Mage::helper('canceledordernotification/notification')->send($order, $recipient);
}
} else {
Mage::helper('canceledordernotification')->log('No order email copy recipient defined, not sending a notification email');
}
} else {
Mage::helper('canceledordernotification')->log('Order status is not in list of notification statuses: ' . print_r(array($orderStatus, $notificationStatuses), true));
}
}
return $observer;
}
示例8: salesOrderPaymentCancel
/**
* Method used for canceling a Aplazame invoice when a Magento order is canceled
*
* @param Varien_Event_Observer $observer
*/
public function salesOrderPaymentCancel($observer)
{
/** @var Mage_Sales_Model_Order|null $order */
$order = $observer->getOrder();
$orderId = explode("-", $order->getIncrementId());
if (isset($orderId[1])) {
/** @var Mage_Sales_Model_Order $nextOrder */
$nextOrder = Mage::getModel('sales/order')->loadByIncrementId($orderId[0] . '-' . ((int) $orderId[1] + 1));
if ($nextOrder->getId()) {
return $this;
}
}
if (!$this->is_aplazame_payment($order)) {
return $this;
}
/** @var Aplazame_Aplazame_Model_Api_Client $client */
$client = Mage::getModel('aplazame/api_client');
try {
$client->cancelOrder($order);
} catch (Aplazame_Sdk_Api_ApiClientException $e) {
if ($e->getStatusCode() == 404) {
return $this;
}
throw $e;
}
return $this;
}
示例9: addInvoicePdf
/**
* Add invoice PDF to order confirmation email;
* Listen to 'sales_order_send_new_email_before' event
*
* @param Varien_Event_Observer $observer
*/
public function addInvoicePdf(Varien_Event_Observer $observer)
{
//get mailer instance
$mailer = $observer->getMailer();
//get order instance
/** @var $order Mage_Sales_Model_Order */
$order = $observer->getOrder();
$storeId = $order->getStoreId();
//generating array of invoices from collection
$invoicesCollection = $order->getInvoiceCollection();
$invoicesArray = array();
foreach ($invoicesCollection as $_invoice) {
$invoicesArray[] = $_invoice;
}
if (count($invoicesArray) > 0) {
if (!Mage::getStoreConfig(RC_Extsales_Helper_Data::XML_PATH_EMAIL_ATTACHED_USE_DEFAULT_PDF_TEMPLATE, $storeId)) {
//Generating invoice by predefined template
$pdf = Mage::helper('extsales/pdf')->htmlToPdf(Mage::helper('extsales')->getInvoiceHtmlForPdf($order, $invoicesArray));
} else {
// Generating pdf from all invoices and put them to mailer object
$pdf = Mage::getModel('sales/order_pdf_invoice')->getPdf($invoicesArray)->render();
}
$pdfAttachment = Mage::helper('extsales')->createAttachment($pdf);
// Appending attachment to mailer object
$attachments = is_array($mailer->getData('attachments')) ? $mailer->getData('attachments') : array();
$attachments[] = $pdfAttachment;
$mailer->setAttachments($attachments);
}
}
示例10: send_transaction_email
/**
* Applies the special price percentage discount
* @param Varien_Event_Observer $observer
* @return Xyz_Catalog_Model_Price_Observer
*/
public function send_transaction_email($observer)
{
$order = $observer->getOrder();
if (Mage::app()->getStore()->isAdmin() && $order->getPayment()->getMethodInstance()->getCode() == 'iwbank_cc') {
Mage::getModel('emergento_iwbank/iwbank')->setPayment($order->getIncrementId())->sendTransactionEmail();
}
}
示例11: trackOrderStatus
/**
* Track orders based on their statuses
*
* @param Varien_Event_Observer $observer
* @return null
*/
public function trackOrderStatus(Varien_Event_Observer $observer)
{
$helper = Mage::helper('totango');
// Current order state
$orderState = $observer->getOrder()->getState();
// List of order states and their data
$orderStates = array(Mage_Sales_Model_Order::STATE_COMPLETE => array('tracker-name' => 'complete_orders', 'attribute-name' => 'Complete Orders'), Mage_Sales_Model_Order::STATE_CANCELED => array('tracker-name' => 'canceled_orders', 'attribute-name' => 'Canceled Orders'));
$helper->log(sprintf('Track %s order', $orderState));
if (!$helper->isEnabled()) {
return;
}
if (!isset($orderStates[$orderState])) {
$helper->log(array('message' => sprintf('%s orders are not trackable', ucfirst($orderState)), 'level' => 5));
return;
}
foreach ($orderStates as $state => $data) {
if ($helper->isTrackerEnabled($data['tracker-name'])) {
// The following line which is used inside
// a for loop is a bit expensive!
// I might look for a possible workaround later.
$orders = Mage::getModel('sales/order')->getCollection()->addAttributeToFilter('status', array('eq' => $state))->getSize();
$helper->track(array('account-attribute' => array($data['attribute-name'] => $orders)));
}
}
}
示例12: disableOrderActions
/**
* Disable order cancel, invoice and reorder actions for orders placed via Rakuten Checkout
* Observes "sales_order_load_after" event
*
* @param Varien_Event_Observer $observer
* @return void
*/
public function disableOrderActions($observer)
{
try {
/** @var $order Mage_Sales_Model_Order */
$order = $observer->getOrder();
if ($order->getRakutenOrder()) {
/**
* Full list of Order Action flags:
* - ACTION_FLAG_CANCEL
* - ACTION_FLAG_HOLD
* - ACTION_FLAG_UNHOLD
* - ACTION_FLAG_EDIT
* - ACTION_FLAG_CREDITMEMO
* - ACTION_FLAG_INVOICE
* - ACTION_FLAG_REORDER
* - ACTION_FLAG_SHIP
* - ACTION_FLAG_COMMENT
*/
$order->setActionFlag(Mage_Sales_Model_Order::ACTION_FLAG_CANCEL, false);
$order->setActionFlag(Mage_Sales_Model_Order::ACTION_FLAG_EDIT, false);
$order->setActionFlag(Mage_Sales_Model_Order::ACTION_FLAG_CREDITMEMO, false);
$order->setActionFlag(Mage_Sales_Model_Order::ACTION_FLAG_INVOICE, false);
$order->setActionFlag(Mage_Sales_Model_Order::ACTION_FLAG_REORDER, false);
//$order->setActionFlag(Mage_Sales_Model_Order::ACTION_FLAG_SHIP, false);
}
} catch (Exception $e) {
}
}
示例13: disableEmailForMultishipping
/**
* Disables sending email after the order creation
*
* @return updated order
*/
public function disableEmailForMultishipping(Varien_Event_Observer $observer)
{
$order = $observer->getOrder();
if (!(strpos($order->getPayment()->getMethod(), 'cybermut') === false)) {
$order->setCanSendNewEmailFlag(false)->save();
}
return $this;
}
示例14: saveOrderInRegistry
/**
* Stores current order in registry
*
* @param Varien_Event_Observer $observer
* @return Datatrans_Hiddenmode_Model_Observer
*/
public function saveOrderInRegistry(Varien_Event_Observer $observer)
{
if (Mage::registry('datatrans_hm_current_order')) {
Mage::unregister('datatrans_hm_current_order');
}
Mage::register('datatrans_hm_current_order', $observer->getOrder());
return $this;
}
示例15: completeSms
public function completeSms(Varien_Event_Observer $observer)
{
$incrementId = $observer->getOrder()->getIncrementId();
$order = $observer->getOrder();
if ($order->getState() == Mage_Sales_Model_Order::STATE_COMPLETE) {
if ($order->getStatus() == 'complete') {
$mobile = $order->getShippingAddress()->getData('telephone');
$param['username'] = Mage::getStoreConfig('bhsms/api/username');
$param['password'] = Mage::getStoreConfig('bhsms/api/password');
$param['to'] = $mobile;
$param['udh'] = Mage::getStoreConfig('bhsms/api/udh');
$param['from'] = Mage::getStoreConfig('bhsms/api/from');
$param['text'] = "Your shipment (Order#" . $incrementId . ") has been delivered. For any further queries write to us at info@mysite.com or call us at +91 99 99999999.";
// Your shipment (Order#100000001) has been delivered. For any further queries write to us at info@mysite.com or call us at +91 99 99999999."
$this->sendSms($param);
}
}
}