Support

Home Forums Pre-Releases Volume Discounts Ignoring Threshold

Volume Discounts Ignoring Threshold

Posted: June 16, 2015 at 3:43 pm


Mitch

June 16, 2015 at 3:43 pm

Hi there,

We’re using EE3 with MER and the Volume Discount plugin on this site:
https://www.bijakids.com/camp/register2015/

I have my discount threshold set to 5 registrations, but any more than 1 registration triggers the discount, and I can’t figure out what’s going wrong.

Here is a screen shot of the settings:
https://www.bijakids.com/wp-content/uploads/2015/06/Screen-Shot-2015-06-16-at-5.31.19-PM.png

I’ve made some significant modifications to the code, but haven’t touched anything regarding discounts / pricing. I found a few posts in the forums about a bug in the Volume discounts — is this part of the bug? Or are my settings off? Is it possible to work around by hard-coding the discount threshold? This is not preferable, but would do, if you can point me to the correct spot in the code.

Thanks for your help!


Dean

June 17, 2015 at 2:32 am

Hi Mitch,

Firstly, loving what you have done with EE! It looks great. Would you be interested in submitting it as a showcase site? http://eventespresso.com/customer-events-showcase-submissions-form/

Back to the issue at hand.

I ran some tests with EE3, MER and Volume Discounts (VOD) (all latest versions) and could not replicate the issue, it worked as it should do.

I’m wondering if this has something to do with the use of the radio buttons rather than dropdowns, as this looks like a modification.

Have you tried testing the the MER/VOD combination while using the default cart layout (i.e. with the dropdowns)?

Can you provide more info on the modification done to use the radio buttons?


Mitch

June 17, 2015 at 10:29 am

Thanks so much, Dean.

That does look like the problem. I just tested it with the standard drop-downs, and the discounts work fine. Here is the modified custom function creating the radio buttons. Am I missing something, or is there a better way to do this?

<? php
/**
* Creates the # of Attendees dropdown in the shopping cart page
*
* @param $event_id
* @param $price_id
* @param $qty – of attendees allowed in this registration
* @param $value – previously selected value
*
* @return Dropdown
*/
if (!function_exists(‘event_espresso_multi_qty_dd’)) {
function event_espresso_multi_qty_dd($event_id, $price_id, $qty, $value = ”) {

$counter = 0;
do_action(‘action_hook_espresso_log’, __FILE__, __FUNCTION__, ”);
?>

<input type=”radio” <?php echo $selected; ?> name=”price_id[<?php echo $event_id; ?>]” value=”<?php echo $price_id; ?>” id=”price_id-<?php echo $event_id; ?>” class=”<?php espresso_template_css_class(‘price_id’,’price_id’); ?>”>

<!–<option <?php echo $selected; ?> value=”<?php echo $i; ?>”><?php echo $i; ?></option>–>

<?php
}
}
?>


Dean

June 19, 2015 at 1:28 am

Hi,

Well, I had played around with it before you provided the code, and couldn’t get it to function correctly. I couldn’t get your code to function at all.

I think that the issue lies in the JavaScript as that is what works out when and where the discount is applied. So I would recommend taking a look at that.

Also note that as you are modifying core files, updates will over write any changes made.


Mitch

June 19, 2015 at 9:17 am

Hi Dean,

I was amazed when that little bit of code worked! I thought switching to radio buttons would have been more complicated, but, until the Volume discount problem, this was working. Apparently, though, it is not really. Can you suggest a better way to make these radio buttons?

What Javascript would you recommend looking at? JS is not my strength and some of the ways EE passes parameters around between functions gets really confusing for me (especially when jQuery and Ajax get involved). Could you please be more specific?

Tried my best to make all the changes in the templates and customfunctions.php files in the uploads folder, but had to make some changes to the core files to do everything we wanted EE3 to do. It’s all backed up, so I’m ready for any updates.

Honestly, EE3 has been challenging to work with and I’d much rather have been starting out with EE4 and not customizing so much, but MER was essential and not ready for EE4 yet, so I put in the time and effort — scouring forum posts for bits of code, revising our pricing structure for our entire program to conform to the discount limitations of EE3, months of development… only to find out that MER is ready for EE4 within days of working out our last bug (and not an unimportant one)… Please. Any help you can offer in working it out (or working around) would be SO very greatly appreciated!


Dean

June 22, 2015 at 5:08 am

Hi,

I used this as the PHP

<input type="radio" id="price_id-<?php echo $event_id; ?>" name="price_id[<?php echo $event_id; ?>]" class="<?php espresso_template_css_class('price_id','price_id'); ?>" value="<?php echo $price_id; ?>" />

The issue definitely lies in the JavaScript (/wp-content/plugins/espresso-volume-discounts-pr/assets/espresso_volume_discounts.js), as when enabling debug (see the top of the file), it shows that it is increasing the counter (vlm_dscnt_cntr) multiple times, which then hitting the discount threshold triggering the discount.

No idea why it’s doing that as with a dropdown it is fine.

I can’t really dig into it any further as it comes under customization which is outside the realm of support 🙁

I understand what you are saying about EE3 vs EE4, EE4 is definitely easier to work with (though at a coding level it is written in Object Oriented PHP, which can be more challenging).

One option would be to revert back to Dropdowns, and use the JavaScript found in this thread, which will automatically set the ticket numbers to one: http://eventespresso.com/topic/set-minimum-attendees-at-1-not-0-mulitple-registration/


Mitch

June 22, 2015 at 5:06 pm

Got it, Dean! Thanks! The debug showed it was just counting 3 tickets per event, so I just used a little arithmetic in the javascript… :O) Works fine now! Thanks again so much!!


Dean

June 23, 2015 at 12:38 am

You’re welcome!

The support post ‘Volume Discounts Ignoring Threshold’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Beta test upcoming software through the pre-release channel. Learn more about the pre-release channel.

Status: closed

Updated by  Dean 4 years, 5 months ago ago

Topic Tags

Notifications

This topic is: not resolved
Do NOT follow this link or you will be banned from the site!