Custom Field - Fee value to work on multiple items

  • Jamie McGhee
  • Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 9 months ago #100511 by Jamie McGhee
Hi there,

I have activated the shopping cart of my events booking system, to allow users to sign up to multiple fitness classes coming up.

As there are certain membership levels,I have also set up a custom field with fee value options to try and account for these levels. Along the lines of:
A silver member gets -2.50 off each class
A gold member gets -6.50 off each class (effectively free)

Though if a customer puts multiple classes in their shopping cart and clicks on a membership option, it takes the one set amount off the total price. Is there anyway or suggestions that can get it to take the amount off each item in the shopping cart?

As an example, a visitor registers for 4 fitness classes at 6.50 each.
Total in the shopping cart is 4 x 6.50 = 26.00
He is a Silver member so should get 2.50 off each class.
Though he clicks on Silver Member option and only 1 x 2.50 is taken off total 26.00 - 2.50 = 23.50

Is there anyway to get it so that any fee calculation in a custom field is taken off each cart item and not just the total of all the items?

Any help, thoughts or suggestions would be greatly appreciated. Thanks and regards

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

More
8 years 9 months ago #100512 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Custom Field - Fee value to work on multiple items
Hi James

Unfortunately, the system could not handle this, so you will have to customize the code if you want the system to calculate it like that

How many custom fee fields like that you are having in your system? If you just have that field, then I guess customization would be easy

Also, what happens if someone enter 2 into quantity for an event which he booked?
The following user(s) said Thank You: Jamie McGhee

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

  • Jamie McGhee
  • Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 9 months ago #100518 by Jamie McGhee
Replied by Jamie McGhee on topic Custom Field - Fee value to work on multiple items
Thank you for the response.

I can probably keep it to the one custom fields which will affect the fee value but just want any reductions in price to be calculated on every item in a cart. If you could give me an indication of the coding needed and where I would need to add / change that would be very helpful - thank you :)

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

More
8 years 9 months ago #100525 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Custom Field - Fee value to work on multiple items
Hello Jamie

I don't know if it works but you can try this solution:

1. Open the file components/com_eventbooking/helper/helper.php

2. Find the method calculateCartFee

3. Find this lines of code:
Code:
$feeAmount = $form->calculateFee(); $items = $cart->getItems();

Change it to:
Code:
$items = $cart->getItems(); $feeAmount = count($items) * $form->calculateFee();

Then try again to see whether it works as you want? Please note that with that change, all the custom fee fields will be multipled with number of items in the cart, so if you have second custom fee field, it might not work as expected

Tuan
The following user(s) said Thank You: Jamie McGhee

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

  • Jamie McGhee
  • Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 9 months ago #100689 by Jamie McGhee
Replied by Jamie McGhee on topic Custom Field - Fee value to work on multiple items
This did work brilliantly!!

Thank you

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

More
8 years 9 months ago #100705 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Custom Field - Fee value to work on multiple items
Great. Happy to hear that

Regards,

Tuan

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

Moderators: Tuan Pham Ngoc