The module has a huge bug with the (Core) Products kits:

I have a store thar sells 3 products in a kit.
Each one costs:

1. US$499
2. US$186
3. US$399 (= US$1084)

They are in bundle/kit that is sold for $599 (about 45% discount).

Their prices are lower for the Chinese market,

1.  880 RMB
2.  480 RMB
3.  725 RMB  (= 2085 RMB)

And the multiprice setting for China is 1080 RMB (about 49%)
The price 1080 RMB displays in the product page perfectly. However, when I go to the cart/checkout the price becomes 1600 RMB! With:

1. 657 RMB
2. 397 RMB
3. 546 RMB

Checking in detail:

The bundle sustracts from the prices of the individual products in USD, but shown in RMB. Thus the kits takes US$186 like 186 RMB and substracts -83.220, showing:

Discount: 186 RMB + -83.220

This gives weird prices for all the kits in my site... I am about to launch the site and the chinese prices + bundles are a must. Which is the best way to fix this? I am willing to code a patch but I really could use support on how to do it.

Miguel

Comments

miguel.rincon86’s picture

Version: 6.x-1.0 » 6.x-2.x-dev

Sorry I see now that I am using 2.x-dev

miguel.rincon86’s picture

It took me a while to understand the price API. I have the fix I made for the module.

In uc_multiprice.module, the function uc_multiprice_price_handler_alter (line 311) add the following code at the end.

  if ($context['type']=='cart_item')
  {
	//I must get the kit id to know calculate the final value
	$kit_id = $context['subject']['cart_item']->data['kit_id'];
	if (isset($kit_id)) {
	  $kit = node_load($kit_id);
	  //I assume that all the quantities are equal to 1. 
	  $price['price'] = (float)$kit->sell_price / (float) count($kit->products);
	  //Make sure all the information is saved
	  $context['subject']['cart_item']->price = $price['price'];
	  $context['subject']['cart_item']->module = 'uc_multiprice';
	  return $price['price'];
	}
  }

This is not good for a patch since it only works for qty = 1 in all the products in the kit (because of sell_price/# prods). I am sure that someone can get this fixed to work for qty = N. I have to get going on some other things now!
This also displays all the products in a kit with the same price (good enough for my store).

Happy new year!

Miguel
SEO and Web Development Beijing

Docc’s picture

Assigned: Unassigned » Docc
Status: Active » Closed (fixed)

Added support for product kits in latest dev