X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   cart and fractional quantities (https://forum.x-cart.com/showthread.php?t=34355)

willis1480 10-03-2007 03:09 PM

cart and fractional quantities
 
I have just begun playing around with this. I have products that I need to be able to ad fractional quantities such as 1.25 or 2.5. Unfortunately x-cart truncates these. I have adjusted the mysql pricing table to accept price breaks based on fractional quantities however cannot get the cart to handle this.

Can anyone give me a quick tutorial on the cart and how it operates?

OR

Has anyone preformed anything like this before?

Thanks

balinor 10-03-2007 05:14 PM

Re: cart and fractional quantities
 
I removed your second post on this, as you posted in a 3 year old thread :)

willis1480 10-03-2007 05:39 PM

Re: cart and fractional quantities
 
Well...anyway...after way too much time spent on this I have resolved my issues. For anyone who comes across this in the next 3 years...here is the answer:

open cart.php and make the following changes
remove the "floor()" functions in the "mode='add'" section
remove the following around line 270
if ($amount < $added_product["min_amount"]) {
func_header_location ("error_message.php?access_denied&id=31");
}

Now in removing the check for min_amount you may want reconsider that. I have no worries about inventory and do not maintain that. By default you minimum amount will be 1.

In addition to this I changed the stock text box for quantity with a drop down menu where I have determined the amount they can add to cart. This eliminates my concerns for user error when entering quantities.

Hope this helps save someone time in the future!

balinor 10-03-2007 05:43 PM

Re: cart and fractional quantities
 
Thanks for following up, always nice when someone actually posts a solution!

Paul Mensch 02-21-2008 10:21 AM

Re: cart and fractional quantities
 
While I found this post helpful in locating the code to change, it must be out of date. I am running X-Cart 4.1.9, and cart.php uses the intval fuction instead of floor. Also, there is code in includes/cart_process.php that call intval.

Perhaps the bigger problem is that X-Cart doesn't seemed to be designed with fractional quantities in mind. I'm implementing it for a fabric store, so this is kind of important to us :-) . If you look at the X-Cart database, you'll see that quantities are defined as INTEGER values. I changed the amount field in the xcart_order_details table to DECIMAL(12,3), and that seems allow fractional quantities to work correctly, but it's still a little early in the testing to be sure. (Also, I'm not using X-Cart's inventory tracking - our POS system handles that and "manipulates" the X-Cart database somewhat directly, so my modifications have not addressed inventory levels at all. In fact, my mods will probably break it to some degree.)

This problem isn't really unique to X-Cart. We used to use OSCommerce, and I had to hack it to death to get fractional quantities to work.

balinor 02-21-2008 10:34 AM

Re: cart and fractional quantities
 
Hi Paul, welcome to the forums. Please be sure to update your forum signature with your X-Cart version per the forum guidelines, as we can't assist you without it. The above post refers to an older version of X-Cart, so it is probably not going to work for you on 4.1.


All times are GMT -8. The time now is 06:45 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.