News:

AbanteCart v1.4.2 is released.

Main Menu

Do you like AbanteCart? Please rate AbanteCart or share your experience with other eCommerce entrepreneurs. Go to Softaculous rating page to add your rating or write a review

selling by linean meter problem in chekout

Started by maniz, December 22, 2013, 12:28:23 AM

Previous topic - Next topic

items with decimal point

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

Total Members Voted: 1

maniz

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 

abantecart

#1
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:

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

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;
}

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

maniz

Thank you abantecart
for your quick and correct respond
I donate 5 euro for your help

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

CTGO.co

Quote from: 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:

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

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

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

Forum Rules Code of conduct
AbanteCart.com 2010 -