本文整理汇总了PHP中Magento\Quote\Model\Quote::setCustomerId方法的典型用法代码示例。如果您正苦于以下问题:PHP Quote::setCustomerId方法的具体用法?PHP Quote::setCustomerId怎么用?PHP Quote::setCustomerId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Quote\Model\Quote
的用法示例。
在下文中一共展示了Quote::setCustomerId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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(\Magento\Customer\Model\Group::NOT_LOGGED_IN_ID);
}
$this->quote->assignCustomer($this->proxyOrder->getCustomer());
}
示例2: testSaveShippingWithCustomerId
/**
* @magentoAppIsolation enabled
* @magentoDbIsolation enabled
* @magentoDataFixture Magento/Customer/_files/customer.php
* @magentoDataFixture Magento/Customer/_files/customer_address.php
*/
public function testSaveShippingWithCustomerId()
{
$this->_currentQuote->setCustomerId(1)->save();
$data = ['address_id' => '', 'firstname' => 'Joe', 'lastname' => 'Black', 'company' => 'Lunatis', 'street' => ['1100 Parmer', 'ln.'], 'city' => 'Austin', 'region_id' => '57', 'region' => '', 'postcode' => '78757', 'country_id' => 'US', 'telephone' => '(512) 999-9999', 'fax' => '', 'save_in_address_book' => 1];
$this->_model->saveShipping($data, 1);
$address = $this->_currentQuote->getShippingAddress();
/* Verify that data from Customer Address identified by id=1 is set */
$this->assertEquals('John', $address->getFirstname());
$this->assertEquals('Smith', $address->getLastname());
$this->assertEquals(['Green str, 67'], $address->getStreet());
$this->assertEquals('CityM', $address->getCity());
$this->assertEquals('Alabama', $address->getRegion());
$this->assertEquals(1, $address->getRegionId());
$this->assertEquals('75477', $address->getPostcode());
$this->assertEquals('US', $address->getCountryId());
$this->assertEquals('3468676', $address->getTelephone());
$this->assertEquals('customer@example.com', $address->getEmail());
$this->assertTrue($address->getCollectShippingRates());
$this->assertEquals(1, $address->getCustomerAddressId());
}
示例3: prepareGuestQuote
/**
* Prepare quote for guest checkout order submit
*
* @param Quote $quote
* @return void
*/
private function prepareGuestQuote(Quote $quote)
{
$quote->setCustomerId(null)->setCustomerEmail($quote->getBillingAddress()->getEmail())->setCustomerIsGuest(true)->setCustomerGroupId(Group::NOT_LOGGED_IN_ID);
}