public static function getCategories($cfilter, $cgformat)
 {
     global $lC_Database, $lC_Datetime, $lC_Language;
     // generate file name to use with this file
     $datetime = '';
     // lC_Datetime::getTimestamp();
     $filename = 'categories';
     // . '-' . $datetime;
     if ($cgformat == 'tabbed') {
         $filename = $filename . '.txt';
         $delim = "\t";
         $seperator = ",";
     } else {
         if ($cgformat == 'csv') {
             $filename = $filename . '.' . $pgformat;
             $delim = ",";
             $seperator = ",";
         } else {
             return false;
         }
     }
     $filepath = DIR_FS_DOWNLOAD . $filename;
     // make columns in clude full table names to i can implode into sql statement
     // add image and category and other product tables to columns and query
     $sql_columns = array('c.categories_id', 'c.categories_image', 'c.parent_id', 'c.sort_order', 'c.categories_mode', 'c.categories_link_target', 'c.categories_custom_url', 'c.categories_status', 'c.categories_visibility_nav', 'c.categories_visibility_box', 'c.date_added', 'cd.language_id', 'cd.categories_name', 'cd.categories_menu_name', 'cd.categories_blurb', 'cd.categories_description', 'cd.categories_keyword', 'cd.categories_tags');
     $columns = array('id', 'image', 'parent_id', 'sort_order', 'mode', 'link_target', 'custom_url', 'status', 'visibility_nav', 'visibility_box', 'date_added', 'language_id', 'name', 'menu_name', 'blurb', 'description', 'keyword', 'tags');
     $sql_columns = implode(",", $sql_columns);
     $sql_statement = 'SELECT ' . $sql_columns . ' FROM :table_categories c, :table_categories_description cd WHERE cd.categories_id = c.categories_id';
     $errormsg = '';
     // make this section get the data and make a file in work folder for the url to be returned.
     $Qcategories = $lC_Database->query($sql_statement);
     $Qcategories->bindTable(':table_categories', TABLE_CATEGORIES);
     $Qcategories->bindTable(':table_categories_description', TABLE_CATEGORIES_DESCRIPTION);
     $Qcategories->execute();
     if ($lC_Database->isError()) {
         $errormsg .= $lC_Database->getError();
     }
     $categories = array();
     while ($Qcategories->next()) {
         $categories[] = $Qcategories->toArray();
     }
     // seperate out all categories and images and comma delimited columns
     $content = '';
     foreach ($categories as $category) {
         $category['date_added'] = lC_Datetime::getShort($category['date_added']);
         foreach ($category as $column_output) {
             $content .= trim(preg_replace('/\\s+/', ' ', $column_output)) . $delim;
         }
         $content .= "\n";
     }
     $fp = fopen($filepath, "wb");
     fwrite($fp, implode($delim, $columns) . "\n" . $content);
     fclose($fp);
     return array('filename' => $filename, 'sql_statement' => $sql_statement, 'errors' => $errormsg);
 }
 $output = '';
 $show_price = true;
 $show_buy_now = true;
 while ($Qlisting->next()) {
     // VQMOD-hookpoint; DO NOT MODIFY OR REMOVE THE LINE BELOW
     $lC_Product = new lC_Product($Qlisting->valueInt('products_id'));
     if (utility::isB2B() && $lC_Customer->isLoggedOn() === false) {
         $access = defined('B2B_SETTINGS_GUEST_CATALOG_ACCESS') && B2B_SETTINGS_GUEST_CATALOG_ACCESS > 0 ? (int) B2B_SETTINGS_GUEST_CATALOG_ACCESS : 0;
         if ($access < 66) {
             $show_price = false;
         }
         if ($access < 99) {
             $show_buy_now = false;
         }
     }
     if (strtotime($lC_Product->getDateAvailable()) <= strtotime(lC_Datetime::getShort())) {
         $output .= '<div class="product-listing-module-items">';
         for ($col = 0, $n = sizeof($column_list); $col < $n; $col++) {
             switch ($column_list[$col]) {
                 case 'PRODUCT_LIST_MODEL':
                     $output .= '<div class="product-listing-module-model">' . $lC_Product->getModel() . '</div>' . "\n";
                     break;
                 case 'PRODUCT_LIST_NAME':
                     if (isset($_GET['manufacturers'])) {
                         $output .= '<div class="product-listing-module-name">' . lc_link_object(lc_href_link(FILENAME_PRODUCTS, $lC_Product->getKeyword() . '&manufacturers=' . $_GET['manufacturers']), $lC_Product->getTitle()) . '</div>' . "\n" . '<div class="product-listing-module-description">' . lc_clean_html($lC_Product->getBlurb()) . '</div>' . "\n";
                     } else {
                         $output .= '<div class="product-listing-module-name">' . lc_link_object(lc_href_link(FILENAME_PRODUCTS, $lC_Product->getKeyword() . ($cPath ? '&cPath=' . $cPath : '')), $lC_Product->getTitle()) . '</div>' . "\n" . '<div class="product-listing-module-description">' . lc_clean_html($lC_Product->getBlurb()) . '</div>' . "\n";
                     }
                     break;
                 case 'PRODUCT_LIST_MANUFACTURER':
                     if ($lC_Product->hasManufacturer()) {
Example #3
0
 public function lC_Products_Products()
 {
     global $lC_Database, $lC_Services, $lC_Session, $lC_Language, $lC_Breadcrumb, $lC_Product, $lC_Image, $lC_Currencies, $cPath_array;
     $template_code = isset($_SESSION['template']['code']) && $_SESSION['template']['code'] != NULL ? $_SESSION['template']['code'] : 'core';
     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 ($id !== false && lC_Product::checkEntry($id)) {
             $lC_Product = new lC_Product($id);
             $lC_Product->incrementCounter();
             if (strtotime($lC_Product->getDateAvailable()) <= strtotime(lC_Datetime::getShort())) {
                 $this->addPageTags('description', substr(strip_tags($lC_Product->getDescription()), 0, 300));
                 $this->addPageTags('keywords', $lC_Product->getTitle());
                 $this->addPageTags('keywords', $lC_Product->getModel());
                 if ($lC_Product->hasTags()) {
                     $this->addPageTags('keywords', $lC_Product->getTags());
                 }
                 $this->addOGPTags('type', 'product');
                 $this->addOGPTags('title', $lC_Product->getTitle() . ' ' . $lC_Product->getModel());
                 $this->addOGPTags('description', $lC_Currencies->displayPrice($lC_Product->getPrice(), $lC_Product->getTaxClassID()) . ' - ' . $lC_Product->getTitle() . ' ' . lc_clean_html($lC_Product->getDescription()));
                 $this->addOGPTags('url', lc_href_link(FILENAME_PRODUCTS, $lC_Product->getKeyword(), 'NONSSL', false, true, true));
                 $this->addOGPTags('image', HTTP_SERVER . DIR_WS_CATALOG . 'templates/' . $template_code . '/images/logo.png');
                 $this->addOGPTags('image', HTTP_SERVER . DIR_WS_CATALOG . $lC_Image->getAddress($lC_Product->getImage(), 'large'));
                 if ($lC_Product->getImages() != '') {
                     foreach ($lC_Product->getImages() as $key => $value) {
                         if ($value['default_flag'] == true) {
                             continue;
                         }
                         if (file_exists(DIR_FS_CATALOG . $lC_Image->getAddress($value['image'], 'popup'))) {
                             $this->addOGPTags('image', HTTP_SERVER . DIR_WS_CATALOG . $lC_Image->getAddress($value['image'], 'large'));
                         }
                     }
                 }
                 lC_Services_category_path::process($lC_Product->getCategoryID());
                 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 ($lC_Services->isStarted('breadcrumb')) {
                     if (isset($_GET['cPath']) && $_GET['cPath'] != '') {
                         $path = $_GET['cPath'];
                     } else {
                         $path = implode("_", $cPath_array);
                     }
                     $lC_Breadcrumb->add($lC_Product->getTitle(), lc_href_link(FILENAME_PRODUCTS, $lC_Product->getKeyword()), $path);
                 }
                 $this->_page_title = $lC_Product->getTitle();
             } else {
                 $this->_page_title = $lC_Language->get('product_not_found_heading');
                 $this->_page_contents = 'info_not_available.php';
             }
         } else {
             $this->_page_title = $lC_Language->get('product_not_found_heading');
             $this->_page_contents = 'info_not_found.php';
         }
     } else {
         $this->_page_title = $lC_Language->get('product_not_found_heading');
         $this->_page_contents = 'info_not_found.php';
     }
 }