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/c...980bee4b28f972
the old code was like this:
PHP Code:
$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:
PHP Code:
$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.
Bookmarks