PHP Scripting Forums » PHP Classes Support Forum

db_cart_class and access_user_class together

(15 posts)
Great offers not only for geeks!
Your Ad Here

  1. User has not uploaded an avatar

    damen18
    Member

    Hi, (here i am again ;))

    I assume it's possible to combine the db_cart_class and the access_user_class.

    Can you recommend what's the best way to do that and what to modify?

    Best regards,

    Posted 3 months ago #
  2. Hi,

    I did that on www . bergtoys . co. uk,

    actually you need to use only two diff. objects. Just create the db_cart pages and protect the page after the checkout. Notice also the page where the shipment address is processed, this page is already prepared to work with AU.

    Posted 3 months ago #
  3. User has not uploaded an avatar

    damen18
    Member

    Thank you for your reply.

    But in de db_cart_example_btn_only.php a customernr is needed right? How can i solve this? Just skip that query in db_cart_example_btn_only.php and execute that query in the checkout page?

    Posted 3 months ago #
  4. I use often the USERID from the AU class as a customer number (this way you can link orders with a customer).

    If you don't need a customer number leave it empty or give the number a zero (0)

    Posted 3 months ago #
  5. User has not uploaded an avatar

    damen18
    Member

    so in the db_cart_example_btn_only.php i give the customernr a zero. And then they have to login at the checkout page? After that the script must update the customernr and shipping information will be displayed?

    Can you give me a little example?

    Thank you

    Posted 3 months ago #
  6. Please test both classes "standalone" first and learn how they work

    Posted 3 months ago #
  7. User has not uploaded an avatar

    damen18
    Member

    i've tested it and i know how it works. It almost works only one problem:

    In the checkout page i made this query: ` $cust_sql = "SELECT t1.id, t1.email, t1.real_name, t2.address, t2.postcode, t2.city, t2.phone
    FROM users AS t1, users_profile AS t2
    WHERE t1.id = t2.users_id
    AND t1.id = '$cust_no'";`

    then i have to get the data out like this:

    $cust_result = mysql_query($cust_sql) or die(mysql_error());
    	$cust_obj = mysql_fetch_object($cust_result);
    	$myCheckout->debnr = $cust_obj->id;
    	$myCheckout->ship_name = $cust_obj->real_name;
    	$myCheckout->ship_address = $cust_obj->address;
    	$myCheckout->ship_pc = $cust_obj->postcode;
    	$myCheckout->ship_city = $cust_obj->city;
    	$myCheckout->ship_person = $cust_obj->email;
    	$myCheckout->ship_telephone = $cust_obj->phone;
    	mysql_free_result($cust_result);

    But in the form the values are empty i think. It shows the variables: real_name, address, postcode, city, email, phone. The values from the session are working. id and email are visible. But id and email are in a session from the db_cart_example_btn_only.php page. Do i have to put all data in a session?

    echo create_form_field("name", "<tr><td>Naam:</td><td>", $myCheckout->ship_name, 30)."</td></tr>";
      echo create_form_field("address", "<tr><td>Adres:</td><td>", $myCheckout->ship_address, 30)."</td></tr>";
      echo create_form_field("postal_code", "<tr><td>Postcode:</td><td>", $myCheckout->ship_pc, 8)."</td></tr>";
      echo create_form_field("place", "<tr><td>Plaats:</td><td>", $myCheckout->ship_city, 30)."</td></tr>";
      echo create_form_field("person", "<tr><td>Contactpersoon:</td><td>", $myCheckout->ship_person, 30)."</td></tr>";
      echo create_form_field("telephone", "<tr><td>Telefoonnummer:</td><td>", $myCheckout->ship_telephone, 30)."</td></tr>";
      // echo create_form_field("country", "Country:", $myCheckout->ship_country, 30)."<br />";
      echo create_text_area("message", "<tr><td>Referentie:</td><td>", $myCheckout->ship_msg, 5, 27)."</td></tr>";

    I hope you know the answer to my problem. Thank you

    Posted 3 months ago #
  8. where do you create the object "$myCheckout"?

    Posted 3 months ago #
  9. User has not uploaded an avatar

    damen18
    Member

    it's the default object you use in the checkout page (i did not change that). $myCheckout = new db_cart(8000);

    Posted 3 months ago #
  10. User has not uploaded an avatar

    damen18
    Member

    i don't know why but it seems to work now :-S Thank you. Your support is great!

    Posted 3 months ago #

RSS feed for this topic

Reply »

You must log in to post.