Author Topic: decimal quantity  (Read 29739 times)

Linholen974

  • Beginner
  • *
  • Posts: 9
decimal quantity
« on: April 25, 2008, 11:28:53 am »
How to modify or activate decimal quantity in cart with virtuemart 1.1???
please help me the old modification doesn't work

jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 28300
  • Always on vacation
    • Jenkin Hill Internet
Re: decimal quantity
« Reply #1 on: April 25, 2008, 15:08:37 pm »
What do you mean by "decimal quantity"? Something like 1.33 products?
Kelvyn

Jenkin Hill Internet,
Lowestoft, Suffolk, UK

Unsolicited PMs/emails will be ignored.

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Currently using VirtueMart 3.8.9.10473 on Joomla 3.9.28 PHP 7.4.14

Linholen974

  • Beginner
  • *
  • Posts: 9
Re: decimal quantity
« Reply #2 on: April 25, 2008, 19:15:16 pm »
yes Something like 1.5 quantity for a product or 0.5
Thank you for your help

jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 28300
  • Always on vacation
    • Jenkin Hill Internet
Re: decimal quantity
« Reply #3 on: April 25, 2008, 20:00:13 pm »
That is not possible as it stands. As VM1.1 is quite different from VM1.0.x a previous version hack would not work. You may have to use a programmer to help out.
Kelvyn

Jenkin Hill Internet,
Lowestoft, Suffolk, UK

Unsolicited PMs/emails will be ignored.

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Currently using VirtueMart 3.8.9.10473 on Joomla 3.9.28 PHP 7.4.14

urso.lv

  • Beginner
  • *
  • Posts: 16
Re: decimal quantity
« Reply #4 on: May 20, 2008, 22:58:11 pm »
Hello.

This possibility is very important for many customers using virtuemart.
I searched forum for this issue. Many people have asked for it some time ago, some found solution in previous versions. And still it is not answered in VM 1.1

Quote
That is not possible as it stands.

It should be possible by tweaking:
1) data storing format in database for appropriate fields
2) some php code

We only need to know which bits of code to change and which database fields formats to change.

PLEASE SOMEBODY HELP US.

VM is a nice piece of code (solution) for small customers and we don't want to move to another products. But if we can not find any solution for this useful for many option to use decimal values, what we can do?
Should we look for another shopping cart product?


urso.lv

  • Beginner
  • *
  • Posts: 16
Re: decimal quantity
« Reply #6 on: May 21, 2008, 11:32:31 am »
It will be used to sell building materials.
Some goods are measured in sq meters.
For example insulation sheet has dimensions 1.2*0.6 meters = 0.72 sq meters.
One package contains 8 sheets = 5.76 sq meters.

We will sell them in packages, but price should be per sq meter (other stores use prices per sqm, it's easier for customer to compare prices and customer is used to see price per sqm not package, because there are many similar products from different manufacturers with different quantity in package). Thats why I want possibility to sell quantity with decimals.
In addition I want to use Drop down to simplify buying process to customers.
For example Drop down values in product properties:
Start value 5.76
End value 86.4
Step value 5.76
(it makes 15 steps)

But it's also not possible to store those values like decimals.
When I save product properties, it says Changes have made, when I return to product Display properties tab there are integer values and in front end Drop down has wrong integer values.


mc_moe

  • Beginner
  • *
  • Posts: 6
Re: decimal quantity
« Reply #7 on: June 04, 2008, 21:34:20 pm »
i had a similar problem.

i changed the following:
file: administrator/components/com_virtuemart/classes/ps_cart.php
lines 120-124

before:
Code: [Select]
    if (!ereg("^[0-9]*$", $quantity)) {
    $vmLogger->warning( $VM_LANG->_PHPSHOP_CART_ERROR_NO_VALID_QUANTITY );
    return False;
    }

after:
Code: [Select]
$quantity = ereg_replace(",",".",$quantity);
    if (!ereg("^[0-9]|[,]|[.]*$", $quantity)) {
    $vmLogger->warning( $VM_LANG->_PHPSHOP_CART_ERROR_NO_VALID_QUANTITY );
    return False;
    }

this code is for adding the product to the cart; as we need this also when updating the cart, I changed the corresponding lines around line 278-282.

as for the database, I changed in table: vm_order_item the field
product_quantity to double(11,2).

I have not tested it thoroughly, but it seems to work properly.

the ereg_replace containing "," is need for me, as my shop is located in germany and the comma is used for decimals. if you are working with "." as decimal separator it is not needed.

I have no idea if this hack produces bugs elsewhere in the system, but I don't see that there should be a problem.
plz have us your feedback if you try this hack...


urso.lv

  • Beginner
  • *
  • Posts: 16
Re: decimal quantity
« Reply #8 on: June 25, 2008, 14:19:13 pm »
It still doesn't work.

I can not sell items in decimal quantities. :(

Phelan

  • Beginner
  • *
  • Posts: 30
Re: decimal quantity
« Reply #9 on: September 08, 2008, 20:51:12 pm »
Hej,

I need this as well....i want sell products in meter.... 1,5, 1,25 and so on...

Thank you !

thierry0169

  • Beginner
  • *
  • Posts: 6
Re: decimal quantity
« Reply #10 on: November 02, 2008, 22:23:04 pm »
Hello,

I also need this...  because I must sell item in kg...  do you have some news about it ??? I can't believe there is a few amount of people selling items in kg or in meters...
Thank you for you help...

thierry0169

  • Beginner
  • *
  • Posts: 6
Re: decimal quantity
« Reply #11 on: November 05, 2008, 23:22:00 pm »
OK...  As we say in France...  "On n'est jamais si bien servi que par soi-meme"
I have tried the mc_moe solution (reply#7).  With Virtuemart 1.1.2 (don't know if it's because of VM 1.1.2), some other modifications were necessary (remove 2 INT functions).
It seems to work correctly....  Just made some tests and it's ok...
I will give all the lines modified later here for those who need this modification.

Phelan

  • Beginner
  • *
  • Posts: 30
Re: decimal quantity
« Reply #12 on: January 07, 2009, 21:52:39 pm »
thierry0169,
 yes please post the changes and or the link to the description

Thank you

Phelan

  • Beginner
  • *
  • Posts: 30
Re: decimal quantity
« Reply #13 on: March 27, 2009, 14:28:28 pm »
Hello

any news or solutions ??????

Linholen974

  • Beginner
  • *
  • Posts: 9
Re: decimal quantity
« Reply #14 on: April 05, 2009, 14:16:38 pm »
I find how to make decimal quantity using i will publish soon the modification to all user want to use it. before i want to test it to see if i have no error in virtuemart 1.1.3 and Joomla 1.5.10