Adds the possibility to return from cart to the product form and change the selected options.

Once you enable the module, the user will be presented an edit link on the cart page.
Clicking on it brings the user back to the product page, with his previously selected options.
He may now change these options and the quantity and save his changes to the cart product.

You can see an older version of this module in action on:
http://www.oschatz-druckwerk.de
http://www.k-books.de

As this is an ubercart module, there is an ubercart project page available:
http://www.ubercart.org/project/uc_cart_edit

Installation

Just enable the module, it will work out of the box.

Modules with similar functionality

Ubercart attributes in cart: Use this module, if you want to let the user change the product's attributes directly in the cart.
If you want to use the product form instead, use "Ubercart Edit Cart Item".

Product kit issues

Right now this module does not support product kits.
We are working on a solution which won't involve hacking ubercart.
#1979412: Full product kit compatibility This has been fixed in the 7.x version, but still needs some review.

Project page:
http://drupal.org/sandbox/laborb/1418732

git clone --branch 6.x-1.x http://git.drupal.org/sandbox/laborb/1418732.git uc_cart_edit
git clone --branch 7.x-1.x http://git.drupal.org/sandbox/laborb/1418732.git uc_cart_edit

Reviewed projects:
https://drupal.org/node/2014627#comment-7526515
https://drupal.org/node/2008852#comment-7526601
https://drupal.org/node/2014453#comment-7522033

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

PA robot’s picture

Status: Needs review » Needs work

There are some errors reported by automated review tools, did you already check them? See http://ventral.org/pareview/httpgitdrupalorgsandboxlaborb1418732git

We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and we will take a look at your project right away :-)

Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).

I'm a robot and this is an automated message from Project Applications Scraper.

labor b’s picture

I just fixed the remaining errors in both the 6.x-1.x branch and the 7.x-1.x branch.

labor b’s picture

Status: Needs work » Needs review

Sorry, forgot to reset the status.

labor b’s picture

Status: Needs review » Needs work

Right now the 7.x version fails, when using checkboxes as attribute display.

labor b’s picture

Status: Needs work » Needs review

Remaining issue has been fixed, I'm marking this as needs review again.

labor b’s picture

Issue summary: View changes

Added correct git clone link.

m1n0’s picture

Hi,
Nice and simple module, here are some thoughts on the D7 version:

Please change the
package = Ubercart Extra
to
package = Ubercart extra
to put it in the same module group as other extra modules

I got the following error when hitting the edit field:
Notice: Undefined index: attributes in uc_cart_edit_form_alter() (line 65 of [path-to-drupal]/sites/all/modules/contrib/ubercart_edit_cart_item/uc_cart_edit.module).
This needs to be fixed.

Quick code review:

I don't get this condition:

  // In the Ubercart 3.x version the uc_product_add_to_cart_form
  // are part of the uc_cart_view_form. Continuing here would lead
  // to errors, so we will just return.
  if (arg(0) == 'cart') {
    return;
  }

Why is there a check for url "cart"?

m1n0’s picture

Status: Needs review » Needs work
labor b’s picture

Status: Needs work » Needs review

Hi, thanks for your review. I fixed the parts you mentioned above.

For some reason ubercart loads the uc_product_add_to_cart_forms again inside the cart, but doesn't display them. I couldn't find a better way to deal with this problem as the forms are exactly the same as before, so I'm just checking the path to determin if we are inside the cart.

I updated the comment above this check to make this more comprehensible.

m1n0’s picture

Hi

Sorry, I meant
Ubercart - extra
- you know, to put it in the same group as other extra modules

Ok now after quick code inspection, I started reviewing the functionality - what I dont understand is who would use this? When I click edit, I get the normal product node view with save button, but what is saved? Is it working as expected? (see screenshots)
On the 2nd screenshot, what am I supposed to do? There are GET parameters containing node ID (which is already there in node/[nid]) and nothing to change or edit.
Please explain

labor b’s picture

Module package is fixed now. To be sure I copied it from uc_addresses. ;)

One of Ubercart's features is that you can add attributes & options to products. Unfortunately once put into cart, there is no way to change your previously configured product attributes. If you want to change a single option, you will have to delete your product from cart and do the whole configuration again. That's not very user friendly.

Imagine you want to buy a PC, configure all the stuff you want, put it into cart and then you notice you selected not enough RAM. Now you will have to do the whole configuration again... with uc_cart_edit, you can just hit the edit button, change your RAM and save you changes.

The GET parameter you see in the url is the cart item id. As ubercart also has product kits (combinations of single products) it is an array of cart item ids.
I hope I could clarify the use case for this module.

labor b’s picture

Status: Needs review » Needs work

On second thought, it might be irritating to have edit links for products without attributes. As you pointed out, there is nothing to change in this case. In a shop there can live products with and without attributes, so it might be the best solution to just hide the edit links for those without attributes.

Also I found an error with product kits in the 7.x version. If display is switched to "individual products", the attributes are not processed correctly.

labor b’s picture

Status: Needs work » Needs review
m1n0’s picture

Status: Needs review » Needs work

Hi

It makes more sense to me now, thanks for explanation.

Further code inspection:

lines 21, 22:
from php doc (http://php.net/manual/en/function.strstr.php):
"If you only want to determine if a particular needle occurs within haystack, use the faster and less memory intensive function strpos() instead."

There is nothing else from my side for now.

labor b’s picture

Status: Needs work » Needs review

Thanks, I didn't know that about strstr & strpos. Learned something today.
I replaced all occurences of strstr with strpos in 6.x & 7.x version.

labor b’s picture

Issue summary: View changes

Added product kit changes.

labor b’s picture

Issue tags: +PAreview: review bonus

Adding review bonus tag.

labor b’s picture

Issue summary: View changes

Added reviewed projects.

klausi’s picture

Assigned: Unassigned » ELC
Status: Needs review » Reviewed & tested by the community
Issue tags: -PAreview: review bonus +PAreview: single application approval

This project is too short to approve you as git vetted user. We are currently discussing how much code we need, but everything with less than 120 lines of code or less than 5 functions cannot be seriously reviewed. However, we can promote this single project manually to a full project for you.

Otherwise looks good to me from a visual code review. Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.

Assigning to ELC as he might have time to take a final look at this.

labor b’s picture

Thanks for your review. I would really like to see this as a full project.

Edit: As our modules are mostly pretty short, would it be possible to get "full project access" after getting multiple short modules through this validation process?

klausi’s picture

Status: Reviewed & tested by the community » Fixed

Sure, just make sure that you reference your existing projects in that application.

no objections for a week, so ...

Thanks for your contribution, labor b!

I promoted this project for you: https://drupal.org/project/uc_cart_edit

Now that this experimental project has been promoted, you'll need to update the URL of your remote repository or reclone it.

Here are some recommended readings to help with excellent maintainership:

You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and get involved!

Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.

Thanks to the dedicated reviewer(s) as well.

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

Anonymous’s picture

Issue summary: View changes

Added additional git clone command for 6.x version.