Jump to content

The method getProducts gets an empty array


detoloslaos

Recommended Posts

Hi!!

 

I am trying to get all the product information but when I use the method getProducts I get an empty array..

 

This is my code..

 

<?php
include('config/config.inc.php');
include('init.php'); 
$productObj = new Product();
$products = $productObj -> getProducts($id_lang, 0, 10, 'id_product', 'DESC' );
echo 'before de foreach';
foreach($products as $product) {
    echo 'inside foreach';

}

?>

 

So.. I have aprox more than 30k products.. what I am doing wrong.

Thanks in advance.

Link to comment
Share on other sites

15 hours ago, detoloslaos said:

Hi!!

 

I am trying to get all the product information but when I use the method getProducts I get an empty array..

 

This is my code..

 

<?php
include('config/config.inc.php');
include('init.php'); 
$productObj = new Product();
$products = $productObj -> getProducts($id_lang, 0, 10, 'id_product', 'DESC' );
echo 'before de foreach';
foreach($products as $product) {
    echo 'inside foreach';

}

?>

 

So.. I have aprox more than 30k products.. what I am doing wrong.

Thanks in advance.

 

As per my understanding, your code is absolutely correct.

Kindly ensure that you are passing correct id_lang. Try to pass hardcode value like 1 for id_lang & check again.

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...