VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: stAn99 on October 17, 2018, 14:55:56 PM

Title: Notice: Undefined offset: 0 in currencydisplay.php on line 183
Post by: stAn99 on October 17, 2018, 14:55:56 PM
hello friends, when using shopper groups with a logged in customer that has only one shopper group associated on vm3.4.2.dev i am getting this notice (which breaks session when error reporting is enabled):

Notice: Undefined offset: 0 in currencydisplay.php on line 183

the line in currencydisplay is:

$sprgrp = $shopperModel->getShopperGroup($user->shopper_groups[0]);


i suggest to rather use the first one instead of referencing it with zero index:


$first = reset($user->shopper_groups);
$sprgrp = $shopperModel->getShopperGroup($first);


it seems that vmtable optimalization loads IDs as keys which is nice, but all VM needs to be checked agains using