Announcement

Collapse
No announcement yet.

displayy shopping cart summary php

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • displayy shopping cart summary php

    hi all, ive jst fininshed building my shopping cart, however i would like a display summary on the products page, ive attatched an example of a pic below



    i can post my shopping cart code if needed

    thanks

  • #2
    Re: displayy shopping cart summary php

    What's the error you're getting with the code you've written?
    Gareth Howells

    BSc (Hons), MBCS, MCP, MCDST, ICCE

    Any advice is given in good faith and without warranty.

    Please give reputation points if somebody has helped you.

    "For by now I could have stretched out my hand and struck you and your people with a plague that would have wiped you off the Earth." (Exodus 9:15) - I could kill you with my thumb.

    "Everything that lives and moves will be food for you." (Genesis 9:3) - For every animal you don't eat, I'm going to eat three.

    Comment


    • #3
      Re: displayy shopping cart summary php

      Originally posted by gforceindustries View Post
      What's the error you're getting with the code you've written?
      there is no error, i would just like to know the code for how its done.

      Comment


      • #4
        Re: displayy shopping cart summary php

        What has your initial research suggested?
        Gareth Howells

        BSc (Hons), MBCS, MCP, MCDST, ICCE

        Any advice is given in good faith and without warranty.

        Please give reputation points if somebody has helped you.

        "For by now I could have stretched out my hand and struck you and your people with a plague that would have wiped you off the Earth." (Exodus 9:15) - I could kill you with my thumb.

        "Everything that lives and moves will be food for you." (Genesis 9:3) - For every animal you don't eat, I'm going to eat three.

        Comment


        • #5
          Re: displayy shopping cart summary php

          Originally posted by gforceindustries View Post
          What has your initial research suggested?
          i want to display how mant items i have added to my current cart session including the total cost
          Last edited by andysutils; 19th October 2008, 00:34.

          Comment


          • #6
            Re: displayy shopping cart summary php

            Ok, so you've looked up how to do this, and related this to the code you've written so far, and now need some help in extendng the code to do what you want / work properly?
            Gareth Howells

            BSc (Hons), MBCS, MCP, MCDST, ICCE

            Any advice is given in good faith and without warranty.

            Please give reputation points if somebody has helped you.

            "For by now I could have stretched out my hand and struck you and your people with a plague that would have wiped you off the Earth." (Exodus 9:15) - I could kill you with my thumb.

            "Everything that lives and moves will be food for you." (Genesis 9:3) - For every animal you don't eat, I'm going to eat three.

            Comment


            • #7
              Re: display shopping cart summary php

              Originally posted by gforceindustries View Post
              Ok, so you've looked up how to do this, and related this to the code you've written so far, and now need some help in extendng the code to do what you want / work properly?
              hi, yes thats correct, would you like me to post you the code to the shopping cart i have designed?

              Comment


              • #8
                Re: displayy shopping cart summary php

                If you can post the code you've written so far to display the summary and highlight the trouble you are having with it, then maybe someone will help you. One of the reasons nobody else has replied so far is that it's taken this long to establish that you have actually done some research into this.
                Gareth Howells

                BSc (Hons), MBCS, MCP, MCDST, ICCE

                Any advice is given in good faith and without warranty.

                Please give reputation points if somebody has helped you.

                "For by now I could have stretched out my hand and struck you and your people with a plague that would have wiped you off the Earth." (Exodus 9:15) - I could kill you with my thumb.

                "Everything that lives and moves will be food for you." (Genesis 9:3) - For every animal you don't eat, I'm going to eat three.

                Comment


                • #9
                  Re: displayy shopping cart summary php

                  <?php

                  $cart = isset($_SESSION['cart']) ? $_SESSION['cart'] : '';
                  $itemcount = isset($_SESSION['itemcount']) ? $_SESSION['itemcount'] : 0;

                  $strHTML = "";

                  if ($itemcount == 0)
                  {
                  $strHTML = "<h3>Your shopping cart is empty.</h3>";
                  }
                  else
                  {
                  $strHTML = "<div style=\"overflow:auto; height=358px;\">"."\n";
                  $strHTML .= "<table border=\"0\" cellpadding=\"3\" cellspacing=\"2\" width=\"100%\">"."\n";
                  $strHTML .= "<tr>"."\n";
                  $strHTML .= "<td>Product code</td>"."\n";
                  $strHTML .= "<td>Product name</td>"."\n";
                  $strHTML .= "<td>Quantity</td>"."\n";
                  $strHTML .= "<td>Price</td>"."\n";
                  $strHTML .= "<td>Total</td></tr>"."\n";

                  $total = 10;
                  for ($i=0; $i<$itemcount; $i++)
                  {
                  $strHTML .= "<tr>"."\n";
                  $strHTML .= "<td>".$cart[PRODUCTCODE][$i]."</td>"."\n";
                  $strHTML .= "<td>".$cart[PRODUCTNAME][$i]."</td>"."\n";
                  $strHTML .= "<td><input type=\"text\" name=\"quantity".($i)."\" value=\"".$cart[QUANTITY][$i]."\" size=\"3\"></td>"."\n";
                  $strHTML .= "<td>"."".number_format($cart[PRICE][$i],2)."</td>"."\n";
                  $strHTML .= "<td>"."".number_format($cart[PRICE][$i]*$cart[QUANTITY][$i],2)."</td>"."\n";
                  $strHTML .= "</tr>"."\n";
                  $total = $total + ($cart[PRICE][$i]*$cart[QUANTITY][$i]);
                  }

                  $strHTML .= "<tr>"."\n";
                  $strHTML .= "<td></td><td></td><td></td>"."\n";
                  $strHTML .= "<td>Total + Shipping</td>"."\n";
                  $strHTML .= "<td>"."".number_format($total, 2)."</td>"."\n";
                  $strHTML .= "</tr>"."\n";
                  $strHTML .= "</table>"."\n";
                  $strHTML .= "</div>"."\n";
                  }
                  echo $strHTML;

                  ?>

                  Comment


                  • #10
                    Re: displayy shopping cart summary php

                    What's the problem you're having with that code?

                    For future reference, when including source code in a post you may want to wrap it in CODE tags using the # button in the editor.
                    Gareth Howells

                    BSc (Hons), MBCS, MCP, MCDST, ICCE

                    Any advice is given in good faith and without warranty.

                    Please give reputation points if somebody has helped you.

                    "For by now I could have stretched out my hand and struck you and your people with a plague that would have wiped you off the Earth." (Exodus 9:15) - I could kill you with my thumb.

                    "Everything that lives and moves will be food for you." (Genesis 9:3) - For every animal you don't eat, I'm going to eat three.

                    Comment


                    • #11
                      Re: displayy shopping cart summary php

                      Originally posted by gforceindustries View Post
                      What's the problem you're having with that code?

                      For future reference, when including source code in a post you may want to wrap it in CODE tags using the # button in the editor.
                      there isnt any problem with the code, i want to display a small summary box of my carts quantity and total cost in a small box on another page

                      Comment


                      • #12
                        Re: displayy shopping cart summary php

                        You are asking to code something you do not know how to code. Keep in mind this is a scripting forum mainly for IT professionals. I'd recommend you post your full and detailed questions on a web design forum site, e.g. www.webdesignforums.net.
                        ** Remember to give credit where credit is due and leave reputation points where appropriate **

                        Comment

                        Working...
                        X