Show auctions in a module custom filtered

  • Posts: 1
  • Thank you received: 0
  • Hikaauction Standard Hikashop Business
1 month 15 hours ago #364611

-- HikaShop version -- : 5.1.1
-- HikaAuction version -- : 4.0.0
-- Joomla version -- : 5.2.1
-- PHP version -- : 8.2

Hi,

I need to show in front page of my site, in a module, all current auctions, ordered by end date, bur only the auctions that have some bids...

Normal hikashop product content model don't have enougth configuration fields to do it. How can I do it... (I have php programing skills)

Thanks

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

  • Posts: 83022
  • Thank you received: 13403
  • MODERATOR
1 month 11 hours ago #364613

Hi,

You'll want to:
- create a HikaShop content module via the Joomla modules manager. You'll be able to have it display the products and sort them based on the "product_sale_end" (in the "ordering column" setting).
- develop a plugin of the group "hikashop" and implement the onBeforeProductListingLoad event:
www.hikashop.com/support/documentation/6...reProductListingLoad
In it, you first want to check $order so that you skip if $order doesn't contain product_sale_end (that way you only add the custom condition on your module products listing, and not on other product listings).
Then, you can run a MySQL query to get all the distinct auction_product_id from the hikaauction_auction table, and then you can add a filter to the $filters parameter like so:

$filters[] = 'b.product_id IN ('.implode(',', $auction_product_ids).')';
I would recommend to sort by descending auction_created and limit the ids to a couple thousands maximum. Otherwise, you might en up with too much product_ids (supposing that you have a store with tens of thousands of auction products) in the condition you're adding to the product loading MySQL query.

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

Moderators: Mohamed Thelji
Time to create page: 0.054 seconds
Powered by Kunena Forum