close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

ECart Help Needed

Thread began 5/09/2012 3:48 pm by Steve E | Last modified 5/17/2012 4:58 am by Steve E | 1732 views | 12 replies |

Steve E

ECart Help Needed

Hi
I am building a shopping cart and am using PayPal checkout, every thing seems to be working ok after a few adjustments to the scripts generated by the latest ecart checkout wizard.

1/ I have noticed that if I place an second order within half an hour or so from the time of the initial order, the order ID is overwritten with the new details and the first order details are lost, I thought about killing the session but as I need to force the user to register at checkout this does not seem to be an option, any ideas on how to overcome this?

2/ I need to update my orders table with a value of 'Completed' I set an initial value of 'Pending' on the confirmation page, on my IPN page I have added a update record behaviour to change the value, this is not working and its getting pretty confusing, I'm sure I'm nearly there with it, but feel this is something I need to ask if you could take a look at to see what needs to be done.

3/ I would like to update the products table to deduct the quantities of the ordered products from the values stored in the products table, I haven't done anything with this as I feel I must get the status updating correctly first.

4/ I would like to display the details of the order on the checkout_success.php page, and send an email to the user when the page loads confirming the purchase and order details.

Any advice would really be appreciated, I have attached the files and will purchase a support ticket if needed as I have a deadline to meet and its fast approaching.

Thanks in advance

Sign in to reply to this post

Jason ByrnesWebAssist

1) Add the following code to the success page:

php:
<?php

// Initialize the session.
// If you are using session_name("something"), don't forget it now!
@session_start();

// Unset all of the session variables.
$_SESSION = array();

// If it's desired to kill the session, also delete the session cookie.
// Note: This will destroy the session, and not just the session data!
if (ini_get("session.use_cookies")) {
    
$params session_get_cookie_params();
    @
setcookie(session_name(), ''time() - 42000,
        
$params["path"], $params["domain"],
        
$params["secure"], $params["httponly"]
    );
}

// Finally, destroy the session.
@session_destroy();
@
session_regenerate_id();
?>




2) there should be a transaction ID binding on the bindings panel, this should be used in the update for the ID Value.

3) you would need to add an update behavior to the IPN Page for this and add a loop so that it updates for each item in the cart.

This will require custom coding to accomplish and will go beyond what we can offer support for through this forum, I would suggest signing up for a premiere ticket where we could help with this, we would also be able to fix the status issue in the premiere ticket pretty quickly.


4) the email receipt should also be sent from the IPN page, but you can display the items orders by adding a cart display manager to the page.

Sign in to reply to this post

Steve E

Hi Jason
Thanks very much for getting back to me, I have not had a chance to take a look at it properly, but it all looks promising, I will let you know how I get on.

Sign in to reply to this post

Steve E

Hi Jason
Thanks for the advice,

This is an example of what comes back from PayPal
ipn.php?tx=02E02861F2075391R&st=Completed&amt=0.04&cc=GBP&cm=13&item_number=

1/Works but I still have to get the user to login again?

2/The transaction ID binding is a long string 'Transaction ID: 02E02861F2075391R' not the orderID, I added a custom field to the PayPal form on the confirmation page and associated the OrderID with this, I then added the update recordset behaviour to the ipn page and post the transaction_status message to the dB (PayPal return value cm=13 cm is custom)
Which works fine.

3/I will probably raise a ticket on this. I take it there are no examples of the looping record set update record which I can look at?

4/I have the order details displaying on the order_success page, thanks for the tip, I also have got an email coming from the ipn page as a confirmation email, however it goes to only the cc and bcc, not to the recipient, also several items do not display, I get the qty, name & price no other details show in the email body, no image etc, I have tried sending it to a record set UserRS1 and to a session variable which I created for the user email. and I'm still having no joy. I have added an attachment containing the relevant files.

If you could take a look and let me know what's up I would really appreciate it. If you feel you could resolve both 3 and 4 on one ticket I will raise a ticket directly, both are basically related to the same pages?
Thanks in advance

Attached Files
WA.zip
Sign in to reply to this post

Jason ByrnesWebAssist

1) See this thread for an example of maintaining the login;
showpost.php?p=80313&postcount=2

2 - 4) all of these issues are related to the same basic problem.

If you start a premiere ticket, we can work with you to correct them all rather quickly.

Sign in to reply to this post

Steve E

Hi Jason
1/I have opened a premier support ticket, at least I think I have, it did not prompt for payment, could this be because I have recently purchace the upgrades for Data Bridge & Design Extender? I can not see it in my Support History yet?

