- Posts: 88
- Thank you received: 20
Products order for inserted products in articles (simple solution provided)
5 years 2 weeks ago #335586
by dyvel
To order by the order of ids, I modified the file: plugins/system/hikashopproductinsert/hikashopproductinsert.php
in line 279:
Change:
To this:
Now the order is respected.
I hope you will consider adding this to the plugin for the next update?
Have a nice day." class="hasTooltip topictitle">Products order for inserted products in articles (simple solution provided) was created by dyvel
-- HikaShop version -- : 4.4.3
-- Joomla version -- : 3.10.1
-- PHP version -- : 7.4
Hi
Often, when I use the hikashopproductinsert plugin to insert products in articles, I need the products to be in a specific order - as in the order I add the ids, but as of now, the order is not respected in the query (it's missing an order by).
Just for reference, I insert products like this:
To order by the order of ids, I modified the file: plugins/system/hikashopproductinsert/hikashopproductinsert.php
in line 279:
Change:
To this:
Now the order is respected.
I hope you will consider adding this to the plugin for the next update?
Have a nice day.
-- Joomla version -- : 3.10.1
-- PHP version -- : 7.4
Hi
Often, when I use the hikashopproductinsert plugin to insert products in articles, I need the products to be in a specific order - as in the order I add the ids, but as of now, the order is not respected in the query (it's missing an order by).
Just for reference, I insert products like this:
To order by the order of ids, I modified the file: plugins/system/hikashopproductinsert/hikashopproductinsert.php
in line 279:
Change:
Code:
$product_query = 'SELECT * FROM ' . hikashop_table('product') . ' WHERE product_id IN (' . implode(',', $ids) . ') AND product_access='.$db->quote('all').' AND product_published=1';
To this:
Code:
$product_query = 'SELECT * FROM ' . hikashop_table('product') . ' WHERE product_id IN (' . implode(',', $ids) . ') AND product_access='.$db->quote('all').' AND product_published=1 ORDER BY FIELD(product_id, ' . implode(',', $ids) . ')';
Now the order is respected.
I hope you will consider adding this to the plugin for the next update?
Have a nice day.
Please Log in or Create an account to join the conversation.
5 years 1 week ago #335608
by nicolas
To order by the order of ids, I modified the file: plugins/system/hikashopproductinsert/hikashopproductinsert.php
in line 279:
Change:
To this:
Now the order is respected.
I hope you will consider adding this to the plugin for the next update?
Have a nice day." class="hasTooltip topictitle">Products order for inserted products in articles (simple solution provided)
Hi,
Yes, we can add that modification.
Thanks for your feedback and contribution.
Yes, we can add that modification.
Thanks for your feedback and contribution.
Please Log in or Create an account to join the conversation.
Time to create page: 0.236 seconds