Storgine - Open source E-commerce engine in progress
We develop own open source e-commerce engine for small and medium sized e-shops.
Class defining Cart
Cart is created as a object with properties of one of each item, serialized in Session after calling to any of inside function.
After any reloadings is Session unserialized back into object, if object is empty.
About serializing/unserializing cares global function "cart_start()":
<?php
function cart_start(){
if(empty($_SESSION['cart'])){
$cart = new Cart();
}else{
$cart = unserialize($_SESSION['cart']);
}
return $cart;
}
$cart = cart_start();
Cart Class in __construct defined property $this->item as array if it's empty.
<?php
class Cart{
function __construct(){
if(empty($this->item)){
$this->item = array();
}
}
Class defining Offer process
In progress
<?php
function offer_start(){
if(empty($_SESSION['offer'])){
$offer = new Offer();
}else{
$offer = unserialize($_SESSION['offer']);
}
return $offer;
}
$offer = offer_start();