0

我有几个针对某些客户群的目录价格规则。以登录客户的身份查看产品时,价格显示正确。我想创建一个库存文件,我可以将其发送给具有此折扣价的客户。我该怎么做?

我试过的:

  • 在获取产品集合之前为客户(使用 )启动会话Mage::getSingleton('customer/session')->loginById($customerId),但这似乎并没有影响$product->getFinalPrice().

    编辑:我还应该说,我已经通过从会话中回显客户组 ID 来确认会话正常工作。

  • 将产品添加到sales/quote为该客户创建的产品中,然后降低价格,quote_item但这也不起作用。

  • 我跟着Mage_Catalog_Model_Product::getFinalPrice()发现了两个事件观察者,Mage_CatalogRule_Model_Observer::processFrontFinalPrice()processAdminFinalPrice()。看起来我应该能够在产品上设置一个客户组 ID,所以我也尝试过这样做......不走运。确定客户组ID的逻辑processFrontFinalPrice()如下所示:

    if ($observer->hasCustomerGroupId()) {
        $gId = $observer->getEvent()->getCustomerGroupId();
    } elseif ($product->hasCustomerGroupId()) {
        $gId = $product->getCustomerGroupId();
    } else {
        $gId = Mage::getSingleton('customer/session')->getCustomerGroupId();
    }
    
4

1 回答 1

0

你检查方法头了吗?public function login($username, $password). 您不能将 login() 与 customerId 一起使用。

但是还有:

Mage::getSingleton('customer/session')->loginById($customerId);
于 2013-02-18T21:21:05.073 回答