close ad
 
Important WebAssist Announcement
open ad
View Menu

Web development tutorial

Inventory management product detail III

Tutorial created by Ray Borduin, WebAssist

Categories: Data Bridge, eCart, Dreamweaver, PHP

rating

In the third tutorial of the Inventory Management series, you will learn how to inform your online customers on the product detail page when the quantity of the product they wish to purchase is no longer available. When you are finished, follow the link to complete the next step in inventory management. A list of Inventory Management tutorials is also found at the bottom of this page.

arrow downWhat do you need to start?

  1. Site defined with Dreamweaver CS4 or higher.
  2. Product and admin pages built with DataAssist. For more assistance, view tutorials: Create a product catalog I and Create a product catalog II.
  3. A checkout experience previously generated with eCart 5 or higher.

arrow downUpdate product detail page I

Now you will update the public product detail page to let your customers know when a product they wish to purchase is no longer available. This is done by adding two snippets of code. In this section, we will add the first snippet to update the Recordset.

  1. Copy the following snippet of code (Ctrl or Cmd + C):
    , ProductStock - (SELECT Coalesce(SUM(DetailQuantity),0) FROM orders Inner Join orderdetails ON orderdetails.DetailOrderID = orders.OrderID WHERE OrderDate > ProductUpdateDate AND DetailProductID = ProductID) AS RemainingInventory

  2. Paste the snippet into the Recordset on the product detail page using code view (Ctrl or Cmd + P):


  3. If you are not using a database provided by WebAssist, update the column references and table references in the SQL field to match the column names and table names in your database.


  4. Test and click OK.

arrow downUpdate product detail page II

Now you will add a message that will replace the Add to Cart button and alert the customer when a product is no longer available for purchase. This is done by wrapping an if statement around the Add to Cart button.

  1. Copy (Ctrl or Cmd + C):
    <?php if ($row_WADAproducts['RemainingInventory'] > 0) { ?>

    <input type="hidden" name="ProductID" value="<?php echo($_GET['ProductID']); ?>">

  2. Paste the if statement above the Add to Cart button using code view (Ctrl or Cmd + P) :


  3. Copy (Ctrl or Cmd + C):
    <?php  } else { ?>
    out of stock
    <?php
    }
    ?>

  4. Paste the second snippet below the Add to Cart button using code view (Ctrl or Cmd + P) :


  5. Now the product detail page will display an out of stock message if there is no more inventory instead of displaying the Add to Cart button.


  6. Go to File > Preview in Browser to view your product detail page.


  7. However, should there be insufficient stock to process your customer's order, the out of stock message will replace the Add to Cart button.

arrow downWhere do you go next?

Now that you've added a message on the product detail page to inform your online customers when the product they wish to purchase is no longer available, you will learn how to alert them in the shopping cart page at Inventory management shopping cart IV.

arrow downWebassist inventory management series

In the WebAssist inventory management series for eCommerce sites, you will learn how to track and update inventory as an administrator. Additionally, you will learn how to inform your customers throughout the shopping and purchase process when the quantity of the product they wish to purchase is insufficient or no longer in stock.

  1. Inventory management series: A summary of six in-depth tutorials which walk you through the steps of managing inventory on your eCommerce site using administrative pages as well as product detail, shopping cart and confirm pages.

  2. Inventory management introduction I: Learn about inventory control for eCommerce sites and how to set up your database to manage product stock.

  3. Inventory management administration II: Learn how to set up inventory control so that an Administrator can track and update the amount of stock carried in an eCommerce site.

  4. Inventory management product detail III: Learn how to alert online customers to insufficient inventory on the product detail page for the product they wish to purchase.

  5. Inventory management shopping cart IV: Learn how to alert online customers to insufficient inventory in the shopping cart for the product they wish to purchase.

  6. Inventory management checkout V: Learn how to alert online customers during checkout to insufficient inventory for the product they wish to purchase.

  7. Inventory management workflow VI: In this final tutorial, you will be walked through the inventory management workflow process from start to finish.


For further inventory management help, check our Community Forums or post comments to this tutorial.

arrow downReviews and comments

Comments will be sent to the author of this tutorial and may not be answered immediately. For general help from WebAssist, please visit technical support.

Sign in to add comments
rating
rating

Dave W: 9 Years, 10 Months, 3 Weeks, 1 Day, 22 Hours, 21 Minutes ago

Parts IV, V, VI don't appear to exist!

Kate Ford: 9 Years, 10 Months, 1 Week, 6 Days, 15 Hours, 16 Minutes ago

Hi Dave, The remaining three tutorials, as well as an overview to the series, are now complete and waiting review before they can be published. ~ Kate

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.