This topic contains 3 replies, has 3 voices, and was last updated by  lara333 3 weeks, 4 days ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • example Shopping Cart #85665

    famp
    Participant

    Hello , it is possible to give product also click on add to cart.

    I added this code , but without success.

     $('.draggable-demo-product').on('click', function (event) {
                        onCart = true;
                        var tshirt = $(this).find('.draggable-demo-product-header').text(),
                            price = $(this).find('.draggable-demo-product-price').text().replace('Price: €', '');
                        $('#cart').css('border', '2px solid #aaa');
                        price = parseInt(price, 10);
                        $(this).jqxDragDrop('data', {
                            price: price,
                            name: tshirt
                        }); 
                         if (onCart) { addItem({ price: event.price, name: event.name });
                             onCart=false;
                         }
                        
                    });
    example Shopping Cart #85669

    Dimitar
    Participant

    Hello famp,

    Here is how to implement your requirement:

    $('.draggable-demo-product').on('click', function (event) {
        var children = $(this).children(),
            price = $(children[1]).text().slice(8),
            name = $(children[0]).text();
    
        addItem({ price: parseFloat(price), name: name });
    });

    We hope this solution is helpful to you.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

    example Shopping Cart #85695

    famp
    Participant

    thank you very much , perfect

    example Shopping Cart #136512

    lara333
    Participant

    It looks like you’re trying to implement the “Add to Cart” feature with drag and drop. Ensure that addItem is defined correctly and the event.price and event.name are passed properly. You can apply this approach to top net ogłoszenia for easy item addition to the cart.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.