php - Unset array from multidimensional array -
These are my works i have a problem in removing and editing shopping cart
before I had only two criteria for just $ id and $ quantity, but I had to add $ version, which stores for instance size.
Insert $ _SESSION and the foreground ['carriage'] works like a magic, but as I said it was not removed and updated.
function addToCart ()
public static function addToCart ($ data) {$ id = $ data ['id']; // id $ volume = $ data ['qty']; // volume $ version = $ data ['version']; // variant // ovą ?? A?, Ãme, zda $ _SESSION ['train]] if (! ($ _ Session [' train ']) ($$$ _ [ride] [' train '] = array ();} Array_push ($ _ session ['Cart'], array ('id' => ID, 'quantity' = & gt; $ quantity, 'version' = & gt; $ edition));} {/ code> < p> edit function () public static function editCart ($ data) {// edit volume + -} function removeFromCart ()
$ id]); Thank you. >
itemprop = "text">
$ id Try it
public static work addToCart ($ data) {$ id = $ data [' id ']; // id $ quantity = $ data [' qty ']; // volume $ version = $ data [' version ']; // varariana // overÃme, zda $ _SESSION [' cart '] if (! ($ _ Session ['cart']} $ _SESSION ['cart'] [$ id] = array ('quantity' = & gt; $ Quantity, 'version' = & gt; $ Version)); }
Comments
Post a Comment