public function GetSession() { if ($_COOKIE['session'] == "") { $sr = new SleekShopRequest(); $xml = $sr->get_new_session(); $xml = new SimpleXMLElement($xml); $code = (string) $xml->code; self::SetSession($code); } else { $code = $_COOKIE['session']; } return $code; }
public function GetPaymentMethods() { $sr = new SleekShopRequest(); $xml = $sr->get_payment_methods(); $xml = new SimpleXMLElement($xml); $result = array(); foreach ($xml->payment_method as $method) { $piecearray = array(); $piecearray["id"] = (int) $method->id; $piecearray["name"] = (string) $method->name; foreach ($method->attributes->attribute as $attr) { $piecearray["attributes"][(string) $attr->attributes()->name] = (string) $attr; } $result[(string) $method->name] = $piecearray; } return $result; }
public function Refresh($session = "") { $sr = new SleekShopRequest(); $xml = $sr->get_cart($session); $xml = new SimpleXMLElement($xml); $cart = self::get_cart_array($xml); setcookie("cart", serialize($cart)); return $cart; }
public function GetCategories($id_parent = 0, $lang = DEFAULT_LANGUAGE) { $sr = new SleekShopRequest(); $xml = $sr->get_categories($id_parent, $lang); $xml = new SimpleXMLElement($xml); $result = array(); foreach ($xml->shopcategory as $shopcategory) { $piecearray = array(); $piecearray["id"] = (int) $shopcategory->id; $piecearray["label"] = (string) $shopcategory->label; $piecearray["permalink"] = (string) $shopcategory->seo->permalink; $piecearray["title"] = (string) $shopcategory->seo->title; $piecearray["description"] = (string) $shopcategory->seo->description; $piecearray["keywords"] = (string) $shopcategory->seo->keywords; $piecearray["children"] = self::GetCategories($piecearray["id"], $lang); $result[] = $piecearray; } return $result; }
public function DoPayment($id_order = 0, $args = array()) { $sr = new SleekShopRequest(); $xml = $sr->do_payment($id_order, $args); $xml = new SimpleXMLElement($xml); $result = array(); $result["method"] = (string) $xml->method; $result["status"] = (string) $xml->status; $result["redirect"] = (string) $xml->redirect; return $result; }
public function SearchProducts($constraint = array(), $left_limit, $right_limit, $order_columns = array(), $order_type = "ASC", $lang = DEFAULT_LANGUAGE, $needed_attributes = array()) { $sr = new SleekShopRequest(); $xml = $sr->search_products($constraint, $left_limit, $right_limit, $order_columns, $order_type, $lang, $needed_attributes); $xml = new SimpleXMLElement($xml); $result["products"] = self::get_products_from_xml($xml); $result["count"] = (int) $xml->count; return $result; }
public function VerifyUser($id_user = 0, $session_id = "") { $sr = new SleekShopRequest(); $xml = $sr->verify_user($id_user, $session_id); $xml = new SimpleXMLElement($xml); $result = array(); $result["status"] = (string) $xml->status; return $result; }