News:

Looking for documentation? Take a look on our wiki

Main Menu

Cart not emptying

Started by DeepaVaith, April 17, 2012, 20:36:30 PM

Previous topic - Next topic

DeepaVaith

Can someone please help me.  This is the paypal.log file after my order is confirmed-but the cart is not empty.
The only time the cart empties is if I go back to the store from the paypal link.  In case I have a few tabs open
with items in the cart, none of the carts empty when the page is refreshed.  Is this intended/bug..It seems an odd
thing to do. 


2012-04-17 18:28:01
message: paypal_data 4.91   b64606   Ineligible   94HWRMKJABBYN   0.00   11:27:54 Apr 17, 2012 PDT   Completed   windows-1252   deepa   0.44   3.4   512383cf2c149c1cb34df1f58f1c3505   verified   deepa_1329192018_biz@yahoo.com   1   AuL6cw-ASsYwHgJfs4X-aE93YB3lAkvo-T8iS0uZRe5yvSl-ZybQU2-7   deepa__1333386065_per@yahoo.com   3X235666C3490850P   instant   vaith   deepa_1329192018_biz@yahoo.com   0.44   VHB2TFSFARJQ4   web_accept   Order Number: b64606   USD      US   1   0.00   512383cf2c149c1cb34df1f58f1c3505   4.91   0.00   1c27f374ac336

2012-04-17 18:28:01
message: process IPN

2012-04-17 18:28:01
message: process IPN OK

2012-04-17 18:28:01
message: plgVmOnPaymentNotification return new_status:C

2012-04-17 18:28:01
message: Notification: emptyCart

DeepaVaith

I forgot to mention joomla 1.5 and VM 2.0.6. 
Even letting me know if what I'm asking for is not provided by VM will be great :(

Thanks,
Deepa

DeepaVaith

hmm...it seems to have something to do with these lines in vmpsplugin.php in the emptyCart function.
   // Recover session in wich the payment is done
$this->logInfo('Notification: before new session emptyCart ' . $session_id, 'message');
       session_id($session_id);
       session_start();
$this->logInfo('Notification: after new session emptyCart ' . $session_id, 'message');
The first message is logged with the correct session id and the second message is not written out.
The session id matches what is in the database-even if I call the emptycart with this session id it
does not work. 
Is this a bug?  Is there a quick way to fix it....If so, please point me in the right direction.
Oh please let me not be talking to myself here!!!! :)



Milbo

No, should work imho, but I am just not the expert for this.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

DeepaVaith

I've tried it in every version from the first release to the 2.0.6.
And it does not work it any version when called from the
plgVmOnPaymentNotification, but works on the click
from Paypal which calls plgVmOnPaymentResponseReceived.
Am I right in this understanding? 
Milbo - thanks for replying.  Though your reply has made things
more confusing :(

alatak

Hi,

Yes you are rigth . The cart is not emptied.
I have fix it for the next version.


Meanwhile you can fix it by changing the code line 450 in file plud-gins/vmpayment/paypal/paypal.php
replace
$this->emptyCart($return_context);
by
$this->emptyCart($paypal_data['custom']);

DeepaVaith

Hi, Thanks for your response.  The problem is not solved.   I changed the line in paypal.php.
I've attached the changes in vmpsplugin.php and the output from the paypal.log files
below.

I added more debugging statements to the emptycart function in vmpsplugin.php file
There seems to be a problem in the session_start line in red.  The session id in the
function, matches  the id in the table. 

Please help!

function emptyCart($session_id) {
   if (!class_exists('VirtueMartCart'))
       require(JPATH_VM_SITE . DS . 'helpers' . DS . 'cart.php');
   $this->logInfo('Notification: emptyCart ' . $session_id, 'message');
/*$_db = JFactory::getDBO();
   $_q = "SELECT data FROM #__session WHERE session_id='".$session_id. "'";

$this->logInfo('Notification: query' . $_q, 'message');
   $_db->setQuery($_q);
   $_r = $_db->loadResult(); // TODO Error check
$this->logInfo('Notification: after query' . $_r, 'message');  */

   if ($session_id != null) {
       $session = JFactory::getSession();
       $session->close();

       // Recover session in wich the payment is done
      $this->logInfo('Notification: after session close', 'message');
       session_id($session_id);
      $this->logInfo('Notification: after getting session', 'message');

          session_start();
      $this->logInfo('Notification: after session_start' . $session_id, 'message');

   }

   $cart = VirtueMartCart::getCart();
   $this->logInfo('Notification: getCart ' . $session_id, 'message');
   $cart->emptyCart();
   $this->logInfo('Notification: final emptyCart ' . $session_id, 'message');
   return true;
    }


Log file from Paypal

2012-04-18 16:23:41

message: plgVmOnPaymentNotification return new_status:C

2012-04-18 16:23:41
message: Notification: emptyCart 2f6956fae42734587377a39c5bfe7970

2012-04-18 16:23:41
message: Notification: after session close

2012-04-18 16:23:41
message: Notification: after getting session

DeepaVaith

Was anyone able to take a look at it?  I'm really desperate as the launch date for
the site has been postponed due to this problem only. 
Any idea when this can be solved?

Thanks,
Deepa

alatak

Hi,

Yes , change this function emptyCart in the file  vmpsplugin.php

function emptyCart($session_id) {
if (!class_exists('VirtueMartCart'))
    require(JPATH_VM_SITE . DS . 'helpers' . DS . 'cart.php');
$this->logInfo('Notification: emptyCart ' . $session_id, 'message');
if ($session_id != null) {
    // Recover session in wich the payment is done
     session_id($session_id);
     session_start();
}

DeepaVaith

Hi Alatak,
   Thanks for the prompt responses.  Now the cart is emptying, but I am being logged out
too.  Can it be worked such that the user does not have to login again if they have more
than one tab open?
Thanks,
Deepa

DeepaVaith


DeepaVaith

Hi!  Please can you tell me if this is something that is likely to be fixed soon?
I am unable to get the contents of the session at that point-if you can tell how to do
that I can try to take it from there.
Thanks.

DeepaVaith

Hi! I am sounding like quite a pain...but I'm completely stuck.  My site is ready and this is
the only thing holding up the launch.  Please could you help me with this bug or let
me know if this is not something that is going to be fixed in soon?  I've tried www.vm-expert.com/
too, but there has been no response from them. 
I am really desperate at this stage....

Thanks,
Deepa

DeepaVaith

Am I the only one on this forum with this problem?  Please can someone respond.
Thanks,
Deepa