2

While debugging the shopping cart price rule calculation i found out that the system uses the default_group configured in backend instead of the actual customer group on this customer group sensitive rule.

It seems to me that this is a bug. But i have never heard of this. I am quite sure there is no custom code responsible for this. When i look into sales_flat_quote db table the customer group id is correctly set with the actual customers group id.

Any hints on this topic?

I checked this in class

code/core/Mage/SalesRule/Model/Quote/Discount.php

in method

collect()

This is the proof:

        Mage::log("BEFORE ENTERING CALCULATOR WE SEE default_group ID");
        Mage::log($quote->getCustomerGroupId());
        $this->_calculator->init($store->getWebsiteId(), $quote->getCustomerGroupId(), $quote->getCouponCode());

I am still debugging but maybe you guys have some hint from experiencing same problems...thank you so much!

P.S.: this is found in EE 1.12 but i am sure its in 1.7.0.2 too.

  • I'm also on 1.7.0.2, same here. I need the vat check for my B2B website, but can not use de VAT check because this is buged like mentioned. When I put auto VAT-check to YES then cartrules won't apply If set to NO there's no problem whith the rules. Would be happy whith an solution too. Anybody on the right track? KR Jerry (NL) – user5213 Feb 12 '14 at 19:11
2

We experienced the same problem with a Magento 1.7.0.2 webshop.

Fortunately this bug was fixed in Magento 1.8.1.0 (I didn't check 1.8.0.0) and can easily by ported over to Magento 1.7.

You have to take a look at the difference between the method changeQuoteCustomerGroupId of the class Mage_Sales_Model_Observer from Magento 1.7.0.2 and 1.8.1.0 Those differences are the fix for the bug.

➜ diff ~/Projects/magento1702/app/code/core/Mage/Sales/Model/Observer.php ~/Projects/magento1810/app/code/core/Mage/Sales/Model/Observer.php
23c23
<  * @copyright   Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
---
>  * @copyright   Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
420a421
>         $isDisableAutoGroupChange = $customerInstance->getDisableAutoGroupChange();
440c441,443
<         if (empty($customerVatNumber) || !Mage::helper('core')->isCountryInEU($customerCountryCode)) {
---
>         if ((empty($customerVatNumber) || !Mage::helper('core')->isCountryInEU($customerCountryCode))
>             && !$isDisableAutoGroupChange
>         ) {
488,490c491,497
<         $groupId = $customerHelper->getCustomerGroupIdBasedOnVatNumber(
<             $customerCountryCode, $gatewayResponse, $customerInstance->getStore()
<         );
---
>         if (!$isDisableAutoGroupChange) {
>             $groupId = $customerHelper->getCustomerGroupIdBasedOnVatNumber(
>                 $customerCountryCode, $gatewayResponse, $customerInstance->getStore()
>             );
>         } else {
>             $groupId = $quoteInstance->getCustomerGroupId();
>         }
1

Found the problem. Some magento inc. coder does the following in the core:

if (empty($customerVatNumber) || !Mage::helper('core')->isCountryInEU($customerCountryCode)) { $groupId = ($customerInstance->getId()) ? $customerHelper->getDefaultCustomerGroupId($storeId) : Mage_Customer_Model_Group::NOT_LOGGED_IN_ID;

You find this in class:

Mage_Sales_Model_Observer

line 440

The result is that during sales shopping cart rules processing the quote will always have default group or not logged in group. This is definitely a core bug!

0

This Do you have Enable Automatic Assignment to Customer Group turned on (under System=>Configuration=>Customer Configuration)? If so then Magento checks to see if the VAT number entered is valid and assign the configured default group.

  • VAT Settings should not conflict with SalesRules. Its ok to check Customers and set them dynamically in VAT related logic, but if SalesRules cannot be applied based on customer groups its obviously a bug. – Michael Leiss Aug 25 '13 at 17:06
  • The VAT settings override the customergroup before the salesrules are checked. As the option states is changes the customergroup automatically, does the salesrule work when you disable the Automatic group assignment? – Vladimir Kerkhoff Aug 25 '13 at 17:36
  • Thanks for trying to help, but i solved it already. I try one more time to explain the problem: 1. Customers are set to my configured group "Special Member" as default, which is working correct and needed. 2. If you enter a new salesrule to be enabled for another customer group it doesnt get applied, because in any case the default group is used while checking if the rule has to be applied. So any configuration in the salesrule concerning customer groups is completely useless and overriden. Its crap and not usable. – Michael Leiss Aug 25 '13 at 17:50
0

I have the same problem on my system (1.7.0.2) and it looks like a bug to me. Under Customer configuration, if "Enable Automatic Customer Assignment to Group" is set to Yes, any discounts setup for special groups show OK in the Catalog, but are calculated incorrectly for the Cart.

It would appear that, somewhere, Magento checks for a valid VAT number, and when it does not validate, it temporarily sets the Customer's group to the default (General in my case) and uses it to do the Cart calculation, this is despite the Customer account being explicitly set to "Disable Automatic Group Change Based on VAT ID"

In 1.7.0.2 the VAT number validation doesn't appear to work anyway, so I disabled it and the Cart prices are now shown correctly.

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.