Support

Home Forums Event Espresso Premium Discount Code Bug

Discount Code Bug

Posted: October 30, 2013 at 4:36 pm


Sarah Rogers

October 30, 2013 at 4:36 pm

Hi there,

My discount codes are giving the following error when I try to update them:

Debug:
Array ( [coupon_code] => COMPEARLY [coupon_code_price] => 12.00 [coupon_code_description] => Company Two 6.00 Tickets [use_percentage] => N ) Number of vars: 4
Number of cols: 4

Additionally, they don’t show up on Edit Event pages.


Tony

  • Support Staff

October 31, 2013 at 3:49 am

Hi Sarah,

That error looks like it only appears if you don’t modify the Coupon and then Update. I’ll get a ticket raised for that.

Regarding them not showing up on the Edit Event pages, do you have Roles & Permissions (Basic) installed?


Sarah Rogers

October 31, 2013 at 4:01 am

Hi Tony,

We do have Roles & Permissions installed. Also, I cannot delete the test improv codes.


Tony

  • Support Staff

October 31, 2013 at 4:48 am

We reproduced both those issues locally and have issued tickets to get them fixed.

With the Roles & Permissions add on, each user has their own set of promo codes to be used with their own events.

So if User 1 creates Event A, User 2 creates Promo B.
Event A can not use Promo B.

Are you the creator of the events you are creating the promo codes for?


Sarah Rogers

October 31, 2013 at 5:15 am

Hi Tony,

Thanks for the quick response. Is there a way for all users to use all promo codes?

Thank you,
Kindra


Tony

  • Support Staff

October 31, 2013 at 5:54 am

No Problem.

It is possible yes, but requires editing Event Espresso core which we do not recommend and can not support.

Having said that if you open event-espresso/includes/admin-files/event-management/promotions_box.php and go to line 46 you’ll find

if (function_exists('espresso_member_data') && !empty($event_id)) {

Comment the whole if function out (so from line 46 – 55) like:

		/*if (function_exists('espresso_member_data') && !empty($event_id)) {
			$wpdb->get_results("SELECT wp_user FROM " . EVENTS_DETAIL_TABLE . " WHERE id = '" . $event_id . "'");
			$wp_user = $wpdb->last_result[0]->wp_user != '' ? $wpdb->last_result[0]->wp_user : espresso_member_data('id');
			$sql .= " WHERE ";
			if ($wp_user == 0 || $wp_user == 1) {
				$sql .= " (wp_user = '0' OR wp_user = '1') ";
			} else {
				$sql .= " wp_user = '" . $wp_user . "' ";
			}
		}*/

That will then show all Promo codes from the DB for all events.

Note this is un-tested. You may find other places with restrictions so I advise fully testing a registration (with another users promo code) on an event after you’ve made this modification.

Also, as this is editing core this will be lost after each Event Espresso update and will need to be re-done.


Sarah Rogers

October 31, 2013 at 7:46 am

Hmmm, would it be possible to override this using the custom functions add on?


Josh

  • Support Staff

October 31, 2013 at 9:25 am

Not at this time. However if the Roles and Permissions add-on is not active all users who have access to the Event Espresso menus will have access to all of the Promo codes.

If you need to restrict some admin capabilities for some users you might consider using the Advanced Access Manager plugin. It allows you to restrict specific capabilities for specific user accounts.


Sarah Rogers

October 31, 2013 at 11:08 am

Thanks for the advice Josh!

Ok, so I’ve removed the Roles & Permissions add on and added the discount code to my event – however, it’s not showing up on my cart page:

http://monkeybusinessinstitute.com/event-registration/?regevent_action=show_shopping_cart

Any ideas?

thank you!


Tony

  • Support Staff

October 31, 2013 at 11:38 am

If you go to Event Espresso -> General Settings. Scroll down to ‘Optional Event Settings’.

Make sure ‘Allow discounts in the shopping cart?’ is set to Yes and then update the settings.

This will allow the Coupon Codes to display on the shopping cart.


Sarah Rogers

October 31, 2013 at 12:03 pm

Thanks! Sorry I missed it.

Ok, here is the next issue – when I activated the coupon codes in the shopping cart, it did not update the price. As a matter of fact, I checked out for $60, but the coupon was supposed to only take $12 off.

Please advise.


Josh

  • Support Staff

October 31, 2013 at 1:16 pm

If you go into the event that you want the discount to apply for, is the Allow Promo codes option set to yes and is the box next to the discount code checked?


Sarah Rogers

October 31, 2013 at 3:59 pm

Hi Josh,

In regards to your last question, all of the fields were checked and the box appeared. However, since the site is live now, I can’t leave these options checked and run the risk that the cart won’t work.

I will make a copy of the site this weekend for testing so you can see what I’m talking about.

Thanks.


Josh

  • Support Staff

October 31, 2013 at 8:16 pm

Hi Sarah,

Can you verify that the “Allow discount codes” option is set to yes for the event you are trying to apply discount codes for?

The support post ‘Discount Code Bug’ 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.

Event Espresso