BuyNow button shopping cart setting.

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

I want to add buynow button and for that customizing ShoppingCartController.

I am thinking to add new Shopping Cart type as BuyNow and use base of ShoppingCartType.ShoppingCart and create new as ShoppingCartType.BuyNow.

I searched for ShoppingCartType.ShoppingCart and found in so many files, so got confused.

I need help to find out in which files should I have to add ShoppingCartType.BuyNow ??

Please Help !!

Thank You...
6 years ago
SSeBookStore wrote:
Hello !!

I want to add buynow button and for that customizing ShoppingCartController.

I am thinking to add new Shopping Cart type as BuyNow and use base of ShoppingCartType.ShoppingCart and create new as ShoppingCartType.BuyNow.

I searched for ShoppingCartType.ShoppingCart and found in so many files, so got confused.

I need help to find out in which files should I have to add ShoppingCartType.BuyNow ??

Please Help !!

Thank You...



Hello,

You have find ShoppingCartType.cs here \Libraries\Nop.Core\Domain\Orders

Thanks,
Jatin
6 years ago
forefront wrote:

Hello,

You have find ShoppingCartType.cs here \Libraries\Nop.Core\Domain\Orders

Thanks,
Jatin


I have added BuyNow in ShoppingCartType.cs but there are so many files where ShoppingCartType.ShoppingCart is used.
So, I want know in which file I should have to make changes and use ShoppingCartType.ShoppingCart as base and add ShoppingCartType.BuyNow. So that ShoppingCartType.ShoppingCart functionalities should not change.
6 years ago
Can you explain your requirement in detail why you want to add third type?

So i can suggest better way.

Thanks,
Jatin
6 years ago
forefront wrote:
Can you explain your requirement in detail why you want to add third type?

So i can suggest better way.

Thanks,
Jatin

I want to add BuyNow button and on click it adds the product in cart and redirect to Checkout Page directly.
6 years ago
SSeBookStore wrote:

I want to add BuyNow button and on click it adds the product in cart and redirect to Checkout Page directly.


nopCommerce already having this flow like addtocart - cart page - check out page

So you need something like when click on that button then directly use should redirect to cart page instead of notification and stay on product detail or list page. ?

Thanks,
Jatin
6 years ago
forefront wrote:

So you need something like when click on that button then directly use should redirect to cart page instead of notification and stay on product detail or list page. ?

Thanks,
Jatin

Yes, I want user to redirect to cart page when clicks on BuyNow button.
6 years ago
SSeBookStore wrote:


Yes, I want user to redirect to cart page when clicks on BuyNow button.


Then rename add to cart button to buy now. And then goto \Presentation\Nop.Web\Scripts\public.ajaxcart.js

See success_process function Comment below code: 78 line no

 //success
                if (AjaxCart.usepopupnotifications == true) {
                    displayPopupNotification(response.message, 'success', true);
                }
                else {
                    //specify timeout for success messages
                    displayBarNotification(response.message, 'success', 3500);
                }

And do redirection using
window.location.href = "http://www.domain.com/cart"


Thanks,
Jatin
6 years ago
forefront wrote:


Yes, I want user to redirect to cart page when clicks on BuyNow button.

Then rename add to cart button to buy now. And then goto \Presentation\Nop.Web\Scripts\public.ajaxcart.js

See success_process function Comment below code: 78 line no
Thanks,
Jatin


Thank you for the Suggestion but I want both button "Add to Cart" as well as "Buy Now"
6 years ago
SSeBookStore wrote:


Thank you for the Suggestion but I want both button "Add to Cart" as well as "Buy Now"


So don't need to develop whole code same as Add to Cart functionality. Just make a copy of below line and change text to Buy now in \Presentation\Nop.Web\Views\Product\_AddToCart.cshtml

<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;" />


Then pass extra param into addproducttocart_details function in public.ajaxcart.js Using this you can redirect to cart on success function.

Thanks,
Jatin
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.