当前位置: 首页>>代码示例>>PHP>>正文


PHP Mage_Sales_Model_Order_Address类代码示例

本文整理汇总了PHP中Mage_Sales_Model_Order_Address的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Order_Address类的具体用法?PHP Mage_Sales_Model_Order_Address怎么用?PHP Mage_Sales_Model_Order_Address使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Mage_Sales_Model_Order_Address类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testAddressActionNoVAT

 /**
  * @magentoDataFixture Mage/Adminhtml/controllers/Sales/_files/address.php
  */
 public function testAddressActionNoVAT()
 {
     $address = new Mage_Sales_Model_Order_Address();
     $address->load('a_unique_firstname', 'firstname');
     $this->getRequest()->setParam('address_id', $address->getId());
     $this->dispatch('admin/sales_order/address');
     $html = $this->getResponse()->getBody();
     $prohibitedStrings = array('validate-vat', 'validateVat', 'Validate VAT');
     foreach ($prohibitedStrings as $string) {
         $this->assertNotContains($string, $html, 'VAT button must not be shown while editing address', true);
     }
 }
开发者ID:NatashaOlut,项目名称:Mage_Test,代码行数:15,代码来源:OrderController.php

示例2: _communicateAddresUpdateToDpd

 /**
  *
  * @param Mage_Sales_Model_Order_Address $address
  *
  * @return boolean
  */
 protected function _communicateAddresUpdateToDpd(Mage_Sales_Model_Order_Address $address)
 {
     $shipsCollectionForOrder = Mage::getResourceModel('zitec_dpd/dpd_ship_collection');
     /* @var $shipsCollectionForOrder Zitec_Dpd_Model_Mysql4_Dpd_Ship_Collection */
     $shipsCollectionForOrder->setOrderFilter($address->getParentId());
     if (!$shipsCollectionForOrder->count()) {
         return false;
     }
     foreach ($shipsCollectionForOrder as $ship) {
         /* @var $ship Zitec_Dpd_Model_Dpd_Ship */
         $dpdShipment = unserialize($ship->getSaveShipmentCall());
         /* @var $dpdShipmnent Zitec_Dpd_Api_Shipment_Save */
         try {
             $response = $dpdShipment->setReceiverAddress($address)->execute();
             /* @var $response Zitec_Dpd_Api_Shipment_Save_Response */
         } catch (Exception $e) {
             Mage::throwException(sprintf($this->__('An error occurred updating the shipping address details with DPD: <br /> "%s"', $e->getMessage())));
         }
         if ($response->hasError()) {
             Mage::throwException(sprintf($this->__('DPD could not update the shipment address. The following error was returned: <br /> "%s: %s"'), $response->getErrorCode(), $response->getErrorText()));
         }
         try {
             $labelPdfStr = $this->_getWsHelper()->getNewPdfShipmentLabelsStr($response->getDpdShipmentId(), $response->getDpdShipmentReferenceNumber());
         } catch (Exception $e) {
             Mage::throwException(sprintf($this->__('An error occurred retrieving the updated shipping labels from DPD. <br />"s%"'), $e->getMessage()));
         }
         $ship->setSaveShipmentCall(serialize($dpdShipment))->setSaveShipmentResponse(serialize($response))->setShippingLabels(base64_encode($labelPdfStr))->save();
         Mage::getModel('sales/order_shipment')->load($ship->getShipmentId())->setShippingLabel($labelPdfStr)->save();
     }
     return true;
 }
开发者ID:GabrielCC,项目名称:zitec-dpd-master,代码行数:37,代码来源:Address.php

