News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Empty cart stay when user removes all items

Started by ghardin, June 09, 2017, 01:13:01 AM

Previous topic - Next topic

GJC Web Design

Jörgens point is if u are in the right file and the code is as above it WILL work
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

ghardin

#16
I am in the right file, in fact I tried it in the default files in the virtuemart components folder AND in the virtuemart HTML folder in my template overrides.  In the code, I see nothing that tells me WHERE the user will be directed to when the cart is empty.  What if I want them to go to some specific page?
I thought I was being pretty specific in what I wanted to happen.  Maybe I am not understanding what it is this section of code is supposed to do.
All that happens is that the user now sees:
Cart Empty
Continue shopping (the link)
and then the breadcrumbs for the navigation, which indicates "Home>Our Store>Shopping Cart"
Because they are still actually "in the Cart", the error messages from the shipping or other plugins STILL are displayed.  If the user is redirected to another page, those do not appear.  They are only active for the cart.

What I want is for the user to actually be redirect to ANOTHER page automatically.  This just tells them the cart is empty, which they already know because they emptied it and then has them click the "Continue Shopping" link.  I just want them to go directly back to the storefront or the category they were in before the cart (or some other page if it is appropriate)

AH

The code works

If you are using default templates you should not see error messages when you empty the cart.  You will probably see the Notice product quantity successfully updated.

It will not direct you to a specific page - other than that show in the VM continue shopping link (which is set by VM when you enter the cart)

Quote
What if I want them to go to some specific page?
I thought I was being pretty specific in what I wanted to happen.  Maybe I am not understanding what it is this section of code is supposed to do.

If you have a more specific request - then maybe you need to have someone code this on your behalf.
Regards
A

Joomla 3.10.11
php 8.0

ghardin

I thought I was pretty specific that I want to redirect to someplace other than the cart.  Thanks for the attempts to help, but I will have to figure it out myself.

Jörgen

#19
I have read the whole thread and you don't give any details whatsoever what you have put and where. Filepath, linenumber e.t.c
It is hard to give any more than this without doing your job fir you. But if you think you have given all the info that you would need to have yourself to fix this. Then ok i will not ask you for more.

Regards

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

ghardin

Ok.  one more time - when the user empties the cart I want them to be automatically redirected to the site home page.  The code snippet does part of what I want, in that it clears the cart page and does Display the words "EMPTY CART" via COM_VIRTUEMART_EMPTY_CART.
Then it displays the "Continue Shopping" link via echo $this->continue_link_html;

I do not want the user to have to click that link at all.  I do not want them to even be in the cart anymore.  I want to redirect them to some other page and for the purposes of this post, let take them to the sites home page (index.php).  If we can get that far then I think I can figure out how to get them to the storefront on the site if that is where I want them to go.  Does all of that make sense?

AH

Ghardin

I am unsure as to how you think the forums work.  You are not doing anyone here a favour by providing information.

The comment  "Ok.  one more time"  is uncalled for.

I suggest you might need to go to the jobs forum for such a thing, someone there may wish to pick this up for you.

http://forum.virtuemart.net/index.php?board=18.0



Regards
A

Joomla 3.10.11
php 8.0

ghardin

Not meaning to be rude.  I am just frustrated because I believe I clearly explained what I wanted to accomplish in the very first post and in much of the thread of discussions between yourself and I.  Then other people joined in and while I appreciated the willingness to help, it seems as though I was asked to explain what I was try to do a second or third time, even while you and I had been working on a solution that was pretty clearly defined.  I frequent the forums quite a bit looking answers to problems and I read the threads and the reference links pretty thoroughly to see if they might be of use.  So I know when I read something that I understand the problem and explanations through the entire threads.  I find the assistance here to be very helpful and while I may have come across as ungrateful, I am not.  But it would behoove others here to not to jump to those conclusions so quickly.  I appreciate all of the efforts to help, but some are more useful than others.

On a separate but related issue, in your snippet of code was this:
if (!empty($this->continue_link_html)) {
    echo $this->continue_link_html;
    }

That was the part I had a problem with as it still left the user in the cart, even though it cleared the screen and made it clear the cart was empty, it did not take the user to another page and that is the heart of what I am trying to accomplish.  More searching on the net found this bit of code that does do that:
// REDIRECT WITHIN A JOOMLA SCRIPT:
$allDone =& JFactory::getApplication();
$allDone->redirect('[link URL]');

But it still does not solve the other part of the problem, in that it does not clear or remove the various error messages from shipping plugins.  It appears that I need to find a way to refresh the page I redirect to, probably the shopfront, so it clears the messages.
If you have a suggestion, I would be pleased to see it.  But if you are done with this effort I also understand that.

jenkinhill

You are asking for bespoke coding help, which really is not what this forum is for.  As AH suggested you may be wise to commission a developer, as you want to do something that nobody has ever requested before in the forum. I wonder how many people actually clear a cart. 

Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

ghardin

The client is a US veterans support group with limited funds and resources.  I am doing the work for them pro-bono so paying someone to produce a small snippet of code is just not feasible.  All of the work on the site, including marketing and SEO has been done pro-bono or by volunteers.  Potentially we might find the right person, but for now I will make do with what I can glean from this and other resources.
To answer your question about who empties a cart, well we do not know that.  But when it does happen, and we have done some testing on the site, the user has to navigate back to somewhere else on the site and that is what we want to make happen automatically.  The error message/warning from the other plugins are also a confusing factor and I am working with those developers for a solution as well.  It improves the overall user experience and because the site relies on the store for a major source of funds, we do not want to turn off any potential customers.  While it is not a huge issue that is a cause for concern, thinking outside of the box and looking to what future needs might be is what I do.  I have been working with computers and systems since the late 1970's and find that much of the software and coding done today only addresses short term needs and relies on frequent updates to fix problems that should have been considered early on.  Mostly it is because of the rush to market most applications seem to have that precludes that.

But I digress into a philosophy that is unlikely to change any time soon. I am confident I will find the solution to the problem with enough research.  Being retired, I have the luxury of time on my side.

GJC Web Design

#25
you already have the code to detect if the cart is empty or not

now google for any standard code snippet to redirect any where you want to go.. 
by php header or  javascript redirect.. what ever.. 
u could even have a js snippet to programatically "click" the continue button

this is really basic stuff that google will show u
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation