Jump to content

Product QTY problem.


Recommended Posts

Good afternoon.

 

Dear. After manipulation (and maybe not because of them) when you add the goods in the basket of goods of the page is automatically added to the goods within a quantity of 2 pieces. if ever after "+" or "-" is a step that increases by 2 initially on the product page shows the number 1 press "+" changed to 3 5 7 etc. press the "-" and everything in reverse order of 5 3 1. sometimes leave a message "You already have the maximum quantity available for this"

 

I shoveled some files. searching QTY.

 

I really hope for your help!

post-883393-0-45041800-1445245465_thumb.jpg

Link to comment
Share on other sites

Yes i seen that rows.
 

// The button to increment the product value
    $(document).on('click', '.product_quantity_up', function(e){
        e.preventDefault();
        fieldName = $(this).data('field-qty');
        var currentVal = parseInt($('input[name=+fieldName+]').val());
if (quantityAvailable > 0) {
quantityAvailableT = quantityAvailable;
} else {
quantityAvailableT = 100000000;
}
        if (!isNaN(currentVal) && currentVal < quantityAvailableT) {
            $('input[name=+fieldName+]').val(currentVal + 1).trigger('keyup');
        } else {
            $('input[name=+fieldName+]').val(quantityAvailableT);
        }
    });
// The button to decrement the product value
    $(document).on('click', '.product_quantity_down', function(e){
        e.preventDefault();
        fieldName = $(this).data('field-qty');
        var currentVal = parseInt($('input[name=+fieldName+]').val());
        if (!isNaN(currentVal) && currentVal > 1) {
            $('input[name=+fieldName+]').val(currentVal - 1).trigger('keyup');
        } else {
            $('input[name=+fieldName+]').val(1);
        }
    });
 
if (typeof minimalQuantity != 'undefined' && minimalQuantity)
{
checkMinimalQuantity();
$(document).on('keyup', 'input[name=qty]', function(e){
checkMinimalQuantity(minimalQuantity);
});
}
 
if (typeof ad !== 'undefined' && ad && typeof adtoken !== 'undefined' && adtoken)
{
$(document).on('click', 'input[name=publish_button]', function(e){
e.preventDefault();
submitPublishProduct(ad, 0, adtoken);
});
$(document).on('click', 'input[name=lnk_view]', function(e){
e.preventDefault();
submitPublishProduct(ad, 1, adtoken);
});
}
 
but they looks normaly. i realy need help with that. thank you!
Link to comment
Share on other sites

You should contact the theme developer regarding this.
Meanwhile a thing you could try is to edit your product.js file, look for these lines:

// The button to increment the product value
$(document).on('click', '.product_quantity_up', function(e){
// The button to decrement the product value
$(document).on('click', '.product_quantity_down', function(e){

And add a .off() call before .on() like this:

// The button to increment the product value
$(document).off('click', '.product_quantity_up').on('click', '.product_quantity_up', function(e){
// The button to decrement the product value
$(document).off('click', '.product_quantity_down').on('click', '.product_quantity_down', function(e){
Edited by gabdara (see edit history)
Link to comment
Share on other sites

 

You should contact the theme developer regarding this.

Meanwhile a thing you could try is to edit your product.js file, look for these lines:

// The button to increment the product value
$(document).on('click', '.product_quantity_up', function(e){
// The button to decrement the product value
$(document).on('click', '.product_quantity_down', function(e){

And add a .off() call before .on() like this:

// The button to increment the product value
$(document).off('click', '.product_quantity_up').on('click', '.product_quantity_up', function(e){
// The button to decrement the product value
$(document).off('click', '.product_quantity_down').on('click', '.product_quantity_down', function(e){

 

OMG!!!

 

i think you solve it!!! but i try step by step.

and that what i got:

1. if i set .off() only in one place (decrement or increment) then it work perfect.

2. if i add .off() to bouth like you say in not work even not change not increment or decriment qty. stay allways "1"

3. i write 

$(document).off();

above 

  // The button to increment the product value
    $(document).on('click', '.product_quantity_up', function(e){

and it WOOOOORK!!!!!!!

 

another question WHY it become not working...

 

thank you man!!! you are realy help me!!! sorry i dont know how i can increase your karma!

 

UPD your new version works perfect

And add a .off() call before .on() like this:
// The button to increment the product value
$(document).off('click', '.product_quantity_up').on('click', '.product_quantity_up', function(e){
// The button to decrement the product value
$(document).off('click', '.product_quantity_down').on('click', '.product_quantity_down', function(e){
Edited by project00 (see edit history)
Link to comment
Share on other sites

ufffff it stil not work perfect... now + or - work normal but after you click "add to cart" it incrase quantity *2 :(

 

i stil need help.

 

i dont understand how to put photos here directly but you cad do my steps to see.

 

open product page. incrace quantity click add to cart.

you will can see message with some error (or not)

then click again "add to cart" and it will incrase quantity *2 :(

 

i think somthin with ADD TO CART it doubled any quantity

(but +- work normaly)

 

Help pls.

 

 

UPD thats make me crazy... it work and not work then work againe...

 

UPD1 i think i understand. in is cookie on client machine. how can i update or reload all cookes cache to all my clients?

Edited by project00 (see edit history)
Link to comment
Share on other sites

thanks.

 

but now another issue.

if i do this all then product picture stop work normaly. i use fancybox(by default and i like it) ant if i change code in product.js then fancybox stop working.

what i must add or change to make it work again?

 

upd.

And add a .off() call before .on() like this:
// The button to increment the product value
$(document).off('click', '.product_quantity_up').on('click', '.product_quantity_up', function(e){
// The button to decrement the product value
$(document).off('click', '.product_quantity_down').on('click', '.product_quantity_down', function(e){

this make "+" and "-" normal (increment and decrement on to 1) but if you add to card it doubled. fancybox work.

 

if i put 

$(document).off();
// The button to increment the product value
$(document).off('click', '.product_quantity_up').on('click', '.product_quantity_up', function(e){
// The button to decrement the product value
$(document).off('click', '.product_quantity_down').on('click', '.product_quantity_down', function(e){

then fancybox stop work but +- and ADD TO CART worked ok.

Edited by project00 (see edit history)
Link to comment
Share on other sites

Adding those lines shouldn't have any effect on fancybox because they are not related in any way.

Reinitializing fancybox might help:

$(document).ready(function()
{
    $('.fancybox').fancybox();
    ...

But I still think you should talk with the theme developer, because he might have done something particular to this theme that isn't in the default one.

What we do now is treating the symptoms instead of the root cause.

Link to comment
Share on other sites

i just think it is my fault and i cant find what i change and where. i think may be duplicate something. but i realy dont want start from the begining set new installation add products and so on... but i am realy hoped that someone can show me the way to fix it.

before i go to code it worked. 

 

i do one function what i need and broke other and now dont remember what i chande. 

 

sorry if i doubt. but hope to your help.

i will try your last strings. but as i write it work like i say with this strings not work without it work (fancybox).

Link to comment
Share on other sites

×
×
  • Create New...