Jump to content

Edit History

ale123

ale123

Hi all. This is strange (to me).

I'm trying to fetch all discounted products with:

        $products = Product::getPricesDrop(
            (int)Context::getContext()->language->id,
            0,
            100
        );


 

But it's returning just 3 items regardless the more than 50 discounted products on the website.

Trying to troubleshoot it i've seen that the query made by Product::getPricesDrop is returning (in $results) 50 products as expected.

I can print_r($results) and see the 50 products, BUT, as soon as the flow run through

$result = array_slice($result, (int) (($page_number - 1) * $nb_products), (int) $nb_products);

only 3 products are returned in the array by the array_slice.

(tested easily by placing a print_r above and below the suspected line)

So, what else should I check ? The query is correct....

ale123

ale123

Hi all. This is strange (to me).

I'm trying to fetch all discounted products with:

[code]

        $products = Product::getPricesDrop(
            (int)Context::getContext()->language->id,
            0,
            100
        );
[/code]

But it's returning just 3 items regardless the more than 50 discounted products on the website.

Trying to troubleshoot it i've seen that the query made by Product::getPricesDrop is returning (in $results) 50 products as expected.

I can print_r($results) and see the 50 products, BUT, as soon as the flow run through
[code]
$result = array_slice($result, (int) (($page_number - 1) * $nb_products), (int) $nb_products);
[/code]

only 3 products are returned in the array by the array_slice.

(tested easily by placing a print_r above and below the suspected line)

So, what else should I check ? The query is correct....

×
×
  • Create New...