Ejemplo n.º 1
0
 function test_get_default_card_handler()
 {
     $cart = new cart(1, $h = null);
     $h = $cart->get_cart_handler();
     $this->assertIsA($h, CART_DEFAULT_HANDLER_TYPE . '_cart_handler');
     $this->assertEqual($h->get_cart_id(), 1);
 }
Ejemplo n.º 2
0
 public function order()
 {
     $objCart = new cart($this->registry->db, $_POST);
     $id = $objCart->saveOrder();
     if ($id > 0) {
         header('Location: http:index.php?p=product&order=success');
     } else {
         header('Location: http:index.php?p=cart/show&order=fail');
     }
 }
 function &get_dataset(&$counter, $params = array())
 {
     $cart =& cart::instance();
     $dataset =& $cart->get_items_array_dataset();
     $counter = $dataset->get_total_row_count();
     return $dataset;
 }
Ejemplo n.º 4
0
 public function actionCoupon()
 {
     if ($_GET['remove'] && !empty($_GET['remove'])) {
         cart_discount::model()->deleteAllByAttributes(array('discount_ID' => $_GET['remove'], 'cart_ID' => Yii::app()->user->getState('cart_ID')));
         Yii::app()->user->setFlash('cart', "voucher has been removed");
         $this->redirect(array('index'));
         exit;
     }
     if ($_POST['token'] != md5(Yii::app()->user->getStateKeyPrefix())) {
         $this->redirect(array('index'));
         exit;
     }
     if (!$_POST['code'] or empty($_POST['code'])) {
         Yii::app()->user->setFlash('cart', "voucher name can't be blank");
         $this->redirect(array('index'));
         exit;
     }
     if (!($discount = discount_entity::model()->findByAttributes(array('discount_name' => $_POST['code'])))) {
         Yii::app()->user->setFlash('cart', "voucher name not valid");
         $this->redirect(array('index'));
         exit;
     }
     $cart = cart::model()->findByPk(Yii::app()->user->getState('cart_ID'));
     if ($msg = $cart->validateDiscount($_POST['total'], $discount->discount_ID, true)) {
         Yii::app()->user->setFlash('cart', $msg);
         $this->redirect(array('index'));
         exit;
     } else {
         $cartDiscount = new cart_discount();
         $cartDiscount->cart_ID = $cart->cart_ID;
         $cartDiscount->discount_ID = $discount->discount_ID;
         $cartDiscount->save();
     }
     $this->redirect(array('index'));
 }
 function perform(&$request, &$response)
 {
     $request->set_status(REQUEST_STATUS_FAILURE);
     if ($request->has_attribute('popup')) {
         $response->write(close_popup_response($request));
     }
     if (!($id = $request->get_attribute('id'))) {
         return;
     }
     if (!($object_data =& fetch_one_by_node_id((int) $id))) {
         return;
     }
     $object =& site_object_factory::create($object_data['class_name']);
     if (!method_exists($object, 'get_cart_item')) {
         $request->set_status(REQUEST_STATUS_FAILURE);
         return;
     }
     $object->import_attributes($object_data);
     $cart_item =& $object->get_cart_item();
     $cart =& cart::instance();
     if ($quantity = (int) $request->get_attribute('quantity')) {
         $cart_item->set_amount($quantity);
     }
     $cart->add_item($cart_item);
     $request->set_status(REQUEST_STATUS_SUCCESS);
     $response->redirect('/root/cart?popup=1');
 }
	function get_cart_summ()
	{
		$cart =& cart :: instance();
		$locale = locale :: instance();
		
		return number_format($cart->get_total_summ(), $locale->fract_digits, $locale->decimal_symbol, $locale->thousand_separator);
	}
 function _valid_perform(&$request, &$response)
 {
     if (!($objects_amounts = $this->dataspace->get('amount'))) {
         $request->set_status(REQUEST_STATUS_FAILURE);
         if ($request->has_attribute('popup')) {
             $response->write(close_popup_response($request));
         }
         return;
     }
     $objects_data =& fetch_by_node_ids(array_keys($objects_amounts), $this->_define_catalog_object(), $counter);
     if (!$objects_data) {
         $request->set_status(REQUEST_STATUS_FAILURE);
         if ($request->has_attribute('popup')) {
             $response->write(close_popup_response($request));
         }
         return;
     }
     $object =& site_object_factory::create($this->_define_catalog_object());
     if (!method_exists($object, 'get_cart_item')) {
         $request->set_status(REQUEST_STATUS_FAILURE);
         if ($request->has_attribute('popup')) {
             $response->write(close_popup_response($request));
         }
         return;
     }
     $cart =& cart::instance();
     foreach ($objects_data as $key => $object_data) {
         $object->import_attributes($object_data);
         $cart_item =& $object->get_cart_item();
         $cart_item->set_amount($objects_amounts[$key]);
         $cart->add_item($cart_item);
     }
     $response->redirect('/root/cart?popup=1');
 }
 function _valid_perform()
 {
     $cart =& cart::instance();
     if ($item_ids = $this->dataspace->get('ids')) {
         $cart->remove_items($item_ids);
     }
     return new redirect_response(RESPONSE_STATUS_FORM_SUBMITTED, '/root/cart');
 }
 function _valid_perform(&$request, &$response)
 {
     $cart =& cart::instance();
     if ($item_ids = $this->dataspace->get('ids')) {
         $cart->remove_items($item_ids);
     }
     $request->set_status(REQUEST_STATUS_FORM_SUBMITTED);
     $response->redirect('/root/cart');
 }
 function _valid_perform()
 {
     $this->_update_items_amount();
     $this->_update_items_notes();
     $cart =& cart::instance();
     if ($cart->count_items() == 0) {
         message_box::write_error(strings::get('no_items_in_cart', 'cart'));
         return new close_popup_response(RESPONSE_STATUS_FAILURE);
     }
     return new redirect_response(RESPONSE_STATUS_FORM_SUBMITTED, '/root/cart?action=checkout&popup=1');
 }
