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


PHP Mage_Customer_Model_Customer::save方法代码示例

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


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

示例1: _saveCustomerAfterOrder

 /**
  * Save customer
  *
  * @param Mage_Customer_Model_Customer $order
  */
 protected function _saveCustomerAfterOrder($order)
 {
     if ($this->_customer) {
         if (!$this->_customer->getId()) {
             $this->_customer->save();
             $order->setCustomerId($this->_customer->getId());
             $this->getBillingAddress()->setCustomerId($this->_customer->getId());
             $this->getShippingAddress()->setCustomerId($this->_customer->getId());
             $this->_customer->sendNewAccountEmail();
         } else {
             $saveCusstomerAddress = false;
             if ($this->getBillingAddress()->getSaveInAddressBook()) {
                 $billingAddress = $this->getBillingAddress()->exportCustomerAddress();
                 if ($this->getBillingAddress()->getCustomerAddressId()) {
                     $billingAddress->setId($this->getBillingAddress()->getCustomerAddressId());
                 }
                 $this->_customer->addAddress($billingAddress);
                 $saveCusstomerAddress = true;
             }
             if ($this->getShippingAddress()->getSaveInAddressBook()) {
                 $shippingAddress = $this->getShippingAddress()->exportCustomerAddress();
                 if ($this->getShippingAddress()->getCustomerAddressId()) {
                     $shippingAddress->setId($this->getShippingAddress()->getCustomerAddressId());
                 }
                 $this->_customer->addAddress($shippingAddress);
                 $saveCusstomerAddress = true;
             }
             if ($saveCusstomerAddress) {
                 $this->_customer->save();
             }
         }
     }
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:38,代码来源:Sales_Order_Create.php

示例2: loginByCustomer

 public function loginByCustomer(Mage_Customer_Model_Customer $customer)
 {
     if ($customer->getConfirmation()) {
         $customer->setConfirmation(null);
         $customer->save();
     }
     Mage::getSingleton('customer/session')->setCustomerAsLoggedIn($customer);
 }
开发者ID:markus99,项目名称:Inchoo_SocialConnect,代码行数:8,代码来源:Google.php

示例3: _saveCustomerAfterOrder

 /**
  * Save customer
  *
  * @deprecated after 1.4.0.0.
  * @param Mage_Customer_Model_Customer $order
  */
 protected function _saveCustomerAfterOrder($order)
 {
     if ($this->_customer) {
         if (!$this->_customer->getId()) {
             $billing = $this->getBillingAddress();
             $customerBilling = $billing->exportCustomerAddress();
             $shipping = $this->getShippingAddress();
             $customerShipping = $shipping->exportCustomerAddress();
             $this->_customer->addAddress($customerBilling);
             if (!$shipping->getSameAsBilling()) {
                 $this->_customer->addAddress($customerShipping);
             }
             // preliminary save to find addresses id
             $this->_customer->save();
             // setting default addresses id
             $defShipping = $shipping->getSameAsBilling() ? $customerBilling->getId() : $customerShipping->getId();
             $this->_customer->setDefaultBilling($customerBilling->getId())->setDefaultShipping($defShipping)->save();
             $order->setCustomerId($this->_customer->getId());
             $billing->setCustomerId($this->_customer->getId());
             $shipping->setCustomerId($this->_customer->getId());
             $this->_customer->sendNewAccountEmail('registered', '', $order->getStoreId());
         } else {
             $saveCusstomerAddress = false;
             if ($this->getBillingAddress()->getSaveInAddressBook()) {
                 $billingAddress = $this->getBillingAddress()->exportCustomerAddress();
                 if ($this->getBillingAddress()->getCustomerAddressId()) {
                     $billingAddress->setId($this->getBillingAddress()->getCustomerAddressId());
                 }
                 $this->_customer->addAddress($billingAddress);
                 $saveCusstomerAddress = true;
             }
             if ($this->getShippingAddress()->getSaveInAddressBook()) {
                 $shippingAddress = $this->getShippingAddress()->exportCustomerAddress();
                 if ($this->getShippingAddress()->getCustomerAddressId()) {
                     $shippingAddress->setId($this->getShippingAddress()->getCustomerAddressId());
                 }
                 $this->_customer->addAddress($shippingAddress);
                 $saveCusstomerAddress = true;
             }
             if ($saveCusstomerAddress) {
                 $this->_customer->save();
             }
         }
     }
 }
开发者ID:beejhuff,项目名称:magento-1.13.0.2,代码行数:51,代码来源:Create.php

示例4: setCustomer

 /**
  * Set the customer account (if any) for the card.
  */
 public function setCustomer(Mage_Customer_Model_Customer $customer, Mage_Payment_Model_Info $payment = null)
 {
     if ($customer->getEmail() != '') {
         $this->setCustomerEmail($customer->getEmail());
         /**
          * Make an ID if we don't have one (and hope this doesn't break anything)
          */
         if ($customer->getId() < 1) {
             $customer->save();
         }
         $this->setCustomerId($customer->getId());
         parent::setCustomer($customer);
     } elseif (!is_null($payment)) {
         $model = null;
         /**
          * If we have no email, try to find it from current scope data.
          */
         if ($payment->getQuote() != null && $payment->getQuote()->getBillingAddress() != null && $payment->getQuote()->getBillingAddress()->getCustomerEmail() != '') {
             $model = $payment->getQuote();
         } elseif ($payment->getOrder() != null && ($payment->getOrder()->getCustomerEmail() != '' || $payment->getOrder()->getBillingAddress() != null && $payment->getOrder()->getBillingAddress()->getCustomerEmail() != '')) {
             $model = $payment->getOrder();
         } else {
             /**
              * This will fall back to checkout/session if onepage has no quote loaded.
              * Should work for all checkouts that use normal Magento processes.
              */
             $model = Mage::getSingleton('checkout/type_onepage')->getQuote();
         }
         if (!is_null($model)) {
             if ($model->getCustomerEmail() == '' && $model->getBillingAddress() instanceof Varien_Object && $model->getBillingAddress()->getEmail() != '') {
                 $model->setCustomerEmail($model->getBillingAddress()->getEmail());
             }
             if ($model->hasEmail()) {
                 $this->setCustomerEmail($model->getEmail());
             } elseif ($model->hasCustomerEmail()) {
                 $this->setCustomerEmail($model->getCustomerEmail());
             }
             $this->setCustomerId(intval($model->getCustomerId()));
         }
     }
     return $this;
 }
开发者ID:billadams,项目名称:forever-frame,代码行数:45,代码来源:Card.php

示例5: array

 *
 * 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_ImportExport
 * @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)
 */
