Calculate how much based on square meters

  • Posts: 52
  • Thank you received: 4
  • Hikashop Multisite
2 years 4 months ago #337710

-- HikaShop version -- : 4.4.4
-- Joomla version -- : 4.0.4
-- PHP version -- : 7.4.23
-- Browser(s) name and version -- : Edge
-- Error-message(debug-mod must be tuned on) -- : No

For a customer I am busy making a shop for floor tiles.
Based on the total area of the room, the number of boxes to be purchased must be calculated. This would involve a custom plugin.
In this case, the user specifies the length, width and cutting loss, the number of packages is automatically calculated.
In the forum I will say that there was a plugin ( www.hikashop.com/support/forum/product-c...e-meter.html?start=0 ). However, this does not work with the current version of Hikashop.
Is there a plugin available or a base that I can customize or an example of a plugin that I can customize? I have programming experience.

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

  • Posts: 81540
  • Thank you received: 13071
  • MODERATOR
2 years 4 months ago #337715

Hi,

The plugin is now available on our marketplace and is working with the current version of HikaShop:
www.hikashop.com/marketplace/product/151...h-length-plugin.html

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

  • Posts: 52
  • Thank you received: 4
  • Hikashop Multisite
2 years 4 months ago #337728

It is workign (also under Joomla 4), but not expected as I thought.

When iI entering the width and Length there is nothinhg happening. Only when I added the items the the card I see the price is calculated.

What i searching for is that the quanty box is changed. Now it is for no one visible what is happening.

Last edit: 2 years 4 months ago by Ginius.

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

  • Posts: 81540
  • Thank you received: 13071
  • MODERATOR
2 years 4 months ago #337736

Hi,

If you want something which directly displays the price, I would recommend you to check Calc Builder:
www.moonsoft.es/joomla/product/3-calc-builder
It's compatible with HikaShop and allows for calculations but with many options compared to this basic plugin we provide.

If you're a developer, you could also stick with the plugin from the marketplace, and add some javascript on the product page to display the price before the product is added to the cart.
We did a complex custom development for one of our customers to have such dynamic calculation on the product page here:
www.danialu.fr/boutique/boutique-toiture...net/56-solinet-15-40

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

  • Posts: 52
  • Thank you received: 4
  • Hikashop Multisite
2 years 4 months ago #337788

Thanks for the answer. In th last example I see you have on the input field an onchange="updateQuantity(this) element. Where or how in a custom field can I add a onchange element?

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

  • Posts: 81540
  • Thank you received: 13071
  • MODERATOR
2 years 4 months ago #337791

Hi,

In the file show_block_custom_item.php , that you can edit via the menu Display>Views, you can see this line:

' '.$onWhat.'="window.hikashop.toggleField(this.value,\''.$fieldName.'\',\'item\',0);"',
This line already adds a onchange to the custom item fields.
So you can just call your javascript function from there. For example:
' '.$onWhat.'="window.hikashop.toggleField(this.value,\''.$fieldName.'\',\'item\',0); my_custom_javascript_function();"',

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

Time to create page: 0.064 seconds
Powered by Kunena Forum