Jump to content
Larry Ullman's Book Forums

Unregistered User Orders


Recommended Posts

Hi Larry

 

I don't see much reference to unregistered users in regards to moving their data through the checkout. With registered users we can collect order data in the DB, then serve them up their billing/shipping address during checkout, but for unregistered users that don't want to create an acoount, how to handle the order data? I assume we are using the $_SESSION vars to maintain a $data array of items added to the cart, but when and if they make the checkout purchase, how and where are we going to add the info to the DB without creating a huge table of "unregistered user" data?

 

The products we sell are all drop shipped or custom made and we require a lot of variables (10 or more) for each product ordered. Some of those vars include text and images. The way we handle it right now is using cookies to maintain data through checkout, No Database, the order is processed with a cgi to GpG encryption, then an encrypted copy is stored on the server and also Emailed to us for decryption and processing on this end. In other words we do not use a gateway.

 

While this system has served us well these past several years, and appears to be very secure, I would like to recode the site in PHP and MySql to take advantage of the power of databases which will be able to provide more features to the customer. On the other habd, I would still prefer to do the encryption rather than a geateway. The problem is really how to retain order data without bloating the DB ?

 

Thanks

Link to comment
Share on other sites

I don't see much reference to unregistered users in regards to moving their data through the checkout. With registered users we can collect order data in the DB, then serve them up their billing/shipping address during checkout, but for unregistered users that don't want to create an acoount, how to handle the order data? I assume we are using the $_SESSION vars to maintain a $data array of items added to the cart, but when and if they make the checkout purchase, how and where are we going to add the info to the DB without creating a huge table of "unregistered user" data?

 

Not sure what you mean by "don't see much reference". The entire second example, which is most of the book, does exactly this. If you look at that code, you'll see that $_SESSION is only used for the customer info during the checkout process. The order contents all stay in the database. You should read that section of the book.

 

While this system has served us well these past several years, and appears to be very secure, I would like to recode the site in PHP and MySql to take advantage of the power of databases which will be able to provide more features to the customer. On the other habd, I would still prefer to do the encryption rather than a geateway. The problem is really how to retain order data without bloating the DB ?

 

 

 

I don't know why you say "encryption rather than a gateway", as these are two different, unrelated things. Also, there's only a couple of ways to retain data: send it in an email, store it in a file, or store it in a database. This isn't "bloat": storing data is what a database is for.

Link to comment
Share on other sites

Well I am still working through the ebook and trying to get a handle on how things are done. I downloaded the scropts and installed the coffee script on my server this morning. I got an sql error when I imported the sql.sql file.

 

SQL query: b_help.png

-- -----------------------------

-- Stored Procedures --

-- -----------------------------

DELIMITER $$ CREATE PROCEDURE select_categories( TYPE VARCHAR( 6 ) ) BEGIN IF TYPE = 'coffee' THEN SELECT *

FROM general_coffees

ORDER BY category;

 

ELSEIF TYPE = 'other' THEN SELECT *

FROM non_coffee_categories

ORDER BY category;

 

END IF ;

 

END$$

MySQL said: b_help.png

#1304 - PROCEDURE select_categories already exists

 

Any idea why this happening ?

 

it created the following tables

 

carts

customers

general_coffees

non_coffee_categories

non_coffee_products

orders

order_contents

sales

sizes

specific_coffees

transactions

wish_lists

 

 

Now when I run the Index.php file I am getting the main page, without any images, and the links to the product pages do not work. Seems they are looking for a DIR called /shop which I do not find anywhere in the HTML dir structure .. Am I missing something ?

Link to comment
Share on other sites

Well, I would start by reading the forum guidelines before you post again, as you're leaving out vital information. But I'll add that the SQL file is giving you that error because you can't import then entire thing at once, as it clearly states at the top of the file.

 

As for the problems loading the site, your directory structure and/or HTML/CSS/.htaccess need to be adjusted.

 

Also, just so you know, the book assumes complete comfort with PHP and MySQL.

Link to comment
Share on other sites

Oh I see .. you are using the .htAccess file to do redirects

 

<IfModule mod_rewrite.c>

RewriteEngine on

# For sales:

RewriteRule ^shop/sales/?$ sales.php

# For the primary categories:

RewriteRule ^shop/([A-Za-z\+]+)/?$ shop.php?type=$1

# For specific products:

RewriteRule ^browse/([A-Za-z\+\-]+)/([A-Za-z\+\-]+)/([0-9]+)$ browse.php?type=$1&category=$2&id=$3

# For HTTPS pages:

RewriteCond %{HTTPS} off

RewriteRule ^(checkout\.php|billing\.php|final\.php|admin/(.*))$ https://%{HTTP_HOST}/$1 [R=301,L]

</IfModule>

 

Problem is I have installed this on my live server in a sub dir, and I believe the main .htAccess redirects are overruling these.

Link to comment
Share on other sites

You're welcome to ask. In fact, you're encouraged to ask. That's what these forums are for. Just please read the forum guidelines to make the process more efficient. It's really rather a small thing I ask of participants, I believe, in order to receive absolutely free help from strangers here.

 

As for your problem, an .htaccess file in a subfolder will override .htaccess rules in a main folder, assuming that's allowed.

Link to comment
Share on other sites

 Share

×
×
  • Create New...