Support

Home Forums Event Espresso Premium Use Cart Only for Registration?

Use Cart Only for Registration?

Posted: February 3, 2015 at 4:26 pm


Anne Eglash

February 3, 2015 at 4:26 pm

Hello:
Is it possible to hide the registration button and use only the shopping cart for event registrations?
Thanks.


Anne Eglash

February 3, 2015 at 4:31 pm

Forgot to add:
EE: 3.1.36.6P
WP: 4.1


Dean

February 4, 2015 at 9:25 am

Hi,

2 ways:

1) Edit the template files to edit/remove the code. This thread has a discussion about it https://eventespresso.com/topic/removing-register-linkview-details-just-add-to-cart-link/

2) Use CSS and the language files to hide the button and ” or ” from the webpage.


Anne Eglash

February 4, 2015 at 10:00 am

Thanks.
I can address the button with
.a_register_link {
visibility:hidden;
)
but do you know how I would address the “or”?


Tony

  • Support Staff

February 4, 2015 at 10:16 am

Hi Anne,

You can add this function to your theme function.php file or a site specific plugin:

https://gist.github.com/Pebblo/9772609552259e625a02

That will ‘translate’ the ‘ or ‘ phrase to ” (nothing).

Here is how it looks with the register button still in place – http://take.ms/scfWF


Anne Eglash

February 4, 2015 at 10:33 am

Thanks Tony.
We would only want to target the instances of “or” that occur after a registration button. Wouldn’t your code address the whole site?


Anne Eglash

February 4, 2015 at 10:54 am

Looking at the thread referred to above, there are a number of issues in the discussion. Could you provide just the instructions for modifying the php to show only “Add to Cart”/”View Cart”?
Thanks.


Tony

  • Support Staff

February 4, 2015 at 10:54 am

Yes and no.

That code will only look for a string that is passed to __() or _e() and looks specifically for ‘ or ‘, here is the code within the event list that outputs that string:

'separator' => __(" or ", 'event_espresso')

So unless you have another string, such as:

$somevar =  __(" or ", 'some_domain')

Then the only ‘ or ‘ that will be replaced it the one within EE.

If you are comfortable editing template files I can provide details on how to do that if you prefer?


Tony

  • Support Staff

February 4, 2015 at 10:56 am

Also to note, that code would NOT translate a string such as – ‘You can do it this way or that way’ because the full string must match exactly. Translating ‘ or ‘ does not translate that string within other strings.


Anne Eglash

February 4, 2015 at 1:54 pm

Tony:
Thanks a lot for the explanation and the code.
We are working with developers who are familiar with EE, so I’d be very appreciative if you could provide details on editing them to use the cart only.
Thanks again.


Lorenzo Orlando Caum

  • Support Staff

February 4, 2015 at 5:24 pm

Hi Anne,

Could you try Tony’s sample code along with this line of CSS in your theme’s stylesheet?

.a_register_link.ui-button.ui-button-big.ui-priority-primary.ui-state-default.ui-state-hover.ui-state-focus.ui-corner-all {display: none;}

That should hide the button and remove the “or.”

http://cl.ly/image/3P180M0t1622


Lorenzo


Tony

  • Support Staff

February 5, 2015 at 4:51 am

If you developers are familiar with EE this should be fairly straight forward.

Within event-espresso/templates/ you will find event_list.php and event_list_display.php

Copy both of those fiel to wp-content/uploads/espresso/templates/

This will keep the modifications you made safe from updates, when editing template, upload them to this location.

So then open the event_list_display.php file.

Around line 137 you will find:

'separator' => __(" or ", 'event_espresso')

Either remove or comment out that line, personally I would comment it out like so:

//'separator' => __(" or ", 'event_espresso')

That will remove the ‘ or ‘ string from the cart link on that page.

Also on line 152 you should find the output for the register now button, you could also remove that link, it will be the one above this:

Or you can continue to do that with CSS if you prefer.

Hope that helps 🙂


Anne Eglash

February 6, 2015 at 9:27 am

