Have you ever made an ecommerce site, and as you were grueling through the horrors of making a product catalog thought to yourself, "there has to be a better way..."? Well, There probably is.
This tutorial will teach you the ancient secret of how to generate your eCart site, then use Data Bridge to create some nice Product pages that folks can use to buy your wares.
For this tutorial, we are focusing primarily on integrating eCart with Data Bridge pages, so we won't be setting up fancy things like payment gateways. For more information on advanced eCart setup, check the eCart support page.
- A dynamic site set up within Dreamweaver
- A blank database
- Dreamweaver CS3 or later
- eCart 5 or later installed and activated in Dreamweaver
- Data Bridge installed and activated in Dreamweaver
First thing's first: You need a connection to your blank database, or how will all of your data get stored? It won't; THAT'S how!
This step doesn't actually create anything within your database. Just a connection that Dreamweaver, and all applications you make within Dreamweaver, can use to connect to the database.
- In Dreamweaver, make sure your site is selected
- Click Window > Databases
- Click the Add Database ( ) button
- Click MySQL Connection
- Enter your Connection name, MySQL server, User name, Password, and Database as per your specific setup
- Click OK
You now have a connection to your database.
Next on the plate, we need to create our order and product pages in Data Bridge. This will give eCart some database goodness to insert and pull from for your products and orders.
Create your Product Administration pages
These pages will allow you to add new products to your database, and manage existing products.
- Click WebAssist > Database > DataAssist Pages in the menu bar
- Select Product Administration from the Application Type list
- Ensure the database connection you just made is selected from the Connection list
- Check the Create the database table for me checkbox if it isn't already checked
- The step to create the connection to a database only creates the connection, but nothing within the database itself. This will create the needed table within the database that we connected to above.
- Take note of the database table name that is created for the admin pages
- Click Finish to make the pages
- Close all pages that were opened
Create your Product Catalog pages
These are the pages the users will see. This is what we link with eCart later.
- Click WebAssist > Database > DataAssist Pages in the menu bar
- Select Product Catalog from the Application Type list
- Ensure the database connection you just made is selected from the Connection list
- Uncheck the Create the database table for me checkbox if it is checked
- Verify the database table is the same as the one created for the admin pages
- Unchecking this will make the catalog pages use the same database as the admin pages. This will link all products correctly.
- Click the Manage Pages tab
- Select the Results page
- Click the Edit button
- Uncheck the Include delete button in results list checkbox
- Click OK
- Select the Detail page
- Click the Edit button
- Uncheck the Include delete button in details list checkbox
- Click OK
- Click Finish to make the pages
- Close all pages that were opened
Create your Orders pages
The Orders pages help you manage orders. eCart will sync with this database table and automatically log new orders.
- Click WebAssist > Database > DataAssist Pages in the menu bar
- Select Orders from the Application Type list
- Ensure the database connection you just made is selected from the Connection list
- Check the Create the database table for me checkbox if it isn't already checked
- Click Finish to make the pages
- Close all pages that were opened
Your pages are now made. For the most part, we won't touch any of these pages, but we needed them to create the database tables for us to tie in with eCart.
Now that we have our product and order pages made, and our database populated with some shiny new tables, it's time to get cracking on eCart.
Create the eCart Object
The heart of your eCart site is the eCart Object. It really ties the room together.
- Click Insert > WebAssist > eCart > eCart Object
- Click the Add button
- Click OK to create the eCart Object
Create the shopping cart page
- Create a new PHP page in your site called cart.php
- Click Insert > WebAssist > eCart > Display Manager
- Click Next
- Click Next again
- Click Finish
Run the eCart Checkout Wizard
For this tutorial, we are skipping payment gateways, tax, shipping, and receipts. You can add these things if you wish, but they won't be covered in the tutorial.
- Click Insert > WebAssist > eCart > Checkout Wizard
- Set the cart object to the one that was created earlier (eCart1)
- Set the gateway to No payment gateway
- Click Next
- Make sure the I will provide shipping checkbox is unchecked
- Click Next
- Make sure the No thanks, I'll handle tax calculation myself checkbox is checked
- Click Next
- Make sure the No thanks, I'll handle order management myself checkbox is unchecked
- Check the Create using preset checkbox
- Select Default from the drop down list
- Ensure the Connection is set to the connection made earlier
- Click Next
- Make sure the No thanks, I'll handle the receipt myself checkbox is checked
- Click Next
- Click Next on the design options page
- Click Finish on the last step
eCart is now making your checkout pages which, when used, will add an order to the order table of your database that was created earlier.
Now it's time to add your Add to Cart button to the Product Detail page that was created earlier. This will allow users to buy your stuff.
- Open the product_detail.php page
- Select the Add to Cart button that is currently on the page
- Delete the button
- Look for the opening ( <form... ) and closing ( </form>) tags in Code view, and remove the whole tags.
- eCart buttons include their own form tags, so the existing tag would have created conflicts
- In Code View, place your cursor within the WADADetailsButton div
- Click Insert > WebAssist > eCart > Add to Cart Button
- Click on Look up item ID from recordset
- Set the Recordset to WADAProducts
- Set the ID Column to ProductID
- Type cart.php in the Go to page field
- Click the Bindings tab
Here we're going to set the values for the product details so the correct product is added to the cart.
- Click Name from the Column list
- Click the Dynamic Data (lightning bolt) button next to the Default value field
- On the Dynamic Data dialog, expand the Recordset (WADAProducts) field
- Select the ProductName variable
- Click OK
- Click Description from the Column list
- Click the Dynamic Data (lightning bolt) button next to the Default value field
- On the Dynamic Data dialog, expand the Recordset (WADAProducts) field
- Select the ProductLongDesc variable
- Click OK
- Click Thumbnail from the Column list
- Click the Dynamic Data (lightning bolt) button next to the Default value field
- On the Dynamic Data dialog, expand the Recordset (WADAProducts) field
- Select the ProductImage variable
- Click OK
- Click Price from the Column list
- Click the Dynamic Data (lightning bolt) button next to the Default value field
- On the Dynamic Data dialog, expand the Recordset (WADAProducts) field
- Select the ProductPrice variable
- Click OK
- Click OK to add the button
- Save your pages
We now have an Add to Cart button on the Product Details page that will add the correct product shown to the cart.
And that's the end of that chapter. You now know how to intermingle eCart and Data Bridge for your own nefarious means. All you have to do is add a product with the product_insert.php file you made earlier, then give your new little ecommerce site a test drive.
Now you can do things to spruce it up, like customize the product search, result, and details pages, customize your shopping cart and checkout pages, and add all your glorious products to appease the spend hungry masses.