Jump to content


New Members
  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About FierceViper

  • Rank
  1. You are correct, I am pretty new to PHP. After your explanation this is starting to make sense now and checking if it is not false does work. Thanks for being patient with me and also thanks for your help!
  2. $itemExists will return the key or position in the array where the same product is located. In the instance of red, red being input - then 0 will be set to $itemExists. I have even tried setting it so that that if ($itemExists = "0"){ which should then should run line 49 because as stated earlier $itemExists will equal 0 for the first products of the same kind entered.
  3. It should return 0. I tested this as well by echoing $itemExists in my page and it in fact does return 0 when the item input is red then red. Which then is inserted in line 49 to add 1 to the quantity to that specific item.
  4. It will only update if I put items in the cart with this similar order: red, blue, blue = red:1 blue:2 But if I put: red, red = red:1 red:1 Instead of putting the quantity to 2. This only seems to be happening while adding the first 2 items of the same kind otherwise the code works fine. $item = array( "image" => $image, "id" => $product_id, "price" => $price, "name" => $name, "desc" => $desc, "qty" => $qty, "slug" => $slug ); function checkCartForItem($addItem, $cartItems) { if (is_array($cartItems)){ foreach($cartItems as $key => $item) {
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.