cancel
Showing results for 
Search instead for 
Did you mean: 

Customer Group - apply customer group for unauthenticated user

Customer Group - apply customer group for unauthenticated user

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