- Posts: 1
- Thank you received: 0
Show auctions in a module custom filtered
1 year 10 months ago #364611
by iptronica
Show auctions in a module custom filtered was created by iptronica
-- 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
-- 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.
1 year 10 months ago #364613
by nicolas
Replied by nicolas on topic Show auctions in a module custom filtered
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:
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.
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:
Code:
$filters[] = 'b.product_id IN ('.implode(',', $auction_product_ids).')';
Please Log in or Create an account to join the conversation.
Moderators: Mohamed Thelji
Time to create page: 0.352 seconds