Created
May 11, 2010 18:56
-
-
Save fleeting/397691 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function cart_add() { | |
if (empty($_SESSION["cart"])) | |
$_SESSION["cart"] = array(); | |
$aProduct = $this->model->getProduct($this->_urlVars->dynamic["id"]); | |
if (array_key_exists($aProduct["id"], $_SESSION["cart"])) { | |
$_SESSION["cart"][$aProduct["id"]]["quantity"]++; | |
} else { | |
$aProduct["quantity"] = 1; | |
$_SESSION["cart"][$aProduct["id"]] = $aProduct; | |
} | |
$this->forward("/store/cart/?notice=".urlencode($aProduct["title"]." added to cart.")); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment