Author Topic: Clear Cart on logout?  (Read 4826 times)

faulk511

  • Beginner
  • *
  • Posts: 37
  • Howdy!
Clear Cart on logout?
« on: August 04, 2009, 18:01:37 pm »
Ok so I use virtuemart for a group that uses the same log on.  I want to keep it this way.  However I want to modify it so that the cart dosn't save.  When the customer logs out I want the cart to clear.

Does anyone have any suggestions on where to look / clear the cart on log out?

Regards,
Greg :)

faulk511

  • Beginner
  • *
  • Posts: 37
  • Howdy!
Re: Clear Cart on logout?
« Reply #1 on: August 05, 2009, 19:25:25 pm »
I have solved what I was looking for.  Email me if you want the golden ticket.  I won't charge you for the answer!  It is so simple.  It's located in the PS_Cart file to eliminate the session and grabbing that saved cart.  In addition I've created a clear button that eliminates the whole basket and not one item at a time.  Have a great day@!

MikeUK

  • Global Moderator
  • Full Member
  • *
  • Posts: 1344
Re: Clear Cart on logout?
« Reply #2 on: August 05, 2009, 19:27:51 pm »
Why don't you post the answer if this is not a commericial thing? It would be much more useful that way.
Get answers faster:

I can build your online shop, setup or customize Virtuemart or help your existing shop maximize its potential. Email / PM for info

slakalot

  • Beginner
  • *
  • Posts: 27
Re: Clear Cart on logout?
« Reply #3 on: August 30, 2009, 19:29:12 pm »
What is the answer to this?

derbenito

  • Beginner
  • *
  • Posts: 1
Re: Clear Cart on logout?
« Reply #4 on: October 01, 2009, 16:22:39 pm »
Why don't you post the answer if this is not a commericial thing? It would be much more useful that way.
Hello did you get a solution? Would you please send it to me? Please give me a feedback. Thnx beni

osol

  • Beginner
  • *
  • Posts: 2
    • Outsource Virtuemart customizations
Re: Clear Cart on logout?
« Reply #5 on: November 06, 2009, 07:46:10 am »
add the following lines where you want to clear the cart

require_once(CLASSPATH . 'ps_cart.php' );
ps_cart::reset();
Best Regards

Sreekanth Dayanand
http://www.outsource-online.net/
Outsource Virtuemart customizations

osol

  • Beginner
  • *
  • Posts: 2
    • Outsource Virtuemart customizations
Re: Clear Cart on logout?
« Reply #6 on: March 10, 2010, 04:05:19 am »
The constant CLASS_PATH may not be available in non virtuemart files.since this thread is about 'clear cart on logout' let me add this.

to clear cart on logout add the following lines

require_once(JPATH_COMPONENT_ADMINISTRATOR.DS.'components'.DS.'com_virtuemart'.DS.'classes'.DS. 'ps_cart.php' );
ps_cart::reset();


inside function logout()
in

components\com_user\controller.php
Best Regards

Sreekanth Dayanand
http://www.outsource-online.net/
Outsource Virtuemart customizations

BlackElk

  • Beginner
  • *
  • Posts: 6
Re: Clear Cart on logout?
« Reply #7 on: April 01, 2011, 18:11:36 pm »
I hate to bring up an old post but I still don't have a resolution for this. Can anyone provide any insight? I would like the cart to clear on logout.


faulk511

  • Beginner
  • *
  • Posts: 37
  • Howdy!
Re: Clear Cart on logout?
« Reply #8 on: May 01, 2011, 09:33:33 am »
Wow - I'm really sorry folks I didn't post this.  It was one of those projects that is done and over with.  Here is what I did. 

Go to ps_cart.php  and comment out the following:

$_SESSION['savedcart'] = array(); 
&
$_SESSION['savedcart'] = unserialize( $contents );

Around lines 43 & 44 (older VM Version 1.1.2 (I think the version was))

Code: [Select]
$contents = $db->f('cart_content');


               // $_SESSION['savedcart'] = array(); 


       //$_SESSION['savedcart'] = unserialize( $contents );

I hope this helps - let me know if I can help any further.  Greg F.  :)

fennix

  • Beginner
  • *
  • Posts: 2
Re: Clear Cart on logout?
« Reply #9 on: October 27, 2011, 15:38:56 pm »
I puted those lines in, still not working.

Any other methods?