All sites have this bug, so heres the fix

Arpit <[email protected]>
Newsgroups gmane.comp.web.oscommerce.tips
Message-ID <c51628a59782674640a5bd0197c6a73a@osCommerce-Forums>
This message was sent from: Tips and Tricks
http://forums.oscommerce.com/viewtopic.php?p=185304#185304
----------------------------------------------------------------

I am not sure if you have noticed this, but every release of osCom has this, the text box where you specify the quantity of products, the shopping_cart.php, there you can specify products with decimal places, so a customer could mistakeably orders 2.5 shirts, now I dont know how to give a customer 2.5 of any item, and the weird thing is, the price total includes the price for that 0.5 shirt, so this is what you do,

In includes/classes/shopping_cart.php around line 99 
make sure that the variable 'qty' has (int) in front of it so it looks like,  

[quote]if ($this->in_cart($products_id)) { 
$this->update_quantity($products_id, [quote](int)[/quote]$qty, $attributes);[/quote]

if you are using CVS2.2 then add (int) in catalog/shopping_cart.php around line 149

[quote]$info_box_contents[$cur_row][] = array('align' => 'right',
                                             'params' => 'class="productListing-data" valign="top"',
                                             'text' => '<b>' . $currencies->display_price($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']), [b](int)[/b]$products[$i]['quantity']) . '</b>');
    }[/quote]

Now if someone tries to enter 2.6 or any quantity with decimal, it would round the quantity and the price would not change :idea:
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.