en Jump to content
  • 0
renaud2263

How can I add an orderBy clause ?

Question

Hi everybody,

In my __construct() I have this request:

$this->_select = 'a.*, DATE(a.dlc) AS dlc, pl.name AS pname';
			$this->_join = '
			INNER JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = a.`id_product` AND pl.`id_lang` = '.(int)$this->context->language->id.')';
			$this->_orderBy = 'a.id_product';
			$this->_orderWay = 'ASC';
			$this->_group = 'GROUP BY a.id';

My simple question: I would like to order by a.id_product AND another field. I tried many ways but always return error bad request.

How can I do ?

Share this post


Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 0

I think it's just not possible with the helper, I have never seen it used with multiple columns. You can try with an array, but I haven't see it used like that

Share this post


Link to post
Share on other sites
  • 0

Hello, I've ever tried with an array, without success.

So in this configuration, how can I formulate my request ? Something like $this->query = "SELECT ........" ?

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

×

Important Information

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