Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


These support forums are now closed for new topics and comments.
Please head on over to http://eureka.ucommerce.net/ for support.

  • João Ferreira 19 posts 40 karma points
    Jul 29, 2013 @ 18:04
    João Ferreira
    0

    Javascript add to basket

    I'm having an error when I try to add a product to the basket.

    Master HTML:
    <%--including uCommerce libraries--%>
            <script src="/../scripts/uCommerce.ServiceStack.js"></script>
            <script src="/../scripts/uCommerce.jQuery.js"></script>
    Page HTML:
    <a href="#" id="add-to-basket" class="btn">Add to basket</a>
    @*Hidden Inputs*@
    <input type="hidden" id="selectedcatalogid" value="24"> <input type="hidden" id="selectedsku" value="jobook"> <input type="hidden" id="selectedvariantsku" value="">
    Javascript:
    $("#add-to-basket").click(function () {
                    $.uCommerce.addToBasket(
                    {
                        catalogId: $('#selectedcatalogid').val(),
                        sku: $('#selectedsku').val(),
                        variantSku: $('#selectedvariantsku'),
                        quantity: 1
                    });
                    return false;
                });

    The error message is the follow:

    1.  
      1. Uncaught TypeError: Accessing selectionDirection on an input element that cannot have a selection. uCommerce.ServiceStack.js:26
        1. callServiceStackuCommerce.jQuery.js:54
        2. $.extend.uCommerce.addToBasketuCommerce.jQuery.js:35
        3. (anonymous function)script.js:1401
        4. v.event.dispatchjquery.min.js:2
        5. o.handle.u

           


        The inputs seem to be right, what am I doing wrong?

  • João Ferreira 19 posts 40 karma points
    Jul 30, 2013 @ 11:33
    João Ferreira
    0

    Sorry, just noticed I was missing .val() in $('#selectedvariantsku')

    I get this error now:

    /ucommerceapi/Json/SyncReply/AddToBasket

    Am I missing any instalation step from ucommerce?

  • João Ferreira 19 posts 40 karma points
    Jul 30, 2013 @ 12:33
    João Ferreira
    0

    I've been trying this solution but with no luck. My version of Umbraco is 4.7 and it does not even have a global.asax.

    I also noticed that the UCommerce.RazorStore.dll does not exist in this installation. uCommerce version 3.5.0.1.13098

  • João Ferreira 19 posts 40 karma points
    Jul 30, 2013 @ 16:43
    João Ferreira
    1

    Hi guys, got the solution from Søren, I was missing the installation of the razor store. Basically I was missing the JSON layer that only the razor store brings.

    Søren, could you guys add this to the basic package?

    Anyway, thank you again for your help.

    Regards, João Ferreira

  • Søren Spelling Lund 1797 posts 2786 karma points
    Aug 02, 2013 @ 14:10
    Søren Spelling Lund
    0

    Hi João,

    Thanks for being awesome and posting the follow-up in the forum!

Please Sign in or register to post replies

Write your reply to:

Draft