click back twice after add product on woocomerec - wordpress

when I add a product to the cart by clicking on (add to cart button)on singal product page and I want to go back to the product list I must to click on the back twice from the browser
my website is (ashjarshop.com)
many thanks

Related

Successfully added to cart message needs to show on a specific page

I have created my own menu page and have created a redirect function so that it redirects after the person hits the "add to cart" button, to go back to the our menu page so they can continue shopping. I would like the 'You have added this product to the cart' message to show up on this page after the redirect. I know that I need to add in a function that will either show this message on the page or create one that shows on the page but not sure exactly how to do so. Please help!
The page is https://notjustcurries.ca/our-menu/

Refresh (reload) WordPress filter widget by Ajax

I have a woocommerce product filter widgets (category and brand filters that display product numbers beside category and brand names) and i want to refresh these filter widgets after every Ajax request to update these numbers.
How i can refresh (reload) these widgets after every Ajax request?

How do I create a View Cart button in Website Payments Standard?

I'm using Website Payments Standard.
I've created 2 Add to Cart buttons using the manager and they work fine.
If my buyer clicks the Continue Shopping button, he's returned to the catalogue page and can't see the cart.
How do I create a View Cart button, please ?
It doesn't appear in the Button factory.
After you create your Add to Cart button, scroll down past the box where PayPal gives you your HTML code. There's a section that says Create more buttons, and one of the options says Create a View Cart button.

How to redirect user to login before he can add products to cart and disable AJAX Cart - NopCommerce

I am using NopCommerce version 3.0. I want the users to get redirected to the login page before they can add products to the cart. I also want to disable the AJAXCart (I want full postback and the products to get added to the cart.).
Please guide me as to how to achieve it.
Thanks.
I have done something similar here: http://clinidirect.co.uk/c-20/continence-care if you add an item to the bag, a popup appears, if you click on "Go to bag" it asks you to login.
This is very rough, but should give you an idea:
First, in _ProductVariantAddToCart.cshtml remove the onclick javascript event from the button, so that the button actually posts the form to AddProductVariantToCart in CatalogController. This should remove the AjaxCart.
This will also add the item to the cart and redirect you to the shoppingcart page.
When the ShoppingCart page loads in action Cart. Add the following:
if(_workContext.CurrentCustomer.IsGuest())
return new HttpUnauthorizedResult("Cart requires the user to have an account");
This will send the user to the login page giving the impression that the user needs to login to add items to the cart.
Hope this helps

Page refresh and bind not working

I've got a .aspx and in it an .ascx. In the .ascx I have a server control.
The .aspx has a list of items in a cart
The .ascx has a list of some cross-sell items (fed from a custom server control) that the customer can add to the cart if desired
both the list of items in cart and list of cross sell items are driven by a repeater and bound on page load. So the .aspx calls a method that rebinds the cart items on page load. And the .ascx calls a method in its page load that rebinds the cross sell items in that custom control (.cs) that is in my .ascx.
The problem I have is, when the user clicks a "add to cart" button in the repeater inside my custom control, the page refreshes and what should happen is the cart items in the .aspx AND the list of cross sells should refrsh showing that the cross sell item was moved to the cart. But even though when I debug and I see the list being rebound with the corret # of items after the move, the page still shows the old state. I have to refresh the page manually again to get it to work.
I guess I need to check for Page.IsPostback? but even if I don't check that..at the least both lists should be refreshing regardless cause I have it in my page load. So even if it's a postback, and I'm not checking for that the lists should show the new state because I'm not even checking for postback anyway. So checking for postaback I don't think is the issue here cause i want the lists to rebind and re-update on any page load....initial or if it's a postback...it doesn't matter. Reload every time. But it doesn't seem to be doing this even though I clearly see the revbind of the lists having the right count (one less on the cross sell and one additional to the cart as it was added after the user clicked the button).
So lets recap again. Here's the sequence of events:
User is on their cart page
User sees a list of cart items that they have added to their cart already (this list is bound in the Cart.aspx and rebound on every page load)
User sees a list of possible cross sell items they can add to their cart somewhere on the page. This list is a custom control found in my .ascx and that .ascx is obviously in my .aspx. The custom control is just a repeater that lists out the cross sell items
User clicks one of the "Add to cart" buttons on one of the cross sells
Page refreshes. In the page load of the .aspx AND the .ascx, I am going out to the DB and rebinding both those lists based on the new state...that is, the new lists after the item was added to the cart which means that now the cart items should have one more added to the list and it does...I clearly see that the new list has one more.
The page comes back after the refresh but I don't see the lists reflecting the new state...I don't see the new item in the cart items list and the added cross sell removed from the cross sell list even though again both lists when I debug are showing correct set of records reflecting the new state
so I'm lost here as to why this is not showing me the updated results.
The problem is, that the eventhandler for the "add to cart" button is called after the page_load. That means that the old items are bound.
The solution would be to manually force a .DataBind() in the eventhandler.
Nevertheless, I would recommend to stay at
if(!Page.IsPostBack)
{
// bind cart
}
in the Page_Load to avoid multiple binds.
Ok, since my Add to cart button is just a hyperlink and the user control checks for a flag in the querystring to fire off a method that moves the item (it gets the item # in the querystring as well to move), I just did a redirect (Response.Redirect(Request.Path);) after the move to cart to the parent .aspx page. That way it will hit the page load for both the cart.aspx and myusercontrol.ascx and rebind the grids.

Resources