Several products with the same name are not migrated to 2.0.x

Started by resor, November 29, 2013, 09:58:43 AM

Previous topic - Next topic

resor

Hello!

I have found a bug and solved it already.
Everything is there: http://forum.virtuemart.net/index.php?topic=120583.0

Case:
When migrating products from 1.1.x to 2.0.x not all products are migrated when there are several products with the same name. That's because 'slug' is badly generated.

Solution:
Change two lines in VmTable class (administrator/components/com_virtuemart/helpers/vmtable.php) method checkCreateUnique near line 599
$posNbr = strrpos($this->$name,'-');
//$existingNbr = (int)substr($this->$name,$posNbr);
$existingNbr = (int)substr($this->$name,$posNbr+1);
$existingNbr++;
//$this->$name = substr($this->$name,0,-$posNbr) . '-' . $existingNbr;
$this->$name = substr($this->$name,0,$posNbr) . '-' . $existingNbr;
old lines are commented

Hope it helps devs.
Regards
ResoR