2/The Session code I'm using is

<?php
// Initialize the session.
// If you are using session_name("something"), don't forget it now!
@session_start('SecurityAssist_UserID');

//store user sessions - create a application variable for each user session variable from the login page
$UserID = $_SESSION['SecurityAssist_UserID'];
$UserFirstName = $_SESSION['UserFirstName'];
$UserLastName = $_SESSION['UserLastName'];
$UserLevel = $_SESSION['UserLevel'];
$UserEmail = $_SESSION['UserEmail'];
//add more application variables if you need to


// Unset all of the session variables.
$_SESSION = array();

// If it's desired to kill the session, also delete the session cookie.
// Note: This will destroy the session, and not just the session data!
if (ini_get("session.use_cookies")) {
$params = session_get_cookie_params();
@setcookie(session_name(), '', time() - 42000,
$params["path"], $params["domain"],
$params["secure"], $params["httponly"]
);
}

// Finally, destroy the session.
session_destroy();
@session_regenerate_id();

//restore the users session variables
$_SESSION['SecurityAssist_UserID'] = $UserID;
$_SESSION['UserFirstName'] = $UserFirstName;
$_SESSION['UserLastName'] = $UserLastName;
$_SESSION['UserLevel'] = $UserLevel;
$_SESSION['UserEmail'] = $UserEmail;
?>

I'm still being prompted to login after the success page.
Thanks in advance

Sign in to reply to this post

Jason ByrnesWebAssist

the sales department will be in contact wit you to schedule the appointment and make payment.


this section of code:
// Finally, destroy the session.
session_destroy();
@session_regenerate_id();

//restore the users session variables
$UserID = $_SESSION['SecurityAssist_UserID'];
$UserFirstName = $_SESSION['UserFirstName'];
$UserLastName = $_SESSION['UserLastName'];
$UserLevel = $_SESSION['UserLevel'];


needs to be changed to:

// Finally, destroy the session.
session_destroy();
@session_regenerate_id();

//restore the users session variables
$_SESSION['SecurityAssist_UserID'] = $UserID;
$_SESSION['UserFirstName'] = $UserFirstName;
$_SESSION['UserLastName'] = $UserLastName;
$_SESSION['UserLevel'] = $UserLevel;

Sign in to reply to this post

Steve E

Sorry Jason
I must of updated this while you wrote the reply, as my code is pretty similar to yours but with the added UserEmail session variable, and it still prompts me to login again.
Sorry for the confusion.

Sign in to reply to this post

Jason ByrnesWebAssist

try adding @session_Start(); just before the code to reset the session variables.


if this is still not working, there must be a session that login is looking for that is being missed.

Sign in to reply to this post

Steve E

Hi Jason
Well all the eCart session variables would still be active at this piont because I have the cart display manager on the page, could this be the reason? should I add all the eCart session variables to be destroyed?

Here is the code I have at the moment
<?php
@session_start();
?>
<?php
// Initialize the session.
// If you are using session_name("something"), don't forget it now!
@session_start('SecurityAssist_UserID');

//store user sessions - create a application variable for each user session variable from the login page
$SecurityAssist_UserID = $_SESSION['SecurityAssist_UserID'];
$UserFirstName = $_SESSION['UserFirstName'];
$UserLastName = $_SESSION['UserLastName'];
$UserLevel = $_SESSION['UserLevel'];
$UserEmail = $_SESSION['UserEmail'];
//add more application variables if you need to


// Unset all of the session variables.
$_SESSION = array('$SecurityAssist_UserID, $UserFirstName, $UserLastName,$UserLevel, $UserEmail');

// If it's desired to kill the session, also delete the session cookie.
// Note: This will destroy the session, and not just the session data!
if (ini_get("session.use_cookies")) {
$params = session_get_cookie_params();
@setcookie(session_name(), '', time() - 42000,
$params["path"], $params["domain"],
$params["secure"], $params["httponly"]
);
}

// Finally, destroy the session.
session_destroy();
@session_regenerate_id();

//restore the users session variables
$_SESSION['SecurityAssist_UserID'] = $SecurityAssist_UserID;
$_SESSION['UserFirstName'] = $UserFirstName;
$_SESSION['UserLastName'] = $UserLastName;
$_SESSION['UserLevel'] = $UserLevel;
$_SESSION['UserEmail'] = $UserEmail;
?>

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...