zennedOut
- Join Date:
- Nov 2005
- Location:
- los angeles
- Posts:
- 2,967
- Plugin Contributions:
- 8
ZCA Bootstrap 4 Template [Support Thread]
actually you are correct.
i am running a module that is overriding the bestseller list; and is using an older version of the module.
the change did happen in v158a, and specifically this commit:
https://github.com/zencart/zencart/commit/165d701259f7106aaf0173901a980bee4b28f972
the old code was like this:
$rows = 0;
while (!$best_sellers->EOF) {
$rows++;
$bestsellers_list[$rows]['id'] = $best_sellers->fields['products_id'];
...
the index value being the var $rows, and here, it starts at 1.
the new code is like this:
$bestsellers_list = [];
foreach ($best_sellers as $bestseller) {
$best_products_id = $bestseller['products_id'];
$bestsellers_list[] = [
'id' => $best_products_id,
'name' => $bestseller['products_name'],
...
with no explicit setting of the index, it will definitely start at 0.
good catch.
as to what is the most eloquent way to address this error, i can not say.
but the commit i referenced above is definitely where this bug got introduced.
