intelipost / Magento2

Novo aplicativo Magento
1 stars 6 forks source link

`getCustomerGroupId` doesn't work on Magento2 #1

Closed heerdt closed 2 years ago

heerdt commented 2 years ago

https://github.com/intelipost/Magento2/blob/0454c4421ab496fae685c5cb4546db63f105abef/Helper/Data.php#L531

 if ($this->isAdmin()) {
            $currentGroupId = $this->backendSession->getQuote()->getCustomerGroupId();
        } else {
            $currentGroupId = $this->customerSession->getCustomerGroupId();
        }

This doesn't work, you should use:

 if ($this->isAdmin()) {
            $currentGroupId = $this->backendSession->getQuote()->getCustomer()->getGroupId();
        } else {
            $currentGroupId = $this->customerSession->getCustomer()->getGroupId();
        }
contardi commented 2 years ago

Hi Maycon, thanks for the comment.

Which version are you using?

heerdt commented 2 years ago

hey @contardi, version 2.4.2 enterprise.

heerdt commented 2 years ago

Maybe is because I am using GraphQL, could you confirm?

contardi commented 2 years ago

I'll see, both classes has the method "getCustomerGroupId"

Anyway I'll change to work without "getCustomerGroupId" method, I'll check if exists and if not, I'll call the customer class. Do you think it'll work for you?

heerdt commented 2 years ago

I am still using the old intelipost/magento2-quote. So I did my workaround rewriting the class in my codebase. Then realised the same problem in this repo. So it would be great if you can test the cart GraphQl call to confirm if it works or not.

Thank you anywany.

contardi commented 2 years ago

I don't have access to the old repository, this one is still a beta but the idea is to replace all the old repositories to this one. However I'll check anyway Thanks @heerdt

heerdt commented 2 years ago

Thanks @contardi. I can see great improvement in this repo. Looking forward to replace the old one.

contardi commented 2 years ago

The fix was applied, thanks again @heerdt

commit aa0deab1c4742843aca601da9713107b10f9f754 (HEAD -> master, origin/master)