#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2004
    Posts
    15
    Rep Power
    0

    global variables + oscommerce


    i am modifying oscommerce for a client and adding new features
    i am trying to use global variables and it seems to work fine on most of the pages. however

    when it gets to the checkout, i want to grab the customers basket id and pass it through a global variable.

    i have grabbed the id and it is saved as $customers_basket_id on the page checkout_confirmation.php

    i have tried everything i can think of to pass this info to checkout_success.php but i cant get it to work. i wanted confirmation that i am passing a global correctly (simple stuff i know but i am so frustrated that i cant get it to work want to make sure im doing i right.)

    on checkout confirmation.php i type

    global $customers_basket_id; (set global var)

    then

    $customers_basket_id = $another_variable; (assign global var)


    then-on checkout_success.php


    global $customers_basket_id; (declare global var for use)

    then
    echo $customers_basket_id; (echo it so i can see if it has been passed)



    this is what i have done but it echoes nothing on checkout_success.php

    i cant really explain what i need it for here cos it would take pages to explain! but basically thats all i need-get the basket id and pass it to the next page

    i can get it no prob but passing it seems like the hardest thing in the world to me although it should be the simplest!

    have tried passing as a $_POST values as the button to checkou_success.php is a from submit button - no joy

    nothing seems to work!!

    could someone confirm that i am correct in my global passing please?

    also - i am posting this on the oscommerce forum
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2004
    Location
    Christchurch, New Zealand
    Posts
    3
    Rep Power
    0
    Your variable will need to be passed first to checkout_process.php - this is what processes the order - then the code redirects to checkout_success.php.

    You may have other issues with this depending on the payment processor you are using. If the processor relies on data from checkout_confirmation.php being posted to the processors site you will need to find a way to pass the data through and back to checkout_process.php.

    Your best bet is to save it as part of the session - then it will be there until the session is lost on a logout or when the browser is closed.

    See how comments are saved into the session round line 40 of checkout_confirmation.php.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2004
    Posts
    15
    Rep Power
    0
    cheers
    didnt realise about checkout process
    there are so many includes in oscommerce its hard to see what is going on and ive been working on it for weeks!

    i used sessions and that seems to work fine

    thanks for the info

IMN logo majestic logo threadwatch logo seochat tools logo