PATH:
home
/
letacommog
/
letaweb
/
admin
/
classes
/
components
<?php class cartComponent { public $contents,$subtotal,$total,$shipping_total,$shipping_tax_total,$weight; public $product_tax_total,$tax_total,$coupon_discount_total; public $discounts_array,$discount_total; public $coupons,$products_array,$coupons_array,$discount_free_shipping,$discounts_products_array; public $cart; public function getCart() { return $this->cart; } public function reload() { $session = Yii::app()->session; $cookie = Yii::app()->request->cookies; if (isset($session['cart'])) { $this->cart = $session['cart']; } if (!Yii::app()->user->isGuest) { $this->reloadCartFormUser(Yii::app()->user->id); } elseif (($customer = Yii::app()->customer->getCustomer()) !== false) { $this->reloadCartFormCustomer($customer->id); } elseif (($guest = Yii::app()->guest->getGuest()) !== false) { $this->reloadCartFormGuest($guest->id); } elseif (isset($cookie['cart_id'])) { $this->reloadCart($cookie['cart_id']->value); } if (!isset($this->cart)) { $this->cart = new SqlliteCart(); $this->cart->setIsNewRecord(true); $this->cart->guests_id = isset($guest) ? $guest->id : 0; $this->cart->customers_id = isset($customer) && $customer !== false ? $customer->id : 0; // $this->cart->save(); $session['cart'] = $this->cart; } } public function reset_contents() { } protected function reloadCartFormGuest($id) { $cart = SqlliteCart::model()->find('guests_id=:guests_id', array(':guests_id' => $id)); if (isset($cart)) { $this->cart = $cart; } } protected function reloadCartFormCustomer($id) { $cart = SqlliteCart::model()->find('customers_id=:customers_id', array(':customers_id' => $id)); if (isset($cart)) { $this->cart = $cart; } } protected function reloadCartFormUser($id) { $cart = SqlliteCart::model()->find('customers_id=:customers_id', array(':customers_id' => $id)); if (isset($cart)) { $this->cart = $cart; } } protected function reloadCart($id) { } public function __construct() { $this->init(); } public function init() { $this->reload(); } public function check_coupon($code) { if (!isset($this->coupons)) { $this->coupons = array(); } $code = trim($code); if (isset($this->coupons[$code])) { return false; } return true; } public function apply_coupon($code) { return $this->cart->apply_coupon($code); } public function remove_coupon($id) { return $this->cart->remove_coupon($id); } public function update_quantity($products_id, $quantity = '', $attributes = '') { return $this->cart->update_quantity($products_id, $quantity, $attributes); } public function in_cart($products_id) { return $this->cart->in_cart($products_id); } public function count_contents() { return $this->cart->count_contents(); } public function get_content_type() { return $this->cart->get_content_type(); } //// // Check if product has attributes public function has_product_attributes($products_id) { return $this->cart->has_product_attributes($products_id); } public function add_cart($products_id, $qty = '1', $attributes = '', $notify = true) { return $this->cart->add_cart($products_id, $qty, $attributes, $notify); } public function generate_cart_id($length = 5) { return $this->create_random_value($length, 'digits'); } //// // Return a random value public function mrand($min = null, $max = null) { static $seeded; if (!isset($seeded)) { mt_srand((double) microtime() * 1000000); $seeded = true; } if (isset($min) && isset($max)) { if ($min >= $max) { return $min; } else { return mt_rand($min, $max); } } else { return mt_rand(); } } public function cleanup() { return $this->cart->cleanup(); } public function create_random_value($length, $type = 'mixed') { if (($type != 'mixed') && ($type != 'chars') && ($type != 'digits')) { return false; } $rand_value = ''; while (strlen($rand_value) < $length) { if ($type == 'digits') { $char = $this->mrand(0, 9); } else { $char = chr($this->mrand(0, 255)); } if ($type == 'mixed') { if (preg_match('/^[a-z0-9]$/i', $char)) { $rand_value .= $char; } } elseif ($type == 'chars') { if (preg_match('/^[a-z]$/i', $char)) { $rand_value .= $char; } } elseif ($type == 'digits') { if (preg_match('/^[0-9]$/i', $char)) { $rand_value .= $char; } } } return $rand_value; } public function get_quantity($products_id) { return $this->cart->get_quantity($products_id); } public function show_weight() { return $this->cart->show_weight(); } public function calculate() { return $this->cart->calculate(); } public function calculate_tax() { } public function getNumberOfItems() { return $this->cart->getNumberOfItems(); } public function get_products() { return $this->cart->get_products(); } public function remove($products_id) { return $this->cart->remove($products_id); } public function is_empty() { return $this->cart->is_empty(); } }
[+]
..
[-] colorComponent.php
[edit]
[-] authorizationComponent.php
[edit]
[-] hostingComponent.php
[edit]
[-] configComponent.php
[edit]
[-] siteComponent.php
[edit]
[-] urlComponent.php
[edit]
[-] paymentComponent.php
[edit]
[-] authManager.php
[edit]
[-] guestComponent.php
[edit]
[-] cmsComponent.php
[edit]
[-] languageComponent.php
[edit]
[-] contextComponent.php
[edit]
[-] cartComponent.php
[edit]
[-] customerComponent.php
[edit]