Hi there,
I'm using a shopping cart block on my order page, and it is redirecting to the front page when clicking the 'delete' button on a line item. The item is removed from the cart, including a message to the effect when the home page loads. Looking at the page source, the action for the form is set as the base URL, rather than the order page's path.
I'm using the default shopping cart block view provided by the cart module, with one change: the contextual filter for Order ID is set to custom PHP code to extract the order ID (since the default behaviour displayed all previous cart items). I've tried changing it back to the default behaviour, but no change.
Any idea why this might be occurring?
Comment | File | Size | Author |
---|---|---|---|
#3 | Screen-Shot-2011-12-06-at-6.49.20-PM.jpg | 167.59 KB | PedroMiguel |
#2 | commerce_cart_block_view.txt | 15.89 KB | aharvie |
Comments
Comment #1
rszrama CreditAttribution: rszrama commentedI'm pretty sure this is a known issue in Views 3, but I can't find the pertinent issue. Mind digging there a bit?
Comment #2
aharvie CreditAttribution: aharvie commentedHmm, I did some searching in the Views issues, but I can't find anything relevant either. The only issues I could find that described a similar problem were these:
http://drupal.org/node/1051668
http://drupal.org/node/1123196
The first one describes AJAX = yes, which is not the case here. The second describes exposed filters, but also a committed fix. I'm trying the latest dev versions of Commerce and Views, but still seeing the problem.
I've attached an export of the view if it helps.
Comment #3
PedroMiguel CreditAttribution: PedroMiguel commentedGot the same error, the form array have a redirect, but the redirect is not used (maybe the array is not well build?)
Not sure if is on views or on commerce itself.
I attach a screenshot, where I think something is wrong.
Comment #4
PedroMiguel CreditAttribution: PedroMiguel commentedChaging this from support request to Bug report, because that what this is.
The delete button on cart dont respect the redirect.
So on a store with thousands products, if a costumer are on a deep path and made a mistake (IE: added a red cap instead a black one) and delete the line item return to front page.
Comment #5
rszrama CreditAttribution: rszrama commentedAs I mentioned, I'm pretty sure there's an issue with the form in Views / Drupal itself. This form isn't managed through Commerce itself, so really we need research to be done to find the root of the problem inside the other systems.
Comment #6
PedroMiguel CreditAttribution: PedroMiguel commentedFound IT!!
Is with commerce itself
Based on this: http://drupal.org/node/525592#comment-1833824
As commerce use a own function to embed view (function commerce_embed_view) on commerce.module I just change line on commerce_cart.module line 491:
Was :
I change to :
I dont know how to create a patch, so if this is ok, someone could please create one?
Comment #7
pcambraActually we're going to remove that embed of the cart block to use the view itself shortly, see #1030128: Convert shopping cart block and form Views to use Views block / page displays
Comment #8
rszrama CreditAttribution: rszrama commentedRevisiting this, since the effort to convert these entirely to Views got postponed, I'm committing PedroMiguel's fix.
Comment #9
drupalerocant CreditAttribution: drupalerocant commentedPlease, can you tell us when you have it fixed?
thanks!
Comment #10
rszrama CreditAttribution: rszrama commentedNovember 16, per the comment above. It's just in the latest -dev version but will be in the 1.5 when it's released.
Comment #11
drupalerocant CreditAttribution: drupalerocant commentedThanks Ryan!
Comment #13
Marko B CreditAttribution: Marko B commentedFor me, this is nothing helping at all. Commerce cart block keeps redirecting to front page. Unless I use solution from here
https://www.drupal.org/node/525592#comment-5906780 and use $view->override_path.
Comment #14
peter panes CreditAttribution: peter panes commentedUse override_url instead of override_path in custom module as above.
Rather than setting the redirect URL for the view now you are setting the Default URL for the view so it will link to that instead of redirecting to homepage:
The following code works perfectly for me with this use case:
$view->override_url = base_path() . $_GET['q'];
Comment #15
maxplus CreditAttribution: maxplus commentedHi,
Thanks @peter panes from #14
For me the way to go is indeed using:
$view->override_url = base_path() . $_GET['q'];
When using:
$view->override_path = $_GET['q'];
=> I was getting unwanted URL's that are no clean URL's anymore and always get longer and longer, like described in https://www.drupal.org/node/525592#comment-9351087
Comment #16
Arne Slabbinck CreditAttribution: Arne Slabbinck commentedThanks to #13 and improvement on path in #14, works like a charm!