Ejemplo n.º 11
0
 public function executeProductLink(sfWebRequest $request)
 {
     if ($request->hasParameter("categoryid") && $request->hasParameter("productid")) {
         $prodcat = new ProductCategory();
         $prodcat->setProductId($request->getParameter("productid"));
         $prodcat->setCategoryId($request->getParameter("categoryid"));
         $prodcat->save();
         cart::update_node($request->getParameter("categoryid"));
         return true;
     }
 }
Ejemplo n.º 12
0
 /**
  * 默认控制器
  */
 public function index()
 {
     $d = cart::getGoods();
     $_SESSION['allNum'] = Cart::getTotalNums();
     //获取商品所有数据
     $data = cart::getAllData();
     $this->assign('data', $data);
     //获取总价格
     $total = cart::getTotalPrice();
     $this->assign('total', $total);
     $this->display();
 }
 function _update_items_notes()
 {
     $cart =& cart::instance();
     if ($item_ids = $this->dataspace->get('notes')) {
         foreach ($item_ids as $item_id => $note) {
             if (!($item =& $cart->get_item($item_id))) {
                 continue;
             }
             $item->set_attribute('note', strip_tags($note));
         }
     }
 }
Ejemplo n.º 14
0
 public function actionChangeCurrency()
 {
     $new_currency = $_POST['id'];
     if ($new_currency and currency::model()->findByPk($new_currency)) {
         $cart = cart::model()->findByPk(Yii::app()->user->getState('cart_ID'));
         $cart->cart_currency_ID = $new_currency;
         $cart->save();
         Yii::app()->user->setState('currency_ID', $new_currency);
         Yii::app()->user->updateCookie();
         die(1);
     } else {
         die(0);
     }
 }
