Adding costs per product at checkout

  • Posts: 55
  • Thank you received: 7
  • Hikashop Multisite
1 year 4 months ago #353335

-- HikaShop version -- : 4.7.4
-- Joomla version -- : 4.3.3
-- PHP version -- : 8.0.24
-- Browser(s) name and version -- : Google Chrome 114.0.5735.198
-- Error-message(debug-mod must be tuned on) -- : -

Hello,

Due to new regulations all products that are sold which has some sort of plastic [cover/bag/whatever] has to add €0,05 per product. The easiest way would be just to add the 5ct to the product, but that's a no go. It has to be separate on the invoice.
What would work best is to give the products involved some sort of tag which will add the 5ct at the checkout. But I really haven't got a clue how to manage that. Can you lend me a hand on this one? Perhaps you've got another idea how to manage this?

Thanks in advance for the help!

Regards,
Ans

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
1 year 4 months ago #353338

Hi,

I think that what you want to use is this:
www.hikashop.com/marketplace/product/279-cart-fee.html
First, you create a custom field of the table "product" via the menu Display>Views. I would recommend a radio field with two values:
0 with the title No, and 1 with the title Yes.
Then, in the formula of the plugin, you can write {product.cart_product_quantity}*{product.xxx}*0.05
where xxx is the column name of your custom product field, and with the "fee already included" setting turned off.
That way, in each product, you'll have a yes/no field to select if it has plastics or not. And on the checkout, the plugin will automatically add an extra fee of 0.05 per product with plastic in it to the total.

The following user(s) said Thank You: Ans van Tongeren

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

  • Posts: 55
  • Thank you received: 7
  • Hikashop Multisite
1 year 4 months ago #353350

Hi Nicolas,

This is exactly what I meant, it works perfectly! Thanks for helping me out once again... :-)

Have a nice day!

Regards,
Ans

The following user(s) said Thank You: Philip

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

  • Posts: 55
  • Thank you received: 7
  • Hikashop Multisite
1 year 4 months ago #353558

Hi Nicolas,

I'm really sorry to have to bother with this once again but it seems there is small issue in the solution.

Everything goes very smooth, until you add a product which hasn't got the extra fee. The cart however is updated with also the €0,05 for the products which haven't got the fee.
Please also take a look at the attachments.

Attachments:
File 1: Screenshot Custom field
File 2: Screenshot Plugin Fees
File 3: Product with added fee [ db22.mitzz.nl/webshop/bekers/product/da-...sbeker-1-bol-1-smaak ]
File 4: Product without added fee [ db22.mitzz.nl/webshop/slagroom-koek-dive...t/slagroom-2-porties ]
File 5: Screenshot cart with both products

This is example is on the development website. I've also taken the same stept on the live website, with similar effect.

Question is: do I have to do something extra which hasn't been described yet?

Thanks in advance for your reply!

Regards,
Ans

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
1 year 4 months ago #353574

Hi,

Thanks for the details on the issue. I was able to reproduce the issue on my end. It comes from a logic problem in how the processing of the tags is done when several products are in the cart. I've made a new version of the plugin to fix this. Please download again the plugin and install it on your website and you'll get the patch.

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

  • Posts: 55
  • Thank you received: 7
  • Hikashop Multisite
1 year 4 months ago #353586

Hi Nicolas,

Thanks for the new version of the plugin. However... I just can't get it to work. I know for sure that I'm doing something wrong, but I'm afraid I've made a mess of it.
On the development site it works like a charm now. So I've taken the exact same steps on the live website, everything works, so why not! :)
The short version what I've done so far:

  • created a custom field
  • installed the new plugin
  • marked the products with yes/no
  • there isn't 0,05ct extra, but 0,10ct per product, also the products flagged No
  • removed the custom field, created another one with other labels/column name
  • deinstalled the plugin, re-installed it once again

I've also checked the database, searching for possible leftovers from the earlier custom fields. But that seems fine to me. But: I'm not database lady! I know how to login, how to search and so on, but that doesn't come close to any knowledge on that part.
I'm not getting any further, to say the least. It feels like I'm getting worse and worse. So, is there anything you can do for me please? dabenito.nl/

Very sorry to have to bother you with this again!

Regards,

Ans

Last edit: 1 year 4 months ago by Ans van Tongeren. Reason: Added URL

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
1 year 4 months ago #353606

Hi,

I would need screenshots of all what you did. You must have missed something somewhere.
For example, this:
i.imgur.com/6pud4e1.png
I assume the first product doesn't need the fee, only the second one.
When I have only the first one in the cart, there is no fee, regardless of the quantity.
When I have only the second one in the cart, there is a fee and it's 10 cents per quantity of that product.
And if I have both products in the cart, only the quantity of the second one is taken into account for the fee.
So, to me, it looks like it's working fine, but it's just that you set a fee of 0.1 instead of 0.05 in the formula in the plugin, or you changed the "yes" value from 1 to 2 in the custom field settings. But I'm just guessing based on the behavior.

The following user(s) said Thank You: Ans van Tongeren

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

  • Posts: 55
  • Thank you received: 7
  • Hikashop Multisite
1 year 3 months ago #353754

Hi Nicolas,

I left this 'on the shelf' for a few days, just to set my mind to zero and have a fresh point of view. That helped, big time. I'm ashamed to let you know that I found what I've been doing wrong... in the product I 'forgot' to select the Yes option. :S Now that I've done that, everything is working just fine.

As I mentioned before: I'm really very sorry to have bothered you with this again. Next time I hope all brain signals will work together again, like they should have done this time. Sorry...

Regards,

Ans

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
1 year 3 months ago #353774

Hi,

No worries. I'm glad you found out the issue.

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

Time to create page: 0.066 seconds
Powered by Kunena Forum