douqiao6015 2015-04-26 12:12
浏览 124

Magento - 未经身份验证的用户的客户组

In Magento I have set up 5 customer groups for pricing. The group table looks a bit like :-

Group ID | Group Name
1        | Northern Ireland
2        | Dublin
3        | Rest of Ireland
4        | Great Britain Zone 1
5        | Great Britain Zone 2 

Each Customer that registers is placed into one of these groups depending on the County/State in their address.

Our products are priced depending on the delivery location so our product pricing would be a bit like:

Product 1
Group ID | Price
1        | £1.99
2        | £2.99
3        | £3.99
4        | £4.99
5        | £5.99

This all works fine for logged in users as they have already been placed into a group so they will be displayed the correct price for their location.

I want to give an unauthenticated user the option of choosing their state from a dropdown list, I can then pass a variable through to select the correct group pricing.

I have been going through the various files trying to find the location to place the code and am looking at app/code/core/Mage/Bundle/Model/Product/Price.php

There is an if statement here that I think may be the correct block to edit.

if (!$gId) {
    $gId = Mage::getSingleton('customer/session')->getCustomerGroupId();
} else if ($gId instanceof Mage_Customer_Model_Group) {
    $gId = $gId->getId();
}

Could anyone confirm this? I would be looking at adding another else if:

if (!$gId) {
    $gId = Mage::getSingleton('customer/session')->getCustomerGroupId();
} else if ($gId instanceof Mage_Customer_Model_Group) {
    $gId = $gId->getId();
} else if **Session Variable Exists** {
    $gId = Session Variable;
}

Thanks for your help, Liam

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
    • ¥15 正弦信号发生器串并联电路电阻无法保持同步怎么办
    • ¥15 划分vlan后,链路不通了?
    • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
    • ¥15 个人网站被恶意大量访问,怎么办
    • ¥15 Vue3 大型图片数据拖动排序
    • ¥15 Centos / PETGEM
    • ¥15 划分vlan后不通了
    • ¥20 用雷电模拟器安装百达屋apk一直闪退
    • ¥15 算能科技20240506咨询(拒绝大模型回答)