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


PHP Mage_Sales_Model_Order::getAddressesCollection方法代码示例

本文整理汇总了PHP中Mage_Sales_Model_Order::getAddressesCollection方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Order::getAddressesCollection方法的具体用法?PHP Mage_Sales_Model_Order::getAddressesCollection怎么用?PHP Mage_Sales_Model_Order::getAddressesCollection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mage_Sales_Model_Order的用法示例。


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

示例1: _prepareOrderAddresses

 /**
  * @return array
  */
 protected function _prepareOrderAddresses()
 {
     /** @var Mage_Sales_Model_Order_Address[] $addresses */
     $addresses = $this->_order->getAddressesCollection();
     $data = array();
     if ($addresses) {
         foreach ($addresses as $address) {
             $address_data = array_filter(array('store_address_id' => $address->getCustomerAddressId(), 'type' => $address->getAddressType(), 'title' => '', 'prefix' => $address->getPrefix(), 'suffix' => $address->getSuffix(), 'first_name' => $address->getFirstname(), 'middle_name' => $address->getMiddlename(), 'last_name' => $address->getLastname(), 'company_name' => $address->getCompany(), 'street_address_1' => $address->getStreet1(), 'street_address_2' => $address->getStreet2(), 'street_address_3' => $address->getStreet3(), 'street_address_4' => $address->getStreet4(), 'city' => $address->getCity(), 'country_code' => $address->getCountry(), 'state' => '', 'region' => $address->getRegion(), 'region_code' => $address->getRegionCode(), 'zip_code' => $address->getPostcode(), 'telephone1' => $address->getTelephone(), 'telephone2' => '', 'telephone3' => '', 'fax' => $address->getFax(), 'vat_number' => $address->getData('vat_id')));
             $data[] = $address_data;
             unset($address);
         }
     }
     return $data;
 }
开发者ID:payin7-payments,项目名称:payin7-magento,代码行数:17,代码来源:Submit.php

示例2: afterSave

 /**
  * After save order billing address process
  *
  * @param Mage_Sales_Model_Order $object
  * @return Mage_Sales_Model_Entity_Order_Attribute_Backend_Billing
  */
 public function afterSave($object)
 {
     $billingAddressId = false;
     foreach ($object->getAddressesCollection() as $address) {
         /* @var $address Mage_Sales_Model_Order_Address */
         if ('billing' == $address->getAddressType()) {
             $billingAddressId = $address->getId();
         }
     }
     if ($billingAddressId) {
         $object->setBillingAddressId($billingAddressId);
         $this->getAttribute()->getEntity()->saveAttribute($object, $this->getAttribute()->getAttributeCode());
     }
     return $this;
 }
开发者ID:QiuLihua83,项目名称:magento-enterprise-1.13.1.0,代码行数:21,代码来源:Billing.php

示例3: _createCustomerFromOrder

 /**
  * Creates new customer from order, adds order addresses as customer addresses
  *
  * @param Mage_Sales_Model_Order|bool $order
  * @return Mage_Customer_Model_Customer
  */
 protected function _createCustomerFromOrder($order)
 {
     if (!$order instanceof Mage_Sales_Model_Order) {
         return false;
     }
     // Check if customer with email address exists
     $existingCustomer = Mage::getResourceModel('customer/customer_collection')->addFieldToFilter('email', $order->getCustomerEmail());
     if (Mage::getSingleton('customer/config_share')->isWebsiteScope()) {
         $existingCustomer->addFieldToFilter('website_id', $order->getWebsiteId());
     }
     $existingCustomer = $existingCustomer->getFirstItem();
     if (!$existingCustomer instanceof Mage_Customer_Model_Customer || !$existingCustomer->getId()) {
         return Mage::getModel('customer/customer');
     }
     // Create customer
     /** @var Mage_Customer_Model_Customer $customer */
     $customer = Mage::getModel('customer/customer')->setEmail($order->getCustomerEmail())->setStoreId($order->getStoreId())->setPrefix($order->getCustomerPrefix())->setFirstname($order->getCustomerFirstname())->setLastname($order->getCustomerLastname());
     $customer->save();
     // Create customer addresses
     foreach ($order->getAddressesCollection() as $orderAddress) {
         /** @var Mage_Sales_Model_Order_Address $orderAddress */
         /** @var Mage_Customer_Model_Address $address */
         $address = Mage::getModel('customer/address')->setParentId($customer->getEntityId())->setCustomerId($customer->getEntityId())->setIsActive(true)->setPrefix($orderAddress->getPrefix())->setFirstname($orderAddress->getFirstname())->setMiddlename($orderAddress->getMiddlename())->setLastname($orderAddress->getLastname())->setSuffix($orderAddress->getSuffix())->setStreet($orderAddress->getStreet())->setCity($orderAddress->getCity())->setPostcode($orderAddress->getPostcode())->setCountryId($orderAddress->getCountryId())->setTelephone($orderAddress->getTelephone())->setCompany($orderAddress->getCompany())->setRegion($orderAddress->getRegion())->setRegionId($orderAddress->getRegionId());
         $address->save();
         // Save default billing and shipping
         if ($orderAddress->getAddressType() == 'billing') {
             $customer->setDefaultBilling($address->getEntityId());
         } elseif ($orderAddress->getAddressType() == 'shipping') {
             $customer->setDefaultShipping($address->getEntityId());
         }
     }
     // Force confirmation
     $customer->setConfirmation($customer->getRandomConfirmationKey());
     $customer->save();
     return $customer;
 }