示例3: initAddress

 /**
  * Set correct values on subscription address based on given subscription and order address
  *
  * @param Adyen_Subscription_Model_Subscription $subscription
  * @param Mage_Sales_Model_Order_Address|Mage_Sales_Model_Quote_Address $address
  * @return $this
  */
 public function initAddress(Adyen_Subscription_Model_Subscription $subscription, $address)
 {
     $this->setSubscriptionId($subscription->getId());
     // Reset (possible) original values
     $this->setOrderAddressId(null)->setCustomerAddressId(null)->setQuoteAddressId(null);
     if ($address->getAddressType() == Mage_Sales_Model_Order_Address::TYPE_BILLING) {
         $this->setType(self::ADDRESS_TYPE_BILLING);
     } else {
         $this->setType(self::ADDRESS_TYPE_SHIPPING);
     }
     // Note: Only use customer address if 'save_in_address_book' or 'same_as_billing'
     // is also checked at the address, because it's not enough to rely solely on the
     // customer address ID, because an address can be changed when creating an order
     // in the backend, but this ID still remains when a quote is converted to an order
     if ($address->getCustomerAddressId() && $address->getData('save_in_address_book')) {
         // Create customer address
         $this->setSource(self::ADDRESS_SOURCE_CUSTOMER)->setCustomerAddressId($address->getCustomerAddressId());
     } elseif ($address instanceof Mage_Sales_Model_Quote_Address) {
         // Create quote address
         $this->setSource(self::ADDRESS_SOURCE_QUOTE)->setQuoteAddressId($address->getId());
     } else {
         // Create order address
         $this->setSource(self::ADDRESS_SOURCE_ORDER)->setOrderAddressId($address->getId());
     }
     return $this;
 }
开发者ID:Adyen,项目名称:adyen-magento-subscription,代码行数:33,代码来源:Address.php

示例4: initAddress

 /**
  * Set correct values on subscription address based on given subscription and order address
  *
  * @param Adyen_Subscription_Model_Subscription $subscription
  * @param Mage_Sales_Model_Order_Address|Mage_Sales_Model_Quote_Address $address
  * @return $this
  */
 public function initAddress(Adyen_Subscription_Model_Subscription $subscription, $address)
 {
     $this->setSubscriptionId($subscription->getId());
     // Reset (possible) original values
     $this->setOrderAddressId(null)->setCustomerAddressId(null)->setQuoteAddressId(null);
     if ($address->getAddressType() == Mage_Sales_Model_Order_Address::TYPE_BILLING) {
         $this->setType(self::ADDRESS_TYPE_BILLING);
     } else {
         $this->setType(self::ADDRESS_TYPE_SHIPPING);
     }
     if ($address instanceof Mage_Sales_Model_Quote_Address) {
         // Create quote address
         $this->setSource(self::ADDRESS_SOURCE_QUOTE)->setQuoteAddressId($address->getId());
     } else {
         // Create order address
         $this->setSource(self::ADDRESS_SOURCE_ORDER)->setOrderAddressId($address->getId());
     }
     return $this;
 }
开发者ID:sandermangel,项目名称:adyen-magento-subscription,代码行数:26,代码来源:Address.php

示例5: Mage_Sales_Model_Order_Address

 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/osl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category    Magento
 * @package     Mage_Sales
 * @subpackage  integration_tests
 * @copyright   Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
 * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */
$addressData = (include __DIR__ . '/address_data.php');
$billingAddress = new Mage_Sales_Model_Order_Address($addressData);
$billingAddress->setAddressType('billing');
$shippingAddress = clone $billingAddress;
$shippingAddress->setId(null)->setAddressType('shipping');
$payment = new Mage_Sales_Model_Order_Payment();
$payment->setMethod('verisign')->setCcExpMonth('5')->setCcLast4('0005')->setCcType('AE')->setCcExpYear('2016');
$order = new Mage_Sales_Model_Order();
$order->setIncrementId('100000001')->setSubtotal(100)->setBaseSubtotal(100)->setCustomerIsGuest(true)->setBillingAddress($billingAddress)->setShippingAddress($shippingAddress)->setStoreId(Mage::app()->getStore()->getId())->setPayment($payment);
$order->save();
开发者ID:nemphys,项目名称:magento2,代码行数:31,代码来源:order_paid_with_verisign.php

示例6: _getAddress

 /**
  * @param Mage_Sales_Model_Order_Address $source
  * @param string $type
  *
  * @return WirecardCEE_Stdlib_ConsumerData_Address
  */
 protected function _getAddress($source, $type = 'billing')
 {
     switch ($type) {
         case 'shipping':
             $address = new WirecardCEE_Stdlib_ConsumerData_Address(WirecardCEE_Stdlib_ConsumerData_Address::TYPE_SHIPPING);
             break;
         default:
             $address = new WirecardCEE_Stdlib_ConsumerData_Address(WirecardCEE_Stdlib_ConsumerData_Address::TYPE_BILLING);
             break;
     }
     $address->setFirstname($source->getFirstname());
     $address->setLastname($source->getLastname());
     $address->setAddress1($source->getStreet1());
     $address->setAddress2($source->getStreet2());
     $address->setZipCode($source->getPostcode());
     $address->setCity($source->getCity());
     $address->setCountry($source->getCountry());
     $address->setState($source->getRegionCode());
     $address->setPhone($source->getTelephone());
     $address->setFax($source->getFax());
     return $address;
 }