Ejemplo n.º 15
0
 public function actionPayment()
 {
     $cart = cart::model()->findByPk(Yii::app()->user->getState('cart_ID'));
     if (!$cart->cart_address_ID or !$cart->cart_carrier_ID) {
         $this->redirect(array('index'));
         exit;
     }
     if (!($address = address_entity::model()->findByPk($cart->cart_address_ID))) {
         $this->redirect(array('index'));
         exit;
     }
     $grandTotal = product_entity::decoratePrice($cart->getOrderTotal(), true);
     $this->render('payment', array('grandTotal' => $grandTotal));
 }
 function _valid_perform(&$request, &$response)
 {
     $this->_update_items_amount();
     $this->_update_items_notes();
     $cart =& cart::instance();
     if ($cart->count_items() == 0) {
         message_box::write_error(strings::get('no_items_in_cart', 'cart'));
         $request->set_status(REQUEST_STATUS_FAILURE);
         if ($request->has_attribute('popup')) {
             $response->write(close_popup_response($request));
         }
         return;
     }
     $request->set_status(REQUEST_STATUS_FORM_SUBMITTED);
     $response->redirect('/root/cart?action=checkout&popup=1');
 }
Ejemplo n.º 17
0
 public function actionCart()
 {
     $errors = '';
     $qty = $_GET['qty'];
     $product = $this->loadModel();
     if ($qty < 0 || $qty > 100) {
         $errors .= "Quantity Invalid \n";
     }
     $cart = cart::model()->findByPk(Yii::app()->user->getState('cart_ID'));
     if (!$cart) {
         //To do
     }
     $cart->updateQty($qty, $product->product_ID);
     Yii::app()->user->setFlash('cart', "Add {$product->product_name} to cart!");
     $this->redirect(array('cart/index'));
 }
 function perform()
 {
     if (!isset($_REQUEST['id'])) {
         return new close_popup_response(RESPONSE_STATUS_FAILURE);
     }
     if (!($object_data =& fetch_one_by_node_id((int) $_REQUEST['id']))) {
         return new close_popup_response(RESPONSE_STATUS_FAILURE);
     }
     $object =& site_object_factory::create($object_data['class_name']);
     if (!method_exists($object, 'get_cart_item')) {
         return new close_popup_response(RESPONSE_STATUS_FAILURE);
     }
     $object->import_attributes($object_data);
     $cart_item =& $object->get_cart_item();
     $cart =& cart::instance();
     $cart->add_item($cart_item);
     return new redirect_response(RESPONSE_STATUS_SUCCESS, '/root/cart?popup=1');
 }
Ejemplo n.º 19
0
 public function __construct($id = -1)
 {
     if (is_null(self::$conn)) {
         self::$conn = mysqli_connect('localhost', 'root', 'osama', 'store');
     }
     if ($id != -1) {
         # to get all the products for a specific user
         $this->user_id = $id;
         $query = "select * from cart where user_id={$id}";
         $result = mysqli_query(self::$conn, $query);
         $data = [];
         while ($row = mysqli_fetch_assoc($result)) {
             $data[] = ['prod_id' => $row['prod_id'], 'qty' => $row['qty']];
         }
         // var_dump($data);
         return $data;
     }
 }
 function _get_mail_body($template_path)
 {
     $template = new template($template_path);
     $locale =& locale::instance();
     $date = new date();
     $template->set('date', $date->format($locale->get_short_date_format()));
     $cart =& cart::instance();
     $list =& $template->find_child('cart_items');
     $list->register_dataset($cart->get_items_array_dataset());
     $template->set('name', $this->dataspace->get('name'));
     $template->set('notes', $this->dataspace->get('notes'));
     $template->set('phone', $this->dataspace->get('phone'));
     $template->set('address', $this->dataspace->get('address'));
     $template->set('email', $this->dataspace->get('email'));
     ob_start();
     $template->display();
     $content = ob_get_contents();
     ob_end_clean();
     return $content;
 }
 function _valid_perform()
 {
     if (!($objects_amounts = $this->dataspace->get('amount'))) {
         return new close_popup_response(RESPONSE_STATUS_FAILURE);
     }
     $objects_data =& fetch_by_node_ids(array_keys($objects_amounts), $this->_catalog_object_class_name, $counter);
     if (!$objects_data) {
         return new close_popup_response(RESPONSE_STATUS_FAILURE);
     }
     $object =& site_object_factory::create($this->_catalog_object_class_name);
     if (!method_exists($object, 'get_cart_item')) {
         return new close_popup_response(RESPONSE_STATUS_FAILURE);
     }
     $cart =& cart::instance();
     foreach ($objects_data as $key => $object_data) {
         $object->import_attributes($object_data);
         $cart_item =& $object->get_cart_item();
         $cart_item->set_amount($objects_amounts[$key]);
         $cart->add_item($cart_item);
     }
     return new redirect_response(RESPONSE_STATUS_SUCCESS, '/root/cart?popup=1');
 }