Lorenzo:
When using CSS to accomplish this task, your code removed the button and the space it occupied, so it is a much better solution than the code I originally posted.
Thanks.


Anne Eglash

February 6, 2015 at 9:36 am

Tony:
The 2 modifications to event_list.php worked great.
Thanks much.


Anne Eglash

February 6, 2015 at 9:42 am

Relatedly, I’ve been using this code to create a link to the EE shopping cart:
My Shopping Cart
Do you see any potential problems with that code?
I’ve not made any of this live yet and want to be thorough in avoiding potential problems.

Also, is it possible to:
1) Detect if there are events in the cart and hide this link if there are none?
2) Count the number of events in the cart and display it along with this link.

Thanks.


Anne Eglash

February 6, 2015 at 9:45 am

Oops, the code was parsed into a link. Let’s try this:
http://domain.org/event-registration-current-events/?regevent_action=show_shopping_cart


Anne Eglash

February 6, 2015 at 9:53 am

Tony:
I noticed that the code for the button that we commented out (above line 152) is duplicated as part of a nested conditional (above line 159). Should that link also be commented out?
Thanks.


Tony

  • Support Staff

February 9, 2015 at 1:46 am

Should that link also be commented out?

That link is displayed when you set the ‘Display Registration form’ to No within an event, so it depends if you will be using that feature or not.

/event-registration-current-events/?regevent_action=show_shopping_cart

That link should work fine, looking at the above it seems you have changed the default EE page slug? (It is fine to do so, just checking)

1) Detect if there are events in the cart and hide this link if there are none?
2) Count the number of events in the cart and display it along with this link.

Both of these features are not available within EE and as you are using your own custom links you’ll need to check the session and see if any events are within. I would recommend looking at the code for the ‘Cart widget’ available within the MER Add-on, this has something like:

if (empty($_SESSION['espresso_session']['events_in_session'])){return;}

You could set a flag using that code, then wrap your links within a check for that flag and only display the links it true.

The ‘Add To Cart’ link should change to a ‘View Cart’ link when the event is added to the cart, is that not what you are looking for?


Anne Eglash

February 11, 2015 at 7:56 pm

That link is displayed when you set the ‘Display Registration form’ to No within an event,

I’m not sure what that is for – does it disable the capability for someone to change the name associated with the event registration?


Anne Eglash

February 11, 2015 at 7:57 pm

That link should work fine, looking at the above it seems you have changed the default EE page slug? (It is fine to do so, just checking)

I just hard coded the link to cart – copied it from an event. When you mention a slug, are you referring to a shortcode? Is so, Where do I find it?


Anne Eglash

February 11, 2015 at 7:59 pm

Is there a setting so that when an event is added to a cart, the number of attendees in the cart is set to 1? It defaults to 0.
Thanks.


Tony

  • Support Staff

February 12, 2015 at 7:29 am

I’m not sure what that is for – does it disable the capability for someone to change the name associated with the event registration?

If you edit one of your events, then look in the options on the right, you’ll see this – http://take.ms/fnuML

When that is set to Yes, the event will display the registration form – http://take.ms/TPF8t

When set to no, only the description is included – http://take.ms/iFXUs
(This events description is empty, but you can see you can’t register onto that event now, as the reg form is hidden)

So at the same time, the event list will display ‘Register Now’ if that setting is set to Yes, and ‘View Details’ if set to no – http://take.ms/SFP93

I just hard coded the link to cart – copied it from an event. When you mention a slug, are you referring to a shortcode? Is so, Where do I find it?

This /event-registration-current-events/ is the page slug, the slug is what is used in the URL and is what your users see in the address bar.

You’ll find this in the permalink structure when editing the page – http://take.ms/Be4Bh

You can also change this from the ‘Pages’ view in WP.

Is there a setting so that when an event is added to a cart, the number of attendees in the cart is set to 1? It defaults to 0.

There is not setting to allow this, but it can be done using the information in this thread:

https://eventespresso.com/topic/cart-ticket-dropdown-defaults-to-0/

The support post ‘Use Cart Only for Registration?’ 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