I wasn't really sure whether to make this a bug or a task. It is sort of both. A small but important thing, potentially confusing for customers (if the site admin does not notice).

Cart and checkout are not the same thing.

This module should say 'Go to cart', or better, it should actually go to the checkout. If a customer has not decided to 'continue shopping', plus they see the information in the popup box, then they probably want to go directly to checkout.

We must remember that the more clicks a customer makes, the less likely it is they will complete the process.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mikeaja’s picture

For those that see the issue here and want to fix themselves, it's very simple.

In thie file, commerce_add_to_cart_confirmation.rules.inc, line 36, change:

$message .= '<div class="button checkout">' . l(t('Go to checkout'), 'cart') . '</div>';

to

$message .= '<div class="button checkout">' . l(t('Go to checkout'), 'checkout') . '</div>';

or alternatively, change to 'Go to cart' to improve the logic.

Left Active as I see this as a fix stil needed in this module.

mikeaja’s picture

Priority: Major » Normal
pslcbs’s picture

@mikeaja, not good idea to hack the code inside the module if you have clean alternatives to do the same.

Instead copy the function theme_commerce_add_to_cart_confirmation_message($variables) containing this code in your theme template.php, rename it as YOURTHEME_commerce_add_to_cart_confirmation_message($variables) and make your changes there.

guy_schneerson’s picture

Ideally both the checkout label and the URL should be configurable as some systems like PayPal express checkout require you to go to the cart page as this is where the EC checkout starts while others prefer to go straight into checkout.

gokulnk’s picture

Based on guy_schneerson's comment I just created a patch that add two config option in the rule admin interface. I agree that this will be very helpful for the non-coders. A must have feature according to me.

I have not tested the patch, but I hope it should work without any issues.

gokulnk’s picture

Status: Active » Needs review
Haza’s picture

I don't have a fresh install of commerce to test the patch.

Can someone test it with a special attention to the case when you apply the patch to an existing install. I just want to be sure I will still work when we change the rules part.

Thanks.

gokulnk’s picture

Haza,

Did you get a chance to review this?

I created the patch for an existing inssance and didn't have any issues. Since we are adding default values to the settings, it should not cause any issues.

deggertsen’s picture

Status: Needs review » Needs work

I'm getting errors with the patch:

Parse error: syntax error, unexpected ';' in /sites/all/modules/commerce_add_to_cart_confirmation/commerce_add_to_cart_confirmation.module on line 75

and

Parse error: syntax error, unexpected '=>' (T_DOUBLE_ARROW) in /sites/all/modules/commerce_add_to_cart_confirmation/commerce_add_to_cart_confirmation.rules.inc on line 48

Also, it will be important that we include defaults in the commerce_add_to_cart_confirmation.rules_defaults.inc file for the LINK LABEL and TARGET URL so that the rule works upon enabling of the module.

Otherwise, I like where this is going! It's always nice when you don't have to hack the module.

deggertsen’s picture

Status: Needs work » Needs review
FileSize
3.55 KB

Here's a patch with the errors fixed that I mentioned above. Looks like everything is working great! Take a look and mark as RTBC.

deggertsen’s picture

FileSize
3.56 KB

Just needed to fix a few whitespace issues.

gokulnk’s picture

Hi deggertsen,

As I had mentioned I had not tested the patch. I wrote it when I had a few minutes and didn't have access to the a commerce instance. Thanks for catching errors and polishing the patch.

I tried this out on a fresh install of Commerce and this module. I have tested two scenarios.

  1. The module is already enabled and the patch is applied later. In this case a set of warnings are being thrown. If the site admin edits the rule and save it, it should fix the issue. But we should also make sure that even for users who don't do it we should be able to update the rule programmatically. We can look at http://dropbucket.org/node/2216 or hook_rules_config_load
  2. If the module is being installed for the first time after the patch then there are no issues and everything works perfectly
gokulnk’s picture

Status: Needs review » Needs work

I always forget to update the status :)

deggertsen’s picture

Yeah, we should be able to do a hook_update for this so that it will not break the rule for users that are updating. I think it would be something like this (I haven't tried this and have not written an update hooks with rules before so there are likely problems with it):

hook_update_N() {
$rules_config = rules_config_load('commerce_add_to_cart_confirmation_message');
$rules_config->action('commerce_add_to_cart_confirmation_message', array(
          "commerce_line_item" : [ "commerce_line_item" ],
          "link_label" : "Go to cart",
          "link_url_target" : "cart"));
}

I think this will just create a new action though rather than overwrite the old one... Definitely needs work.

deggertsen’s picture

I've included a temporary fix included in my patch (rework_CSS-1980658-6.patch) in #1980658: Completely redo CSS. I'll be using that until we can get the details worked out in this issue.