Similar to #897038: Option to NOT show "<product> successfully removed from cart" but instead of a generalized request for configurability, I don't think it should appear on the checkout page at all .

When a customer removes something from their cart, a message is good. When a customer checks out from the store, they don't need to know that behind the scenes they still have a shopping cart and that it has been emptied. Maybe it's a good message for admin users to see when testing (but on the other hand, testing while logged in as an admin user usually leads to bad things anyway.)

Thanks for this awesome module! It really impressed my client.

Comments

Priority:Normal» Major

subscribe - I need to get this fixed as well.

subscribe

Can anyone point me in the right direction where this message is being set. From there I might be able to add an admin setting to check on or off. Thanks

Theres a couple of things you can do. The message is being set in line 25-33 of uc_ajax_cart.module:

function uc_ajax_cart_cart_item( $op, $product ) {
  switch ( $op ) {
    case 'remove':
      if ( variable_get('ajax_cart_message_remove_display', 1 ) )  {
        $message = variable_get('ajax_cart_message_remove', '!product successfully removed from cart.');
        drupal_set_message( t( $message, array('!product' => $product->title )) );
      }
    break;
  }
}

The variable that you would set to turn this feature on or off happens to be commented out in uc_ajax_cart.admin.inc:
line 74-88:

/**
    'display_remove_message' => array
    (
      '#type' => 'checkbox' ,
      '#title' => t('Should show a message if product is removed from cart.') ,
      '#default_value' => variable_get('ajax_cart_message_remove_display' , 1 )
    ),
    'display_add_message' => array
    (
      '#type' => 'checkbox' ,
      '#title' => t('Should show a message if product is added from cart.') ,
      '#default_value' => variable_get('ajax_cart_message_add_display' , 1 )
    ),
**/

Either comment out the function in uc_ajax_cart.module, or move the /** from line 74 to line 81, and then set it to not display in your admin settings screen.

Word.

In 6.x-2.0-dev

Tried 2nd method - move the comment according to Mixologic suggested. The option shows up but it didn't work. So, I tried to comment out function uc_ajax_cart_cart_item. It works ok now.

My code will be like this :

function uc_ajax_cart_cart_item( $op, $product ) {
  /**
  switch ( $op ) {
    case 'remove':
      if ( variable_get('ajax_cart_message_remove_display', 1 ) )  {
        $message = variable_get('ajax_cart_message_remove', '!product successfully removed from cart.');
        drupal_set_message( t( $message, array('!product' => $product->title )) );
      }
    break;
  }
  **/
}

Thanks,

I'm using 6.x-2.0-beta2

Re #5 Commenting out the contents of uc_ajax_cart_cart_item was disastrous for me—instead of seeing a message saying "product successfully removed from cart" when a product was removed from the cart I get a very broken shopping cart page in the page's theme inside a lightbox.

Re: #4 the admin setting change didn't work for me either. I got the checkbox but the message still persisted.

Both of these solutions look like (if they worked) they remove that message universally, which is not what I'm asking for. I want customers to see the "successfully removed from cart" message when they remove something from their cart.

Where I don't want that message to appear is in the (non-AJAX) text of the page /cart/checkout/complete. That's a user experience nightmare. My client is killing me over it on a site that's set to launch soon—and she's right to be on my back about it.

That's how this is not the same as #897038: Option to NOT show "<product> successfully removed from cart" which is a feature request. This is a bug report. More configurability is nice, but sending this message to customers is a real problem.

I cobbled together a fix by changing line 26 of uc_ajax_cart.module:

