Jump to content

gazapko

Recommended Posts

Hi! I'm preparing one module about saving XML file all list of products.

 

I'm using the getProducts function, but in this case I have a lot of products (more than 20000 products) and the server is limited to 30sec executing function for security (I can't change, is not possible)

 

Anybody knows how to make loading products step by step automatic in only one script? Maybe using the parametres "start" and "limit" in the same function, but If I try in the same php file the execution time is overload.

 

(sorry for my baaaad english! thanks!!)

Link to comment
Share on other sites

Hi, I'm trying to call the method getCategories() , and the way I think is the same than getProducts(). I was chatting with prestashop staff and they told me that some prestashop folders as admin, tabs, etc are autoload for all the prestashop resources classes, objetcts, etc... I could see how it works: They oppened a blank file with the following code (If I'm not in a mistake):

 

<?
$cats = getCategories();
print_r ($cats);
?>

 

 

and we could see the array of all categories...

 

Now, I'm I'm my offfice the results are very bad:

 

 

Fatal error: Call to undefined function  getcategories() in test.php on line 2

 

Thanks, Emilio Alvarez

Link to comment
Share on other sites

Hi, I'm trying to call the method getCategories() , and the way I think is the same than getProducts(). I was chatting with prestashop staff and they told me that some prestashop folders as admin, tabs, etc are autoload for all the prestashop resources classes, objetcts, etc... I could see how it works: They oppened a blank file with the following code (If I'm not in a mistake):

 

<?
$cats = getCategories();
print_r ($cats);
?>

 

 

and we could see the array of all categories...

 

Now, I'm I'm my offfice the results are very bad:

 

 

Fatal error: Call to undefined function  getcategories() in test.php on line 2

 

Thanks, Emilio Alvarez

 

Hi Emilio,

 

'getCategories()' is a method of a class, you can't call it without an object.

Link to comment
Share on other sites

OK, the correct code is:

 

 

<?
include_once "../config/autoload.php";

/* getCategories arguments
*  arg 1 - id of the default language
*  arg 2 - true | false - Only active categories
*  arg 3 - true | false - Para indicar que no es un pedido
*
*  Without arguments the result array is confused [/font]
[font=courier new,courier,monospace]*/

$cats = Category::getCategories( (int)($cookie->id_lang), true, false  ) ;
print_r($cats);

foreach ($cats as $cat)
  echo "\n id_category = " .$cats['id_category'] . " name = " . $category['name'];

?>

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...