以编程方式将客户分配给报价

时间:2015-09-24 07:27:02

标签: php magento quote sales customer

我为登录和addtocart操作创建了一个自定义api。当用户未登录并将产品添加到保存引号ID的购物车时以及当用户使用my api登录时,我想将此客户分配给我之前保存的报价。我曾经用于分配的代码报价的客户如下。

$quoteId = '1720';
$customer = Mage::getModel('customer/customer');
$customer->loadByEmail($email);
$quote          =    Mage::getModel('sales/quote')->load($quoteId);
$quote->assignCustomer($customer);

但是当这不起作用时。当客户登录时,会针对用户创建新报价。但我希望客户被分配到他在登录前添加的上述报价。

1 个答案:

答案 0 :(得分:0)

这样做:

$quoteId = '1720';
$customer = Mage::getModel('customer/customer');
$customer->loadByEmail($email);
$quote = Mage::getModel('sales/quote')->load($quoteId);
$quote->setCustomer($customer);
$quote->save();

在我的测试中,购物车无法设置客户。

相关问题