AjaxCart.addproducttocart_details Problems

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

Im having an issue where the FlyoutShoppingCart html is not rendering at the moment I click "Add to cart", I dont know if it is an issue of the latest version or if it is a backoffice option.

the button in question is
  <input type="button" id="[email protected]" class="button-1 add-to-cart-button" value="@addToCartText" data-productid="@Model.ProductId" onclick="AjaxCart.addproducttocart_details('@Url.RouteUrl("AddProductToCart-Details", new { productId = Model.ProductId, shoppingCartTypeId = (int)ShoppingCartType.ShoppingCart })', '#product-details-form');return false;" />


If Im not mistaken the public.ajaxcart.js is the Javascript that adds the functionality on the success.
addproducttocart_details: function (urladd, formselector)


If it is a success it goes to
success_process: function (response)


and it should render the html filled in the backoffice to the html property of the selector:
        if (response.updateflyoutcartsectionhtml) {
            $(AjaxCart.flyoutcartselector).replaceWith(response.updateflyoutcartsectionhtml);
        }


But for some reason is not applying the html to that selector. As a matter of fact, the selector is empty.

Appreciate the help.

Best Regards!
6 years ago
I presume you've edited the default HTML.

The \Views\Shared\_Root.cshtml has the following code:
<script type="text/javascript" >
   AjaxCart.init(false, '.header-links .cart-qty', '.header-links .wishlist-qty', '#flyout-cart');
</script>

You have to ensure that you have an element with "flyout-cart" ID (in the FlyoutShoppingCart.cshtml file)
6 years ago
a.m. wrote:
I presume you've edited the default HTML.

The \Views\Shared\_Root.cshtml has the following code:
<script type="text/javascript" >
   AjaxCart.init(false, '.header-links .cart-qty', '.header-links .wishlist-qty', '#flyout-cart');
</script>

You have to ensure that you have an element with "flyout-cart" ID (in the FlyoutShoppingCart.cshtml file)


And you presumed well dear Sir :)

Thanks so much for the heads up, it seems the Theme Im using 'forgot' of this script.


Best Regards!
2 years ago
hii
I'm creating a new functionin public.ajaxcart.js file using NopCommerce 4.3
But when i'm trying to access that function , then it show me error like "this is not a function".
please give any suggestion if someone have any idea about that?
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.