Support

Home Forums Event Espresso Premium Shopping cart URL

Shopping cart URL

Posted: August 21, 2014 at 12:36 am


Bart De COck

August 21, 2014 at 12:36 am

I have an issue with some URL’s viewing the shopping cart. When I press the link on the event I am redirected to the shopping cart with the correct link.
http://www.mysite.be/VK/?page_id=94&regevent_action=show_shopping_cart

However when I click show shopping cart in the widget it redirects me to almost the same URL except for the & after id=94. It is replaced with a ? and the URL shows an empty shopping cart
http://www.mysite.be/VK/?page_id=94?regevent_action=show_shopping_cart


Dean

August 21, 2014 at 6:23 am

Hi,

Can you provide a link to an example please?


Bart De COck

August 21, 2014 at 7:05 am

http://www.de-vriendenkring.be/VK/wp-content/uploads/2014/08/Issue01.doc

Here is an example.
The website is in Dutch sorry for that.


Tony

  • Support Staff

August 21, 2014 at 8:28 am

Hi,

Thank you, that helped find the cause.

This bug is visible when using the default permalinks, using another format such as ‘Post name’ permalinks will prevent this from happening although the code fix is fairly simple.

Open up espresso-multiple/cart-widget.php

Make a space on line 35 and add this:

$registration_cart_url = add_query_arg('regevent_action', 'show_shopping_cart', get_permalink($org_options['event_page_id']));

Then look for this line:

echo '<p class="widget_cart_link"><a href="'.get_permalink($org_options['event_page_id']).'?regevent_action=show_shopping_cart">'.__('View Cart', 'event_espresso').'</a> | <a href="'.get_permalink($org_options['cancel_return']).'">'.__('Clear Cart', 'event_espresso').'</a>
';

Which will be around line 42.

Change that for:

echo '<p class="widget_cart_link"><a href="' . $registration_cart_url . '">' .  __('View Cart', 'event_espresso').'</a> | <a href="'.get_permalink($org_options['cancel_return']).'">'.__('Clear Cart', 'event_espresso').'</a>
';

Then refresh the page and view the cart link which should work correctly. This fix will be included within the next update to the Multi Event Registration Add-on.


Bart De COck

August 22, 2014 at 1:50 am

I get
Fatal error: Call to undefined function espresso_page() in /home/vrienden/public_html/VK/wp-content/plugins/espresso-multiple/cart-widget.php on line 36

Here are the first 45 lines