$customers = array();
$customer = new Mage_Customer_Model_Customer();
$customer->setWebsiteId(1)->setEntityId(1)->setEntityTypeId(1)->setAttributeSetId(0)->setEmail('customer@example.com')->setPassword('password')->setGroupId(1)->setStoreId(1)->setIsActive(1)->setFirstname('Firstname')->setLastname('Lastname')->setDefaultBilling(1)->setDefaultShipping(1);
$customer->isObjectNew(true);
$customer->save();
$customers[] = $customer;
$customer = new Mage_Customer_Model_Customer();
$customer->setWebsiteId(1)->setEntityId(2)->setEntityTypeId(1)->setAttributeSetId(0)->setEmail('julie.worrell@example.com')->setPassword('password')->setGroupId(1)->setStoreId(1)->setIsActive(1)->setFirstname('Julie')->setLastname('Worrell')->setDefaultBilling(1)->setDefaultShipping(1);
$customer->isObjectNew(true);
$customer->save();
$customers[] = $customer;
$customer = new Mage_Customer_Model_Customer();
$customer->setWebsiteId(1)->setEntityId(3)->setEntityTypeId(1)->setAttributeSetId(0)->setEmail('david.lamar@example.com')->setPassword('password')->setGroupId(1)->setStoreId(1)->setIsActive(1)->setFirstname('David')->setLastname('Lamar')->setDefaultBilling(1)->setDefaultShipping(1);
$customer->isObjectNew(true);
$customer->save();
$customers[] = $customer;
Mage::unregister('_fixture/Mage_ImportExport_Customer_Collection');
Mage::register('_fixture/Mage_ImportExport_Customer_Collection', $customers);
开发者ID:nemphys,项目名称:magento2,代码行数:31,代码来源:customers.php

示例6: _registerSetBasicData

 /**
  * Set customers basic data like name, gender etc.
  *
  * @param Mage_Customer_Model_Customer $magentoCustomer
  * @param ShopgateCustomer             $shopgateCustomer
  *
  * @return Mage_Customer_Model_Customer $magentoCustomer
  */
 protected function _registerSetBasicData($magentoCustomer, $shopgateCustomer)
 {
     $magentoCustomer->setConfirmation(null);
     $magentoCustomer->setFirstname($shopgateCustomer->getFirstName());
     $magentoCustomer->setLastname($shopgateCustomer->getLastName());
     $magentoCustomer->setGender($this->getMagentoCustomerGender($shopgateCustomer->getGender()));
     $magentoCustomer->setDob($shopgateCustomer->getBirthday());
     $magentoCustomer->setForceConfirmed(true);
     $magentoCustomer->save();
     $magentoCustomer->sendNewAccountEmail('registered', '', $magentoCustomer->getStore()->getId());
     return $magentoCustomer;
 }
开发者ID:buttasg,项目名称:cowgirlk,代码行数:20,代码来源:Customer.php


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