VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: p.barg on December 11, 2015, 16:08:47 PM

Title: product variant restriction to shopper group
Post by: p.barg on December 11, 2015, 16:08:47 PM
Hello,
the restriction of products to specific shopper groups only seems to work for (main) products, but not for variants.
I was going to add a variant of a product that should only be visible for a specified shoppergroup, but the variant is shown in the dropdown for all customers.
Is there a way (other than create a new product for this shoppergroup) to achieve this?

Thanks

Petra

J.3.4.5 /  VM 3.0.12
Title: Re: product variant restriction to shopper group
Post by: Milbo on December 13, 2015, 21:07:44 PM
You mean a MV or GV? It should work with children.
Title: Re: product variant restriction to shopper group
Post by: p.barg on December 14, 2015, 08:53:39 AM
Hi Milbo,
we're using standard variants, but I've also tried with Multivariants. Doesn't work either for me...
Works perfectly with main products. Maybe I'm missing some setting?

Petra
Title: Re: product variant restriction to shopper group
Post by: Milbo on December 16, 2015, 19:52:21 PM
What are standard variants? I have to update the german wording. it is horrible, yeh.

Standard variants are for me done without children.
Then there are the generic child variants
and the Multivariants.
Title: Re: product variant restriction to shopper group
Post by: p.barg on December 16, 2015, 22:10:57 PM
Hi Max,
I'm talking about Generic Child Variants and Multivariants.

-- Petra
Title: Re: product variant restriction to shopper group
Post by: Milbo on December 17, 2015, 01:00:56 AM
the child has the same groups as the parent as long not overriden. Be aware that shoppergroups can remove the standard group or keep it.
Title: Re: product variant restriction to shopper group
Post by: p.barg on December 17, 2015, 08:39:54 AM
That's exactly what I'm trying to do: override the shopper group of the parent product:
In my tests the child has a different shopper group than the parent (which is not restricted to a specific shopper group), but it shown nevertheless to all shopper groups.
So, obviously it doesn't work as expected.
Title: Re: product variant restriction to shopper group
Post by: p.barg on December 24, 2015, 09:49:49 AM
So can you confirm that this is a bug and if so is there a workaround/fix?
Title: Re: product variant restriction to shopper group
Post by: Milbo on January 04, 2016, 11:15:52 AM
No, I cannot confirm.
Did you check this? "Be aware that shoppergroups can remove the standard group or keep it.
Modify message"
Title: Re: product variant restriction to shopper group
Post by: p.barg on January 04, 2016, 11:49:44 AM
I have 4 shopper groups - none of them is defined as "additional shopper group" (if that's what you mean by 'can remove the standard group or keep it').
One product variant is restricted to exactly one of these shopper groups (in our case 'wholesale') and yet all other shopper groups (e.g. guests) also see this variant.
If needed I can provide some screenshots.
Title: Re: product variant restriction to shopper group
Post by: Milbo on January 04, 2016, 12:39:18 PM
Thank you. I was not lazy and can confirm it.

Please check line 254 in sublayouts/customfield.php. Just remove the second parameter of
$productChild = $productModel->getProduct((int)$child,false);

or set the second parameter to true.
Title: Re: product variant restriction to shopper group
Post by: p.barg on January 04, 2016, 13:13:50 PM
Thanks for looking into this Max! Your fix solves the problem in that the variant itself is no longer listed in the drop-down for the other shopper groups now.
But for some reason a price with (0,00 €) is displayed in its place. I'm sure this can be removed easily (probably in the same file), but I couldn't find it....
Title: Re: product variant restriction to shopper group
Post by: Milbo on January 04, 2016, 14:43:03 PM
and the price setting? which price should be shown?
Title: Re: product variant restriction to shopper group
Post by: p.barg on January 04, 2016, 14:58:18 PM
As the variant shouldn't be shown (and isn't after applying your fix), the price shouldn't be shown either.
It appears to be a leftover from the variant that is not shown any longer. See attached image - the 0,00€
in the first line.