Add ordering field in product class object

  • Posts: 28
  • Thank you received: 0
9 years 1 month ago #242663

-- HikaShop version -- : 2.6.3
-- Joomla version -- : 3.5.1
-- PHP version -- : 5.5

Hi,

I want to fetch all the products from a selected category and display through my custom code. For this I referred here:
hikashop.com/support/documentation/62-hi...umentation.html#code

$productClass = hikashop_get('class.product');
$product=$productClass->get($product_id);

I want to know how can I add an ordering parameter here ? for example I want to display products from selected category. So, here I am passing the product id of all the fetched products but want to order them by product_name, product_id etc. or do I need to write the whole sql query for this?

Please Log in or Create an account to join the conversation.

  • Posts: 84079
  • Thank you received: 13634
  • MODERATOR
9 years 1 month ago #242689

Hi,

There is a function to load the ids of all the products of a category but you can't tweak it to change the ordering.
The best is to write your own MySQL query.

Please Log in or Create an account to join the conversation.

Time to create page: 0.053 seconds
Powered by Kunena Forum