Author Topic: Empty cart stay when user removes all items  (Read 4321 times)

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 9729
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.6.8
Re: Empty cart stay when user removes all items
« Reply #15 on: June 14, 2017, 17:45:24 pm »
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 http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 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
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

ghardin

  • Beginner
  • *
  • Posts: 35
Re: Empty cart stay when user removes all items
« Reply #16 on: June 14, 2017, 18:10:53 pm »
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

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3231
  • VirtueMart Version: 3.8.4
Re: Empty cart stay when user removes all items
« Reply #17 on: June 14, 2017, 18:33:41 pm »
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.9.19
php 7.3

ghardin

  • Beginner
  • *
  • Posts: 35
Re: Empty cart stay when user removes all items
« Reply #18 on: June 14, 2017, 18:41:11 pm »
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

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2858
    • Kreativ Fotografi
  • VirtueMart Version: 3.4.x
Re: Empty cart stay when user removes all items
« Reply #19 on: June 14, 2017, 19:21:45 pm »
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)

ghardin

  • Beginner
  • *
  • Posts: 35
Re: Empty cart stay when user removes all items
« Reply #20 on: June 14, 2017, 19:31:51 pm »
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

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3231
  • VirtueMart Version: 3.8.4
Re: Empty cart stay when user removes all items
« Reply #21 on: June 15, 2017, 09:27:39 am »
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.9.19
php 7.3

ghardin

  • Beginner
  • *
  • Posts: 35
Re: Empty cart stay when user removes all items
« Reply #22 on: June 15, 2017, 16:32:03 pm »
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

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 27779
  • Always on vacation
    • Jenkin Hill Internet
Re: Empty cart stay when user removes all items
« Reply #23 on: June 15, 2017, 16:43:04 pm »
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

Jenkin Hill Internet,
Lowestoft, Suffolk, UK

Unsolicited PMs/emails will be ignored.

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

Currently using VM 3.8.4.10335 on Joomla 3.9.19 PHP 7.3.18

ghardin

  • Beginner
  • *
  • Posts: 35
Re: Empty cart stay when user removes all items
« Reply #24 on: June 15, 2017, 17:14:42 pm »
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

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 9729
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.6.8
Re: Empty cart stay when user removes all items
« Reply #25 on: June 16, 2017, 13:14:42 pm »
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 http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 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
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation