Close

How to Integrate Ajax Cart 2.65

pdesignz
11 years ago
#1401 Quote
Avatar
  • 40
I am using 2.65, and am trying to follow the integration guide but am not sure where to change as the code looks different than the integration guide. I am using a custom theme, so I assume that I need to do the manual integration vs the automatic.

On the product Box page, the code is a little different and am not 100% sure how to integrate.

The code is here:

<input type="button" value="@(Model.ProductPrice.AvailableForPreOrder ? T("ShoppingCart.PreOrder") : T("ShoppingCart.AddToCart"))" class="button-2 product-box-add-to-cart-button" onclick="AjaxCart.addproducttocart('@addtocartlink');return false;" />
            }

On the product detail page, using the Product Variant template the code is also a little different than the integration guide.

This code is here and also a little unsure of where to place the code from the integration guide

<input type="button" class="button-1 add-to-cart-button" value="@(Model.AvailableForPreOrder ? T("ShoppingCart.PreOrder") : T("ShoppingCart.AddToCart"))" onclick="AjaxCart.addproductvarianttocart('@Url.RouteUrl("AddProductVariantToCart", new { productVariantId = Model.ProductVariantId, shoppingCartTypeId = (int)ShoppingCartType.ShoppingCart })', '#product-details-form');return false;" />

Thanks
IvanStoyanov
11 years ago
#1409 Quote
Avatar
  • Moderator
  • 269
pdesignz wrote:
I am using 2.65, and am trying to follow the integration guide but am not sure where to change as the code looks different than the integration guide. I am using a custom theme, so I assume that I need to do the manual integration vs the automatic.

On the product Box page, the code is a little different and am not 100% sure how to integrate.

The code is here:

<input type="button" value="@(Model.ProductPrice.AvailableForPreOrder ? T("ShoppingCart.PreOrder") : T("ShoppingCart.AddToCart"))" class="button-2 product-box-add-to-cart-button" onclick="AjaxCart.addproducttocart('@addtocartlink');return false;" />
            }

On the product detail page, using the Product Variant template the code is also a little different than the integration guide.

This code is here and also a little unsure of where to place the code from the integration guide

<input type="button" class="button-1 add-to-cart-button" value="@(Model.AvailableForPreOrder ? T("ShoppingCart.PreOrder") : T("ShoppingCart.AddToCart"))" onclick="AjaxCart.addproductvarianttocart('@Url.RouteUrl("AddProductVariantToCart", new { productVariantId = Model.ProductVariantId, shoppingCartTypeId = (int)ShoppingCartType.ShoppingCart })', '#product-details-form');return false;" />

Thanks


Hi pdesignz,

To integrate the Ajax Cart in the_ProductBox view add the following code:

@if (!Model.ProductPrice.DisableBuyButton)
            {
                <br />
@Html.Action("GetAddProductToCartAjaxButton", "NopAjaxCart", new { ProductId = Model.Id, ButtonValue = Model.ProductPrice.AvailableForPreOrder ? T("ShoppingCart.PreOrder") : T("ShoppingCart.AddToCart") })
}


and in the _ProductVarintAddToCart:

 @if (!Model.DisableBuyButton)
            {
@Html.Action("GetAddProductVariantToCartAjaxButton", "NopAjaxCart", new { ProductVariantId = Model.ProductVariantId, ButtonValue = Model.AvailableForPreOrder ? T("ShoppingCart.PreOrder") : T("ShoppingCart.AddToCart") })
}
Thank you for choosing our products! Your feedback is important to us!
pdesignz
11 years ago
#1411 Quote
Avatar
  • 40
This worked, Thanks! Does this work only for the add to cart or can this also be applied to the add to wishlist button as well. Thanks
IvanStoyanov
11 years ago
#1412 Quote
Avatar
  • Moderator
  • 269
pdesignz wrote:
This worked, Thanks! Does this work only for the add to cart or can this also be applied to the add to wishlist button as well. Thanks


We are sorry but the Ajax Cart works only for add to cart buttons.
You can propose this in our User voice portal
Thank you for choosing our products! Your feedback is important to us!