1

I have a strange one.

I took a new install of magento, and a new theme and connected them to an existing magento website db.

When I log to my account as 'dealer' I can go to the homepages and interior pages and I am a dealer and can see my pricing.

As soon as I enter the cart my customer group is shown as the default group and not 'dealer', if I go back into the product pages I can see I am a dealer again.

Any clue to what in the world is going on?

I am using this to show my group:

<?
if(Mage::getSingleton('customer/session')->isLoggedIn()){
      // Get group Id
      $groupId = Mage::getSingleton('customer/session')->getCustomerGroupId();
      //Get customer Group name
      $group = Mage::getModel('customer/group')->load($groupId);
      echo $group->getCode();
}
?>

If you want to test you can create an account here and it will set you as 'Dealer'.

http://tinyurl.com/mqufujc

You can see it show the customer group on the top left if you are logged in.

I tried adding this at the top of the head.phtml and although it echoed the correct customer_group it did not solve the issue with the prices rendering incorrectly.

if(Mage::getSingleton('customer/session')->isLoggedIn()){
      // Get group Id
    $customerz = Mage::getSingleton('customer/session')->getCustomer();
    $email = $customerz->getEmail();
    $customerz->loadByEmail($email); //load customer by email id
    $newGroupId = $customerz->getGroupId(); 
    $customerz->setGroupId($newGroupId)->save();
}

I have uploaded all of the files from a fresh magento install app/code/core.

I have tried with the default theme and without and no change.

SOLVED

Thank you for your help, it was the Automatic Group Assignment issue.

This is a great module that I am using for the advanced login with automatic customer group assignment and custom fields. http://www.magentocommerce.com/magento-connect/registration-form-advanced.html

1

Because you're calling function getCode() with empty value – which's returning defualt group while you should call getCode($VALUE) – which's in your case $groupId which you've loaded one line above.

You have a mistake at line:

  echo $group->getCode();

while it should be:

  echo $group->getCode($groupId);

Change your code into:

<?php
if(Mage::getSingleton('customer/session')->isLoggedIn()){
      // Get group Id
      $groupId = Mage::getSingleton('customer/session')->getCustomerGroupId();
      //Get customer Group name
      $group = Mage::getModel('customer/group')->load($groupId);
      echo $group->getCode($groupId);
}
?>

Have a nice weekend,
versedi

  • I am sorry but that is not the case, I used your edit and am still getting the same result. The issue looks like a magento issue in the cart. For some reason it is not pulling the session group off it is just showing the default store customer group. – Matt Oct 18 '14 at 17:22
  • 1. Are you sure, your customer is logged in and is in other group then default one? check twice he's account information from Administrator Panel. 2. Are you sure you don't have Automatic Group Assignment Enabled? I've just tested this code on fresh Magento installation, cart page and everything's fine. – versedi Oct 19 '14 at 11:29
  • Automatic Group Assignment Enabled was enabled... I can't believe that was the issue the whole time! Thank you so much for your help. – Matt Oct 19 '14 at 16:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.