Disable quantity validation

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
8 years ago
Hi,

How i can disable validation quantity field ( Quantity should be positive ) during click on add to cart button ?

Regards,
Mateusz
8 years ago
mateuszherc wrote:
Hi,

How i can disable validation quantity field ( Quantity should be positive ) during click on add to cart button ?

Regards,
Mateusz



Logically, a customer cannot add (-1) product in the cart which is why the validation is there.

Could you provide some more detail about your requirement(s)? Why you would like to disable this validation?
8 years ago
L.K wrote:
Hi,

How i can disable validation quantity field ( Quantity should be positive ) during click on add to cart button ?

Regards,
Mateusz


Logically, a customer cannot add (-1) product in the cart which is why the validation is there.

Could you provide some more detail about your requirement(s)? Why you would like to disable this validation?


NopCommerce does not support weight attribute on product page. So i try find alternative solution. On my shop we offer products which cannot be sell using only integer quantity.


When online offer contains products like Meat, fishes, potatoes , customers should have possibility to choose weight that products. So i think simplest solution this problem is change quantity field to decimal. Resume i want add to chart e.g

0.2 meat (kilo)
1.2 fish (kilo)

etc

look at this
http://www.alma24.pl/swieze/mieso-swieze-cj/mieso-wolowe-bez-kosci

please click button "Dodaj do koszyka"

my shop below - i cannot sell this product(meat) using qunatity, it is not possible sell two meat:):):)
http://whsklep-001-site1.smarterasp.net/ko%C5%9Bci-wieprzowe

I changed all get/set Quantity method to decimal, but i dont know where i can disable validation .... it is in ajax/jquery scripts?

Solution with drop down attributes is not acceptable for me;)


Regards,
Mateusz
8 years ago
You created a similar topic regarding decimal quantity.

Please see my response here: https://www.nopcommerce.com/boards/t/37980/quantity-decimal.aspx
8 years ago
I have it!:)

To disable quantity validation, remove or comment below code

            if (quantity <= 0)
            {
                warnings.Add(_localizationService.GetResource("ShoppingCart.QuantityShouldPositive"));
                return warnings;
            }



class ShoppingCartService.cs (Libraries\Nop.Services\Orders)

method:  public virtual IList<string> AddToCart
8 years ago
That's great :)
8 years ago
L.K wrote:
That's great :)


;);)
4 years ago
HI,

I've the same issue, may you send me the compilated dll?

It could be very helpful.

Kind Regards.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.