开发者ID:hsq,项目名称:Ho_Customer,代码行数:42,代码来源:Observer.php

示例4: _setShipGroups

 /**
  * Add ship groups to the request. For each address in the order, dispatch
  * an event for handling ship group destinations. For each ship group
  * destination added, trigger additional events for each item in the ship
  * group.
  *
  * @param Mage_Sales_Model_Order
  * @param IOrderCreateRequest
  * @return self
  */
 protected function _setShipGroups(Mage_Sales_Model_Order $order, IOrderCreateRequest $request)
 {
     $shipGroups = $request->getShipGroups();
     $orderItems = $request->getOrderItems();
     $destinations = $request->getDestinations();
     $itemCollection = $order->getItemsCollection();
     foreach ($order->getAddressesCollection() as $address) {
         $items = $this->_getItemsForAddress($address, $itemCollection);
         if ($items) {
             $shipGroups->offsetSet($this->_buildShipGroupForAddress($address, $items, $order, $shipGroups, $destinations, $orderItems));
         }
     }
     return $this;
 }
开发者ID:adderall,项目名称:magento-retail-order-management,代码行数:24,代码来源:Create.php

示例5: getPgAddress

 /**
  * Gets a PakjeGemak address for either a quote or an order object.
  *
  * @param Mage_Sales_Model_Quote|Mage_Sales_Model_Order $object
  *
  * @return false|Mage_Sales_Model_Order_Address|Mage_Sales_Model_Quote_Address|TIG_MyParcel2014_Model_Shipment
  */
 public function getPgAddress($object)
 {
     /**
      * Get all addresses for the specified object.
      */
     if ($object instanceof Mage_Sales_Model_Quote) {
         $addressCollection = $object->getAllAddresses();
     } elseif ($object instanceof Mage_Sales_Model_Order) {
         $addressCollection = $object->getAddressesCollection();
     } elseif ($object instanceof TIG_MyParcel2014_Model_Shipment) {
         $order = $object->getOrder();
         if (!$order) {
             return false;
         }
         $addressCollection = $order->getAddressesCollection();
     } else {
         return false;
     }
     /**
      * Go through each address and check if it's a PakjeGemak address.
      *
      * @var Mage_Sales_Model_Quote_Address|Mage_Sales_Model_Order_Address $address
      */
     $pgAddress = false;
     foreach ($addressCollection as $address) {
         if ($address->getAddressType() == self::PG_ADDRESS_TYPE) {
             $pgAddress = $address;
             break;
         }
     }
     /**
      * Return the PakjeGemak address or false if none was found.
      */
     return $pgAddress;
 }
开发者ID:myparcelnl,项目名称:magento1,代码行数:42,代码来源:Data.php

示例6: getPrimaryShippingAddress

 /**
  * get shipping address with the highest subtotal amount.
  *
  * @param Mage_Sales_Model_Order
  * @return Mage_Sales_Model_Order_Address|null
  */
 protected function getPrimaryShippingAddress(Mage_Sales_Model_Order $order)
 {
     $collection = $order->getAddressesCollection();
     $address = $collection->getItemByColumnValue('quote_address_id', $this->getQuotePrimaryShippingAddressId($order->getQuote()));
     return $address;
 }
开发者ID:WinstonN,项目名称:magento-retail-order-management,代码行数:12,代码来源:Ccpayment.php

示例7: array

 * 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();
    $order->getPaymentsCollection()->removeAllItems();
    $order->setIncrementId((string) (10000000 + $i))->setCreatedAt(date('Y-m-d H:i:s'))->setCustomerEmail("customer{$i}@example.com")->setBillingAddress($billingAddress)->setShippingAddress($shippingAddress)->addItem($item)->setPayment($payment);
    $order->save();
}
开发者ID:nemphys,项目名称:magento2,代码行数:31,代码来源:sales_100k_orders.php


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