开发者ID:wirecard,项目名称:magento-wcs,代码行数:28,代码来源:Abstract.php

示例7: _getAddressInfo

 /**
  * Create address request data
  *
  * @param Mage_Sales_Model_Order_Address $address
  * @return array
  */
 protected function _getAddressInfo($address)
 {
     $result = array();
     foreach ($this->_addressFileds as $addressField) {
         if ($address->hasData($addressField)) {
             $result[$addressField] = $address->getData($addressField);
         }
     }
     //Streets must be transfered separately
     $streets = $address->getStreet();
     $result['street'] = array_shift($streets);
     if ($street2 = array_shift($streets)) {
         $result['street2'] = $street2;
     }
     //Region code lookup
     $region = Mage::getModel('directory/region')->load($address->getData('region_id'));
     if ($region && $region->getId()) {
         $result['region'] = $region->getCode();
     } else {
         $result['region'] = $address->getRegion();
     }
     return $result;
 }
开发者ID:hyhoocchan,项目名称:mage-local,代码行数:29,代码来源:Pbridge.php

示例8: _getShopgateAddressFromOrderAddress

 /**
  * @param Mage_Sales_Model_Order_Address $address
  * @return array
  */
 protected function _getShopgateAddressFromOrderAddress($address)
 {
     $shopgateAddress = new ShopgateAddress();
     $shopgateAddress->setFirstName($address->getFirstname());
     $shopgateAddress->setLastName($address->getLastname());
     $shopgateAddress->setGender($this->_getCustomerHelper()->getShopgateCustomerGender($address));
     $shopgateAddress->setCompany($address->getCompany());
     $shopgateAddress->setPhone($address->getTelephone());
     $shopgateAddress->setStreet1($address->getStreet1());
     $shopgateAddress->setStreet2($address->getStreet2());
     $shopgateAddress->setCity($address->getCity());
     $shopgateAddress->setZipcode($address->getPostcode());
     $shopgateAddress->setCountry($address->getCountry());
     $shopgateAddress->setState($this->_getHelper()->getIsoStateByMagentoRegion($address));
     return $shopgateAddress->toArray();
 }
开发者ID:buttasg,项目名称:cowgirlk,代码行数:20,代码来源:Orders.php

示例9: addAddress

 public function addAddress(Mage_Sales_Model_Order_Address $address)
 {
     $address->setOrder($this)->setParentId($this->getId());
     if (!$address->getId()) {
         $this->getAddressesCollection()->addItem($address);
     }
     return $this;
 }
开发者ID:blazeriaz,项目名称:youguess,代码行数:8,代码来源:Order.php

示例10: _isAddressBillingAddress

 /**
  * Check if the address is a billing address.
  *
  * @param Mage_Sales_Model_Order_Address
  * @return bool
  */
 protected function _isAddressBillingAddress(Mage_Sales_Model_Order_Address $address)
 {
     return $address->getAddressType() === Mage_Sales_Model_Order_Address::TYPE_BILLING;
 }
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:10,代码来源:Factory.php

示例11: importOrderAddress

 /**
  * Import address data from order address
  *
  * @param   Mage_Sales_Model_Order_Address $address
  * @return  Mage_Sales_Model_Quote_Address
  */
 public function importOrderAddress(Mage_Sales_Model_Order_Address $address)
 {
     $this->setAddressType($address->getAddressType())->setCustomerId($address->getCustomerId())->setCustomerAddressId($address->getCustomerAddressId())->setEmail($address->getEmail());
     Mage::helper('Mage_Core_Helper_Data')->copyFieldset('sales_convert_order_address', 'to_quote_address', $address, $this);
     return $this;
 }
开发者ID:relue,项目名称:magento2,代码行数:12,代码来源:Address.php

