Display Quantity Field question

  • Posts: 18
  • Thank you received: 3
12 years 4 months ago #56210

I have some products with fixed quantities (100, 250, 500, 1000, etc.), so I have Display Quantity Field set to NO and use variants to set the pricing for each pre-set quantity. I have other products where the quantity can be anything number and I need to display the quantity field on those products. Is it possible to display the quantity field for select products? I was thinking of a way to create a flag and edit the code on the product display page to display or not display the field. It would be great, though, if I could have the Display Quantity Field at the product level instead of global level. Before I start implementing the flag solution, I thought I'd check and make sure the system doesn't accommodate this need.

Thanks for a really great product.

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

  • Posts: 82820
  • Thank you received: 13368
  • MODERATOR
12 years 4 months ago #56268

There is indeed no option for that at the product level.
You will have to modify the code.
I recommend you to create a quantity field template override for that:
www.hikashop.com/en/support/documentatio...tation.html#override

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

  • Posts: 18
  • Thank you received: 3
12 years 4 months ago #56586

nicolas, thanks for the response. I looked at the link you provided but went ahead with my solution. I was originally going to add a Characteristic (show_quantity_field) but realized this would appear on the product page, so I decided to create a Category by the same name. If a product is added to the "show_quantity_field" category, I want the Quantity Field to be displayed; otherwise do not show it. To handle this, I edited the cart.php file in ../administrator/components/com_hikashop/helpers folder. After the ELSE statement at Line 101, I added code to query the appropriate hikashop tables (joining "hikashop_product_category" to "hikashop_category" and setting my WHERE clause to look for the product (via product_id) and the show_quantity_field category. Finally, I perform a test based on the results from the query. If I get a result, I execute your code that displays the Quantity Field; otherwise I skip the code. So far, it looks like it is working just the way I need it. I realize a MAJOR issue lies in the modification of cart.php--i.e. if I update the software, this file will be overwritten and my modification nixed. I'll look at a better solution that will handle that or spend some time on the URL you provided and implementing a solution that way. Since I'll be the one updating the software, I have enough 'red flags' to prevent me from blindly applying the update.

The following user(s) said Thank You: nicolas

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

Time to create page: 0.056 seconds
Powered by Kunena Forum