SKU (model-number) not saved to order information if product and option have same SKU

Project:Ubercart Contributions
Component:Code
Category:
Priority:critical
Assigned:Unassigned
Status:active
Description
Project: 
Ubercart

I have a product who have two options, big and small.

Product SKU is A1 and default option is small, whitch model number is also A1. big option have model number A2.

When I order this product with small option, and go order packages page and create new package, the model field is empty. If I select big option when I create order, the model field show right SKU.

I set same SKU to main product and default option because the main product SKU is show in the product page.

Version: 
Ubercart 1.3
Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: SKU (model-number) not saved to order information if product

Sounds like this is for Lyle in the uc_shipping module?

Can you provide the path of the page you're referring to?

junix's picture
Offline
Joined: 03/10/2008
Juice: 20
Re: Re: SKU (model-number) not saved to order information if pro
Assigned to:Ryan» junix

the admin page path where model number is not show, is /admin/store/orders/[order_id]/packages/new

But I think that the problem is not here. I did debug packages creation page, and see that model number field is empty in database (uc_order_products table).

The model number information lost when product is added to cart. If I add normal product to cart, I can see the model number in cart page source code (in setQuoteCallbacks javascrpit functions). If I add to cart product who have same sku in product and attribute witch are selected, the model field is empty in cart page source code.

Is this help you?

... And sorry about my bad English skill..

junix's picture
Offline
Joined: 03/10/2008
Juice: 20
The problem sovled

Hi!

I hunted the bug over tree hours, but sovved this finally.

The bug is in the uc_multi_stock-contribution module in line 92.

This is original line:

$item->model = $sku;

This is fixed line:

if(!empty($sku)) $item->model = $sku;

This problem is hard to solve therefore I dont know, that option cant have same model as if product. Product adjustments form is not tell that some model cant saved (if this is same that product model). And if some model not have saved model, form use procut model to default value in form.

facts:
1. option model not saved to database if model is same as if poroduct.
2. adjustments form use product model in options default value if is not found from database.
3. uc_multi_stock overwrite product model number thought options model is empty.

Lyle's picture
Offline
AdministratoreLiTe!
Joined: 08/07/2007
Juice: 6846
Re: The problem sovled
Assigned to:junix» Lyle

Good to hear you got it figured out. I was going to set this issue to the uc_multi_stock module, but apparently it isn't here. Make sure whoever maintains that module knows about this bug.

JaceRider's picture
Offline
Joined: 03/17/2008
Juice: 98
Re: Re: The problem sovled
Assigned to:Lyle» JaceRider

Thank junix! I was experiencing the same issue and have resolved it with your fix.