VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: doell-computer on April 21, 2012, 16:56:09 PM

Title: Generic_Child_Variant Bug: Parent-Product appears multiple times in dropdown
Post by: doell-computer on April 21, 2012, 16:56:09 PM
2.0.6
If the parent-product is assigned to more then one category it appears multiple times in dropdown-list.

[attachment cleanup by admin]
Title: Re: Generic_Child_Variant Bug: Parent-Product appears multiple times in dropdown
Post by: mark R on April 21, 2012, 16:59:56 PM
I also have this problem.
Title: Re: Generic_Child_Variant Bug: Parent-Product appears multiple times in dropdown
Post by: doell-computer on April 24, 2012, 11:09:20 AM
I hope this bug will be fixed soon. I tried to fix it, didn't get it to work  :-[
I would pay for it!

Wird das gefixt? Kann doch nicht so ein riesiges Problem sein. Leider reichen meine php-Kenntnisse dafür nicht aus.
Würds auch bezahlen.
Title: Re: Generic_Child_Variant Bug: Parent-Product appears multiple times in dropdown
Post by: teobgeno on April 24, 2012, 20:35:15 PM
At administrator/components/com_virtuemart/models/product.php -> function getUncategorizedChildren($selected)

The query on this function return multiple virtuemart_product_id in case this virtuemart_product_id belongs to more than 1 category

Line 1549 - 1553

if($app->isSite()){
$q .= ' AND p.`published`="1"';
}

$q .= ' ORDER BY ordering DESC';


By adding a group by on this the issue seems to be solved .So modify it as below


if($app->isSite()){
$q .= ' AND p.`published`="1"';
}

$q .= ' GROUP BY `virtuemart_product_id`';
        $q .= ' ORDER BY ordering DESC';


Beware that GROUP BY is before ORDER BY . Do not change position or else it will throw a  mysql error. I hope this will solve this problem .Because i have not completely tested it i would like if anyone use this modification to reply if everything is ok after this change.
Quote
I would pay for it!
No need to pay  ;)

Title: Re: Generic_Child_Variant Bug: Parent-Product appears multiple times in dropdown
Post by: doell-computer on April 24, 2012, 21:42:01 PM
teobgeno... you made my day!!!   ;) 8) ;D
Title: Re: Generic_Child_Variant Bug: Parent-Product appears multiple times in dropdown
Post by: teobgeno on April 24, 2012, 21:44:15 PM
nice to hear that your problem solved but please make some tests and reply if everything is ok.
Title: Re: Generic_Child_Variant Bug: Parent-Product appears multiple times in dropdown
Post by: doell-computer on April 27, 2012, 08:09:30 AM
after two days of testing, i think it works just fine  :)