tigtig22 Posted December 22, 2011 Share Posted December 22, 2011 Hi all, I am making some modifications in the way that customers explore products in my shop. Is there a function that works similar to the getProducts() function but gets products from a defined category using a category ID (rather than the current category) ? I would like to use the output of the function on the category.php page. Thanks for any help you can offer. Paul T 1 Link to comment Share on other sites More sharing options...
CartExpert.net Posted December 26, 2011 Share Posted December 26, 2011 Hi! You can use the getProducts() function to get products from a defined category. Link to comment Share on other sites More sharing options...
tigtig22 Posted December 27, 2011 Author Share Posted December 27, 2011 Thanks for that - that is good to know. Do you have any example code ? I cannot work out how to use getProducts() on a category of my choice. Thanks again, P Link to comment Share on other sites More sharing options...
CartExpert.net Posted December 28, 2011 Share Posted December 28, 2011 Hello! This is the function's head: getProducts($id_lang, $start, $limit, $orderBy, $orderWay, $id_category = false, $only_active = false) id_lang - this is stored is a cookie start - the index of the element in the result list limit - number of elements orderBy - criteria to be ordered by orderWay - can be 'ASC' for ascending or 'DESC' for descending id_category - this is where you set the category id only_active - by default is false, so it will return all products To use the function: $product_list = Product::getProducts($cookie->id_lang, 0,0, 'id_product', 'ASC', [PUT_HERE_CATEGORY_ID], true); 2 Link to comment Share on other sites More sharing options...
liloulila13 Posted January 5, 2012 Share Posted January 5, 2012 hi, Is it possible to use this function in product.tpl ? I have an error 500. I would like to get products of a specific category in all my products pages. Thanks you ! Link to comment Share on other sites More sharing options...
CartExpert.net Posted January 5, 2012 Share Posted January 5, 2012 Hello! You do not have to put it in product.tpl. You can use it in ProductController.php Link to comment Share on other sites More sharing options...
liloulila13 Posted January 5, 2012 Share Posted January 5, 2012 Thank you !! I can get data products of my category (product name, id product...). But I can't get the data derived from the jointed table (id image...). What can be the reason? Link to comment Share on other sites More sharing options...
CartExpert.net Posted January 6, 2012 Share Posted January 6, 2012 Hello! To get the images too, you need to use the getProducts() function of the Category class. Link to comment Share on other sites More sharing options...
sheraz4pro Posted May 15, 2013 Share Posted May 15, 2013 Hi, i have to customize the category products which shows on the page after clicking on a category.can you tell me which function i have to customize for this purpose.?? i have searched on google and found that Category::getProducts() is used to get category products. i am making changes in this function but changes are not taking place. Can you guide me how i can customize category products.??? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now