Using Drupal 6.14, Ubercart 6.x-2.0, and UC Reorder 6.x-1.2.

The Reorder buttom is correctly placed next to the list of previous orders. Also, when I click on Reorder, it correctly adds that order to the cart. However, the Shopping Cart Total does not include the additional options that were added to the order when it was placed. For example, if the sell price of the product is $10.00 and a $1.00 option was added on the original order for a total order price of $11.00, the reorder price is $10.00 not $11.00.

Any help with this problem would be greatly appreciated.

Comments

tr’s picture

Status: Active » Postponed (maintainer needs more info)

From day one, this module was designed to work properly with attributes. In particular, the latest release was tested extensively with all four types of attributes, with multiple options for each attribute, and with various price adjustments for each option. I have never seen it fail like you describe - the price in the cart of a reordered product with attributes is always exactly the same as if you had put that item directly into the cart without the reorder button. The price in the cart will always be the *current* price, not the price taken from the saved order, so if you've changed your sell price or option prices since the original order the customer will pay a different amount.

You've given me very little information to go on, and since I've never seen this behavior and can't reproduce it, there's not much I can do. I suggest you upgrade to UC 2.2 as a start, disable any modules that affect pricing, then try to specify the conditions under which you can reproduce the problem.

markagray’s picture

I upgraded to UC 2.2 and there was no change. I then ran several test cases. I found that if the product is not created from a product class, then there is no problem. However, if I create a product from a product class, I notice two things. The "sell" price on a reorder is correctly added to the cart price, however the price of any added attribute options are not. I appreciate your help with this.

tr’s picture

OK, so to be clear:

If you re-order an order that has just regular products in it, the attributes and prices for those products show up properly in the cart?

But if you re-order an order that has a product class in it, the attributes show up in the cart but the price in the cart is the base price without any attribute price adjustments for that product class?

I just created some product clases and test orders to see if I can reproduce this, and I can't - it works properly for product classes for me.

What is the structure of your product class and the attributes you're using - is it something I can copy here to try to reproduce the problem?

Are you trying to re-order orders that were created under an old version of Ubercart (before UC 2.0 RC 5) ? The structure of attribute options changed in Ubercart at that point, so this module might not work on orders created with the old version.

Another problem might be, if you've changed your attribute pricing, re-ordered products will use the *new* pricing, not the pricing for the order as originally placed. Likewise, if you've changed what attributes/options are available for that product, I'm not sure what will happen. I think it will work correctly, but I've never tested that situation.

I'm looking for a way I can reprodue the problem on a clean install, because if I can't reproduce it I can't debug it. I might have to resort to having you put print statements in your code to track things down, but it's going to take a long time to go back and forth with that.

markagray’s picture

Thanks so much for your help.

The answers to your first two questions are Yes.

In answer to your third question, I will create and test a simple test case and then describe it to you, maybe by some screen shots.

In answer to your fourth question, no, I am not reordering orders that were created under an old version of Ubercart. I am working on a test site (not live) and I'm placing new test orders then trying to reorder them.

You indicated "if you've changed what attributes/options are available for that product", yes, I have done this. Maybe that's the problem. I will create a new class and new product from that class and retest.

Thanks!

markagray’s picture

TR,

After a lot of testing I found a test case that causes the problem. When a product derived from a class contains an attribute whose attribute name does not match the attribute label, the problem occurs. If I make the label match the name it works. Try this and let me know your result.

Thanks!
Mark

tr’s picture

Status: Postponed (maintainer needs more info) » Fixed

Yep, that was it. Thanks for your persistence in tracking this down. I've never encountered that bug because I always make the name and label the same when I create product attributes on my sites. Once you were able to tell me the conditions under which the bug occurred I was able to quickly reproduce it and fix the problem.

Ubercart stores only the attribute *label* in the database, not the unique attribute id. (The attribute id, however, is what is needed to add a product with that attribute to the cart). uc_reorder was using the attribute *name* instead of the label to figure out the attribute id. When the name and the label are the same uc_reorder worked, when they were different it didn't.

I just released a new -dev version of the module with this fixed.

This is actually a bug in Ubercart, which I will try to get fixed. Ubercart *should* be using the name, not the label, because the attribute label is not a required field and may be blank in the database. If it is blank, then there is *no way* to figure out from the data stored in the order which attribute id was attached to that product. The name, on the other hand, is required, so it will always exist. Likewise, the label is intended to be more of a user-interface element, so it does not seem appropriate to use it as a database key. Once that gets fixed in Ubercart, I'll have to change uc_reorder back to the old way of doing things.

(It's going to be a real pain to roll an Ubercart patch that will properly fix all previous orders in the database to use name instead of label, and the patch will affect a lot of code, so I don't expect it will be put into Ubercart anytime soon.)

markagray’s picture

Thank you for bearing with me and helping me to find the problem. My workaround was to create another attribute with a name/label pair that matched my second case, but it would be ideal to have a single attribute and tweak the label for the different product instances.

Status: Fixed » Closed (fixed)

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

bradezone’s picture

this really ought to be fixed in the actual release (not just dev). this tripped me up for a while today.
it's been almost a year since the last "stable" release.

bradezone’s picture

Status: Closed (fixed) » Active

opening this again b/c I just noticed the dev version does not completely fix my problem :(

the store I am setting up uses required attributes (radio buttons) that change the cost. These were not working in the "stable" version but are working in the dev version. However, I also have some text field attributes that DID work on stable but NOT on dev, i.e. they are no longer showing up at all in the cart (normally all attributes are show in a list with the product). these don't affect the price but are still essential when reordering.

If the developer wants to email me, I can give you a customer login to the site in question so you can see what's happening. my email is bradezone [at] gmail.com

I may look into this further myself, but i'm pressed for time on this project and was hoping this module would "just work"...

dave.hussey’s picture

@bradezone

did you have any luck getting this module to work?

bradezone’s picture

sadly no :(
we simply launched the store without the "reorder" option since it is not absolutely essential, but hopefully a fix is still in the works. as I described, between the "stable" and "dev" versions everything works, just not on the same version :/