AbanteCart Community

Shopping Cart Operations => Support => Topic started by: maniz on December 22, 2013, 12:28:23 AM

Title: selling by linean meter problem in chekout
Post by: maniz on December 22, 2013, 12:28:23 AM
I need to use by a meter in the item but at the check point it calculate only the first number not the decimal 
e.g.
sell by 1.5 meter x $20.00 = $30.00 
check out 1 x $20.00 =$20.00 
Title: Re: selling by linean meter problem in chekout
Post by: abantecart on December 22, 2013, 12:33:07 PM
Quantity filed is considered to be whole number, or an integer number and cannot be decimal.

If you need to allow this as a special case for your business model, modification is required.

Open file: core/lib/cart.php

Locate about line 305:
Code: [Select]
if ((int)$qty && ((int)$qty > 0)) {
    if (!isset($this->session->data['cart'][$key])) {
      $this->session->data['cart'][$key]['qty'] = (int)$qty;
    } else {
      $this->session->data['cart'][$key]['qty'] += (int)$qty;
    }
    //TODO Add validation for correct options for the product and add error return or more stable behaviour
$this->session->data['cart'][$key]['options'] = $options;
}
change to
Code: [Select]
if ((int)$qty && ((int)$qty > 0)) {
    if (!isset($this->session->data['cart'][$key])) {
      $this->session->data['cart'][$key]['qty'] = $qty;
    } else {
      $this->session->data['cart'][$key]['qty'] += $qty;
    }
    //TODO Add validation for correct options for the product and add error return or more stable behaviour
$this->session->data['cart'][$key]['options'] = $options;
}
Title: Re: selling by linean meter problem in chekout
Post by: maniz on December 23, 2013, 01:30:28 AM
Thank you abantecart
for your quick and correct respond
I donate 5 euro for your help
Title: Re: selling by linean meter problem in chekout
Post by: abantecart on December 23, 2013, 07:49:58 AM
Glad, I can help. Thank you for donation  8)
Title: Re: selling by linean meter problem in chekout
Post by: CTGO.co on May 27, 2019, 04:25:35 PM
Quantity filed is considered to be whole number, or an integer number and cannot be decimal.

If you need to allow this as a special case for your business model, modification is required.

Open file: core/lib/cart.php

Locate about line 305:
Code: [Select]
if ((int)$qty && ((int)$qty > 0)) {
    if (!isset($this->session->data['cart'][$key])) {
      $this->session->data['cart'][$key]['qty'] = (int)$qty;
    } else {
      $this->session->data['cart'][$key]['qty'] += (int)$qty;
    }
    //TODO Add validation for correct options for the product and add error return or more stable behaviour
$this->session->data['cart'][$key]['options'] = $options;
}
change to
Code: [Select]
if ((int)$qty && ((int)$qty > 0)) {
    if (!isset($this->session->data['cart'][$key])) {
      $this->session->data['cart'][$key]['qty'] = $qty;
    } else {
      $this->session->data['cart'][$key]['qty'] += $qty;
    }
    //TODO Add validation for correct options for the product and add error return or more stable behaviour
$this->session->data['cart'][$key]['options'] = $options;
}


I tried this but its not working. is that not active any more on last version (1.2.15) ???
Title: Re: selling by linean meter problem in chekout
Post by: CTGO.co on August 08, 2019, 03:04:21 PM
hello Community!

I checked that file core>lib>cart.php and found it as in the solution.

 Can you help in this issue to make cart adding decimals and calculating them please?


I really need this function to be processed on orders correctly.

Thank you