In the eCommerce series, you will learn about using eCart to create a responsive shopping cart for selling your products online. There are three steps to this process, each with a dedicated tutorial. This tutorial shows you how to place an Add to Cart button on a product catalog which your customers can use to select items to purchase and add them to their shopping cart. (If you do not have a product catalog, the first tutorial in this series will walk you through the steps of creating one.) The previous shopping cart tutorial shows you how to create an eCart object which defines the structure of your cart. The last shopping cart tutorial shows you how to design a responsive cart page that holds informational details about the products a customer is purchasing.
You'll find a linked index including an overview of each tutorial belonging to the eCommerce series at the bottom of this page.
- Dreamweaver CS4 or higher.
- eCart 5 or higher installed and activated in Dreamweaver.
- Site defined in Dreamweaver. For assistance defining a site, view these tutorials: Define a dynamic site in CS4 or Define a dynamic site in CS5+.
- PHP web page and connection in Dreamweaver to your database. For assistance, view this tutorial: Create a PHP database connection.
- Product catalog pages. For assistance creating product catalog pages, view this tutorial: Create a product catalog.
Using eCart's interface, you can create an Add to Cart button to be placed beside each product listing on your website. When clicked, this button will add the item that is for sale to the shopping cart. Customers can continue shopping on your store, adding additional items to their cart, and then proceed to the shopping cart page when ready to purchase those items. But first it is necessary to delete the existing button on the form.
When using an existing product catalog, this section may not be necessary if you do not have a form on the page. If so, you can skip to the next section, Create an Add to Cart Button.
- Open the product_detail.php page.
- In split code view, select the Add to Cart Button that is currently on the page and delete it.
- Within the code, look for the opening (<form...) and closing (</form>) tags and remove both tags. Because eCart buttons include their own form tags, leaving the existing tag will create a conflict.
Now you will create an Add to Cart Button and place it on the detail page of your product catalog using the eCart interface. This will allow customers to purchase your products displayed in your online store.
- In code view, place your cursor as indicated, inside <div class="WADADetailsButton"></div>.
- Click 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 of the Add to Cart Button dialog. Here you're going to set the values for the product details so the correct product is added to the cart. As well, you can determine how the cart is updated and if a redirect should take place upon an update.
- 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 ProductShortDesc 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 Weight 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 ProductWeight 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.
Once you have finished configuring the Add to Cart Button, you may discover that you want to add a new column. If this happens, you must return to the eCart Add to Cart Button interface and manually bind the new column after adding the column to the eCart Object. Otherwise, you will get an error message.
- Updateable option: You have the option of making a column value editable and including an updateable form field. Cart columns can be updated using one of the three types of form fields: hidden field, text field, or select list.
- For example, by checking the Updateable field for Quantity (which automatically uses a text field), your customer can purchase more than one of the same product.
- However, there may be some instances when you would not want Quantity updated. Going back to the example of selling boats, if you had only one Bayliner for sale, you would not want to make Quantity an updateable field.
- If you want to use eCart to set up donations, one easy way is to configure the price field to be updateable, allowing someone to enter how much they intend to donate. This will require some additional configuring. Refer to Donations with eCart for more information.
Using a select list to update a cart column requires that you configure the list's options after creating the button. This can be done directly through the Property Inspector for the list.
- If Item In Cart option: You can select one of four options from the Action list to determine how an item is populated into the shopping cart if it's already present.
- Sum increases the quantity of the item in the cart.
- Ignore does not allow the item to be added. Add New creates a new instance of that item in the cart.
- Replace adds the item to the shopping cart and replaces the existing item.
- Redirect option: You may decide to redirect a customer to another page. If so, click the Redirect checkbox and enter a new URL.
- For example, you might want to explain why their action is ignored when they try to purchase an item on back-order.
- This redirect will override the redirect specified on the General tab.
- Now click on the Button tab of the eCart Add To Button interface to configure the type of button displayed. You have the option of selecting different color schemes and form buttons. Or you can create a custom button and specify its image location.
- Click OK to add the button.
- Save the page (Ctrl or Cmd + S).
- You can preview your page by going to File > Preview in Browser and selecting your browser.
- You now have created an Add to Cart Button for your Product Details page that will add selected products to the cart.
You may find that you want to make changes in the eCart Add to Cart Button interface in the future. If so, re-enter the interface by going to Server Behaviors > eCart Add From Recordset (your-cart's-name WADAproducts).
Congratulations! You've finished creating the eCart Object, shopping cart, and Add to Cart Button. Tutorials 4 and 5 in this series will shows you how to incorporate your product options with eCart's shopping cart functionality including the ability to increment the price of products for certain options.
Now that you are finished placing an Add to Cart button on a product catalog page, proceed to the next shopping cart tutorial: Add a shopping cart III (eCommerce Series) where you will design a responsive cart page that holds informational details about the products a customer is purchasing.
With eCart technology as the cornerstone of the WebAssist eCommerce series, these in-depth tutorials will walk you through the steps of building an eCommerce site: product catalogs, shopping carts, product options (both static and dynamic), and checkout including payments. Completing the eCart portion of the series is help for setting up a back-end administration to manage your eCommerce business. Additionally, to be used with or without eCart, you will learn about payment gateway providers, hosting solutions, and online shipping accounts.
- Introduction to the eCommerce series: An overview of the WebAssist eCommerce series including a detailed description of each tutorial.
- Create a product catalog: Learn to create a dynamic product catalog for an online store.
- In Create a product catalog I, you will learn if a dynamic product catalog is appropriate for your online store and how to complete the initial set-up.
- In Create a product catalog II, you will learn how to create product administration pages, product catalog pages, and order pages for your dynamic product catalog.
- Add a shopping cart: Learn about using eCart to create a responsive shopping cart for selling your products online.
- Create an eCart object to define the structure of your shopping cart.
- Place an Add to Cart button on a product catalog which your customers can use to select items to purchase and add them to their shopping cart.
- Design a responsive shopping cart page that holds informational details about the products a customer is purchasing.
- Add dynamic product options I: Learn how to add dynamic product options to your website's online store using eCart's shopping cart functionality.
- Add dynamic product options II: Learn how to add dynamic product options, which include options within themselves (for example, incremental pricing), to your website's online store using eCart's shopping cart functionality.
- Add static product options: Learn how to add static product options to your online catalog store.
- Add checkout and administration: Learn how to manage checkout, payments, and the back-end administration of your eCommerce site using the seven tabs in the eCart Checkout Wizard - Settings, Payments, Shipping, Tax, Orders, Email, and Form Design.
- In the Settings tab, you will choose the general settings for your site and checkout pages.
- In the Payments tab, you will set up payment provider and checkout options.
- In the Shipping tab, you will choose shipping providers and set charges.
- In the Tax tab, you will set the rules for sales tax or VAT.
- In the Orders tab, you will configure your order storage options.
- In the Email tab, you will enter your email server settings.
- In the Form Design tab, you will select your checkout form from preset designs.
- Online payment solutions: Learn about online payment solutions including seamless checkout, remote checkout, and various PayPal checkout options.
- Hosting provider solutions: Learn about and choose between five hosting providers, 1&1, GoDaddy, HostGator, Network Solutions, and DreamHost.
- Online shipping solutions: Learn where and how to set up free shipping accounts with FedEx, UPS, USPS, and Australia Post.
: 10 Years, 1 Month, 3 Weeks, 2 Days, 14 Hours, 43 Minutes ago
Hi, I'm following this to the letter but when I delete the code you mention and insert my add to cart button it doesn't show when previewed. Do you have any ideas?