Problem/Motivation

The module causes /cart to always redirect to /checkout, except when the cart is empty.

Proposed resolution

In commerce_responsive_ui.pages.inc, the function commerce_responsive_ui_commerce_cart_view on line 21 has a 'viewname | display name' string compared with a 'viewname' string and fails, dropping through to 'Fallback to checkout.'

$view_name = variable_get('commerce_responsive_ui_cart_override', 'commerce_cart_form');

The proposed resolution, by Neo13 and RaphaelBriskie, is to add the following three lines:

if ($view_name != 'commerce_cart_form') {
  $view_name = substr($view_name, 0, strpos($view_name, '|'));
}

Remaining tasks

Review and commit.

User interface changes

None (other than lack of unexpected redirection).

API changes

None.

Data model changes

None.

Original report by JDSaward

The module causes /cart to always redirect to /checkout, except when the cart is empty.

This is because, in commerce_responsive_ui_commerce_cart_view, a 'viewname | display name' string is compared with a 'viewname' string and fails, dropping through to 'Fallback to checkout'.

'viewname | display name' string: $view_name = variable_get('commerce_responsive_ui_cart_override', 'commerce_cart_form');

'viewname' strings: $enabled_views = views_get_enabled_views();

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

JDSaward created an issue. See original summary.

Neo13’s picture

I can confirm the issue. It can be fixed with substracting |default form the $view_name variable.

    $view_name = variable_get('commerce_responsive_ui_cart_override', 'commerce_cart_form');
    $view_name = substr($view_name, 0, strpos($view_name, '|'));
ropic’s picture

+1 Confirmed

RaphaelBriskie’s picture

Should actually be:

if ($view_name != 'commerce_cart_form') {
  $view_name = substr($view_name, 0, strpos($view_name, '|'));
}

So that if the default (non responsive) cart view is selected then it won't have the same redirect issue.

RaphaelBriskie’s picture

Or possibly check to see if $view_name has a '|' instead.

DoubleGJ’s picture

i used the #4 and it works, thank you JDSaward, Neo13 and RaphaelBriskie :)

rootwork’s picture

Priority: Normal » Major
Status: Active » Needs review
FileSize
752 bytes

Here is #4 in patch form.

Given the pretty significant unexpected behavior this bug introduces, I think it's reasonable to at least raise the priority to major.

rootwork’s picture

Issue summary: View changes

Updated issue summary just to make things a little clearer in the hopes of getting this committed.

oana.hulpoi’s picture

I confirm the issue. Thanks for the patch, it works :)

tyler.frankenstein’s picture

Status: Needs review » Reviewed & tested by the community

#7 also works for me.

rootwork’s picture

If/when this patch gets committed, credit should go to @Neo13 and @RaphaelBriskie. All I did was roll their fixes into a patch.

rv0’s picture

+1 for this fix

HansKuiters’s picture

Reviewed, tested and approved.