Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

cart and fractional quantities

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 10-03-2007, 03:09 PM
 
willis1480 willis1480 is offline
 

Member
  
Join Date: Sep 2006
Posts: 15
 

Default 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
__________________
www.mypacksupply.com
X-CART 4.0.19
Reply With Quote
  #2  
Old 10-03-2007, 05:14 PM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default Re: cart and fractional quantities

I removed your second post on this, as you posted in a 3 year old thread
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #3  
Old 10-03-2007, 05:39 PM
 
willis1480 willis1480 is offline
 

Member
  
Join Date: Sep 2006
Posts: 15
 

Default 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!
__________________
www.mypacksupply.com
X-CART 4.0.19
Reply With Quote
  #4  
Old 10-03-2007, 05:43 PM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default Re: cart and fractional quantities

Thanks for following up, always nice when someone actually posts a solution!
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #5  
Old 02-21-2008, 10:21 AM
 
Paul Mensch Paul Mensch is offline
 

Newbie
  
Join Date: Feb 2008
Posts: 1
 

Default 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.
__________________
Paul
X-Cart 4.1.9
Reply With Quote
  #6  
Old 02-21-2008, 10:34 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default 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.
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 07:11 AM.

   

 
X-Cart forums © 2001-2020