if ( variable_get('ajax_cart_message_remove_display', 1 ) && $_SERVER['REQUEST_URI'] != '/cart/checkout/complete' )  {

...but I'm pretty sure that's Not The Drupal Way Of Doing It.

I'm in the same boat. Need to stop this message at checkout, but still want it to appear when a user actually removes items from cart. What is the best way?

actually it's a pretty easy fix, please use the following code:

<?php
function uc_ajax_cart_cart_item( $op, $product ) {
  switch (
$op ) {
  case
'remove':
    if (!
$_SESSION['do_complete']) {
      if (
variable_get('ajax_cart_message_remove_display', 1 ) )  {
       
$message = variable_get('ajax_cart_message_remove', '!product successfully removed from cart.');
       
drupal_set_message( t( $message, array('!product' => $product->title )) );
      }
    }
    break;
  }
}
?>

This will only add the message when it's not on the "Order complete" page.

In other words, there will be no "production removed" message on order complete page now.

Status:Active» Needs review

BTW, the $_SESSION['do_complete'] is defined in uc_cart.module

Hi,

What's the status of this issue? Will the code posted by yang_yi_cn in #9 (which does the trick) be included in the next release or do I need to look for another solution to this problem?

Subscribing, greetings, Martijn

@rhmtts: I just downloaded and installed 2.0-beta2 today, tried to recreate this issue, and discovered yang_yi_cn's code is included by default.

The 1st if statement has also been removed as mentioned in reply #10.

Regards,
BigMike

@BigMike #13 : Which 2.0-beta2 is that? The one from drupal.org still has the incorrect code. The same is true from uc_ajax_cart-6.x-2.x-dev

I just downloaded http://ftp.drupal.org/files/projects/uc_ajax_cart-6.x-2.0-beta2.tar.gz today at 13:19 PST to double check, and the changes are there.

Extract the files and open uc_ajax_cart.module. Look at lines 25-34.

EDIT: I've added lines 20 - 40 for reference:

20 function uc_ajax_cart_perm() {
21   return array('show uncached cart', 'use cart');
22 }
23
24
25 function uc_ajax_cart_cart_item( $op, $product ) {
26   switch ( $op ) {
27     case 'remove':
28       if ( variable_get('ajax_cart_message_remove_display', 1 ) )  {
29         $message = variable_get('ajax_cart_message_remove', '!product successfully removed from cart.');
30         drupal_set_message( t( $message, array('!product' => $product->title )) );
31       }
32     break;
33   }
34 }
35
36
37 function uc_ajax_cart_menu() {
38
39   /** Default Settings URL **/
40   $items['admin/store/settings/uc_ajax_cart'] = array(

BigMike

If you compare that code to yang_yi_cn's in #9 you'll see it's missing the all-important if (!$_SESSION['do_complete']) {

Without that if, the message gets shown on the order completion page, which is not what you want.

So it seems the patch has not made it into the dev branch or the beta branch yet.

Is there anything I can do to make it get in there?

@ #16: Right, that is the if statement that was removed as per reply #10 that I made mention of in my first reply here, "The 1st if statement has also been removed as mentioned in reply #10."

I do not get the message on my order completion page. I just did a checkout again and YOU ARE CORRECT, the issue remains! I am sorry for the misunderstanding!! :'(

Okay, this is in no way the correct or even acceptable method to do this, but until a proper solution comes out, this is what I'm going with:

Insert this code right above the tag of your page.tpl.php (or anywhere for that matter)

<?php if (check_plain(request_uri()) == "/cart/checkout/complete"): print '<style type="text/css">div.messages { display: none; }</style>'; endif; ?>

Mike

@BigMike #18 : The trouble with that solution is that it hides *all* messages, not just the product removal ones.

@rhmtts #19 : That is true but I didn't see any other messages being displayed so I figured it would fly. My site (D6.20 & UC2.4) places the cart checkout message in div#content-area of my main content region and not in a message div (furthermore my message div is located in my content-header region). So the customer still gets the, "Checkout completion message header" message followed by the "Checkout completion for logged-in users" message (if logged in) (configurable at admin/store/settings/checkout/edit/messages).

I'm certainly not trying to argue against you; I am also looking for a suitable temporary solution for this :-)

BigMike

Version:» 6.x-2.x-dev
Status:Needs review» Fixed

Committed yang_yi_cn fix in #9 to 2.x-dev branch, it seems to work ok, thanks for the patch.

Also, if you test patches remember to set status to "reviewed & tested by the community" for fast fixing ;-)

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Status:Closed (fixed)» Active

Patch works ok but variable ajax_cart_message_remove_displayis not set and is not available in admin page.

Status:Active» Fixed

Removed ajax_cart_message_remove_display var check since there's no reason to show those messages.

Nice work guys, thank you!

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.