<?php
if (!class_exists(‘Espresso_CartWidget’)) {
class Espresso_CartWidget extends WP_Widget {

/**
* Register widget with WordPress.
*/
public function __construct() {
parent::__construct(
‘event-cart’, // Base ID
‘Event Espresso Cart Widget’, // Name
array(‘classname’ => ‘widget_espresso_cart’, ‘description’ => __(‘An event shopping cart widget.’, ‘text_domain’),) // Args
);
}

/**
* Front-end display of widget.
*
* @see WP_Widget::widget()
*
* @param array $args Widget arguments.
* @param array $instance Saved values from database.
*/
public function widget($args, $instance) {
if (empty($_SESSION[‘espresso_session’][‘events_in_session’])){return;}
extract($args);
global $org_options;
$grand_total = !empty($_SESSION[‘espresso_session’][‘grand_total’]) ? $_SESSION[‘espresso_session’][‘grand_total’] : 0.00;
$title = apply_filters(‘widget_title’, $instance[‘title’]);
echo $before_widget;
echo $before_title . $title . $after_title;
//Debug
//echo ‘<h4>$VARIABLE :

' . print_r($_SESSION['espresso_session']) . '

<span style=”font-size:10px;font-weight:normal;”>’ . __FILE__ . ‘<br />line no: ‘ . __LINE__ . ‘</span></h4>’;
//echo ‘<p>Events in cart: ‘.count($_SESSION[‘espresso_session’][‘events_in_session’]).'</p><br />’;
echo ‘

    ‘;
    $registration_cart_url = add_query_arg(‘regevent_action’, ‘show_shopping_cart’, espresso_page(‘event_page_id’));
    foreach ($_SESSION[‘espresso_session’][‘events_in_session’] as $event){
    echo ‘

  1. ‘.$event[‘event_name’].’
  2. ‘;
    }
    echo ‘

‘;
echo ‘<br /><p class=”widget_cart_total”>‘.__(‘Total:’, ‘event_espresso’).’ ‘.$org_options[‘currency_symbol’].'<span id=”event_total_price_widget”>’.number_format( $grand_total, 2, ‘.’, ” ).'</span></p>’;
echo ‘<p class=”widget_cart_link”>‘ . __(‘View Cart’, ‘event_espresso’).’ | ‘.__(‘Clear Cart’, ‘event_espresso’).’</p>’;
echo $after_widget;
}


Dean

August 22, 2014 at 2:13 am

Hi,

What version of EE and Multiple Event Registration are you using? In the latest there is no reference to espresso_page()


Bart De COck

August 22, 2014 at 3:33 am

EE : 3.1.36.5.P
Multi Event Registration : 1.0.5.p


Dean

August 22, 2014 at 5:27 am

Thank you,

The espresso_page() is not in that version of the plugin, nor in the code Tony suggested. This looks like a possible modification?

If so, please revert to a default copy of the plugin.


Bart De COck

August 22, 2014 at 5:34 am

Dear,

I did not modified this.
The original was:

<?php
if (!class_exists(‘Espresso_CartWidget’)) {
class Espresso_CartWidget extends WP_Widget {

/**
* Register widget with WordPress.
*/
public function __construct() {
parent::__construct(
‘event-cart’, // Base ID
‘Event Espresso Cart Widget’, // Name
array(‘classname’ => ‘widget_espresso_cart’, ‘description’ => __(‘An event shopping cart widget.’, ‘text_domain’),) // Args
);
}

/**
* Front-end display of widget.
*
* @see WP_Widget::widget()
*
* @param array $args Widget arguments.
* @param array $instance Saved values from database.
*/
public function widget($args, $instance) {
if (empty($_SESSION[‘espresso_session’][‘events_in_session’])){return;}
extract($args);
global $org_options;
$grand_total = !empty($_SESSION[‘espresso_session’][‘grand_total’]) ? $_SESSION[‘espresso_session’][‘grand_total’] : 0.00;
$title = apply_filters(‘widget_title’, $instance[‘title’]);
echo $before_widget;
echo $before_title . $title . $after_title;
//Debug
//echo ‘<h4>$VARIABLE :

' . print_r($_SESSION['espresso_session']) . '

<span style=”font-size:10px;font-weight:normal;”>’ . __FILE__ . ‘<br />line no: ‘ . __LINE__ . ‘</span></h4>’;
//echo ‘<p>Events in cart: ‘.count($_SESSION[‘espresso_session’][‘events_in_session’]).'</p><br />’;
echo ‘

    ‘;
    foreach ($_SESSION[‘espresso_session’][‘events_in_session’] as $event){
    echo ‘

  1. ‘.$event[‘event_name’].’
  2. ‘;
    }
    echo ‘

‘;
echo ‘<br /><p class=”widget_cart_total”>‘.__(‘Total:’, ‘event_espresso’).’ ‘.$org_options[‘currency_symbol’].'<span id=”event_total_price_widget”>’.number_format( $grand_total, 2, ‘.’, ” ).'</span></p>’;
echo ‘<p class=”widget_cart_link”>‘.__(‘View Cart’, ‘event_espresso’).’ | ‘.__(‘Clear Cart’, ‘event_espresso’).’</p>’;
echo $after_widget;
}


Lorenzo Orlando Caum

  • Support Staff

August 22, 2014 at 5:54 am

Hello,

Please send an email to the address below to request an already patched version of the file:

support [at] eventespresso.com

Be sure to include a link to this support post.

Alternatively, please turn on pretty permalinks through WP-admin –> Settings –> Permalinks as this appears to affect the default permalinks only.


Lorenzo

The support post ‘Shopping cart URL’ 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.

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3

Documentation for Event Espresso 4

Status: closed

Updated by  Lorenzo Orlando Caum 5 years, 3 months ago ago

Topic Tags

Tagged: ,

Notifications

This topic is: not resolved
Do NOT follow this link or you will be banned from the site!
[for="input_96_5_3"]
[for="input_96_5_3"]
[gravityform id=96 title=false description=false]
  • This field is for validation purposes and should be left unchanged.
[i]
[i]
[gravityform id=69 title=false description=false]
  • This field is for validation purposes and should be left unchanged.