Exemplo n.º 1
0
 /**
  * Adds an entry to the breadcrumb navigation path
  *
  * @param string  $title  The title of the breadcrumb navigation entry
  * @param string  $link   The link of the breadcrumb navigation entry
  * @param string  $cPath  The cPath used to prefix the breadcrumb
  * @access public
  */
 public function add($title, $link = null, $cPath = null)
 {
     global $lC_Category;
     if ($cPath != null) {
         $cPathArr = explode('_', $cPath);
         $cp = '';
         foreach ($cPathArr as $id) {
             $lC_Category = new lC_Category($id);
             $this->_path[] = lc_link_object(lc_href_link(FILENAME_DEFAULT, 'cPath=' . $cp . $id), $lC_Category->getTitle($id));
             $cp .= $id . '_';
         }
     }
     if (!empty($link)) {
         $title = lc_link_object($link, $title);
     }
     if (!empty($title)) {
         $this->_path[] = $title;
     }
 }
Exemplo n.º 2
0
 public function lC_Index_Index()
 {
     global $lC_Database, $lC_Services, $lC_Language, $lC_Breadcrumb, $cPath, $cPath_array, $current_category_id, $lC_CategoryTree, $lC_Category, $lC_Session;
     $this->_page_title = sprintf($lC_Language->get('index_heading'), STORE_NAME);
     $template_code = isset($_SESSION['template']['code']) && $_SESSION['template']['code'] != NULL ? $_SESSION['template']['code'] : 'core';
     // attempting to match categories url capability to get data from permalink
     if (empty($_GET) === false) {
         $id = false;
         // PHP < 5.0.2; array_slice() does not preserve keys and will not work with numerical key values, so foreach() is used
         foreach ($_GET as $key => $value) {
             $key = end(explode("/", $key));
             if ((preg_match('/^[0-9]+(#?([0-9]+:?[0-9]+)+(;?([0-9]+:?[0-9]+)+)*)*$/', $key) || preg_match('/^[a-zA-Z0-9 -_]*$/', $key)) && $key != $lC_Session->getName()) {
                 $id = $key;
             }
             break;
         }
     }
     if (empty($cPath_array) && $_GET['cPath'] == '' && isset($lC_Services) && $lC_Services->isStarted('seo')) {
         foreach ($_GET as $cats => $values) {
             $cats = explode("/", $cats);
             foreach ($cats as $cat) {
                 $Qcid = $lC_Database->query('select item_id from :table_permalinks where permalink = :permalink and type = 1 and language_id = :language_id');
                 $Qcid->bindTable(':table_permalinks', TABLE_PERMALINKS);
                 $Qcid->bindValue(':permalink', $cat);
                 $Qcid->bindInt(':language_id', $lC_Language->getID());
                 $Qcid->execute();
                 $cPath_array[] = $Qcid->valueInt('item_id');
             }
         }
     }
     if (isset($lC_Services) && $lC_Services->isStarted('seo') && $_GET['cpath'] == '') {
         $id = $lC_CategoryTree->getID($id);
         $cData = $lC_CategoryTree->getData($id);
         $cPath = end(explode("_", $cData['query']));
         $current_category_id = $cData['item_id'];
     } else {
         $cPath = $_GET['cPath'];
     }
     if (isset($cPath) && empty($cPath) === false) {
         if ($lC_Services->isStarted('breadcrumb')) {
             $Qcategories = $lC_Database->query('select categories_id, categories_name from :table_categories_description where categories_id in (:categories_id) and language_id = :language_id');
             $Qcategories->bindTable(':table_categories_description', TABLE_CATEGORIES_DESCRIPTION);
             $Qcategories->bindTable(':categories_id', implode(',', $cPath_array));
             $Qcategories->bindInt(':language_id', $lC_Language->getID());
             $Qcategories->execute();
             $categories = array();
             while ($Qcategories->next()) {
                 $categories[$Qcategories->value('categories_id')] = $Qcategories->valueProtected('categories_name');
             }
             $Qcategories->freeResult();
             if ($lC_Services->isStarted('breadcrumb')) {
                 if (isset($_GET['cPath']) && $_GET['cPath'] != '') {
                     $path = $_GET['cPath'];
                 } else {
                     $path = implode("_", $cPath_array);
                 }
                 $lC_Breadcrumb->add(null, null, $path);
             }
         }
         $lC_Category = new lC_Category($current_category_id);
         // added to check for category status and show not found page
         if ($lC_CategoryTree->getStatus($current_category_id) == 1) {
             // categry is enabled move on
             $this->_page_title = $lC_Category->getTitle();
             if ($lC_Category->hasImage()) {
                 $this->_page_image = 'categories/' . $lC_Category->getImage();
             }
             $Qproducts = $lC_Database->query('select products_id from :table_products_to_categories where categories_id = :categories_id limit 1');
             $Qproducts->bindTable(':table_products_to_categories', TABLE_PRODUCTS_TO_CATEGORIES);
             $Qproducts->bindInt(':categories_id', $current_category_id);
             $Qproducts->execute();
             if ($Qproducts->numberOfRows() > 0) {
                 $this->_page_contents = 'product_listing.php';
                 $this->_process();
             } else {
                 $Qparent = $lC_Database->query('select categories_id from :table_categories where parent_id = :parent_id limit 1');
                 $Qparent->bindTable(':table_categories', TABLE_CATEGORIES);
                 $Qparent->bindInt(':parent_id', $current_category_id);
                 $Qparent->execute();
                 // VQMOD-hookpoint; DO NOT MODIFY OR REMOVE THE LINE BELOW
                 $this->_page_contents = 'category_listing.php';
                 $this->_process();
             }
             // ogp tags
             $this->addOGPTags('site_name', STORE_NAME);
             $this->addOGPTags('type', 'website');
             $this->addOGPTags('title', $this->_page_title);
             $this->addOGPTags('description', $this->_page_title);
             $this->addOGPTags('url', lc_href_link(FILENAME_DEFAULT, 'cPath=' . $_GET['cPath'], 'NONSSL', false, true, true));
             $this->addOGPTags('image', HTTP_SERVER . DIR_WS_CATALOG . 'templates/' . $template_code . '/images/logo.png');
             if ($lC_Category->hasImage()) {
                 $this->addOGPTags('image', HTTP_SERVER . DIR_WS_CATALOG . DIR_WS_IMAGES . $this->_page_image);
             }
         } else {
             // category is disabled, show not found content
             $this->_page_contents = 'category_not_found.php';
         }
     } else {
         $this->addOGPTags('site_name', STORE_NAME);
         $this->addOGPTags('type', 'website');
         $this->addOGPTags('title', $this->_page_title);
         $this->addOGPTags('description', lC_Template::getBranding('meta_description') != '' ? lC_Template::getBranding('meta_description') : $this->_page_title);
         $this->addOGPTags('url', lc_href_link(FILENAME_DEFAULT, '', 'NONSSL', false, true, true));
         if ($this->getBranding('og_image') && $this->getBranding('og_image') != 'no_image.png') {
             $this->addOGPTags('image', HTTP_SERVER . DIR_WS_CATALOG . DIR_WS_IMAGES . 'branding/' . $this->getBranding('og_image'));
         } else {
             $this->addOGPTags('image', HTTP_SERVER . DIR_WS_CATALOG . DIR_WS_IMAGES . 'no_image.png');
         }
     }
 }
Exemplo n.º 3
0
 public function getCategories()
 {
     $history = array();
     if (isset($this->visits['categories']) && empty($this->visits['categories']) === false) {
         $counter = 0;
         foreach ($this->visits['categories'] as $k => $v) {
             $counter++;
             $lC_Category = new lC_Category($v['id']);
             if ($lC_Category->hasParent()) {
                 $lC_CategoryParent = new lC_Category($lC_Category->getParent());
             }
             $history[] = array('id' => $lC_Category->getID(), 'name' => $lC_Category->getTitle(), 'path' => $lC_Category->getPath(), 'image' => $lC_Category->getImage(), 'parent_name' => $lC_Category->hasParent() ? $lC_CategoryParent->getTitle() : '', 'parent_id' => $lC_Category->hasParent() ? $lC_CategoryParent->getID() : '');
             if ($counter == SERVICE_RECENTLY_VISITED_MAX_CATEGORIES) {
                 break;
             }
         }
     }
     return $history;
 }