Poll

items with decimal point

selling by linear meter
0 (0%)
Checkout wrong calculation
1 (100%)

Total Members Voted: 1

Author Topic: selling by linean meter problem in chekout  (Read 4808 times)

Offline maniz

  • Newbie
  • *
  • Posts: 15
  • Karma: +4/-0
    • View Profile
selling by linean meter problem in chekout
« 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 
« Last Edit: December 22, 2013, 01:40:08 AM by maniz »

Offline abantecart

  • Administrator
  • Hero Member
  • *****
  • Posts: 4358
  • Karma: +298/-10
    • View Profile
    • Ideal Open Source Ecommerce Solution
Re: selling by linean meter problem in chekout
« Reply #1 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;
}
« Last Edit: December 22, 2013, 12:41:53 PM by abantecart »
Please  rate your experience or leave your review
We need your help to build better free open source ecommerce platform for everyone. See how you can help

Offline maniz

  • Newbie
  • *
  • Posts: 15
  • Karma: +4/-0
    • View Profile
Re: selling by linean meter problem in chekout
« Reply #2 on: December 23, 2013, 01:30:28 AM »
Thank you abantecart
for your quick and correct respond
I donate 5 euro for your help

Offline abantecart

  • Administrator
  • Hero Member
  • *****
  • Posts: 4358
  • Karma: +298/-10
    • View Profile
    • Ideal Open Source Ecommerce Solution
Re: selling by linean meter problem in chekout
« Reply #3 on: December 23, 2013, 07:49:58 AM »
Glad, I can help. Thank you for donation  8)
Please  rate your experience or leave your review
We need your help to build better free open source ecommerce platform for everyone. See how you can help

CTGO.co

  • Guest
Re: selling by linean meter problem in chekout
« Reply #4 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) ???

CTGO.co

  • Guest
Re: selling by linean meter problem in chekout
« Reply #5 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

 

Powered by SMFPacks Social Login Mod