8 Replies Latest reply on Jun 19, 2007 8:37 AM by jefferisp7

    WebAssist Cart help? I know it's off topic but... Could really use some help...

    jefferisp7 Level 1
      I've got a shopping cart that is working and I'm trying to update the
      quantities in inventory by subtracting the quantity ordered from the total
      inventory in a table called ITEMS.
      I can update a record after a sale in the cart, but right now it is
      updating by completely replacing the value of the items in inventory with
      the quantity in the checkout cart. So, if there are 800 items, after the
      update, there are -1 total in inventory, not 799.
      The problem is that I don't know how to coordinate the item(s) in the stored
      shopping cart with a call to their ID and quantity in the online database.

      Here's what I have so far:
        • 1. Re: WebAssist Cart help? I know it's off topic but... Could really use some help...
          Günter Schenk Level 4
          Why don´t you ask the WebAssist support ?

          Günter Schenk
          Adobe Community Expert, Dreamweaver
          • 2. Re: WebAssist Cart help? I know it's off topic but... Could really use some help...
            jefferisp7 Level 1
            On 5/15/07 12:43 PM, in article 3bc3e9d6.0@webcrossing.la2eafNXanI,
            "Günter_Schenk@adobeforums.com" <> wrote:

            > Why don´t you ask the WebAssist support ?
            >
            > Günter Schenk
            > Adobe Community Expert, Dreamweaver

            There forums are very empty with responses to questions like these. I can
            file a tech support option, but I don't want to use them all up yet. I've
            been finding a lot of bugs that need support on tech, and I've not gotten
            them all refunded yet :-) I've a limit to the number of free incidents I
            get for the new produces, but get reimbursed for finding bugs...
            Eventually...
            • 3. Re: WebAssist Cart help? I know it's off topic but... Could really use some help...
              jefferisp7 Level 1
              On 5/15/07 1:12 PM, in article C26F6236.5554E%jefferis@petersonsales.net,<br />"Jefferis Peterson" <jefferis@petersonsales.net> wrote:<br /><br />>> Adobe Community Expert, Dreamweaver<br />> <br />> There forums are very empty with responses to questions like these. I can<br />> file a tech support option, but I don't want to use them all up yet. I've<br />> been finding a lot of bugs that need support on tech, and I've not gotten<br />> them all refunded yet :-)  I've a limit to the number of free incidents I<br />> get for the new produces, but get reimbursed for finding bugs...<br />> Eventually... <br /><br />Besides, this type of question may be considered part of their premium<br />development assistance :-)  $$$$
              • 4. Re: WebAssist Cart help? I know it's off topic but... Could really use some help...
                jefferisp7 Level 1
                On 5/15/07 1:40 PM, in article C26F68D6.55555%jefferis@petersonsales.net,<br />"Jefferis Peterson" <jefferis@petersonsales.net> wrote:<br /><br />> Besides, this type of question may be considered part of their premium<br />> development assistance :-)  $$$$<br />> <br />Nevermind, I hand coded it myself.
                • 5. Re: WebAssist Cart help? I know it's off topic but... Could really use some help...
                  Hi jefferis....

                  How did you solve the problem?
                  I am having the same problem trying to incorporate an inventory code into a shopping cart that will deduct the number of items purchased from my total inventory to let me and my customers know how many items I have remaining in stock.

                  Ex:
                  inventory: 500 plants
                  purchased: 20 plants
                  remaining inventory: 480 plants

                  It would also help if there was a code for canceled orders. If the customer changes their mind and cancels the order, the items selected would be added back into inventory.

                  Ex:
                  inventory: 500 plants
                  purchased: 20 plants
                  canceled purchase: 20 plants
                  remaining inventory: 500 plants

                  or:

                  Ex:
                  inventory: 500 plants
                  purchased: 20 plants
                  canceled purchase: 10 plants
                  remaining inventory: 490 plants

                  Any help would be appreciated.
                  • 6. Re: WebAssist Cart help? I know it's off topic but... Could really use some help...
                    jefferisp7 Level 1
                    On 6/16/07 3:06 PM, in article 3bc3e9d6.4@webcrossing.la2eafNXanI,<br />"Liz_Fichtl@adobeforums.com" <Liz_Fichtl@adobeforums.com> wrote:<br /><br />> Hi jefferis....<br />> <br />> How did you solve the problem?<br />> I am having the same problem trying to incorporate an inventory code into a<br />> shopping cart that will deduct the number of items purchased from my total<br />> inventory to let me and my customers know how many items I have remaining in<br />> stock.<br />> <br />> Ex:<br />> inventory: 500 plants<br />> purchased: 20 plants<br />> remaining inventory: 480 plants<br /><br />Yes I did. <br /><br />I've been struggling with this piece of pie for about 5 days and<br />thought it might benefit others, so here's a way to update your quantities<br />in INVENTORY after a checkout success.  I read another thread but found it<br />way too complex and depended on holding inventory in the session:<br />http://www.webassist.com/professional/support/kbcompletethread.asp?DiscID=33<br />046  <br />But you may lose the info when you go offsite to Paypal, e.g., to complete<br />the transaction.  <br /><br />Here's my approach using the "checkout_success.php" page.  Using this page<br />works because user arrives here ONLY after a successful purchase.<br />First of all, I used the BSM php sample store as a starting point.  I added<br />an ItemQuantity field to the items DB to track the stock or items in<br />inventory in the store.<br /><br />In order for this automatic deduction of sold items to work, it must be<br />placed within the do while {  area of the  display page for the cart's<br />items. } The code is commented below:<br /><br /><?php<br />//WA eCart Show If Start<br />if (!$eCart->IsEmpty())     {    // IF CART NOT EMPTY...<br />?><br />    <h2>Order Receipt </h2>  // STANDARD STUFF TILL NEXT COMMENT<br />    <br /><br />    <h3 class="eCart_OrderHeaderInfo">Order number: <?php echo session_id();<br />?></h3><br />    <br />    <p class="eCart_OrderHeaderInfo">This is your order receipt. Please make<br />a copy for your records. An email will also be sent to you. </p><br />    <table class="eC_ShoppingCart" border="0" cellspacing="0"<br />cellpadding="0"><br />            <tr><br />                <br />                    <th>Name</th><br />                <br /><br />                    <th>Price</th><br />                <br /><br />                    <th  class="eC_FormItem" >Quantity</th><br />                <br /><br />                    <th>Total</th><br />            </tr><br />        <?php<br />while (!$eCart->EOF())      {  // DO WHILE FOR EACH ITEM IN CART<br />?><br />            <tr><br />                <br />                    <td><img src="/images/thumbs/<?php echo<br />$eCart->DisplayInfo("Thumbnail"); ?>" alt="" width="100" height="100"<br />class="eC_ProductThumb" /><br />                        <p class="eC_ItemLabel"><?php echo<br />$eCart->DisplayInfo("Name"); ?></p><br />                  <p class="eC_ItemDescription"><?php echo<br />$eCart->DisplayInfo("Description"); ?></p>  <p<br />class="eC_ItemDescription"><?php echo $eCart->DisplayInfo("ID");<br />$idCall = $eCart->DisplayInfo("ID");?>>  // CREATE A VARIABLE FOR<br />//THE ITEM's ID NUMBER in the DB<br />//USE DISPLAY ID TO GET ID # and make it = $idCall<br /></p></td<br />                    <td  class="eC_PriceItem" ><?php echo<br />WA_eCart_DisplayMoney($eCart, $eCart->DisplayInfo("Price")); ?></td><br />                <br /><br />                    <td  class="eC_FormItem" ><?php echo<br />$eCart->DisplayInfo("Quantity");<br />$solditems = $eCart->DisplayInfo("Quantity");?>  //DO THE SAME FOR QUANTITY<br />//SOLD, MAKE QUANTITY SOLD  = $solditems<br /></td><br /><br />// NOW UPDATE THE DATABASE. SUBTRACT $solditems from ItemQuantity ( YOUR<br />//INVENTORY OR STOCK)<br />//FOR EACH ITEM IN CART. SELECT the item's ID  by $idCall:<br /><?php<br />mysql_select_db($database_connBSM, $connBSM);<br />$query_itemQ = "Update items SET  items.ItemQuantity = items.ItemQuantity -<br />$solditems WHERE items.ItemID = $idCall";<br />$itemQ = mysql_query($query_itemQ, $connBSM) or die(mysql_error());<br /><br />?><br />                    <td  class="eC_PriceItem" ><?php echo<br />WA_eCart_DisplayMoney($eCart, $eCart->DisplayInfo("TotalPrice")); ?> </td><br />            </tr><br />        <?php<br />  $eCart->MoveNext();    //// REPEATS BEHAVIOR FOR EACH ITEM IN CART<br />}<br />$eCart->MoveFirst();<br />?><br />BTW, once the items in inventory = 0, the items do not appear in the<br />catalog.  That is set in the catalog page's recordset.<br />Jeff<br />~~~~~~~~~~~~<br />Jefferis Peterson, Pres.<br />Web Design and Marketing<br />http://www.PetersonSales.com
                    • 7. Re: WebAssist Cart help? I know it's off topic but... Could really use some help...
                      Level 1
                      Ahhhhhhhh Jeff...<br />If I can get this going...<br /><br />I spent days looking for this solution.<br />Thank you very much.<br />Just bought Dreamweaver CS3 and am battling through the bells and whistles.<br /><br />Liz<br /><br />----- Original Message ----- <br />From: "jefferis" <member@adobeforums.com><br />To: <adobe.dreamweaver.developer.php@adobeforums.com><br />Sent: Tuesday, June 19, 2007 9:50 AM<br />Subject: Re: WebAssist Cart help? I know it's off topic but... Could really <br />use some help...<br /><br />>A new message was posted by jefferis in<br />><br />> ADDT - PHP Application Development --<br />>  WebAssist Cart help? I know it's off topic but... Could really use some <br />> help...<br />><br />> On 6/16/07 3:06 PM, in article 3bc3e9d6.4@webcrossing.la2eafNXanI,<br />> "Liz_Fichtl@adobeforums.com" <Liz_Fichtl@adobeforums.com> wrote:<br />><br />>> Hi jefferis....<br />>><br />>> How did you solve the problem?<br />>> I am having the same problem trying to incorporate an inventory code into <br />>> a<br />>> shopping cart that will deduct the number of items purchased from my <br />>> total<br />>> inventory to let me and my customers know how many items I have remaining <br />>> in<br />>> stock.<br />>><br />>> Ex:<br />>> inventory: 500 plants<br />>> purchased: 20 plants<br />>> remaining inventory: 480 plants<br />><br />> Yes I did.<br />><br />> I've been struggling with this piece of pie for about 5 days and<br />> thought it might benefit others, so here's a way to update your quantities<br />> in INVENTORY after a checkout success.  I read another thread but found it<br />> way too complex and depended on holding inventory in the session:<br />> http://www.webassist.com/professional/support/kbcompletethread.asp?DiscID=33<br />> 046<br />> But you may lose the info when you go offsite to Paypal, e.g., to complete<br />> the transaction.<br />><br />> Here's my approach using the "checkout_success.php" page.  Using this page<br />> works because user arrives here ONLY after a successful purchase.<br />> First of all, I used the BSM php sample store as a starting point.  I <br />> added<br />> an ItemQuantity field to the items DB to track the stock or items in<br />> inventory in the store.<br />><br />> In order for this automatic deduction of sold items to work, it must be<br />> placed within the do while {  area of the  display page for the cart's<br />> items. } The code is commented below:<br />><br />> <?php<br />> //WA eCart Show If Start<br />> if (!$eCart->IsEmpty())     {    // IF CART NOT EMPTY...<br />> ?><br />>    <h2>Order Receipt </h2>  // STANDARD STUFF TILL NEXT COMMENT<br />>    <br /><br />>    <h3 class="eCart_OrderHeaderInfo">Order number: <?php echo <br />> session_id();<br />> ?></h3><br />><br />>    <p class="eCart_OrderHeaderInfo">This is your order receipt. Please <br />> make<br />> a copy for your records. An email will also be sent to you. </p><br />>    <table class="eC_ShoppingCart" border="0" cellspacing="0"<br />> cellpadding="0"><br />>            <tr><br />><br />>                    <th>Name</th><br />><br />><br />>                    <th>Price</th><br />><br />><br />>                    <th  class="eC_FormItem" >Quantity</th><br />><br />><br />>                    <th>Total</th><br />>            </tr><br />>        <?php<br />> while (!$eCart->EOF())      {  // DO WHILE FOR EACH ITEM IN CART<br />> ?><br />>            <tr><br />><br />>                    <td><img src="/images/thumbs/<?php echo<br />> $eCart->DisplayInfo("Thumbnail"); ?>" alt="" width="100" height="100"<br />> class="eC_ProductThumb" /><br />>                        <p class="eC_ItemLabel"><?php echo<br />> $eCart->DisplayInfo("Name"); ?></p><br />>                  <p class="eC_ItemDescription"><?php echo<br />> $eCart->DisplayInfo("Description"); ?></p>  <p<br />> class="eC_ItemDescription"><?php echo $eCart->DisplayInfo("ID");<br />> $idCall = $eCart->DisplayInfo("ID");?>>  // CREATE A VARIABLE FOR<br />> //THE ITEM's ID NUMBER in the DB<br />> //USE DISPLAY ID TO GET ID # and make it = $idCall<br />> </p></td<br />>                    <td  class="eC_PriceItem" ><?php echo<br />> WA_eCart_DisplayMoney($eCart, $eCart->DisplayInfo("Price")); ?></td><br />><br />><br />>                    <td  class="eC_FormItem" ><?php echo<br />> $eCart->DisplayInfo("Quantity");<br />> $solditems = $eCart->DisplayInfo("Quantity");?>  //DO THE SAME FOR <br />> QUANTITY<br />> //SOLD, MAKE QUANTITY SOLD  = $solditems<br />> </td><br />><br />> // NOW UPDATE THE DATABASE. SUBTRACT $solditems from ItemQuantity ( YOUR<br />> //INVENTORY OR STOCK)<br />> //FOR EACH ITEM IN CART. SELECT the item's ID  by $idCall:<br />> <?php<br />> mysql_select_db($database_connBSM, $connBSM);<br />> $query_itemQ = "Update items SET  items.ItemQuantity = <br />> items.ItemQuantity -<br />> $solditems WHERE items.ItemID = $idCall";<br />> $itemQ = mysql_query($query_itemQ, $connBSM) or die(mysql_error());<br />><br />> ?><br />>                    <td  class="eC_PriceItem" ><?php echo<br />> WA_eCart_DisplayMoney($eCart, $eCart->DisplayInfo("TotalPrice")); ?> </td><br />>            </tr><br />>        <?php<br />>  $eCart->MoveNext();    //// REPEATS BEHAVIOR FOR EACH ITEM IN CART<br />> }<br />> $eCart->MoveFirst();<br />> ?><br />> BTW, once the items in inventory = 0, the items do not appear in the<br />> catalog.  That is set in the catalog page's recordset.<br />> Jeff<br />> ~~~~~~~~~~~~<br />> Jefferis Peterson, Pres.<br />> Web Design and Marketing<br />> http://www.PetersonSales.com<br />><br />><br />><br />><br />> ------------------------------------------------------<br />> View/reply at <<a href="/cgi-bin/webx?13@@.3bc3e9d6/5">jefferis, "WebAssist Cart help? I know it's off topic but... Could really use some help..." #6, 19 Jun 2007 6:50 am</a>><br />> You must visit the conference to reply. Email replies are not allowed and <br />> will be returned.<br />> Use the unsubscribe form at <br />> <a href=http://www.adobeforums.com/cgi-bin/webx?280@@.3bc3e9d6!folder=.3bc3909c> <br />> to cancel your email subscription.
                      • 8. Re: WebAssist Cart help? I know it's off topic but... Could really use some help...
                        jefferisp7 Level 1
                        On 6/19/07 12:04 PM, in article 3bc3e9d6.6@webcrossing.la2eafNXanI,<br />"Liz_Fichtl@adobeforums.com" <Liz_Fichtl@adobeforums.com> wrote:<br /><br />> I spent days looking for this solution.<br />> Thank you very much.<br />> Just bought Dreamweaver CS3 and am battling through the bells and whistles.<br />> <br />> Liz<br /><br />You are welcome! <br />Jeff<br />~~~~~~~~~~~~<br />Jefferis Peterson, Pres.<br />Web Design and Marketing<br />http://www.PetersonSales.com