Setting the default qty of a products table to 'All'

  • Posts: 116
  • Thank you received: 3
  • Hikashop Business
11 months 17 hours ago #334792

-- HikaShop version -- : 4.4.3
-- Joomla version -- : 3.9.28

My customer has asked me to build a print-oriented price list for his entire inventory, however, he has specific needs for the layout design: combining up to three different products which are in different top-level categories into a single row. They keep three different catalogs of identical product designs, but each catalog is made of a different material - cast stone, resin, and plaster, each with subcategories for the design styles. But not every product exists in all three. The product codes follow the convention XXXX-CS, XXXX-RS, and XXXX-PL.

The most efficient way to do this would seem to be by overriding Hikashop's Product Table display template and using the existing search data, but I don't believe there's a way to modify the product search from within the template override (probably product/listing or product/listingtable). (Adding a GroupBy parameter to the search might be handy.)

I suspect I will need a way to ensure that the list's default qty of returned items is overridden to be 'All' every time the page is loaded so that no pagination controls are needed -- I know that this may produce a long load time, but there is no choice if they want a full inventory. I plan to use the override template and css to make it reliably printable.

Is there a way to set the default list quantity to All?

Do you have any other suggestions?

Thanks.

If it were my own component, I would simply add a brand new Joomla View, but I don't think Hikashop has a way to do that without modifying the component manually, which could make updates difficult.

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

  • Posts: 75902
  • Thank you received: 11852
  • MODERATOR
11 months 13 hours ago #334793

Hi,

The default number of elements per page is dictated by the number of columns / rows you configured in the settings of the menu item.
So if you configure 10000 rows there for your table layout, you'll get 10 000 products listed on the page when you arrive on it.
So that's not really the problem.
The real problem here is modifying the MySQL query loading the products in order to load the ones your want based on your specific conditions. This can't be done from a view override since the data is already loaded by the point you reach the view file.
You could create your own view with a plugin, but I think that's overkill for what you need.
A simpler approach is to implement the onBeforeProductListingLoad(&$filters,&$order,&$parent, &$select, &$select2, &$a, &$b, &$on) event of HikaShop ( www.hikashop.com/support/documentation/6...reProductListingLoad ) in a plugin of the group "hikashop" so that you can directly inject the extra conditions you need to only get the products you want listed on the listing of products.
So you could configure a menu item listing all your products in a table with 10000 rows, then have a custom plugin add the necessary conditions to the MySQL query to only load the products you need on that listing, and finally, if you need to customize the look of the listing, you can use a view override of listing_table.php
Doing it like that will be way simpler than adding your own view like with do with the plugin hikashop/email_history which adds its own controller and views to the backend of HikaShop for the Customers>Emails history. This plugin was a proof of concept on the system we've added to HikaShop years ago to be able to add controllers/views from a plugin.

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

  • Posts: 116
  • Thank you received: 3
  • Hikashop Business
11 months 11 hours ago #334797

Excellent! This site already uses a Hikashop-specific custom plugin to trigger some custom operations after certain products are purchased. I'll see if I can add the onBeforeProductListingLoad() method there, or if I need to add an additional plugin (one not within the payment group).

Thank you for the guidance!

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

  • Posts: 75902
  • Thank you received: 11852
  • MODERATOR
11 months 2 hours ago #334806

Hi,

If the custom plugin you already have is of the group "hikashoppayment", you'll want to create another plugin of the group "hikashop". I don't think that the "hikashoppayment" plugins are always loaded when onBeforeProductListingLoad is triggered. It could when the cart is not empty, but it's clunky to rely on that.

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

Time to create page: 0.057 seconds
Powered by Kunena Forum