Closed (fixed)
Project:
Commerce Core
Version:
7.x-1.x-dev
Component:
Cart
Priority:
Normal
Category:
Feature request
Assigned:
Issue tags:
Reporter:
Created:
18 Oct 2010 at 08:02 UTC
Updated:
25 Jul 2011 at 16:59 UTC
Jump to comment: Most recent file
Comments
Comment #1
rszrama commentedYeah, I'm not sure if a View would help or not... but I bet you can achieve the same result by embedding the shopping cart form in a custom checkout pane. You'll just need to alter the submit buttons a bit to use D7's FAPI #ajax property.
Comment #2
recidive commentedI'm working on this as part of #945090: Shopping cart user experience.
Comment #3
recidive commentedHere is a patch that turns the shopping cart into a view.
It does this by though the "Shopping cart" views display plugin.
It's very handy since you can override the default view to include whatever fields you want.
See attached screenshot to see how the shopping cart will look with this patch.
Comment #4
pieterdcHappy to see this :-)
Basically, the patch works.
At first, I didn't realize you can disable / enable the 'Remove', 'Update' and 'Checkout' buttons. But you can do so via the Views 'Shopping cart'-style settings.
Is it possible to put the 'Remove' button in a seperate field / column?
Comment #5
recidive commented@PieterDC: Thanks for testing the patch.
I forgot to mention I added settings for opting to show/hide the buttons.
>Is it possible to put the 'Remove' button in a seperate field / column?
Good question. Perhaps it makes sense to make the delete button a view field?
Comment #6
pieterdcIt makes sense to me.
That would also mean we don't all have to agree on the position of the delete button - which is mentioned elsewhere in the issue queue. We only have to agree on the default position of that button.
Comment #7
rszrama commentedYeah, delete button should end up its own field... I'll give it a shot this afternoon. Even if it's its own field, you can still display it in the same column as another field (like the Quantity box or Description).
Comment #8
recidive commentedAs Ryan and me have talked on IRC, I've changed the patch so it makes uses of 'table' style plugin or any other. This is a great improvement that means you can now have cart formatted using any views style plugin, so you can have total control of output of the cart.
Also, line_item views integration has now two new fields: 'quantity_edit' field that presents the form field to edit line item quantity and 'remove' field that presents a button to remove a line item.
I've implemented an abstract class to make it easy to create other editable line item fields. The new approach is a step forward in enabling it to also allow editing other orders, not only cart.
The patch still have few rough edges, but it's ready for review of the direction it's taking.
There are three known issues:
- it's missing the Subtotal from the other patch
- it's missing a CSS class, so the cart is not formatted as in previous patch yet
- the buttons is appearing on cart block since it's not currently testing if there are quantity edit or remove button fields added to the view before creating the cart form
Also, we should move the cart form buttons to a area handler, so we can control e.g., if forms should appear on views footer, header or both.
Comment #9
recidive commentedPatch in #8 was including the cart style plugin which it shouldn't. Here's a new patch without it.
Comment #10
recidive commentedHere is an updated patch, I've moved CSS code from cart to line item module, so now the output cart form is themed. I also did some code cleanup and moved the line item editing form logic to a separate include file.
What's remaining to do is:
1. Move buttons to a views area handler so to give us control of it's placement.
2. Add back subtotal, as a views area handler as well.
3. Check for the existence of line item editing fields prior to creating the form, to avoid ending up with a form that does nothing.
Comment #11
recidive commentedOk, the patch is now complete.
I added a new area field to line item views integration 'line_item_actions" that is responsible for outputting the views buttons. I also added hook_line_item_summary_buttons() hook for allowing other modules to add their actions buttons.
The cart views is now using the "line_item_summary".
Comment #12
recidive commentedUpdating the patch to reflect new changes in github. Also removing three kitten killers chunks from last patch.
It would be awesome to get some review/testing.
Comment #13
rszrama commentedQuick heads up to say I had to fix the price field schema to use "amount" instead of "price" for the numeric value. It was inconsistent before. I'm guessing that affects this patch.
Comment #14
recidive commentedRe-rolling the patch after pulling changes from Ryan's github fork.
Comment #15
recidive commentedI'm here wondering if we shouldn't make the hook_line_item_summary_buttons() hooks return a complete form to be added to the area handler, likely this could be used for displaying the "add line item" widget to also enable making the admin order edit form a view.
Comment #16
recidive commentedI've submitted a pull request:
https://github.com/drupalcommerce/drupalcommerce/pull/3
Comment #17
recidive commentedHere is a re-rolled patch. No changes were made to it.
Comment #18
recidive commentedFixing problem with PHP 5.3 variable references.
Comment #19
rszrama commentedComment #20
rszrama commentedTagging.
Comment #21
recidive commentedOk, I did 1, 3 and 5.
4 I started adding some options to the summary area handler.
6 and 7 We figured out we can't remove the order right now, since we need it.
Keeping as need work, will finish it tomorrow morning.
Comment #22
recidive commentedOk. I did 2. And for 4 I added options for choosing what info to show in the summary area handler. Also added some css margin for separating the summary from the actions buttons.
Comment #23
pcambraIt works fine to me.
Maybe we could add an option to let the user to select whether the "Remove" from cart is a button or a checkbox.
Comment #24
rszrama commentedWe switched away from using checkboxes for usability, though I did try to have the buttons work through hidden checkboxes... that got shot down for some reason (it was either too buggy or just not necessary), and we switched to just using submit buttons. Will review the rest of the patch ASAP.
Comment #25
rszrama commentedDone! Hooray!
Comment #27
pieterdcHooray idd :-)
Comment #28
chinita7 commentedDoes anyone know if this function can be used in Drupal6?
I really need a view for my shopping cart but this forum is only what I could find but it's for Drupal7
Thanks
Comment #29
recidive commented@chino7: Drupal Commerce module is for Drupal 7 only. And this is not a forum, but an issue queue, so it's not the right place to ask.
As far as I know the answer for your question should be no.
Comment #30
chinita7 commentedThanks for your quick reply.
I'm sorry I misunderstood that this forum was for Ubercart as I stumbled on this forum while googling with that key word.