CMS MADE SIMPLE FORGE

Cart2

 

[#9332] No price-decimals in options-dropdown an cart when product has options

avatar
Created By: Freud (Freud)
Date Submitted: Wed Jun 19 03:21:43 -0400 2013

Assigned To: Robert Campbell (calguy1000)
Version: 1.0.5
CMSMS Version: None
Severity: Major
Resolution: Fixed
State: Open
Summary:
No price-decimals in options-dropdown an cart when product has options
Detailed Description:
CMSMS: 1.11.7
CGEcommerceBase: 1.4.2
Products: 2.19.6
Carts2: 1.0.5

When a product has one or more options, the decimals of the price
(unitprice+price_adjustment) will not be displayed in the options-dropdownbox of
the addtocart-template and in the cart (mycart and viewcart).

For example: productprice = 89.50, price-adjustment=10.00, in dropdown and
cart=99.00
or productprice = 89.00, price-adjustment=10.50, in dropdown and cart=99.00

Imho both problems can be found in the file action.default.php of the Cart2
module.

For the dropdownissue that is line 400:
$price = (float)sprintf('%.2f',$base_price + $my_offer->discount);
This rounds the price-variable.
Changing this line to 
$price = number_format($base_price + $my_offer->discount, 2);
could be a solution.

I think the cart-problem is caused by the base64-encoding of the cartoptions.
I've tested that by multiplying the base_price by 100 before encoding the
cartoptions (line 401) and dividing it by 100 after decoding (line 194).
Then the cart will show the correct decimals.


History

Comments
avatar
Date: 2014-12-20 14:22
Posted By: Robert Campbell (calguy1000)

fixed in svn... but this will not solve the whole 'locale' issue with the
ecommerce suite as floatval has issues too.
      
avatar
Date: 2016-10-21 03:54
Posted By: arthur zitter (Zitar)

Edit the next line also:

$sig =
base64_encode(implode('::',array($opt->sku,$opt->qoh,$base_price,$my_offer->discount,$my_offer->parent,$my_offer->promo_id)));

into:

$sig =
base64_encode(implode('::',array($opt->sku,$opt->qoh,$price,$my_offer->discount,$my_offer->parent,$my_offer->promo_id)));

$base_price -> $price

The right price will show in your orderlist.

      
Updates

Updated: 2014-12-20 14:22
resolution_id: 5 => 7
cmsms_version_id: 30005 => -1

Updated: 2013-06-19 03:23
description: CMSMS: 1.11.7 CGEcommerceBase: 1.4.2 Products: 2.19.6 Carts2: 1.0.5 When a product has one or more options, the decimals of the price (unitprice+price_adjustment) will not be displayed in the options-dropdownbox of the addtocart-template and in the => CMSMS: 1.11.7 CGEcommerceBase: 1.4.2 Products: 2.19.6 Carts2: 1.0.5 When a product has one or more options, the decimals of the price (unitprice+price_adjustment) will not be displayed in the options-dropdownbox of the addtocart-template and in the
resolution_id: => 5