Example #1
0
 public function __construct()
 {
     if ($GLOBALS['EnableSEOUrls'] == 1) {
         $url_array = split('/', strtolower($_SERVER['REQUEST_URI']));
         $searchlogid = $url_array[array_search('searchlogid', $url_array, true) + 1];
     } else {
         $searchlogid = $_GET['SearchLogId'];
     }
     UpdateSearchLogforBestKeyWord($searchlogid);
     // Initialize the cart management API.
     $this->api = new ISC_CART_API();
     if (!isset($_SESSION['CART'])) {
         $_SESSION['CART'] = array();
     }
     $this->api->SetCartSession($_SESSION['CART']);
     // Setup the number of products in the cart which will be shown
     // on the header of every page of the site
     $this->SetNumItemsInCart();
     // Setup the page title
     $this->pageTitle = GetConfig('StoreName') . " - " . GetLang('ShoppingCart');
     // The default "Click here to keep shopping" text
     //commented by blessen
     //			if ($this->api->GetNumItemsInCart() > 0) {
     //				$GLOBALS['KeepShoppingText'] = GetLang('ClickHereToKeepShopping');
     //				$GLOBALS['KeepShoppingLink'] = "javascript:history.go(-1)"; // $GLOBALS['ShopPath'];
     //			} else {
     //				$GLOBALS['KeepShoppingText'] = '';
     //				$GLOBALS['KeepShoppingLink'] = ''; // $GLOBALS['ShopPath'];
     //			}
     if (isset($_SESSION['JustAddedProduct']) && $_SESSION['JustAddedProduct'] != '') {
         // Get the category of the last product added to the store
         $query = sprintf("select c.categoryid, catname from [|PREFIX|]categoryassociations ca inner join [|PREFIX|]categories c on ca.categoryid=c.categoryid where ca.productid='%d' ", $GLOBALS['ISC_CLASS_DB']->Quote((int) $_SESSION['JustAddedProduct']));
         $query .= $GLOBALS['ISC_CLASS_DB']->AddLimit(0, 1);
         $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
         if ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
             $GLOBALS['KeepShoppingLink'] = CatLinkNew($row['categoryid'], $row['catname']);
             $GLOBALS['KeepShoppingText'] = sprintf(GetLang('ClickHereToKeepShoppingCat'), isc_html_escape($row['catname']));
         }
         $_SESSION['JustAddedProduct'] = '';
     }
     // Special function used to reconvert currencies if the admin user changes the default currency while people currently have items in their cart
     RecompileOrderPrices();
 }
Example #2
0
 public function __construct($productid = 0)
 {
     /* alandy_2012-1-13 commit.
     			if($GLOBALS['EnableSEOUrls'] == 1)
     			{
     				$url_array = split('/', strtolower($_SERVER['REQUEST_URI']));
     				$searchlogid = $url_array[array_search('searchlogid', $url_array, true)+1];
     			}
     			else
     			{
     				$searchlogid = $_GET['SearchLogId'];
     			}
     			*/
     //alandy_2012-1-13 modify.
     if (isset($_SESSION['SearchLogId'])) {
         $searchlogid = $_SESSION['SearchLogId'];
         unset($_SESSION['SearchLogId']);
     } else {
         $searchlogid = '';
     }
     if (isnumeric($searchlogid)) {
         UpdateSearchLogforBestKeyWord($searchlogid);
     }
     /*alandy_2012-1-13 commit.
     		//get search log id if exist
     		if($GLOBALS['EnableSEOUrls'] == 1)
     		{
     			$url_array = split('/', strtolower($_SERVER['REQUEST_URI']));
     			$searchlogid = $url_array[array_search('searchlogid', $url_array, true)+1];
     		}
     		else
     		{
     			$searchlogid = $_GET['SearchLogId'];
     		}
     		*/
     // validate URL coming from other sites - vikas
     $this->ValidateURLFromOtherSites();
     // Load the data for this product
     $this->_SetProductData($productid);
     //alandy_2012-3-8 add product detail url.
     $GLOBALS['detailUrl'] = $GLOBALS['ShopPath'] . $_SERVER['REQUEST_URI'];
     // Add it to the list of recently viewed products
     if ($productid == 0) {
         // We must load the CSS file here for the product details bulk discount thickbox as it needs to be defined before the
         // headers get built
         if (GetConfig('BulkDiscountEnabled') && $this->_prodnumbulkdiscounts > 0) {
             $GLOBALS['AdditionalStylesheets'][] = GetConfig('AppPath') . '/javascript/jquery/plugins/imodal/imodal.css';
         }
         $this->_AddToRecentlyViewedProducts();
         // Workout the breadcrumb(s)
         $this->_BuildBreadCrumbs();
         // Track a view for this page
         $this->_TrackView();
     }
 }