Ejemplo n.º 22
0
 /**
  * Populates the current user object with the information obtained from cookie.
  * This method is used when automatic login ({@link allowAutoLogin}) is enabled.
  * The user identity information is recovered from cookie.
  * Sufficient security measures are used to prevent cookie data from being tampered.
  * @see saveToCookie
  */
 protected function restoreFromCookie()
 {
     $app = Yii::app();
     $cookie = $app->getRequest()->getCookies()->itemAt($this->getStateKeyPrefix());
     if ($cookie && !empty($cookie->value) && ($data = $app->getSecurityManager()->validateData($cookie->value)) !== false) {
         $data = @unserialize($data);
         if (is_array($data) && isset($data[1], $data[2], $data[3])) {
             list($id, $name, $duration, $states) = $data;
             if (isset($id)) {
                 if ($this->beforeLogin($id, $states, true)) {
                     $this->changeIdentity($id, $name, $states);
                     if ($this->autoRenewCookie) {
                         $cookie->expire = time() + $duration;
                         $app->getRequest()->getCookies()->add($cookie->name, $cookie);
                     }
                     $this->afterLogin(true);
                 }
             } else {
                 //Guest vistor,read info from cookie
                 $this->changeIdentity($id, $name, $states);
                 if ($this->autoRenewCookie) {
                     $cookie->expire = time() + $duration;
                     $app->getRequest()->getCookies()->add($cookie->name, $cookie);
                 }
             }
         }
     } else {
         //new vistor setup coookie info
         $names['cart_ID'] = true;
         $names['guest_ID'] = true;
         $names['currency_ID'] = true;
         $guest_ID = guest::AddGuest();
         $currency_ID = 2;
         $cart_ID = cart::AddCart($guest_ID, $currency_ID);
         $this->setState('__states', $names);
         $this->setState('cart_ID', $cart_ID);
         $this->setState('guest_ID', $guest_ID);
         $this->setState('currency_ID', $currency_ID);
         $this->saveToCookie(31104000);
     }
 }
