本文整理汇总了PHP中Mage_Sales_Model_Quote::assignCustomer方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Quote::assignCustomer方法的具体用法?PHP Mage_Sales_Model_Quote::assignCustomer怎么用?PHP Mage_Sales_Model_Quote::assignCustomer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Quote
的用法示例。
在下文中一共展示了Mage_Sales_Model_Quote::assignCustomer方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initializeCustomer
private function initializeCustomer()
{
if ($this->proxyOrder->isCheckoutMethodGuest()) {
$this->quote->setCustomerId(null)->setCustomerEmail($this->proxyOrder->getBuyerEmail())->setCustomerFirstname($this->proxyOrder->getCustomerFirstName())->setCustomerLastname($this->proxyOrder->getCustomerLastName())->setCustomerIsGuest(true)->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID);
}
$this->quote->assignCustomer($this->proxyOrder->getCustomer());
}
示例2: initCheckout
/**
* Prepare quote, reserve order ID for specified quote
*
* @return string
*/
public function initCheckout()
{
$this->_quote->reserveOrderId()->save();
/**
* Reset multishipping flag before any manipulations with quote address
* addAddress method for quote object related on this flag
*/
if ($this->_quote->getIsMultiShipping()) {
$this->_quote->setIsMultiShipping(false);
$this->_quote->save();
}
/*
* want to load the correct customer information by assigning to address
* instead of just loading from sales/quote_address
*/
$customer = Mage::getSingleton('Mage_Customer_Model_Session')->getCustomer();
if ($customer) {
$this->_quote->assignCustomer($customer);
}
$quote = Mage::getSingleton('Mage_Checkout_Model_Session')->getQuote();
if (!Mage::getSingleton('Mage_Customer_Model_Session')->isLoggedIn() && Mage::helper('Mage_Checkout_Helper_Data')->isAllowedGuestCheckout($quote)) {
$this->_prepareGuestQuote();
}
return $this->_quote->getReservedOrderId();
}
示例3: getCustomerCart
/**
* Retrieve customer cart quote object model
*
* @return Mage_Sales_Model_Quote
*/
public function getCustomerCart()
{
if (!is_null($this->_cart)) {
return $this->_cart;
}
$this->_cart = Mage::getModel('sales/quote');
if ($this->getSession()->getCustomer()->getId()) {
$this->_cart->setStore($this->getSession()->getStore())->loadByCustomer($this->getSession()->getCustomer()->getId());
if (!$this->_cart->getId()) {
$this->_cart->assignCustomer($this->getSession()->getCustomer());
$this->_cart->save();
}
}
return $this->_cart;
}
示例4: _assignCustomer
/**
* @param $customerInfo
* [customer] => Array
* (
* [bindId] => 1 (int)
* [website] => 1 (int)
* [group] => 1 (int)
* [newsletter] => 0|1
* )
*
* @param $checkoutMode
* @param $billingAddress
* @param $needNotifyCustomer
* @return Ess_M2ePro_Model_MagentoSales
*/
protected function _assignCustomer($customerInfo, $checkoutMode, $billingAddress, $needNotifyCustomer)
{
$customer = Mage::getModel('customer/customer');
switch ($checkoutMode) {
default:
case Ess_M2ePro_Model_Accounts::ORDERS_CUSTOMER_MODE_GUEST:
$this->_quote->setCustomerId(null)->setCustomerEmail($billingAddress['email'])->setCustomerIsGuest(true)->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID);
return $this;
case Ess_M2ePro_Model_Accounts::ORDERS_CUSTOMER_MODE_NEW:
// Register each customer
// If we have customer with selected email - assign customer to quote
$customer->setWebsiteId($customerInfo['website']);
// Try to use storeId for customer
$customer->loadByEmail($billingAddress['email']);
if ($customer->getId()) {
// Customer this such email already exist
// If this customer need confirmation, manual activate
if ($customer->getConfirmation() && $customer->isConfirmationRequired()) {
$customer->setConfirmation(null);
$customer->save();
}
} else {
// We need to create customer and register it
$customer = $this->_createCustomer($billingAddress, $customerInfo['website'], $customerInfo['group'], $needNotifyCustomer, $customerInfo['newsletter']);
}
break;
case Ess_M2ePro_Model_Accounts::ORDERS_CUSTOMER_MODE_EXIST:
if (!$customerInfo['bindId']) {
throw new LogicException('The customer ID was not specified in eBay account settings for Predefined customer mode. ');
}
// Assign all checkout to single account
// Load account
$customer = Mage::getModel('customer/customer')->load($customerInfo['bindId']);
break;
}
if (!$customer->getId()) {
// Not found - Customer
throw new LogicException('Cannot find customer for order. It is not existed or was deleted.');
}
$this->_quote->assignCustomer($customer);
}
示例5: setCustomer
/**
* Setter for customer
*
* @param Mage_Customer_Model_Customer $customer
*
* @return Mage_Paypal_Model_Express_Checkout
*/
public function setCustomer($customer)
{
$this->_quote->assignCustomer($customer);
$this->_customerId = $customer->getId();
return $this;
}