close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

eCart session variables

Thread began 8/23/2011 2:18 am by david331670 | Last modified 8/25/2011 10:27 am by Jason Byrnes | 1026 views | 6 replies |

david331670

eCart session variables

I Just cant get it.
I am starting to produce photobooks.
My books assembly software loaded onto users computer assembles the files to a folder, the finished files are sent to my FTP site and the user logs onto my cart page with link address similar to this: http://localhost:/Shop-Photobooks.php?pgx=32&pid=274&job_id=Cards_475"

I can "Get" the data for the number of pages, (pgx=32) calculated from page price in data base, the product ID (pid=274) from product ID in data base, and I can display the Job_id number ( Cards_475). These item display and calculate properly. I want the job_id to be carried forward and displayed on the cart summary page, the confirm page and the cart success page. This JobID is related to the folder on my FTP site and it is important to have the job_id displayed on the success page/invoice as this is the way the customer can have reference to his job.
I can display the job_id number if I include it in the URL but I cannot get it to carry over to any or all three pages.
I just know it is simple but no luck.
I have used this code to display URL items on the cart page.
Line11 after:
<?php
$Spectrum_online->GetContent();
?>
<?php
session_start();
// store session data
$_SESSION['PBksID']=$_GET['job_id'];
?>

body
html

This in a table cell:
<?php
//retrieve session data
echo "Job identification=". $_SESSION['PBksID'];
?>
can you point me in the correct direction please.
Thanks
David

Sign in to reply to this post

Jason ByrnesWebAssist

change this line:

$_SESSION['PBksID']=$_GET['job_id'];


to:
if(isset($_GET['job_id'])) $_SESSION['PBksID']=$_GET['job_id'];

this way the session will only get set if the job_id querysting variable exists.

My bet is that the session is getting reset at some point to be empty, and that is why it is not carrying over to the other pages.

once it is set, you should be able to use:
echo "Job identification=". $_SESSION['PBksID'];


on any page to display the session value.

Sign in to reply to this post

david331670

Thanks for that.
I found the problem and the job_id now displays on the cart summary page. However I now cant get it to display on the confirm page and success page.
Link from cart summary to secure site for transaction.
All the rest of the data works ok to confirm and success pages, just the job_id is the headache. I keep trying to put hidden data at the bottom of the car summary "
<input type="hidden" name="PagePrice_<?php echo $Spectrum_online_Index; ?>" id="PagePrice_<?php echo $Spectrum_online_Index; ?>" value="<?php echo $Spectrum_online->DisplayInfo("PagePrice") ?>" />
The above portion works.
Below is my attempt at a hidden field that is not connected to the data base.
Its pure rubbish but , Am I on the right track
<input name="job_id" type="hidden" value="<?php echo $job_id ;?>"/>
Thanks again

Sign in to reply to this post

Jason ByrnesWebAssist

the code for the hidden element would be:

<input name="job_id" type="hidden" value="<?php echo $_SESSION['PBksID'];?>"/>

to:
then on the checkout page, use the following code to reset the session on the secure server:
<?php if(isset($_POST['job_id'])) $_SESSION['PBksID']=$_POST['job_id']; ?>

Sign in to reply to this post

david331670

What a star you are!!
Finally got it working.

I have used the following code to reset the session on the secure server:
I have put this code at the bottom of the checkout page:
</body>
</html>
<?php if(isset($_POST['job_id'])) $_SESSION['PBksID']=$_POST['job_id']; ?>

Is that correct? or somewhere else?
Many thanks
David

Sign in to reply to this post

david331670

Cart error

Me again
When I use the cart for the photobooks for eg "?pgx=32&pid=274&job_id=Cards_475" as described above all now works well
However when the item is not in the cart, ie different item I get an error message "Cart-A.php" on line 238" which is line 238= " <?php echo "Job ID: ". $_SESSION['PBksID']; ?>"
Do I use something like this in front of the code "if(isset($_GET['job_id'])) " so that I dont get an error if the code is not there.
I have this at the top of the cart summary page: <?php
if (!session_id()) session_start();
// store session data
if(isset($_GET['job_id'])) $_SESSION['PBksID']=$_GET['job_id'];
?>
Thanks
David

Sign in to reply to this post

Jason ByrnesWebAssist

you dont mention what the error message says.

you only mention the code that is creating the error.

this only gives me half of the story

I have no way of knowing how to fix an error without knowing what the error is.

Sign in to reply to this post

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...