本文整理汇总了PHP中Mage_Sales_Model_Order::loadByIncrementId方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Order::loadByIncrementId方法的具体用法?PHP Mage_Sales_Model_Order::loadByIncrementId怎么用?PHP Mage_Sales_Model_Order::loadByIncrementId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Order
的用法示例。
在下文中一共展示了Mage_Sales_Model_Order::loadByIncrementId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createReservationDocument
public function createReservationDocument($event)
{
$order = new Mage_Sales_Model_Order();
$incrementId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
$order->loadByIncrementId($incrementId);
$orderData = $order->getData();
$customerID = sprintf("WEBC%010d", $order['customer_id']);
$orderDate = date('Y-m-d H:i:s');
$XML = "\n <TrumpasPardRezDok>\n <sKlientas>{$customerID}</sKlientas>\n <tData>{$orderDate}</tData>\n <sSerija></sSerija>\n <sDokumentas></sDokumentas>\n <sValiuta>{$orderData['order_currency_code']}</sValiuta>";
$VAT = 21;
foreach ($order->getAllItems() as $item) {
$children = $item->getChildrenItems();
if (!empty($children)) {
continue;
// bundle
}
$itemData = $item->getData();
$priceVat = round($itemData['price_incl_tax'], 4);
$priceNoVat = round($priceVat / ($VAT / 100 + 1), 4);
$priceVatValue = round($priceVat - $priceNoVat, 4);
$qty = intval($itemData['qty_ordered']);
$XML .= "\n <PardDokPrekeDetEil>\n <sKodas>{$itemData['sku']}</sKodas>\n <sPavadinimas>{$itemData['name']}</sPavadinimas>\n <sSandelis>CENTR.</sSandelis>\n <nKiekis>{$qty}</nKiekis>\n <dSumaL>{$priceNoVat}</dSumaL>\n <dSumaV>{$priceNoVat}</dSumaV>\n <dSumaPVMV>{$priceVatValue}</dSumaPVMV>\n <dSumaPVML>{$priceVatValue}</dSumaPVML>\n </PardDokPrekeDetEil>";
}
$shippingAmountVat = round($order->getShippingAmount(), 4);
$shippingAmountNoVat = round($shippingAmountVat / ($VAT / 100 + 1), 4);
$shippingVatValue = round($shippingAmountVat - $shippingAmountNoVat, 4);
$XML .= "\n <PardDokPaslaugaDetEil>\n <sKodas>TRANSPORTAV</sKodas>\n <nKiekis>100</nKiekis>\n <dSumaV>{$shippingAmountNoVat}</dSumaV>\n <dSumaL>{$shippingAmountNoVat}</dSumaL>\n <dSumaPVMV>{$shippingVatValue}</dSumaPVMV>\n <dSumaPVML>{$shippingVatValue}</dSumaPVML>\n \t </PardDokPaslaugaDetEil>\n ";
$XML .= "</TrumpasPardRezDok>";
/** @var $fvs Srautas_Finvalda_Webservice */
$fvs = Mage::getSingleton('finvalda/webservice');
$fvs->InsertNewOperation(array('ItemClassName' => 'TrumpasPardRezDok', 'sParametras' => 'PIRMAS', 'xmlString' => $XML));
return $this;
}
示例2: orderSuccessEvent
/**
* Adiciona o Link do meio de pagamento a página de sucesso.
* @param $observer
*/
public function orderSuccessEvent($observer)
{
try {
$order = new Mage_Sales_Model_Order();
$lastOrderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
$order->loadByIncrementId($lastOrderId);
$quoteId = $order->getQuoteId();
$quote = Mage::getModel("sales/quote")->loadByIdWithoutStore($quoteId);
$type = null;
$payment_method_bcash = $quote->getPaymentMethodBcash();
if ($payment_method_bcash) {
$helper = new Bcash_Pagamento_Helper_PaymentMethod();
$type = $helper->getPaymentMethod($payment_method_bcash);
}
$layout = Mage::app()->getLayout();
$block = $layout->createBlock('Mage_Core_Block_Template', 'link_pagamento_bcash', array('template' => 'bcash/pagamento/checkout/success.phtml'));
$block->setOrder($order);
$block->setQuote($quote);
$block->setType($type);
$layout->getBlock('content')->append($block);
$bcashTransacation = $order->getTransactionIdBcash();
Mage::helper("bcash")->saveLog("Pedido '" . $lastOrderId . "' realizado com sucesso. Transacao: " . $bcashTransacation);
} catch (Exception $e) {
Mage::helper("bcash")->saveLog($e->getMessage());
}
}
示例3: successAction
public function successAction()
{
$order = new Mage_Sales_Model_Order();
$lastOrderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
$order->loadByIncrementId($lastOrderId);
$quoteId = $order->getQuoteId();
$quote = Mage::getModel("sales/quote")->load($quoteId);
try {
$order->setTransactionIdBcash($quote->getTransactionIdBcash())->setStatusBcash($quote->getStatusBcash())->setDescriptionStatusBcash($quote->getDescriptionStatusBcash())->setPaymentLinkBcash($quote->getPaymentLinkBcash())->setPaymentMethodBcash($quote->getPaymentMethodBcash())->setInstallmentsBcash($quote->getInstallmentsBcash());
$order->save();
$order->sendNewOrderEmail();
} catch (Exception $ex) {
}
$type = null;
$payment_method_bcash = $order->getPaymentMethodBcash();
if ($payment_method_bcash) {
$helper = new Bcash_Pagamento_Helper_PaymentMethod();
$type = $helper->getPaymentMethod($payment_method_bcash);
}
$this->loadLayout();
$this->getLayout()->getBlock('root')->setTemplate('page/2columns-right.phtml');
$block = $this->getLayout()->createBlock('Mage_Core_Block_Template', 'link_pagamento_bcash', array('template' => 'bcash/pagamento/checkout/success.phtml'));
$block->setOrder($order);
$block->setQuote($quote);
$block->setType($type);
$this->getLayout()->getBlock('content')->append($block);
$this->_initLayoutMessages('checkout/session');
Mage::dispatchEvent('checkout_onepage_controller_success_action', array('order_ids' => array($lastOrderId)));
$this->renderLayout();
}
示例4: hookToOrderSaveEvent
public function hookToOrderSaveEvent()
{
$order = new Mage_Sales_Model_Order();
$incrementId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
$order->loadByIncrementId($incrementId);
//Fetch the data from select box and throw it here
$_heared4us_data = null;
$_heared4us_data = Mage::getSingleton('core/session')->getInchooHeared4us();
//Save fhc id to order obcject
$order->setData(self::ORDER_ATTRIBUTE_FHC_ID, $_heared4us_data);
$order->setData("affiliate_sale_type", $_heared4us_data);
$order->save();
$write = Mage::getSingleton('core/resource')->getConnection('core_write');
$sql = "UPDATE sales_flat_order_grid SET affiliate_sale_type = {$_heared4us_data} WHERE entity_id = '{$order->getEntityId()}'";
$write->query($sql);
if ($_heared4us_data != 3) {
$entity = $order->getEntityId();
$customer_id = $order->getCustomerId();
$expired = Mage::getModel('affiliate/affiliateexpired')->load($customer_id)->getData();
$historic = '[{"order":"' . $entity . '"}]';
$today = date("Y-m-d 23:59:59");
$expired_date = new DateTime($today);
$interval = new DateInterval('P1M');
$expired_date->add($interval);
$final = $expired_date->format('Y-m-d h:i:s');
$write = Mage::getSingleton('core/resource')->getConnection('core_write');
if ($expired) {
$sql = "UPDATE mw_affiliate_expired SET historic='{$historic}', expired_package = '{$final}' WHERE customer_id = '{$customer_id}'";
} else {
$sql = "INSERT INTO mw_affiliate_expired VALUES({$customer_id}, '{$final}', NULL, '{$historic}')";
}
$write->query($sql);
}
}
示例5: redirectAction
public function redirectAction()
{
// Retrieve order
$order = new Mage_Sales_Model_Order();
$ccavenue['order_id'] = Mage::getSingleton('checkout/session')->getLastRealOrderId();
$order->loadByIncrementId($ccavenue['order_id']);
// Get CCAvenue Parameters
$ccavenue['action'] = Mage::getStoreConfig('payment/ccavenue/submit_url');
$ccavenue['merchant_id'] = Mage::getStoreConfig('payment/ccavenue/merchant_id');
$ccavenue['amount'] = round($order->base_grand_total, 2);
$ccavenue['redirect_url'] = Mage::getBaseUrl() . 'ccavenue/payment/response';
$ccavenue['working_key'] = Mage::getStoreConfig('payment/ccavenue/working_key');
$ccavenue['checksum'] = $this->getCheckSum($ccavenue['merchant_id'], $ccavenue['amount'], $ccavenue['order_id'], $ccavenue['redirect_url'], $ccavenue['working_key']);
// Retrieve order details
$billingAddress = $order->getBillingAddress();
$billingData = $billingAddress->getData();
$shippingAddress = $order->getShippingAddress();
if ($shippingAddress) {
$shippingData = $shippingAddress->getData();
}
$ccavenue['billing_cust_name'] = $billingData['firstname'] . ' ' . $billingData['lastname'];
$ccavenue['billing_cust_address'] = $billingAddress->street;
$ccavenue['billing_cust_state'] = $billingAddress->region;
$ccavenue['billing_cust_country'] = Mage::getModel('directory/country')->load($billingAddress->country_id)->getName();
$ccavenue['billing_cust_tel'] = $billingAddress->telephone;
$ccavenue['billing_cust_email'] = $order->customer_email;
if ($shippingAddress) {
$ccavenue['delivery_cust_name'] = $shippingData['firstname'] . ' ' . $shippingData['lastname'];
$ccavenue['delivery_cust_address'] = $shippingAddress->street;
$ccavenue['delivery_cust_state'] = $shippingAddress->region;
$ccavenue['delivery_cust_country'] = Mage::getModel('directory/country')->load($shippingAddress->country_id)->getName();
$ccavenue['delivery_cust_tel'] = $shippingAddress->telephone;
$ccavenue['delivery_city'] = $shippingAddress->city;
$ccavenue['delivery_zip'] = $shippingAddress->postcode;
} else {
$ccavenue['delivery_cust_name'] = '';
$ccavenue['delivery_cust_address'] = '';
$ccavenue['delivery_cust_state'] = '';
$ccavenue['delivery_cust_country'] = '';
$ccavenue['delivery_cust_tel'] = '';
$ccavenue['delivery_city'] = '';
$ccavenue['delivery_zip'] = '';
}
$ccavenue['merchant_param'] = '';
$ccavenue['billing_city'] = $billingAddress->city;
$ccavenue['billing_zip'] = $billingAddress->postcode;
$ccavenue['billing_cust_notes'] = '';
// Insert into CCAvenue Response Log Table
$now = Mage::getModel('core/date')->timestamp(time());
Mage::getModel('ccavenue/ccavenueredirect')->setMerchantId($ccavenue['merchant_id'])->setAmount($ccavenue['amount'])->setOrderId($ccavenue['order_id'])->setRedirectUrl($ccavenue['redirect_url'])->setChecksum($ccavenue['checksum'])->setBillingCustName(addslashes($ccavenue['billing_cust_name']))->setBillingCustAddress(addslashes($ccavenue['billing_cust_address']))->setBillingCustCountry(addslashes($ccavenue['billing_cust_country']))->setBillingCustState(addslashes($ccavenue['billing_cust_state']))->setBillingZip($ccavenue['billing_zip'])->setBillingCustTel($ccavenue['billing_cust_tel'])->setBillingCustEmail($ccavenue['billing_cust_email'])->setDeliveryCustName(addslashes($ccavenue['delivery_cust_name']))->setDeliveryCustAddress(addslashes($ccavenue['delivery_cust_address']))->setDeliveryCustCountry(addslashes($ccavenue['delivery_cust_country']))->setDeliveryCustState(addslashes($ccavenue['delivery_cust_state']))->setDeliveryCustTel($ccavenue['delivery_cust_tel'])->setBillingCustNotes($ccavenue['billing_cust_notes'])->setMerchantParam($ccavenue['merchant_param'])->setBillingCustCity(addslashes($ccavenue['billing_city']))->setBillingZipCode($ccavenue['billing_zip'])->setDeliveryCustCity(addslashes($ccavenue['delivery_city']))->setDeliveryZipCode($ccavenue['delivery_zip'])->setCcavenueRedirectIp($this->get_uer_ip())->setCcavenueRedirectDtime(date('Y-m-d H:i:s', $now))->save();
// Add data to registry so it's accessible in the view file
Mage::register('ccavenue', $ccavenue);
// Render layout
$this->loadLayout();
$block = $this->getLayout()->createBlock('Mage_Core_Block_Template', 'ccavenue', array('template' => 'ccavenue/redirect.phtml'));
$this->getLayout()->getBlock('content')->append($block);
$this->renderLayout();
}
示例6: _testProcessIpnRequestCurrency
/**
* Test processIpnRequest() currency check for paypal_express and paypal_standard payment methods
*
* @param string $currencyCode
* @dataProvider currencyProvider
*/
protected function _testProcessIpnRequestCurrency($currencyCode)
{
$ipnData = (require __DIR__ . '/../_files/ipn.php');
$ipnData['mc_currency'] = $currencyCode;
$this->_model->processIpnRequest($ipnData, $this->_createMockedHttpAdapter());
$order = new Mage_Sales_Model_Order();
$order->loadByIncrementId('100000001');
$this->_assertOrder($order, $currencyCode);
}
示例7: saveCompensation
public function saveCompensation(Varien_Event_Observer $observer)
{
$order = new Mage_Sales_Model_Order();
$orderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
$order->loadByIncrementId($orderId);
$orderPriceExldTax = $order->getBaseSubtotal();
// calculate commission for price WITHOUT TAX
Mage::getModel('magemlm/commissions')->calculateCommissions(Mage::helper('customer')->getCustomer()->getId(), $orderId, $orderPriceExldTax);
}
示例8: testLoadByTxnId
public function testLoadByTxnId()
{
$order = new Mage_Sales_Model_Order();
$order->loadByIncrementId('100000001');
$model = new Mage_Sales_Model_Order_Payment_Transaction();
$model->setOrderPaymentObject($order->getPayment())->loadByTxnId('invalid_transaction_id');
$this->assertNull($model->getId());
$model->loadByTxnId('trx1');
$this->assertNotNull($model->getId());
}
示例9: redirectAction
public function redirectAction()
{
// Retrieve order
$order = new Mage_Sales_Model_Order();
$customcard['order_id'] = Mage::getSingleton('checkout/session')->getLastRealOrderId();
$order->loadByIncrementId($customcard['order_id']);
// Get Custom card method Parameters
$customcard['action'] = Mage::getStoreConfig('payment/paymentmodulepackbankin_checkout/submit_url');
$customcard['merchant_id'] = Mage::getStoreConfig('payment/paymentmodulepackbankin_checkout/merchant_id');
$customcard['amount'] = round($order->base_grand_total, 2);
$customcard['redirect_url'] = Mage::getBaseUrl() . 'paymentmodulepackbankin_checkout/payment/response';
// Retrieve order details
$billingAddress = $order->getBillingAddress();
$billingData = $billingAddress->getData();
$shippingAddress = $order->getShippingAddress();
if ($shippingAddress) {
$shippingData = $shippingAddress->getData();
}
$customcard['billing_cust_name'] = $billingData['firstname'] . ' ' . $billingData['lastname'];
$customcard['billing_cust_address'] = $billingAddress->street;
$customcard['billing_cust_state'] = $billingAddress->region;
$customcard['billing_cust_country'] = Mage::getModel('directory/country')->load($billingAddress->country_id)->getName();
$customcard['billing_cust_tel'] = $billingAddress->telephone;
$customcard['billing_cust_email'] = $order->customer_email;
if ($shippingAddress) {
$customcard['delivery_cust_name'] = $shippingData['firstname'] . ' ' . $shippingData['lastname'];
$customcard['delivery_cust_address'] = $shippingAddress->street;
$customcard['delivery_cust_state'] = $shippingAddress->region;
$customcard['delivery_cust_country'] = Mage::getModel('directory/country')->load($shippingAddress->country_id)->getName();
$customcard['delivery_cust_tel'] = $shippingAddress->telephone;
$customcard['delivery_city'] = $shippingAddress->city;
$customcard['delivery_zip'] = $shippingAddress->postcode;
} else {
$customcard['delivery_cust_name'] = '';
$customcard['delivery_cust_address'] = '';
$customcard['delivery_cust_state'] = '';
$customcard['delivery_cust_country'] = '';
$customcard['delivery_cust_tel'] = '';
$customcard['delivery_city'] = '';
$customcard['delivery_zip'] = '';
}
$customcard['merchant_param'] = '';
$customcard['billing_city'] = $billingAddress->city;
$customcard['billing_zip'] = $billingAddress->postcode;
$customcard['billing_cust_notes'] = '';
// Add data to registry so it's accessible in the view file
Mage::register('customcard', $customcard);
// Render layout
$this->loadLayout();
$block = $this->getLayout()->createBlock('Mage_Core_Block_Template', 'customcard', array('template' => 'paymentmodulepackbankin/redirect.phtml'));
$this->getLayout()->getBlock('content')->append($block);
$this->renderLayout();
}
示例10: getLastRealOrder
/**
* Get order instance based on last order ID
*
* @return Mage_Sales_Model_Order
*/
public function getLastRealOrder()
{
$orderId = $this->getLastRealOrderId();
if ($this->_order !== null && $orderId == $this->_order->getIncrementId()) {
return $this->_order;
}
$this->_order = $this->_getOrderModel();
if ($orderId) {
$this->_order->loadByIncrementId($orderId);
}
return $this->_order;
}
示例11: redirectAction
public function redirectAction()
{
$this->helper = Mage::helper('devopensource_redsys');
$_order = new Mage_Sales_Model_Order();
$orderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
$_order->loadByIncrementId($orderId);
$nameStore = Mage::getStoreConfig('payment/redsys/namestore', Mage::app()->getStore());
$merchantcode = Mage::getStoreConfig('payment/redsys/merchantcode', Mage::app()->getStore());
$sha256key = Mage::getStoreConfig('payment/redsys/sha256key', Mage::app()->getStore());
$terminal = Mage::getStoreConfig('payment/redsys/terminal', Mage::app()->getStore());
$transaction = Mage::getStoreConfig('payment/redsys/transaction', Mage::app()->getStore());
$productsDescription = $this->helper->getDescriptionOrder($_order);
$urlStore = $this->helper->getUrlStore();
$language = $this->helper->getLanguages();
$currency = $this->helper->getCurrency();
$this->helper->stateInTpv($_order);
$transaction_amount = number_format($_order->getBaseGrandTotal(), 2, '', '');
$amount = (double) $transaction_amount;
$payMethods = "C";
$urlOK = Mage::getBaseUrl() . 'redsys/index/success';
$urlKO = Mage::getBaseUrl() . 'redsys/index/cancel';
$redsys = new RedsysAPI();
$redsys->setParameter("DS_MERCHANT_AMOUNT", $amount);
$redsys->setParameter("DS_MERCHANT_ORDER", strval($orderId));
$redsys->setParameter("DS_MERCHANT_MERCHANTCODE", $merchantcode);
$redsys->setParameter("DS_MERCHANT_CURRENCY", $currency);
$redsys->setParameter("DS_MERCHANT_TRANSACTIONTYPE", $transaction);
$redsys->setParameter("DS_MERCHANT_TERMINAL", $terminal);
$redsys->setParameter("DS_MERCHANT_MERCHANTURL", $urlStore);
$redsys->setParameter("DS_MERCHANT_URLOK", $urlOK);
$redsys->setParameter("DS_MERCHANT_URLKO", $urlKO);
$redsys->setParameter("Ds_Merchant_ConsumerLanguage", $language);
$redsys->setParameter("Ds_Merchant_ProductDescription", $productsDescription);
$redsys->setParameter("Ds_Merchant_Titular", $nameStore);
$redsys->setParameter("Ds_Merchant_MerchantName", $nameStore);
$redsys->setParameter("Ds_Merchant_PayMethods", $payMethods);
$version = "HMAC_SHA256_V1";
$paramsBase64 = $redsys->createMerchantParameters();
$signatureMac = $redsys->createMerchantSignature($sha256key);
echo '
<form action="' . $this->helper->getUrlEnviroment() . '" method="post" id="redsys" name="redsys">
<input type="hidden" name="Ds_SignatureVersion" value="' . $version . '" />
<input type="hidden" name="Ds_MerchantParameters" value="' . $paramsBase64 . '" />
<input type="hidden" name="Ds_Signature" value="' . $signatureMac . '" />
</form>
<h3> ' . $this->__('Redirecting the TPV please wait...') . '</h3>
<script type="text/javascript">
document.redsys.submit();
</script>';
}
示例12: getScript
public function getScript()
{
$request = Mage::app()->getRequest();
$module = $request->getModuleName();
$controller = $request->getControllerName();
$action = $request->getActionName();
$flag = false;
$currency = Mage::app()->getStore()->getCurrentCurrencyCode();
$script = "<script>var apiKey = '" . $this->getKey() . "';</script>" . "\n";
if ($module == 'checkout' && $controller == 'onestep' && $action == 'success' || $module == 'checkout' && $controller == 'onepage' && $action == 'success' || $module == 'securecheckout' && $controller == 'index' && $action == 'success' || $module == 'customdownloadable' && $controller == 'onepage' && $action == 'success' || $module == 'onepagecheckout' && $controller == 'index' && $action == 'success' || $module == 'onestepcheckout' && $controller == 'index' && $action == 'success') {
$order = new Mage_Sales_Model_Order();
$orderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
$order->loadByIncrementId($orderId);
// Load order details
$order_total = round($order->getGrandTotal(), 2);
// Get grand total
$order_coupon = $order->getCouponCode();
// Get coupon used
$items = $order->getAllItems();
// Get items info
$cartInfo = array();
// Convert object to string
foreach ($items as $item) {
$product = Mage::getModel('catalog/product')->load($item->getProductId());
$name = $item->getName();
$qty = $item->getQtyToInvoice();
$cartInfo[] = array('id' => $item->getProductId(), 'name' => $name, 'quantity' => $qty);
}
$cartInfoString = serialize($cartInfo);
$cartInfoString = addcslashes($cartInfoString, "'");
$order_name = $order->getCustomerName();
// Get customer's name
$order_email = $order->getCustomerEmail();
// Get customer's email id
// Call invoiceRefiral function
$scriptAppend = "<script>whenAvailable('invoiceRefiral',function(){invoiceRefiral('{$order_total}','{$order_total}','{$order_coupon}','{$cartInfoString}','{$order_name}','{$order_email}','{$orderId}', '{$currency}')});</script>" . "\n";
if ($this->debug()) {
$scriptAppend .= "<script>console.log('Module: " . $module . ", Controller: " . $controller . ", Action: " . $action . "');</script>";
$scriptAppend .= "<script>console.log('Total: " . $order_total . ", Coupon: " . $order_coupon . ", Cart: " . $cartInfoString . ", Name: " . $order_name . ", Email: " . $order_email . ", Id: " . $orderId . ", Currency: " . $currency . "');</script>";
}
$script .= '<script>var showButton = false;</script>' . "\n";
} else {
if ($this->debug()) {
$scriptAppend = "<script>console.log('Module: " . $module . ", Controller: " . $controller . ", Action: " . $action . "');</script>";
} else {
$scriptAppend = '';
}
$script .= '<script>var showButton = true;</script>' . "\n";
}
$script .= '<script type="text/javascript">(function e(){var e=document.createElement("script");e.type="text/javascript",e.async=true,e.src="//rfer.co/api/v1/js/all.js";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)})();</script>' . "\n";
return $script . $scriptAppend;
}
示例13: testSendNewOrderEmail
/**
* @magentoConfigFixture current_store design/theme/full_name default/default/default
* @magentoDataFixture Mage/Sales/_files/order.php
*/
public function testSendNewOrderEmail()
{
$order = new Mage_Sales_Model_Order();
$order->loadByIncrementId('100000001');
$order->setCustomerEmail('customer@example.com');
$payment = $order->getPayment();
$paymentInfoBlock = Mage::helper('Mage_Payment_Helper_Data')->getInfoBlock($payment);
$paymentInfoBlock->setArea('invalid-area');
$payment->setBlockMock($paymentInfoBlock);
$this->assertEmpty($order->getEmailSent());
$order->sendNewOrderEmail();
$this->assertNotEmpty($order->getEmailSent());
$this->assertEquals('frontend', $paymentInfoBlock->getArea());
}
示例14: testSendEmail
/**
* @magentoConfigFixture sales_email/invoice/enabled 1
* @magentoConfigFixture current_store design/theme/full_name default/default/default
* @magentoDataFixture Mage/Sales/_files/order.php
*/
public function testSendEmail()
{
$order = new Mage_Sales_Model_Order();
$order->loadByIncrementId('100000001');
$order->setCustomerEmail('customer@example.com');
$invoice = new Mage_Sales_Model_Order_Invoice();
$invoice->setOrder($order);
$paymentInfoBlock = Mage::helper('Mage_Payment_Helper_Data')->getInfoBlock($order->getPayment());
$paymentInfoBlock->setArea('invalid-area');
$invoice->setPaymentInfoBlock($paymentInfoBlock);
$this->assertNull($invoice->getEmailSent());
$invoice->sendEmail(true);
$this->assertTrue($invoice->getEmailSent());
$this->assertEquals('frontend', $paymentInfoBlock->getArea());
}
示例15: execute
/**
* Execute
*
* @param ArrayObject $settings
* @param boolean $multipack
* @return Dhl_Intraship_Model_Shipment $this
*/
public function execute(ArrayObject $settings, $multipack = null)
{
$helper = new Dhl_Intraship_Model_Autocreate();
$model = new Mage_Sales_Model_Order();
$myOrder = $model->loadByIncrementId($this->getOrderId());
$myOrder->setReordered(true);
$data = array('currency' => 'EUR', 'account' => array('group_id' => 1, 'email' => 'jochen.werner@netresearch.de'), 'billing_address' => $myOrder->getBillingAddress()->getData(), 'shipping_address' => $myOrder->getShippingAddress()->getData(), 'shipping_method' => 'flatrate_flatrate', 'comment' => array('customer_note' => false, 'send_confirmation' => false));
$admin = new Mage_Adminhtml_Model_Sales_Order_Create();
$order = $admin->initFromOrder($myOrder)->importPostData($data)->createOrder();
$shipment = $helper->checkOrder($order)->createShipment($order);
$helper->saveShipment($shipment, $settings);
$intraship = new Dhl_Intraship_Model_Shipment();
$intraship->load($shipment->getId(), 'shipment_id');
if (true === $multipack) {
$intraship->setPackages(array('package_0' => array('weight' => 0.1), 'package_1' => array('weight' => 0.2), 'package_2' => array('weight' => 0.3)))->save();
}
return $intraship;
}