Error if character in quantity

02.10.2014 13:42
#1
celsoclaro
Joomshopping forum user no avatar
Name: celso
17.10.2011
Posts: 52
Quote
Error if character in quantity

Hi.
I'm using cartajax module and if I insert a character (like a or b or other) instead of a number in the quantity of a product and add it to cart, the cart goes empty, even if I had other products there. When I refresh the page the cart shows the products again.

Is this a bug? The inputbox shouldn't allow characters but only numbers.

Can you help me solve this?

Thanks

 
02.10.2014 15:29
#2
admin
(Support Team)
User admin
Name: Admin
05.08.2010
Posts: 25852
Quote
Aw: Error if character in quantity

Not error

quantity 0

 
02.10.2014 16:21
#3
celsoclaro
Joomshopping forum user no avatar
Name: celso
17.10.2011
Posts: 52
Quote
Aw: Error if character in quantity

The problem is that the cart shows this message "Your cart is empty" when, in fact, the cart has other products.

 
02.10.2014 21:18
#4
admin
(Support Team)
User admin
Name: Admin
05.08.2010
Posts: 25852
Quote
Aw: Error if character in quantity

Need quantity > 0

See code

model cart.php
function add
....
if ($quantity <= 0){
return 0;
}

change to
if ($quantity <= 0){
JError::raiseNotice('', 'Error qty.');
return 0;
}


Last change: 02.10.2014 21:19
 
04.10.2014 15:01
#5
celsoclaro
Joomshopping forum user no avatar
Name: celso
17.10.2011
Posts: 52
Quote
Aw: Error if character in quantity

That's it! Solved!

Thank you very much!

 
04.10.2014 15:14
#6
celsoclaro
Joomshopping forum user no avatar
Name: celso
17.10.2011
Posts: 52
Quote
Aw: Error if character in quantity

Another question:
Using the same logic of your rply, I added this:

if ($quantity > $product->product_quantity) { JError::raiseNotice('', 'Quantity higher than stock. Products will be dispached after 15 days');
$updateqty = 1;

And it works but the products only show in cartajax after I refresh the page.
How can I make it show in cart in real time?

Thanks

 


Copyrights MAXXmarketing GmbH. Alle Rechte vorbehalten
Durch die Nutzung dieser Website stimme ich zu, dass Cookies zur optimalen Gestaltung der Website sowie zur Analyse der Nutzung der Website verwendet werden. Weiterführende Informationen finden Sie hier. OK, einverstanden.