Ejemplo n.º 23
0
        header("HTTP/1.0 500 ");
        echo rawurlencode($e->getMessage()) . ' (' . $e->getCode() . ')';
    }
    exit;
}
if (isset($_GET['ctg']) && $_GET['ctg'] == 'checkout' && $_GET['checkout'] && $_SESSION['s_login']) {
    try {
        /**Handles cart and catalog*/
        include "catalog.php";
    } catch (Exception $e) {
        $smarty->assign("T_EXCEPTION_TRACE", $e->getTraceAsString());
        $message = $e->getMessage() . ' &nbsp;<a href = "javascript:void(0)" onclick = "eF_js_showDivPopup(event, \'' . _ERRORDETAILS . '\', 2, \'error_details\')">' . _MOREINFO . '</a>';
        $message_type = failure;
    }
} else {
    $smarty->assign("T_CART", cart::prepareCart());
}
if (isset($_SESSION['s_login']) && ($GLOBALS['currentTheme']->options['sidebar_interface'] == 2 && $GLOBALS['currentTheme']->options['show_header'] == 2)) {
    try {
        //$currentUser = EfrontUserFactory :: factory($_SESSION['s_login']);
        $currentUser = EfrontUser::checkUserAccess();
        refreshLogin();
        //$_SESSION['last_action_timestamp'] = time();		//Keep the last time something happened to the session
        if ($accounts = unserialize($currentUser->user['additional_accounts'])) {
            $result = eF_getTableData("users", "login, user_type", 'login in ("' . implode('","', array_values($accounts)) . '")');
            $smarty->assign("T_MAPPED_ACCOUNTS", $result);
        }
    } catch (Exception $e) {
    }
}
if (isset($_GET['ctg']) && is_numeric($_GET['ctg'])) {
 /**
  * Return array of cart products
  *
  * @param  cart (object)
  * @return  array of products | or empty
  */
 public static function getCartProducts(cart $cartObject)
 {
     $cart_products = array();
     foreach ($cartObject->getProducts() as $product) {
         $cart_products[] = $product;
     }
     return $cart_products;
 }
Ejemplo n.º 25
0
 function modifyService($item, $billing_id)
 {
     global $C_debug;
     # Get the product details
     $db =& DB();
     $q = "SELECT * FROM " . AGILE_DB_PREFIX . "product WHERE\n\t        \t  id \t\t=  " . $db->qstr($item->fields['product_id']) . " AND\n\t        \t  site_id \t=  " . $db->qstr(DEFAULT_SITE);
     $prod = $db->Execute($q);
     # Get the current service details
     $q = "SELECT * FROM " . AGILE_DB_PREFIX . "service WHERE\n\t        \t  id \t\t=  " . $db->qstr($item->fields['service_id']) . " AND\n\t        \t  site_id \t=  " . $db->qstr(DEFAULT_SITE);
     $servrs = $db->Execute($q);
     $service = $servrs->fields;
     $service_id = $service['id'];
     # Determine Price, Price Type, and Next Invoice Date:
     if ($item->fields['price_type'] == '1') {
         # Recurring Item
         $this->recurring_schedule = $item->fields['recurring_schedule'];
         $this->price = $item->fields['price_base'];
         $this->bind = '1';
         # Determine the next invoice date:
         $this->next_invoice = $this->calcNextInvoiceDate(time(), $this->recurring_schedule, $prod->fields['price_recurr_type'], $prod->fields['price_recurr_weekday'], $prod->fields['price_recurr_week']);
         # Determine the last invoice date:
         if (empty($service['date_last_invoice'])) {
             $this->last_invoice = time();
         } else {
             $this->last_invoice = $service['date_last_invoice'];
         }
         $old_unit = $this->getDailyCost($service['recur_schedule'], $service['price']);
         $new_unit = $this->getDailyCost($item->fields['recurring_schedule'], $this->price);
         //echo "old_unit=$old_unit <br> new_unit=$new_unit <br>";
         $daysLeft = ceil(($service['date_next_invoice'] - time()) / 86400);
         $prorated = $old_unit * $daysLeft;
         $daysDiff = ceil($prorated / $new_unit);
         //echo "daysLeft=$daysLeft prorated=$prorated daysDiff=$daysDiff <br>";
         //echo "dt=". date("d-m-Y", $this->next_invoice)."<br>";
         $this->next_invoice += $daysDiff * 86400;
         //echo "final dt=". date("d-m-Y", $this->next_invoice) ."<br>";
     }
     # If set-date type recurring transaction, determine full price:
     if ($prod->fields['price_type'] == '1' && $prod->fields['price_recurr_type'] == '1') {
         include_once PATH_MODULES . 'cart/cart.inc.php';
         $cart = new cart();
         $price = $cart->price_prod($prod->fields, $this->recurring_schedule, $invoice->fields['account_id'], false);
         $this->price = $price['base'];
         $price = $cart->price_attr($prod->fields, $item->fields['product_attr_cart'], $this->recurring_schedule, $invoice->fields['account_id'], false);
         $this->price += $price['base'];
     }
     # Determine the Service Type:
     if (!empty($prod->fields['assoc_grant_group'])) {
         if (!empty($prod->fields['prod_plugin'])) {
             $this->type = 'product_group';
         } elseif (!empty($prod->fields['host'])) {
             $this->type = 'host_group';
         } else {
             $this->type = 'group';
         }
     } elseif (!empty($prod->fields['prod_plugin'])) {
         $this->type = 'product';
     } elseif (!empty($prod->fields['host'])) {
         $this->type = 'host';
     } else {
         $this->type = 'none';
     }
     # Reconfigure host data:
     $host_arr = "";
     if ($this->type == "host" || $this->type == "host_group") {
         $old = serialize($service['host_provision_plugin_data']);
         $host_arr = $prod->fields['host_provision_plugin_data'];
         if (is_array($old) && count($old) > 0) {
             foreach ($old as $key => $val) {
                 if (!isset($host_arr["{$key}"]) && @$old["{$key}"] != "") {
                     $host_arr["{$key}"] = $val;
                 }
             }
         }
     }
     # Create the item record:
     $q = "UPDATE " . AGILE_DB_PREFIX . "service SET\n\t\t        date_last\t\t\t\t= " . $db->qstr(time()) . ", \n\t\t        invoice_id\t\t\t\t= " . $db->qstr($item->fields['invoice_id']) . ",\n\t\t        invoice_item_id\t\t\t= " . $db->qstr($item->fields['id']) . ", \n\t\t        account_billing_id \t\t= " . $db->qstr($billing_id) . ",\n\t\t        product_id\t\t\t\t= " . $db->qstr($prod->fields['id']) . ",\n\t\t        sku\t\t\t\t\t\t= " . $db->qstr($item->fields['sku']) . ",\n\t\t        active\t\t\t\t\t= " . $db->qstr(1) . ", \n\t\t        type\t\t\t\t\t= " . $db->qstr($this->type) . ",\n\t\t        queue\t\t\t\t\t= " . $db->qstr('edit') . ", \n\t\t        price\t\t\t\t\t= " . $db->qstr(@$this->price) . ",\n\t\t        price_type\t\t\t\t= " . $db->qstr($prod->fields['price_type']) . ",\n\t\t        taxable\t\t\t\t\t= " . $db->qstr($prod->fields['taxable']) . ", \n\t\t        date_last_invoice\t\t= " . $db->qstr(@$this->last_invoice) . ",\n\t\t        date_next_invoice\t\t= " . $db->qstr(@$this->next_invoice) . ",\n\t\t        recur_schedule\t\t\t= " . $db->qstr(@$this->recurring_schedule) . ",\n\t\t        recur_type\t\t\t\t= " . $db->qstr($prod->fields['price_recurr_type']) . ",\n\t\t        recur_weekday\t\t\t= " . $db->qstr($prod->fields['price_recurr_weekday']) . ",\n\t\t        recur_week\t\t\t\t= " . $db->qstr($prod->fields['price_recurr_week']) . ",\n\t\t        recur_schedule_change \t= " . $db->qstr($prod->fields['price_recurr_schedule']) . ",\n\t\t        recur_cancel\t\t\t= " . $db->qstr($prod->fields['price_recurr_cancel']) . ", \n\t\t        recur_modify\t\t\t= " . $db->qstr($prod->fields['price_recurr_modify']) . ", \n\t\t        group_grant\t\t\t\t= " . $db->qstr($prod->fields['assoc_grant_group']) . ",\n\t\t        group_type\t\t\t\t= " . $db->qstr($prod->fields['assoc_grant_group_type']) . ",\n\t\t        group_days\t\t\t\t= " . $db->qstr($prod->fields['assoc_grant_group_days']) . ",  \n\t\t        host_provision_plugin_data=" . $db->qstr(@$host_arr) . ", \n\t\t        prod_plugin_name\t\t= " . $db->qstr(@$prod->fields["prod_plugin_file"]) . ",\n\t\t        prod_plugin_data\t\t= " . $db->qstr(@$prod->fields["prod_plugin_data"]) . " \n\t\t        WHERE \n\t\t        site_id = " . DEFAULT_SITE . " AND id = {$service_id}";
     $rs = $db->Execute($q);
     if ($rs === false) {
         global $C_debug;
         $C_debug->error('service.inc.php', 'invoiceItemToService', $q . " | " . @$db->ErrorMsg());
     }
     # Run the queue on this item:
     $this->queue_one($service_id, false);
     return true;
 }
Ejemplo n.º 26
0
 /**
  * Set the title for the cart
  * @Developer brandon
  * @Date Oct 11, 2010
  */
 public function __construct()
 {
     parent::__construct();
     meta::set_title('Shopping Cart');
     $this->cart = cart::get();
 }
Ejemplo n.º 27
0
								   
								 </div>		
							  </div>
		                     </div>
	                      </div>
	                    </a>
					</li>
					<?php 
}
?>

					<!-- // add product into cart -->

				   <?php 
