Jump to content

change order quantity to a decimal value


Recommended Posts

Need to give a chance to buyers to order quantities under and above 1 ( for example 0,3 meters or 1,6 meters ).

 

As the product is fabric, we must have the price in meters ( eg: € 15,00 / linear meter )...

 

 

Can anybody help???

 

 

Thanks,

 

 

Carlos

Link to comment
Share on other sites

I think you are better off leaving all the fields as is (IE INT and not Decimal) as this would require a lot of work.

 

Instead, you can change the display of the quantity to be in multiples of 100 and then divide by 100 where needed (or vice versa)

Link to comment
Share on other sites

Thanks for the advise tomerg3. It was my first idea as it seems to be the less complicated. The problem is that the store will have products to be sold with INT units ( like a pencil or a needle ).

 

Please inform if the " lot of work " solution would be only the change from INT to Decimal or we must to make more changes.

 

 

Many thanks,

 

 

Carlos

Link to comment
Share on other sites

Thanks for your help tomerg3. Our developer is taking care about that. We have an indication from a previous post, to make changes in several php files and also in DB tables, but it seems that only work with 1.40 version. We are trying to find a solution.

 

Following the changes that have been done by WFREEBIRD in his website www.lacouture.nl

 

It's a lot of work in 1.4.

First I changed the database. I searched in all the tables with the fields quantity and changed the type to decimal(17,2).

The tables are:

- ps

- ps

- ps_discount

- ps_orders (total_products and total_products_wt)

- ps_order_detail (all the fields with quantity in the name)

- ps_order_return_detail

- ps_order_slip_detail

- ps_pack

- ps_product

- ps_product_attribute

- ps_product_sale

- ps_specific_price

- ps_stock_mvt

 

After this you go to your prestashop folder

Now you have to search for all the files where the quantity value is set.

Open the files one by one and search for "intval($row['cart_quantity'])" for example. Every line with the word "intval" before the word "quantity" or "qty".

Change the word "intval" to "floatval".

Then repeat all but now you search for the word "int" an change this to "float".

You need to do this for the files:

- prestashop/classes/Attribute.php

- prestashop/classes/Cart.php

- prestashop/classes/Customization.php

- prestashop/classes/Discount.php

- prestashop/classes/Order.php

- prestashop/classes/OrderDetail.php

- prestashop/classes/OrderHistory.php

- prestashop/classes/OrderReturn.php

- prestashop/classes/Product.php

- prestashop/classes/ProductSale.php

- prestashop/classes/QuantityDiscount.php

- prestashop/classes/StockMvt.php

- prestashop/controllers/CartController.php

- prestashop/controllers/OrderController.php

- prestashop/order.php

- prestashop/cart.php

- prestashop/themes/prestashop/product.tpl (or if you have a other theme prestashop/themes/themename/product.tpl

 

Please check yourself if the above files are all the files you need to change. Just open the other files as well and search.

I did it with dreamweaver and used "find and replace" type by Find "int" and by Replace "float".

 

Do you agree with this solution??

 

Thanks :)

Link to comment
Share on other sites

×
×
  • Create New...