示例#1
0
 function osC_Index_Index()
 {
     global $osC_Database, $osC_Services, $osC_Language, $osC_Breadcrumb, $cPath, $cPath_array, $current_category_id, $osC_Category;
     $this->_page_title = sprintf($osC_Language->get('index_heading'), STORE_NAME);
     if (isset($cPath) && empty($cPath) === false) {
         if ($osC_Services->isStarted('breadcrumb')) {
             $Qcategories = $osC_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', $osC_Language->getID());
             $Qcategories->execute();
             $categories = array();
             while ($Qcategories->next()) {
                 $categories[$Qcategories->value('categories_id')] = $Qcategories->valueProtected('categories_name');
             }
             $Qcategories->freeResult();
             for ($i = 0, $n = sizeof($cPath_array); $i < $n; $i++) {
                 $osC_Breadcrumb->add($categories[$cPath_array[$i]], osc_href_link(FILENAME_DEFAULT, 'cPath=' . implode('_', array_slice($cPath_array, 0, $i + 1))));
             }
         }
         $osC_Category = new osC_Category($current_category_id);
         $this->_page_title = $osC_Category->getTitle();
         if ($osC_Category->hasImage()) {
             $this->_page_image = 'categories/' . $osC_Category->getImage();
         }
         $Qproducts = $osC_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 = $osC_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();
             if ($Qparent->numberOfRows() > 0) {
                 $this->_page_contents = 'category_listing.php';
             } else {
                 $this->_page_contents = 'product_listing.php';
                 $this->_process();
             }
         }
     }
 }
 function getCategories()
 {
     $history = array();
     if (isset($this->visits['categories']) && empty($this->visits['categories']) === false) {
         $counter = 0;
         foreach ($this->visits['categories'] as $k => $v) {
             $counter++;
             $osC_Category = new osC_Category($v['id']);
             if ($osC_Category->hasParent()) {
                 $osC_CategoryParent = new osC_Category($osC_Category->getParent());
             }
             $history[] = array('id' => $osC_Category->getID(), 'name' => $osC_Category->getTitle(), 'path' => $osC_Category->getPath(), 'image' => $osC_Category->getImage(), 'parent_name' => $osC_Category->hasParent() ? $osC_CategoryParent->getTitle() : '', 'parent_id' => $osC_Category->hasParent() ? $osC_CategoryParent->getID() : '');
             if ($counter == SERVICE_RECENTLY_VISITED_MAX_CATEGORIES) {
                 break;
             }
         }
     }
     return $history;
 }
示例#3
0
 function osC_Index_Index()
 {
     global $osC_Database, $osC_Services, $osC_Language, $breadcrumb, $cPath, $cPath_array, $current_category_id, $osC_Category;
     $this->_page_title = sprintf($osC_Language->get('index_heading'), STORE_NAME);
     if (isset($cPath) && empty($cPath) === false) {
         if ($osC_Services->isStarted('breadcrumb')) {
             $Qcategories = $osC_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->bindRaw(':categories_id', implode(',', $cPath_array));
             $Qcategories->bindInt(':language_id', $osC_Language->getID());
             $Qcategories->execute();
             $categories = array();
             while ($Qcategories->next()) {
                 $categories[$Qcategories->value('categories_id')] = $Qcategories->valueProtected('categories_name');
             }
             $Qcategories->freeResult();
             for ($i = 0, $n = sizeof($cPath_array); $i < $n; $i++) {
                 $breadcrumb->add($categories[$cPath_array[$i]], osc_href_link(FILENAME_DEFAULT, 'cPath=' . implode('_', array_slice($cPath_array, 0, $i + 1))));
             }
         }
         $osC_Category = new osC_Category($current_category_id);
         $this->_page_title = $osC_Category->getTitle();
         $this->_page_image = 'categories/' . $osC_Category->getImage();
         $page_title = $osC_Category->getPageTitle();
         if (!empty($page_title)) {
             $this->setMetaPageTitle($page_title);
         }
         $meta_keywords = $osC_Category->getMetaKeywords();
         if (!empty($meta_keywords)) {
             $this->addPageTags('keywords', $meta_keywords);
         }
         $meta_description = $osC_Category->getMetaDescription();
         if (!empty($meta_description)) {
             $this->addPageTags('description', $meta_description);
         }
         $Qproducts = $osC_Database->query('select p.products_id from :table_products_to_categories ptc left join :table_products p on ptc.products_id = p.products_id where p.products_status = 1 and categories_id = :categories_id limit 1');
         $Qproducts->bindTable(':table_products_to_categories', TABLE_PRODUCTS_TO_CATEGORIES);
         $Qproducts->bindTable(':table_products', TABLE_PRODUCTS);
         $Qproducts->bindInt(':categories_id', $current_category_id);
         $Qproducts->execute();
         if ($Qproducts->numberOfRows() > 0) {
             $this->_page_contents = 'product_listing.php';
             $this->_process();
         } else {
             $Qparent = $osC_Database->query('select categories_id from :table_categories where categories_status = 1 and parent_id = :parent_id limit 1');
             $Qparent->bindTable(':table_categories', TABLE_CATEGORIES);
             $Qparent->bindInt(':parent_id', $current_category_id);
             $Qparent->execute();
             if ($Qparent->numberOfRows() > 0) {
                 $this->_page_contents = 'category_listing.php';
             } else {
                 $this->_page_contents = 'product_listing.php';
                 $this->_process();
             }
         }
     } else {
         $code = strtoupper($osC_Language->getCode());
         if (defined('HOME_META_KEYWORD_' . $code) && defined('HOME_META_DESCRIPTION_' . $code) && defined('HOME_PAGE_TITLE_' . $code)) {
             $page_title = constant('HOME_PAGE_TITLE_' . $code);
             $meta_keywords = constant('HOME_META_KEYWORD_' . $code);
             $meta_description = constant('HOME_META_DESCRIPTION_' . $code);
         }
         if (!empty($page_title)) {
             $this->setMetaPageTitle($page_title);
         }
         if (!empty($meta_keywords)) {
             $this->addPageTags('keywords', $meta_keywords);
         }
         if (!empty($meta_description)) {
             $this->addPageTags('description', $meta_description);
         }
     }
 }