9. E – Commerce Website Tutorial – Shopping Cart PHP Multidimensional Array

www.developphp.com In this 9th video we will begin creating the multidimensional array in PHP that is the shopping cart. We will use a SESSION variable to store and remember the cart data as the user browses pages. The E – Commerce Web Site we will be assembling is one in which all of the inventory is in a MySQL database and we offer a custom PHP cart for a unique shopping experience.

22 Comments

  • Dude was going to ask if you will be putting up the source files soon! I have try’d the code for video 3 in dreamweaver but still getting errors on the php blocks, gone through everything 4 or 5 times now but still getting errors, as far as I know the code i got is the exact same as yours! just lost for ideas now

  • @phillipdews33 hi what errors do you get? the error description is very exact and does even list the number of the error line. But usually you are getting errors for not ending a line with a semicolon or forgetting to close a bracket.
    sorry for my bad english this isn’t my mother tongue^^

  • @Dectois basically i keep getting errors on my index.php file under the store admin and keep getting errors on lines 8,9,14 and 18 saying “there is a syntax error on line 8, code hinting may not work”

  • @phillipdews33 i can’t really tell you the cause of the problem without seeing your code. But if i am correct these must be the lines where you check the Session Variables with preg_replace. You may have done a little typo at the first argument of the function. or forget to close all brackets.
    You may have someone else with basic php knowledge look over your code.
    You can also send me the code per mail, if you like –> lucas.dworschak@gmx[dot]at

  • Is the subject of sales tax going to be implemented into this tutorial series. This is my first exposure to php cookies and muli dimensional arrays, These tutorials just keep getting better. I will watch your php variables tutorial and let you know if i have any issues. I would like to include the actual cookies like you mentioned for better flow of their shopping experience.

    Thank you,

    Eric

  • hey if we were to put a size drop box in, 1) how many areas would we have to place it because there would have to be the actual code that lets them choose a size and then the code that brings it all around to say the cart and then on to me. so there is at least 2 places. and 2) once thats done how might you suggest i organize it for items that do not need the size option. im assuming ide have to make multiple product pages, one with and one without but then again its 2am here so maybe im wrong.

  • Great video! just to clarify session vars are stored on the server and accessed with a session id cookie. This makes it so sessions vars can’t be tampered with unlike cookies which come from the user and can be manipulated. If you need to make sure the vars aren’t altered by the user use session vars not cookies.

  • Can anyone help me..
    I HAVE A PROBLEM IN cart.php page….whenever i click on Add to cart button , it displays the following message
    “Fatal error: Call to undefined function money_format() in cart.php on line 120”

  • @kizzel77 give me your e mail id …i found the solution…the problem is that the money_format() fuction does not work on windows…i will send it to you via email…

Leave a Reply

Your email address will not be published. Required fields are marked *