示例12: addressToQuoteAddress

 /**
  * Convert order address to quote address
  *
  * @param   Mage_Sales_Model_Order_Address $address
  * @return  Mage_Sales_Model_Quote_Address
  */
 public function addressToQuoteAddress(Mage_Sales_Model_Order_Address $address)
 {
     $quoteAddress = AO::getModel('sales/quote_address')->setStoreId($address->getStoreId())->setAddressType($address->getAddressType())->setCustomerId($address->getCustomerId())->setCustomerAddressId($address->getCustomerAddressId());
     AO::helper('core')->copyFieldset('sales_convert_order_address', 'to_quote_address', $address, $quoteAddress);
     //            ->setPrefix($address->getPrefix())
     //            ->setFirstname($address->getFirstname())
     //            ->setMiddlename($address->getMiddlename())
     //            ->setLastname($address->getLastname())
     //            ->setSuffix($address->setSuffix())
     //            ->setCompany($address->getCompany())
     //            ->setStreet($address->getStreet(-1))
     //            ->setCity($address->getCity())
     //            ->setRegion($address->getRegion())
     //            ->setRegionId($address->getRegionId())
     //            ->setPostcode($address->getPostcode())
     //            ->setCountryId($address->getCountryId())
     //            ->setTelephone($address->getTelephone())
     //            ->setFax($address->getFax());
     return $quoteAddress;
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:26,代码来源:Convert_Order.php

示例13: _getInternationalFullStreet

 /**
  * Generate the entire global address at two address fields
  *
  * @param Mage_Sales_Model_Order_Address $address
  *
  * @return string
  */
 protected function _getInternationalFullStreet($address)
 {
     if (!$address->getStreet2()) {
         return preg_replace("/[\n\r]/", " ", $address->getStreetFull());
     }
     $numberBeforeStreetCountry = array('CN', 'FR', 'GR', 'IE', 'IL', 'JP', 'LU', 'MY', 'MA', 'NZ', 'SG', 'GB');
     if (in_array($address->getCountry(), $numberBeforeStreetCountry)) {
         return $address->getStreet2() . ' ' . $address->getStreet1();
     } else {
         return preg_replace("/[\n\r]/", " ", $address->getStreetFull());
     }
 }
开发者ID:myparcelnl,项目名称:magento1,代码行数:19,代码来源:Data.php

示例14: Mage_Sales_Model_Order_Address

<?php

/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/osl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category    Magento
 * @package     Mage_Adminhtml
 * @subpackage  integration_tests
 * @copyright   Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
 * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */
$address = new Mage_Sales_Model_Order_Address();
$address->setRegion('CA')->setPostcode('90210')->setFirstname('a_unique_firstname')->setLastname('lastname')->setStreet('street')->setCity('Beverly Hills')->setEmail('admin@example.com')->setTelephone('1111111111')->setCountryId('US')->setAddressType('shipping')->save();
开发者ID:nemphys,项目名称:magento2,代码行数:29,代码来源:address.php

示例15: array

 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category    Magento
 * @package     Mage_Sales
 * @subpackage  integration_tests
 * @copyright   Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
 * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */
$addressData = array('region' => 'CA', 'postcode' => '11111', 'street' => 'street', 'city' => 'Los Angeles', 'telephone' => '11111111', 'country_id' => 'US');
$billingAddress = new Mage_Sales_Model_Order_Address($addressData);
$shippingAddress = clone $billingAddress;
$item = new Mage_Sales_Model_Order_Item();
$item->setOriginalPrice(100)->setPrice(100)->setQtyOrdered(1)->setRowTotal(100)->setSubtotal(100);
$payment = new Mage_Sales_Model_Order_Payment();
$payment->setMethod('checkmo');
$order = new Mage_Sales_Model_Order();
$order->setBaseSubtotal(100)->setSubtotal(100)->setBaseGrandTotal(100)->setGrandTotal(100)->setTotalPaid(100)->setCustomerIsGuest(true)->setState(Mage_Sales_Model_Order::STATE_NEW, true)->setStoreId(Mage::app()->getStore()->getId());
for ($i = 1; $i <= 100000; $i++) {
    $billingAddress->setId(null)->setFirstname("Name {$i}")->setLastname("Lastname {$i}")->setEmail("customer{$i}@example.com");
    $shippingAddress->setId(null)->setFirstname("Name {$i}")->setLastname("Lastname {$i}")->setEmail("customer{$i}@example.com");
    $item->setId(null)->setSku("item{$i}");
    $payment->setId(null);
    $order->setId(null);
    $order->getItemsCollection()->removeAllItems();
    $order->getAddressesCollection()->removeAllItems();
开发者ID:nemphys,项目名称:magento2,代码行数:31,代码来源:sales_100k_orders.php


注:本文中的Mage_Sales_Model_Order_Address类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。