include 'cart.php';
$cart = new cart();
// var_dump($_GET);
@$cart->insert($_SESSION['user_id'], $_GET['cart']);
?>
				<!-- ////////////////////////// -->
				
				</ul>
			</div>
			<script src="js/cbpViewModeSwitch.js" type="text/javascript"></script>
	        <script src="js/classie.js" type="text/javascript"></script>
    </div>
   </div>
   <div class="footer">
   	 <div class="container">
	    <div class="clearfix"></div>
	    <div class="copy">
Ejemplo n.º 28
0
			<input type='submit' name='submit_zipcode' value='Calculate Shipping' />
			</form>
			<?php 
if (isset($_SESSION['zipcode_error'])) {
    echo '<div class="warning">Error: ' . $_SESSION['zipcode_error'] . '</div>';
    unset($_SESSION['zipcode_error']);
} else {
    if (count($cart->getShippingQuotes()) > 0 and $cart->getZipcode() != "") {
        echo "<p style='margin-left: 110px;font-weight: bold; display:inline;'>Current shipping location: <span style='font-weight: normal'>" . $cart->getZipcode() . " (" . $cart->getLocation() . ")</span></p>";
    } else {
        echo "<p style='font-weight: bold;color:#ff4100;display:inline;'><img src='/sfCartPlugin/images/arrow.gif' alt='arrow' style='padding-right: 20px;' />To continue, enter your zipcode</p>";
    }
}
echo "</div>";
echo "<div style='clear:both'></div>";
cart::display_summary();
//checkout form
if ($cart->getZipcode() != "" and $cart->getSelectedQuote() != 0 and count($cart->getShippingQuotes()) > 0) {
    ?>
			<form method='post' action='/checkout'>
      
			<?php 
    if ($cart->agreeshown == false) {
        ?>
				<input type="hidden" id="agreeshown" name="agreeshown" value="no">				  
				<?php 
        $cart->agreeshown = true;
    } else {
        ?>
				<input type="hidden" id="agreeshown" name="agreeshown" value="yes">	  
				<?php 
Ejemplo n.º 29
0
<?php

defined('IN_DESTOON') or exit('Access Denied');
if ($DT_BOT) {
    dhttp(403);
}
require DT_ROOT . '/module/' . $module . '/common.inc.php';
require DT_ROOT . '/module/' . $module . '/cart.class.php';
include load('misc.lang');
$do = new cart();
$cart = $do->get();
$max_cart = $MOD['max_cart'];
if ($action == 'ajax') {
    $itemid or exit('-1');
    $s1 = isset($s1) ? intval($s1) : 0;
    $s2 = isset($s2) ? intval($s2) : 0;
    $s3 = isset($s3) ? intval($s3) : 0;
    $key = $itemid . '-' . $s1 . '-' . $s2 . '-' . $s3;
    if (strpos($cart . ',', ',' . $key . ',') !== false) {
        exit('-2');
    }
    $item = $db->get_one("SELECT itemid,status,username FROM {$table} WHERE itemid={$itemid}");
    if ($item && $item['status'] == 3) {
        if ($item['username'] != $_username) {
            $cart = ',' . $key . $cart;
            $do->set($cart);
            exit('1');
        } else {
            exit('-4');
        }
    } else {
 function get_cart_summ()
 {
     $cart =& cart::instance();
     return $cart->get_total_summ();
 }