0

I have a special setup where we have some products that are sold on exact sizes (like 3.14 sq m).

In order to comply with local invoice regulations the base price needs to be provided in 1 sq m, so in order to achieve this all products of this type have the surface size in the qty field and in the Minimum Qty Allowed in Shopping Cart I have the amount again.

On the front end the qty field is hidden so when somebody wants to add a product to cart the exact size is added without the possibility to change the qty.

The problem is that when I specify a decimal in the Minimum Qty Allowed in Shopping Cart field this is saved to the database, but when I reload the product in the backend the number is rounded down and on the next save the decimals are lost.

Anybody else facing this issue and where can I look for a solution?

  • Under these rules can you show 2 prices on the product page, the per sq m and the price per unit (3.14)? If so might be easier to have the 1 sq m price as attribute and also call that at the product page. Even better would be to store the unit for the product (3.14) as an attribute and use that to divide into the price that will show the correct per unit price when you update your prices ( guessing that the units are different for each product, but will stay the same for that product) – PaddyD Oct 31 at 16:57
  • Yes, there are two prices displayed on the product page: the price per sq m is the basically the product price and the price / piece is just an additional attribute. I initially set it up as you are suggesting, but we needed to specify the price per sq m and the qty sold. The store sells leather, leatherette and upholstery cloths. The leathers are in irregular shapes and sizes they can not be sold in fractions, the other products are sold linear meter. The site was launched about 4 years ago and was working without any problems, but one of the updates had a bug and broke the min qty field. – Andras Oct 31 at 17:09
1

After digging a little bit and comparing files from previous backups I found the problem: in /app/design/adminhtml/default/default/template/catalog/product/tab/inventory.phtml line 80 has to be changed from (remove the (int) before getting the min sale qty):

 <td class="value"><input type="text" class="input-text validate-number" id="inventory_min_sale_qty" name="<?php echo $this->getFieldSuffix() ?>[stock_data][min_sale_qty]" value="<?php echo (bool)$this->getProduct()->getId() ? (int)$this->getFieldValue('min_sale_qty') : Mage::helper('catalog/product')->getDefaultProductValue('min_sale_qty', $this->getProduct()->getTypeId()) ?>" <?php echo $_readonly ?>/>     

to

 <td class="value"><input type="text" class="input-text validate-number" id="inventory_min_sale_qty" name="<?php echo $this->getFieldSuffix() ?>[stock_data][min_sale_qty]" value="<?php echo (bool)$this->getProduct()->getId() ? $this->getFieldValue('min_sale_qty') : Mage::helper('catalog/product')->getDefaultProductValue('min_sale_qty', $this->getProduct()->getTypeId()) ?>" <?php echo $_readonly ?>/>     

This how it was in previous versions:

<td class="value"><input type="text" class="input-text validate-number" id="inventory_min_sale_qty" name="<?php echo $this->getFieldSuffix() ?>[stock_data][min_sale_qty]" value="<?php echo $this->getFieldValue('min_sale_qty')*1 ?>" <?php echo $_readonly;?>/>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.