Price Calculations plugin

  • Posts: 4
  • Thank you received: 0
  • Hikashop Business
2 days 9 hours ago #365263

-- HikaShop version -- : 5.1.2
-- Joomla version -- : 4.4.10
-- PHP version -- : 8.1
-- Browser(s) name and version -- : Chrome

i can't seem to figure it out. Very little documentation on the plugin.

I have a custom field with a dropdown box. If the answer is Yes, then i need to add 6.25 euro.

How do i do that.

ChatGPT comes up with this formula, but isn't working {custom_field} == 'Yes' ? ({price} + 6.25) : {price}

Please help!

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

  • Posts: 83103
  • Thank you received: 13413
  • MODERATOR
2 days 6 hours ago #365265

Hi,

You can't write PHP code in the formula.
Supposing that you have two values in your field: 0 (with the title "no") and 1 (with the title "yes"), and supposing that the column name of your custom field is "custom_field" and that your custom field is a custom field of the table "item", you could write this formula:

{price}+6.25*{custom_field}
If the value selected is "no", then the formula will be {price}+6.25*0 and thus the calculated price will be equal to the base price of the product.
If the value selected is "yes", then the formula will be {price}+6.25*1 and thus the calculated price will be equal to the base price of the product plus 6.25.

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

  • Posts: 4
  • Thank you received: 0
  • Hikashop Business
2 days 3 hours ago #365268

Thanks, this works. But i still have trouble understanding this kind of formulas.

Now the first field is working, but the second field in the same product is not. I made a extra formula. But it's not counting.

It's for a soccer shirt. First field is for a name on the back, second field is for the number on te back of the shirt

Attachments:

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

  • Posts: 83103
  • Thank you received: 13413
  • MODERATOR
1 day 16 hours ago #365271

Hi,

Only one formula can apply at the same time.
So you need to merge both formulas together:

{price}+6.25*{custom_field}+6.25*{custom_field2}

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

Time to create page: 0.057 seconds
Powered by Kunena Forum