Jump to content

How to get SQL query from executed function


Recommended Posts

I have a function which pulls list of products:

        $id_category = false;
        $only_active =true;
        $context = null;

Product::getProducts($id_lang, $start, $limit, $order_by, $order_way, $id_category, $only_active,  $context)

How can i see that query? The problem is there are some products missing in this select of 25 products.



Share this post

Link to post
Share on other sites


If you just want to display the request, you just have to put this kind of code in the file Product.php


Also, I would place it right after the $sql declaration to avoid wasting time with all the processing behind it.

$rq = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
if ($order_by == 'price') {
	Tools::orderbyPrice($rq, $order_way);


Share this post

Link to post
Share on other sites

Il y a 4 heures, ps8moduly.cz a dit :

Beware of die(), if you have a live store, customers will wonder if it will show up 😄

Of course, but we can assume that we are in the developer section of the forum and that some evidence is already acquired and if not, that the applicant will acquire it at that time 😉

Share this post

Link to post
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...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More