public function init() { $_SESSION['link_to_store_front'] = Link::Build(str_replace(VIRTUAL_LOCATION, '', getenv('REQUEST_URI'))); // Создаем ссылку для возврата в каталог if (!isset($_GET['CartAction'])) { $_SESSION['link_to_last_page_loaded'] = $_SESSION['link_to_store_front']; } // Load department details if visiting a department if (isset($_GET['DepartmentId'])) { $this->mContentsCell = 'department.tpl'; $this->mCategoriesCell = 'categories_list.tpl'; } elseif (isset($_GET['ProductId']) && isset($_SESSION['link_to_continue_shopping']) && strpos($_SESSION['link_to_continue_shopping'], 'DepartmentId', 0) !== false) { $this->mCategoriesCell = 'categories_list.tpl'; } // Load product details page if visiting a product if (isset($_GET['ProductId'])) { $this->mContentsCell = 'products.tpl'; } elseif (isset($_GET['SearchResults'])) { $this->mContentsCell = 'search_results.tpl'; } // Загружаем шаблон для отображения содержимого корзины if (isset($_GET['CartAction'])) { $this->mContentsCell = 'cart_details.tpl'; } else { $this->mCartSummaryCell = 'cart_summary.tpl'; } // Load the page title $this->mPageTitle = $this->_GetPageTitle(); }
public function __construct() { $this->mSiteUrl = Link::Build('', 'https'); //Разрешаем доступ к этой странице только через HTTPS, //если USE_SSL установлена в значение yes if (USE_SSL == 'yes' && getenv('HTTPS') != 'on') { header('Location: https://' . getenv('SERVER_NAME') . getenv('REQUEST_URI')); exit; } }
public function init() { // Get product details from business tier $this->mProduct = Catalog::GetProductDetails($this->_mProductId); if (isset($_SESSION['link_to_continue_shopping'])) { $continue_shopping = Link::QueryStringToArray($_SESSION['link_to_continue_shopping']); $page = 1; if (isset($continue_shopping['Page'])) { $page = (int) $continue_shopping['Page']; } if (isset($continue_shopping['CategoryId'])) { $this->mLinkToContinueShopping = Link::ToCategory((int) $continue_shopping['DepartmentId'], (int) $continue_shopping['CategoryId'], $page); } elseif (isset($continue_shopping['DepartmentId'])) { $this->mLinkToContinueShopping = Link::ToDepartment((int) $continue_shopping['DepartmentId'], $page); } elseif (isset($continue_shopping['SearchResults'])) { $this->mLinkToContinueShopping = Link::ToSearchResults(trim(str_replace('-', ' ', $continue_shopping['SearchString'])), $continue_shopping['AllWords'], $page); } else { $this->mLinkToContinueShopping = Link::ToIndex($page); } } if ($this->mProduct['image']) { $this->mProduct['image'] = Link::Build('images/product_images/' . $this->mProduct['image']); } if ($this->mProduct['image_2']) { $this->mProduct['image_2'] = Link::Build('images/product_images/' . $this->mProduct['image_2']); } $this->mProduct['attributes'] = Catalog::GetProductAttributes($this->mProduct['product_id']); $this->mLocations = Catalog::GetProductLocations($this->_mProductId); // Create the Add to Cart link $this->mProduct['link_to_add_product'] = Link::ToCart(ADD_PRODUCT, $this->_mProductId); // Build links for product departments and categories pages for ($i = 0; $i < count($this->mLocations); $i++) { $this->mLocations[$i]['link_to_department'] = Link::ToDepartment($this->mLocations[$i]['department_id']); $this->mLocations[$i]['link_to_category'] = Link::ToCategory($this->mLocations[$i]['department_id'], $this->mLocations[$i]['category_id']); } // Подготавливаем кнопу редактирования $this->mEditActionTarget = Link::Build(str_replace(VIRTUAL_LOCATION, '', getenv('REQUEST_URI'))); if (isset($_SESSION['admin_logged']) && $_SESSION['admin_logged'] == TRUE && isset($_POST['submit_edit'])) { $product_locations = $this->mLocations; if (count($product_locations) > 0) { $department_id = $product_locations[0]['department_id']; $category_id = $product_locations[0]['category_id']; header('Location: ' . htmlspecialchars_decode(Link::ToProductAdmin($department_id, $category_id, $this->_mProductId))); } } }
public function init() { /* If browsing a category, get the list of products by calling the * GetProductsInCategory() business tier method */ if (isset($this->_mCategoryId)) { $this->mProducts = Catalog::GetProductsInCategory($this->_mCategoryId, $this->mPage, $this->mrTotalPages); } elseif (isset($this->_mDepartmentId)) { $this->mProducts = Catalog::GetProductsOnDepartment($this->_mDepartmentId, $this->mPage, $this->mrTotalPages); } else { $this->mProducts = Catalog::GetProductsOnCatalog($this->mPage, $this->mrTotalPages); } /* If there are subpages of products, display navigation controls */ if ($this->mrTotalPages > 1) { // Build the Next link if ($this->mPage < $this->mrTotalPages) { if (isset($this->_mCategoryId)) { $this->mLinkToNextPage = Link::ToCategory($this->_mDepartmentId, $this->_mCategoryId, $this->mPage + 1); } elseif (isset($this->_mDepartmentId)) { $this->mLinkToNextPage = Link::ToDepartment($this->_mDepartmentId, $this->mPage + 1); } else { $this->mLinkToNextPage = Link::ToIndex($this->mPage + 1); } } // Build the Previous Link if ($this->mPage > 1) { if (isset($this->_mCategoryId)) { $this->mLinkToPreviousPage = Link::ToCategory($this->_mDepartmentId, $this->_mCategoryId, $this->mPage - 1); } elseif (isset($this->_mDepartmentId)) { $this->mLinkToPreviousPage = Link::ToDepartment($this->_mDepartmentId, $this->mPage - 1); } else { $this->mLinkToPreviousPage = Link::ToIndex($this->mPage - 1); } } } // Build links for product details pages for ($i = 0; $i < count($this->mProducts); $i++) { $this->mProducts[$i]['link_to_product'] = Link::ToProduct($this->mProducts[$i]['product_id']); if ($this->mProducts[$i]['thumbnail']) { $this->mProducts[$i]['thumbnail'] = Link::Build('images/product_images/' . $this->mProducts[$i]['thumbnail']); } $this->mProducts[$i]['attributes'] = Catalog::GetProductAttributes($this->mProducts[$i]['product_id']); } }
public function init() { // Get product details from business tier $this->mProduct = Catalog::GetProductDetails($this->_mProductId); // Session Handle if (isset($_SESSION['link_to_continue_shopping'])) { $continue_shopping = Link::QueryStringToArray($_SESSION['link_to_continue_shopping']); $page = 1; // Cache the current query string. Then after choose the product, we will get back this page. if (isset($continue_shopping['Page'])) { $page = (int) $continue_shopping['Page']; } if (isset($continue_shopping['CategoryId'])) { $this->mLinkToContinueShopping = Link::ToCategory((int) $continue_shopping['DepartmentId'], (int) $continue_shopping['CategoryId'], $page); } elseif (isset($continue_shopping['DepartmentId'])) { $this->mLinkToContinueShopping = Link::ToDepartment((int) $continue_shopping['DepartmentId'], $page); } else { $this->mLinkToContinueShopping = Link::ToIndex($page); } } // Product detail if ($this->mProduct['image']) { $this->mProduct['image'] = Link::Build('images/product_images/' . $this->mProduct['image']); } if ($this->mProduct['image_2']) { $this->mProduct['image_2'] = Link::Build('images/product_images/' . $this->mProduct['image_2']); } $this->mProduct['attributes'] = Catalog::GetProductAttributes($this->mProduct['product_id']); // Similar products in catalog $this->mLocations = Catalog::GetProductLocations($this->_mProductId); // Build links for product departments and categories pages for ($i = 0; $i < count($this->mLocations); $i++) { $this->mLocations[$i]['link_to_department'] = Link::ToDepartment($this->mLocations[$i]['department_id']); $this->mLocations[$i]['link_to_category'] = Link::ToCategory($this->mLocations[$i]['department_id'], $this->mLocations[$i]['category_id']); } }
public function __construct() { $this->mSiteUrl = Link::Build(''); }
"> <img src="<?php echo Link::Build('images/images/tshirtshop.png'); ?> " alt="tshirtshop logo" /> </a> </div> <div id="contents" class="yui-g"> <h1> The page that you have requested doesn't exist on TShirtShop. </h1> <p> Please visit the <a href="<?php echo Link::Build(''); ?> ">TShirtShop catalog</a> if you're looking for T-shirts, or <a href="<?php echo ADMIN_ERROR_MAIL; ?> ">email us</a> if you need further assistance. </p> <p>Thank you!</p> <p>The TShirtShop team.</p> </div> </div> </div> </body>
<?php // uncomment the following to define a path alias // Yii::setPathOfAlias('local','path/to/local-folder'); // This is the main Web application configuration. Any writable // CWebApplication properties can be configured here. require 'params_conf.php'; require 'link.php'; Yii::setPathOfAlias('bootstrap', BOOTSTRAP); return array('basePath' => BASE_PATH, 'name' => SITE_NAME, 'preload' => array('log'), 'import' => array('application.models.*', 'application.components.*'), 'modules' => array('shop' => array('debug' => 'true')), 'components' => array('user' => array('allowAutoLogin' => true), 'bootstrap' => array('class' => 'bootstrap.components.Bootstrap'), 'db' => array('connectionString' => 'mysql:host=localhost;dbname=yiishop', 'emulatePrepare' => true, 'username' => 'root', 'password' => '', 'charset' => 'utf8'), 'errorHandler' => array('errorAction' => 'site/error'), 'log' => array('class' => 'CLogRouter', 'routes' => array(array('class' => 'CFileLogRoute', 'levels' => 'error, warning')))), 'params' => array('adminEmail' => '*****@*****.**', 'logo' => Link::Build("") . 'images2/logo.png'));
"> <img src="<?php echo Link::Build('images/images/title.png'); ?> " alt="tshirtshop logo" /> </a> </div> <div id="contents" class="yui-g"> <h1> Tshirtshop is experiencing technical difficulties. </h1> <p> Please <a href="<?php Link::Build(); ?> ">Visit US </a> soon, or <a href="<?php echo ADMIN_ERROR_MAIL; ?> ">Contact us</a> </p> <p>Thank you!</p> <p>The Tshirtshop team.</p> </div> </div> </div>
public function init() { //Подготавливаем кнопку редактирования $this->mEditActionTarget = Link::Build(str_replace(VIRTUAL_LOCATION, '', getenv('REQUEST_URI'))); if (isset($_SESSION['admin_logged']) && $_SESSION['admin_logged'] == TRUE && isset($_POST['product_id'])) { if (isset($this->_mDepartmentId) && isset($this->_mCategoryId)) { header('Location: ' . htmlspecialchars_decode(Link::ToProductAdmin($this->_mDepartmentId, $this->_mCategoryId, (int) $_POST['product_id']))); } else { $product_locations = Catalog::GetProductLocations((int) $_POST['product_id']); if (count($product_locations) > 0) { $department_id = $product_locations[0]['department_id']; $category_id = $product_locations[0]['category_id']; header('Location: ' . htmlspecialchars_decode(Link::ToProductAdmin($department_id, $category_id, (int) $_POST['product_id']))); } } } /* If searching the catalog, get the list of products by calling the Search business tier method */ if (isset($this->mSearchString)) { // Get search results $search_results = Catalog::Search($this->mSearchString, $this->mAllWords, $this->mPage, $this->mrTotalPages); // Get the list of products $this->mProducts = $search_results['products']; // Build the title for the list of products if (count($search_results['accepted_words']) > 0) { $this->mSearchDescription = '<p class="description">Products containing <font class="words">' . ($this->mAllWords == 'on' ? 'all' : 'any') . '</font>' . ' of these words: <font class="words">' . implode(', ', $search_results['accepted_words']) . '</font></p>'; } if (count($search_results['ignored_words']) > 0) { $this->mSearchDescription .= '<p class="description">Ignored words: <font class="words">' . implode(', ', $search_results['ignored_words']) . '</font></p>'; } if (!(count($search_results['products']) > 0)) { $this->mSearchDescription .= '<p class="description">Your search generated no results.</p>'; } } elseif (isset($this->_mCategoryId)) { $this->mProducts = Catalog::GetProductsInCategory($this->_mCategoryId, $this->mPage, $this->mrTotalPages); } elseif (isset($this->_mDepartmentId)) { $this->mProducts = Catalog::GetProductsOnDepartment($this->_mDepartmentId, $this->mPage, $this->mrTotalPages); } else { $this->mProducts = Catalog::GetProductsOnCatalog($this->mPage, $this->mrTotalPages); } /* If there are subpages of products, display navigation controls */ if ($this->mrTotalPages > 1) { // Build the Next link if ($this->mPage < $this->mrTotalPages) { if (isset($_GET['SearchResults'])) { $this->mLinkToNextPage = Link::ToSearchResults($this->mSearchString, $this->mAllWords, $this->mPage + 1); } elseif (isset($this->_mCategoryId)) { $this->mLinkToNextPage = Link::ToCategory($this->_mDepartmentId, $this->_mCategoryId, $this->mPage + 1); } elseif (isset($this->_mDepartmentId)) { $this->mLinkToNextPage = Link::ToDepartment($this->_mDepartmentId, $this->mPage + 1); } else { $this->mLinkToNextPage = Link::ToIndex($this->mPage + 1); } } // Build the Previous link if ($this->mPage > 1) { if (isset($_GET['SearchResults'])) { $this->mLinkToPreviousPage = Link::ToSearchResults($this->mSearchString, $this->mAllWords, $this->mPage - 1); } elseif (isset($this->_mCategoryId)) { $this->mLinkToPreviousPage = Link::ToCategory($this->_mDepartmentId, $this->_mCategoryId, $this->mPage - 1); } elseif (isset($this->_mDepartmentId)) { $this->mLinkToPreviousPage = Link::ToDepartment($this->_mDepartmentId, $this->mPage - 1); } else { $this->mLinkToPreviousPage = Link::ToIndex($this->mPage - 1); } } // Build the pages links for ($i = 1; $i <= $this->mrTotalPages; $i++) { if (isset($_GET['SearchResults'])) { $this->mProductListPages[] = Link::ToSearchResults($this->mSearchString, $this->mAllWords, $i); } elseif (isset($this->_mCategoryId)) { $this->mProductListPages[] = Link::ToCategory($this->_mDepartmentId, $this->_mCategoryId, $i); } elseif (isset($this->_mDepartmentId)) { $this->mProductListPages[] = Link::ToDepartment($this->_mDepartmentId, $i); } else { $this->mProductListPages[] = Link::ToIndex($i); } } } /* 404 redirect if the page number is larger than the total number of pages */ if ($this->mPage > $this->mrTotalPages && !empty($this->mrTotalPages)) { // Clean output buffer ob_clean(); // Load the 404 page include '404.php'; // Clear the output buffer and stop execution flush(); ob_flush(); ob_end_clean(); exit; } // Build links for product details pages for ($i = 0; $i < count($this->mProducts); $i++) { $this->mProducts[$i]['link_to_product'] = Link::ToProduct($this->mProducts[$i]['product_id']); if ($this->mProducts[$i]['thumbnail']) { $this->mProducts[$i]['thumbnail'] = Link::Build('images/product_images/' . $this->mProducts[$i]['thumbnail']); } // Create the Add to Cart link $this->mProducts[$i]['link_to_add_product'] = Link::ToCart(ADD_PRODUCT, $this->mProducts[$i]['product_id']); $this->mProducts[$i]['attributes'] = Catalog::GetProductAttributes($this->mProducts[$i]['product_id']); } }