public function initialize() { global $lC_Database, $lC_Language, $lC_Currencies, $lC_Image; if (MODULE_CONTENT_FEATURED_PRODUCTS_MAX_DISPLAY > 0) { $limit = ' limit ' . MODULE_CONTENT_FEATURED_PRODUCTS_MAX_DISPLAY; } $Qfeatured = $lC_Database->query('select products_id from :table_featured_products where (str_to_date(expires_date, "%Y-%m-%d") >= str_to_date(now(), "%Y-%m-%d") or expires_date = "0000-00-00 00:00:00") and status = 1 order by rand() asc' . $limit); $Qfeatured->bindTable(':table_featured_products', TABLE_FEATURED_PRODUCTS); $Qfeatured->bindInt(':max_display_featured_products', MODULE_CONTENT_FEATURED_PRODUCTS_MAX_DISPLAY); $Qfeatured->execute(); if (MODULE_CONTENT_FEATURED_PRODUCTS_CACHE > 0) { $Qfeatured->setCache('featured_products-' . $lC_Language->getCode() . '-' . $lC_Currencies->getCode(), MODULE_CONTENT_FEATURED_PRODUCTS_CACHE); } if ($Qfeatured->numberOfRows() > 0) { $this->_content = ''; while ($Qfeatured->next()) { // VQMOD-hookpoint; DO NOT MODIFY OR REMOVE THE LINE BELOW $lC_Product = new lC_Product($Qfeatured->valueInt('products_id')); $this->_content .= '<div class="content-featured-products-container">' . "\n" . ' <div class="content-featured-products-name">' . lc_link_object(lc_href_link(FILENAME_PRODUCTS, $lC_Product->getKeyword()), $lC_Product->getTitle()) . '</div>' . "\n"; if ($lC_Product->hasImage()) { $this->_content .= ' <div class="content-featured-products-image">' . lc_link_object(lc_href_link(FILENAME_PRODUCTS, $lC_Product->getKeyword()), $lC_Image->show($lC_Product->getImage(), $lC_Product->getTitle(), 'class="content-featured-products-image-src"')) . '</div>' . "\n"; } $this->_content .= ' <div class="content-featured-products-desc">' . substr(lc_clean_html($lC_Product->getDescription()), 0, 62) . '...</div>' . "\n" . ' <div class="content-featured-products-price pricing-row">' . $lC_Product->getPriceFormated(true) . '</div>' . "\n" . ' <div class="content-featured-products-button pricing-row buy-btn-div"><button class="content-featured-products-add-button" onclick="window.location.href=\'' . lc_href_link(FILENAME_PRODUCTS, $lC_Product->getKeyword() . '&action=cart_add') . '\'" type="button">' . $lC_Language->get('new_products_button_buy_now') . '</button></div>' . "\n" . '</div>' . "\n"; } } $Qfeatured->freeResult(); }
function execute() { global $lC_Database, $lC_Session, $lC_NavigationHistory, $lC_Customer; if (!$lC_Customer->isLoggedOn()) { $lC_NavigationHistory->setSnapshot(); lc_redirect(lc_href_link(FILENAME_ACCOUNT, 'login', 'SSL')); return false; } $id = false; foreach ($_GET as $key => $value) { 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); $Qcheck = $lC_Database->query('select products_id from :table_products_notifications where customers_id = :customers_id and products_id = :products_id limit 1'); $Qcheck->bindTable(':table_products_notifications', TABLE_PRODUCTS_NOTIFICATIONS); $Qcheck->bindInt(':customers_id', $lC_Customer->getID()); $Qcheck->bindInt(':products_id', $lC_Product->getID()); $Qcheck->execute(); if ($Qcheck->numberOfRows() > 0) { $Qn = $lC_Database->query('delete from :table_products_notifications where customers_id = :customers_id and products_id = :products_id'); $Qn->bindTable(':table_products_notifications', TABLE_PRODUCTS_NOTIFICATIONS); $Qn->bindInt(':customers_id', $lC_Customer->getID()); $Qn->bindInt(':products_id', $lC_Product->getID()); $Qn->execute(); } } lc_redirect(lc_href_link(basename($_SERVER['SCRIPT_FILENAME']), lc_get_all_get_params(array('action')))); }
public function initialize() { global $lC_Cache, $lC_Database, $lC_Services, $lC_Currencies, $lC_Specials, $lC_Language, $lC_Image; $this->_title_link = lc_href_link(FILENAME_PRODUCTS, 'new'); $data = array(); if ($lC_Cache->isEnabled() && BOX_WHATS_NEW_CACHE > 0 && $lC_Cache->read('box-whats_new-' . $lC_Language->getCode() . '-' . $lC_Currencies->getCode(), BOX_WHATS_NEW_CACHE)) { $data = $lC_Cache->getCache(); } else { $Qnew = $lC_Database->query('select products_id from :table_products where products_status = :products_status order by products_date_added desc limit :max_random_select_new'); $Qnew->bindTable(':table_products', TABLE_PRODUCTS); $Qnew->bindInt(':products_status', 1); $Qnew->bindInt(':max_random_select_new', BOX_WHATS_NEW_RANDOM_SELECT); $Qnew->executeRandomMulti(); if ($Qnew->numberOfRows()) { // VQMOD-hookpoint; DO NOT MODIFY OR REMOVE THE LINE BELOW $lC_Product = new lC_Product($Qnew->valueInt('products_id')); $data = $lC_Product->getData(); $data['display_price'] = $lC_Product->getPriceFormated(true); $data['display_image'] = $lC_Product->getImage(); } if ($lC_Cache->isEnabled()) { $lC_Cache->write($data); } } if (!empty($data)) { $this->_content = ''; if (empty($data['display_image']) === false) { $this->_content = '<li class="box-whats-new-image"><div class="thumbnail">' . lc_link_object(lc_href_link(FILENAME_PRODUCTS, $data['keyword']), $lC_Image->show($data['display_image'], $data['name'], 'class="box-whats-new-image-src"')) . '</div></li>'; } $this->_content .= '<li class="box-whats-new-name">' . lc_link_object(lc_href_link(FILENAME_PRODUCTS, $data['keyword']), $data['name']) . '</li>'; $this->_content .= '<li class="box-whats-new-price pricing-row">' . $data['display_price'] . '</li>'; $this->_content .= '<li class="box-whats-new-buy-now pricing-row buy-btn-div"><button onclick="window.location.href=\'' . lc_href_link(FILENAME_PRODUCTS, $data['keyword'] . '&action=cart_add') . '\'" title="" type="button">' . $lC_Language->get('button_buy_now') . '</button>'; } }
public function initialize() { global $lC_Product; if (defined('MODULE_CONTENT_PRODUCT_ON_HOMEPAGE')) { $lC_Product = new lC_Product(MODULE_CONTENT_PRODUCT_ON_HOMEPAGE); $product_url = HTTP_SERVER . DIR_WS_HTTP_CATALOG . 'products.php?' . $lC_Product->getKeyword(); $resultHTML = transport::getResponse(array('url' => $product_url, 'method' => 'get')); $content = substr($resultHTML, strpos($resultHTML, '<!--content/products/info.php start')); $this->_content = substr($content, strpos($content, '<!--content/products/info.php start'), strpos($content, 'content/products/info.php end-->') + 32); } }
public static function getPriceInfo() { global $lC_Product; if (!isset($lC_Product)) { $lC_Product = new lC_Product($_GET['id']); } $result = $lC_Product->getPriceInfo($_GET['id'], $_GET['group'], $_GET); if ($result !== false) { $result['rpcStatus'] = RPC_STATUS_SUCCESS; } echo json_encode($result); }
public function initialize() { global $lC_Database, $lC_Language, $lC_Currencies, $lC_Image; $Qupcoming = $lC_Database->query('select p.products_id, pa.value as date_expected from :table_products p, :table_templates_boxes tb, :table_product_attributes pa where tb.code = :code and tb.id = pa.id and to_days(str_to_date(pa.value, "%m/%d/%Y")) >= to_days(now()) and pa.products_id = p.products_id and p.products_status = :products_status order by pa.value limit :max_display_upcoming_products'); $Qupcoming->bindTable(':table_products', TABLE_PRODUCTS); $Qupcoming->bindTable(':table_templates_boxes', TABLE_TEMPLATES_BOXES); $Qupcoming->bindTable(':table_product_attributes', TABLE_PRODUCT_ATTRIBUTES); $Qupcoming->bindValue(':code', 'date_available'); $Qupcoming->bindInt(':products_status', 1); $Qupcoming->bindInt(':max_display_upcoming_products', MODULE_CONTENT_UPCOMING_PRODUCTS_MAX_DISPLAY); if (MODULE_CONTENT_UPCOMING_PRODUCTS_CACHE > 0) { $Qupcoming->setCache('upcoming_products-' . $lC_Language->getCode() . '-' . $lC_Currencies->getCode(), MODULE_CONTENT_UPCOMING_PRODUCTS_CACHE); } $Qupcoming->execute(); if ($Qupcoming->numberOfRows() > 0) { $this->_content = ''; while ($Qupcoming->next()) { // VQMOD-hookpoint; DO NOT MODIFY OR REMOVE THE LINE BELOW $lC_Product = new lC_Product($Qupcoming->valueInt('products_id')); $this->_content .= '<div class="content-upcoming-products-container">' . "\n" . '<div class="content-upcoming-products-name">' . lc_link_object(lc_href_link(FILENAME_PRODUCTS, $lC_Product->getKeyword()), $lC_Product->getTitle()) . '</div>' . "\n"; if ($lC_Product->hasImage()) { $this->_content .= '<div class="content-upcoming-products-image">' . lc_link_object(lc_href_link(FILENAME_PRODUCTS, $lC_Product->getKeyword()), $lC_Image->show($lC_Product->getImage(), $lC_Product->getTitle(), 'class="content-upcoming-products-image-src"', 'small')) . '</div>' . "\n"; } $this->_content .= '<div class="content-upcoming-products-price pricing-row">' . $lC_Product->getPriceFormated(true) . '</div>' . "\n" . '<div class="content-upcoming-products-date">' . $Qupcoming->value('date_expected') . '</div>' . "\n" . '</div>' . "\n"; } } $Qupcoming->freeResult(); }
public function initialize() { global $lC_Services, $lC_RecentlyVisited, $lC_Language, $lC_Image, $lC_Product; if ($lC_Services->isStarted('recently_visited') && $lC_RecentlyVisited->hasHistory()) { $this->_content = ''; if ($lC_RecentlyVisited->hasProducts()) { foreach ($lC_RecentlyVisited->getProducts() as $product) { // VQMOD-hookpoint; DO NOT MODIFY OR REMOVE THE LINE BELOW $lC_Product = new lC_Product($product['id']); $this->_content .= '<div class="content-recently-visited-container">' . "\n" . ' <div class="content-recently-visited-name">' . lc_link_object(lc_href_link(FILENAME_PRODUCTS, $lC_Product->getKeyword()), $lC_Product->getTitle()) . '</div>' . "\n"; if ($lC_Product->hasImage()) { $this->_content .= '<div class="content-recently-visited-image">' . (SERVICE_RECENTLY_VISITED_SHOW_PRODUCT_IMAGES == '1' ? lc_link_object(lc_href_link(FILENAME_PRODUCTS, $lC_Product->getKeyword()), $lC_Image->show($lC_Product->getImage(), $lC_Product->getTitle(), 'class="content-recently-visited-image-src"', 'small')) : NULL) . '</div>' . "\n"; } $this->_content .= ' <div class="content-recently-visited-price pricing-row">' . $lC_Product->getPriceFormated(true) . '</div>' . "\n" . ' <div class="content-recently-visited-from">' . sprintf($lC_Language->get('recently_visited_item_in_category'), lc_link_object(lc_href_link(FILENAME_DEFAULT, 'cPath=' . $product['category_path']), $product['category_name'])) . '</div>' . "\n" . '</div>' . "\n"; } } if ($lC_RecentlyVisited->hasCategories()) { foreach ($lC_RecentlyVisited->getCategories() as $category) { // VQMOD-hookpoint; DO NOT MODIFY OR REMOVE THE LINE BELOW if (!empty($category['parent_id'])) { $this->_content .= '<div class="content-recently-visited-container">' . "\n" . ' <div class="content-recently-visited-name">' . sprintf($lC_Language->get('recently_visited_item_in_category'), lc_link_object(lc_href_link(FILENAME_DEFAULT, 'cPath=' . $product['category_path']), $product['category_name'])) . '</div>' . "\n"; if (isset($category['image']) && empty($category['image']) === false) { $this->_content .= '<div class="content-recently-visited-image">' . (SERVICE_RECENTLY_VISITED_SHOW_CATEGORY_IMAGES == '1' ? lc_link_object(lc_href_link(FILENAME_DEFAULT, 'cPath=' . $category['id']), lc_image('images/categories/' . $category['image'], $category['name'], null, null, 'class="content-recently-visited-image-src"')) : NULL) . '</div>' . "\n"; } $this->_content .= ' <div class="content-recently-visited-price pricing-row"></div>' . "\n" . ' <div class="content-recently-visited-from">' . sprintf($lC_Language->get('recently_visited_item_in_category'), lc_link_object(lc_href_link(FILENAME_DEFAULT, 'cPath=' . $category['parent_id']), $category['parent_name'])) . '</div>' . "\n" . '</div>' . "\n"; } } } if ($lC_RecentlyVisited->hasSearches()) { foreach ($lC_RecentlyVisited->getSearches() as $searchphrase) { // $this->_content .= '<div class="content-recently-visited-searches">' . lc_link_object(lc_href_link(FILENAME_SEARCH, 'keywords=' . $searchphrase['keywords']), lc_output_string_protected($searchphrase['keywords'])) . ' <i>(' . number_format($searchphrase['results']) . ' results)</i></div>'; } } } }
function execute() { global $lC_Database, $lC_Session, $lC_NavigationHistory, $lC_Customer; if (!$lC_Customer->isLoggedOn()) { $lC_NavigationHistory->setSnapshot(); lc_redirect(lc_href_link(FILENAME_ACCOUNT, 'login', 'SSL')); return false; } $notifications = array(); if (isset($_GET['products']) && !empty($_GET['products'])) { $products_array = explode(';', $_GET['products']); foreach ($products_array as $product_id) { if (is_numeric($product_id) && !in_array($product_id, $notifications)) { $notifications[] = $product_id; } } } else { $id = false; foreach ($_GET as $key => $value) { 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); $notifications[] = $lC_Product->getID(); } } if (!empty($notifications)) { foreach ($notifications as $product_id) { $Qcheck = $lC_Database->query('select products_id from :table_products_notifications where customers_id = :customers_id and products_id = :products_id limit 1'); $Qcheck->bindTable(':table_products_notifications', TABLE_PRODUCTS_NOTIFICATIONS); $Qcheck->bindInt(':customers_id', $lC_Customer->getID()); $Qcheck->bindInt(':products_id', $product_id); $Qcheck->execute(); if ($Qcheck->numberOfRows() < 1) { $Qn = $lC_Database->query('insert into :table_products_notifications (products_id, customers_id, date_added) values (:products_id, :customers_id, :date_added)'); $Qn->bindTable(':table_products_notifications', TABLE_PRODUCTS_NOTIFICATIONS); $Qn->bindInt(':products_id', $product_id); $Qn->bindInt(':customers_id', $lC_Customer->getID()); $Qn->bindRaw(':date_added', 'now()'); $Qn->execute(); } } } lc_redirect(lc_href_link(basename($_SERVER['SCRIPT_FILENAME']), lc_get_all_get_params(array('action')))); }
public static function newArrivalsListing() { global $lC_Vqmod; include_once $lC_Vqmod->modCheck('includes/classes/products.php'); $lC_Products = new lC_Products(); $Qlisting = $lC_Products->execute(); $cnt = 0; $listing = ''; while ($Qlisting->next()) { $lC_Product = new lC_Product($Qlisting->valueInt('products_id')); $listing .= '<li>' . lc_link_object(lc_href_link(FILENAME_PRODUCTS, $lC_Product->getKeyword()), substr($lC_Product->getTitle(), 0, 20)) . '</li>'; $cnt++; if ($cnt == 5) { break; } } return $listing; }
public function lC_Products_Images() { global $lC_Session, $lC_Language, $lC_Product; if (empty($_GET) === false) { $id = false; $counter = 0; foreach ($_GET as $key => $value) { $counter++; if ($counter < 2) { continue; } 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); $this->addPageTags('keywords', $lC_Product->getTitle()); $this->addPageTags('keywords', $lC_Product->getModel()); if ($lC_Product->hasTags()) { $this->addPageTags('keywords', $lC_Product->getTags()); } $this->_page_title = $lC_Product->getTitle(); } 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'; } }
public function lC_Products_Tell_a_friend() { global $lC_Services, $lC_Session, $lC_Language, $lC_Breadcrumb, $lC_Customer, $lC_NavigationHistory, $lC_Product; if (ALLOW_GUEST_TO_TELL_A_FRIEND == '-1' && $lC_Customer->isLoggedOn() === false) { $lC_NavigationHistory->setSnapshot(); lc_redirect(lc_href_link(FILENAME_ACCOUNT, 'login', 'SSL')); } $counter = 0; foreach ($_GET as $key => $value) { $counter++; if ($counter < 2) { continue; } 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()) { if (lC_Product::checkEntry($key) === false) { $this->_page_title = $lC_Language->get('product_not_found_heading'); $this->_page_contents = 'info_not_found.php'; } else { $lC_Product = new lC_Product($key); $this->_page_title = $lC_Product->getTitle(); if ($lC_Services->isStarted('breadcrumb')) { $lC_Breadcrumb->add($lC_Product->getTitle(), lc_href_link(FILENAME_PRODUCTS, $lC_Product->getKeyword())); $lC_Breadcrumb->add($lC_Language->get('breadcrumb_tell_a_friend'), lc_href_link(FILENAME_PRODUCTS, $this->_module . '&' . $lC_Product->getKeyword())); } if (isset($_GET['action']) && $_GET['action'] == 'process') { $this->_process(); } } break; } } if ($counter < 2) { $this->_page_title = $lC_Language->get('product_not_found_heading'); $this->_page_contents = 'info_not_found.php'; } }
public function initialize() { global $lC_Database, $lC_Currencies, $lC_Language, $lC_Image; $this->_title_link = lc_href_link(FILENAME_PRODUCTS, 'featured_products'); $Qfeatured = $lC_Database->query('select products_id from :table_featured_products where str_to_date(expires_date, "%Y-%m-%d") >= str_to_date(now(), "%Y-%m-%d") and status = 1 order by rand() limit 1'); $Qfeatured->bindTable(':table_featured_products', TABLE_FEATURED_PRODUCTS); $Qfeatured->execute(); if ($Qfeatured->numberOfRows() > 0) { // VQMOD-hookpoint; DO NOT MODIFY OR REMOVE THE LINE BELOW $lC_Product = new lC_Product($Qfeatured->valueInt('products_id')); $this->_content = ''; if ($lC_Product->hasImage()) { $this->_content = '<li class="box-featured-products-image">' . lc_link_object(lc_href_link(FILENAME_PRODUCTS, $lC_Product->getKeyword()), $lC_Image->show($lC_Product->getImage(), $lC_Product->getTitle(), 'class="content-featured-products-image-src"')) . '</li>'; } $this->_content .= '<li class="box-featured-products-name">' . lc_link_object(lc_href_link(FILENAME_PRODUCTS, $lC_Product->getKeyword()), $lC_Product->getTitle()) . '</li>'; $this->_content .= '<li class="box-featured-products-price pricing-row">' . $lC_Product->getPriceFormated(true) . '</li>'; $this->_content .= '<li class="box-featured-products-buy-now pricing-row buy-btn-div"><button onclick="window.location.href=\'' . lc_href_link(FILENAME_PRODUCTS, $lC_Product->getKeyword() . '&action=cart_add') . '\'" type="button">' . $lC_Language->get('button_buy_now') . '</button>'; } }
public function initialize() { global $lC_Database, $lC_Cache, $lC_Language, $lC_Currencies, $lC_Image, $current_category_id; $data = array(); if ($lC_Cache->isEnabled() && MODULE_CONTENT_NEW_PRODUCTS_CACHE > 0 && $lC_Cache->read('new_products-' . $lC_Language->getCode() . '-' . $lC_Currencies->getCode() . '-' . $current_category_id, MODULE_CONTENT_NEW_PRODUCTS_CACHE)) { $data = $lC_Cache->getCache(); } else { if ($current_category_id < 1) { $Qproducts = $lC_Database->query('select products_id from :table_products where products_status = :products_status and parent_id = :parent_id order by products_date_added desc limit :max_display_new_products'); } else { $Qproducts = $lC_Database->query('select distinct p2c.products_id from :table_products p, :table_products_to_categories p2c, :table_categories c where c.parent_id = :category_parent_id and c.categories_id = p2c.categories_id and p2c.products_id = p.products_id and p.products_status = :products_status and p.parent_id = :parent_id order by p.products_date_added desc limit :max_display_new_products'); $Qproducts->bindTable(':table_products_to_categories', TABLE_PRODUCTS_TO_CATEGORIES); $Qproducts->bindTable(':table_categories', TABLE_CATEGORIES); $Qproducts->bindInt(':category_parent_id', $current_category_id); } $Qproducts->bindTable(':table_products', TABLE_PRODUCTS); $Qproducts->bindInt(':products_status', 1); $Qproducts->bindInt(':parent_id', 0); $Qproducts->bindInt(':max_display_new_products', MAX_DISPLAY_PRODUCTS_NEW); $Qproducts->execute(); while ($Qproducts->next()) { // VQMOD-hookpoint; DO NOT MODIFY OR REMOVE THE LINE BELOW $lC_Product = new lC_Product($Qproducts->valueInt('products_id')); $data[$lC_Product->getID()] = $lC_Product->getData(); $data[$lC_Product->getID()]['display_price'] = $lC_Product->getPriceFormated(true); $data[$lC_Product->getID()]['display_image'] = $lC_Product->getImage(); } if ($lC_Cache->isEnabled()) { $lC_Cache->write($data); } } if (!empty($data)) { $this->_content = ''; foreach ($data as $product) { $this->_content .= '<div class="content-new-products-container">' . "\n"; $this->_content .= ' <div class="content-new-products-image">' . lc_link_object(lc_href_link(FILENAME_PRODUCTS, $product['keyword']), $lC_Image->show($product['display_image'], $product['name'], 'class="content-new-products-image-src"')) . '</div>' . "\n" . ' <div class="content-new-products-name">' . lc_link_object(lc_href_link(FILENAME_PRODUCTS, $product['keyword']), $product['name']) . '</div>' . "\n" . ' <div class="content-new-products-desc">' . (strlen(lc_clean_html($product['description'])) > 65 ? substr(lc_clean_html($product['description']), 0, 62) . '...' : lc_clean_html($product['description'])) . '</div>' . "\n" . ' <div class="content-new-products-price pricing-row">' . $product['display_price'] . '</div>' . "\n" . ' <div class="content-new-products-button pricing-row buy-btn-div"><button class="content-new-products-add-button" onclick="window.location.href=\'' . lc_href_link(FILENAME_PRODUCTS, $product['keyword'] . '&action=cart_add') . '\'" type="button">' . $lC_Language->get('new_products_button_buy_now') . '</button></div>' . "\n"; $this->_content .= '</div>' . "\n"; } } }
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'; } }
function execute() { global $lC_Session, $lC_ShoppingCart, $lC_Product, $lC_Language, $lC_Customer; if (!isset($lC_Product)) { $id = false; foreach ($_GET as $key => $value) { if ((is_numeric($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); } } if (isset($lC_Product)) { // VQMOD-hookpoint; DO NOT MODIFY OR REMOVE THE LINE BELOW $quantity = isset($_POST['quantity']) && !empty($_POST['quantity']) ? (int) $_POST['quantity'] : 1; if ($lC_Product->hasVariants()) { if (isset($_POST['variants']) && is_array($_POST['variants']) && !empty($_POST['variants'])) { if ($lC_Product->variantExists($_POST['variants'])) { $lC_ShoppingCart->add($lC_Product->getProductVariantID($_POST['variants']), $quantity); } else { lc_redirect(lc_href_link(FILENAME_PRODUCTS, $lC_Product->getKeyword() . '&error=' . urlencode($lC_Language->get('variant_combo_not_available')))); return false; } } else { lc_redirect(lc_href_link(FILENAME_PRODUCTS, $lC_Product->getKeyword())); return false; } } else { if (isset($_GET['info']) && $_GET['info'] == '1') { } else { if ($lC_Product->hasSubProducts($lC_Product->getID()) || $lC_Product->hasSimpleOptions()) { lc_redirect(lc_href_link(FILENAME_PRODUCTS, $lC_Product->getKeyword())); } } if (isset($_POST['quantity']) && is_array($_POST['quantity'])) { foreach ($_POST['quantity'] as $product_id => $quantity) { $lC_ShoppingCart->add((int) $product_id, (int) $quantity); } } else { $lC_ShoppingCart->add($lC_Product->getID(), $quantity); } } } lc_redirect(lc_href_link(FILENAME_CHECKOUT)); }
$define_list = array('PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL, 'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME, 'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER, 'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE, 'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY, 'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT, 'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE, 'PRODUCT_LIST_BUY_NOW' => PRODUCT_LIST_BUY_NOW); asort($define_list); $column_list = array(); reset($define_list); while (list($key, $value) = each($define_list)) { if ($value > 0) { $column_list[] = $key; } } if ($Qlisting->numberOfRows() > 0) { $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";
public function getProducts() { $history = array(); if (isset($this->visits['products']) && empty($this->visits['products']) === false) { $counter = 0; foreach ($this->visits['products'] as $k => $v) { $counter++; $lC_Product = new lC_Product($v['id']); $lC_Category = new lC_Category($lC_Product->getCategoryID()); $history[] = array('name' => $lC_Product->getTitle(), 'id' => $lC_Product->getID(), 'keyword' => $lC_Product->getKeyword(), 'price' => SERVICE_RECENTLY_VISITED_SHOW_PRODUCT_PRICES == '1' ? $lC_Product->getPriceFormated(true) : '', 'image' => $lC_Product->getImage(), 'category_name' => $lC_Category->getTitle(), 'category_path' => $lC_Category->getPath()); if ($counter == SERVICE_RECENTLY_VISITED_MAX_PRODUCTS) { break; } } } return $history; }
public function update($item_id, $quantity) { global $lC_Database, $lC_Customer, $lC_Services; if (!is_numeric($quantity)) { $quantity = $this->getQuantity($item_id); } $this->_contents[$item_id]['quantity'] = $quantity; if ($lC_Customer->isLoggedOn()) { $Qupdate = $lC_Database->query('update :table_shopping_carts set quantity = :quantity where customers_id = :customers_id and item_id = :item_id'); $Qupdate->bindTable(':table_shopping_carts', TABLE_SHOPPING_CARTS); $Qupdate->bindInt(':quantity', $quantity); $Qupdate->bindInt(':customers_id', $lC_Customer->getID()); $Qupdate->bindInt(':item_id', $item_id); $Qupdate->execute(); } // get default tax_class_id $Qproduct = $lC_Database->query('select products_tax_class_id as tax_class_id from :table_products where products_id = :products_id and products_status = :products_status'); $Qproduct->bindTable(':table_products', TABLE_PRODUCTS); $Qproduct->bindInt(':products_id', $this->_contents[$item_id]['id']); $Qproduct->bindInt(':products_status', 1); $Qproduct->execute(); if ($Qproduct->numberOfRows() === 1) { $this->_contents[$item_id]['tax_class_id'] = $Qproduct->valueInt('tax_class_id'); } $simple_options = array(); if (isset($this->_contents[$item_id]['simple_options'])) { foreach ($this->_contents[$item_id]['simple_options'] as $key => $val) { $simple_options[$val['group_id']] = $val['value_id']; } } // we get the product price from the product class - price already includes options, etc. if (!isset($lC_Product)) { $lC_Product = new lC_Product($this->_contents[$item_id]['id']); } $this->_contents[$item_id]['price_data'] = $lC_Product->getPriceInfo($this->_contents[$item_id]['id'], $lC_Customer->getCustomerGroup(), array('quantity' => $quantity, 'simple_options' => $simple_options)); $this->_contents[$item_id]['price'] = $this->_contents[$item_id]['price_data']['price']; $this->_cleanUp(); $this->_calculate(); return $this->_contents[$item_id]['price_data']; }
public function lC_Products_Reviews() { global $lC_Services, $lC_Session, $lC_Language, $lC_Breadcrumb, $lC_Product, $lC_Customer, $lC_NavigationHistory, $lC_Image, $lC_Currencies; if ($lC_Services->isStarted('reviews') === false) { lc_redirect(lc_href_link(FILENAME_DEFAULT)); } $this->_page_title = $lC_Language->get('reviews_heading'); $template_code = isset($_SESSION['template']['code']) && $_SESSION['template']['code'] != NULL ? $_SESSION['template']['code'] : 'core'; $this->addJavascriptPhpFilename('templates/' . $template_code . '/javascript/form_check.js.php'); if ($lC_Services->isStarted('breadcrumb')) { $lC_Breadcrumb->add($lC_Language->get('breadcrumb_reviews'), lc_href_link(FILENAME_PRODUCTS, $this->_module)); } if (is_numeric($_GET[$this->_module])) { if (lC_Reviews::exists($_GET[$this->_module])) { $lC_Product = new lC_Product(lC_Reviews::getProductID($_GET[$this->_module])); $this->_page_title = $lC_Product->getTitle(); $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')); 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')); } } } $this->_page_contents = 'reviews_info.php'; if ($lC_Services->isStarted('breadcrumb')) { $lC_Breadcrumb->add($lC_Product->getTitle(), lc_href_link(FILENAME_PRODUCTS, $this->_module . '=' . $_GET[$this->_module])); } } else { $this->_page_contents = 'reviews_not_found.php'; } $counter = 0; foreach ($_GET as $key => $value) { $counter++; if ($counter < 2) { continue; } 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()) { if (lC_Product::checkEntry($key) === false) { $this->_page_contents = 'info_not_found.php'; } elseif ($_GET[$this->_module] == 'new') { if ($lC_Customer->isLoggedOn() === false && SERVICE_REVIEW_ENABLE_REVIEWS == 1) { $lC_NavigationHistory->setSnapshot(); lc_redirect(lc_href_link(FILENAME_ACCOUNT, 'login', 'SSL')); } $lC_Product = new lC_Product($key); $this->_page_title = $lC_Product->getTitle(); $this->_page_contents = 'reviews_new.php'; if ($lC_Services->isStarted('breadcrumb')) { $lC_Breadcrumb->add($lC_Product->getTitle(), lc_href_link(FILENAME_PRODUCTS, $this->_module . '&' . $lC_Product->getKeyword())); $lC_Breadcrumb->add($lC_Language->get('breadcrumb_reviews_new'), lc_href_link(FILENAME_PRODUCTS, $this->_module . '=new&' . $lC_Product->getKeyword())); } if (isset($_GET['action']) && $_GET['action'] == 'process') { $this->_process($lC_Product->getID()); } } else { $lC_Product = new lC_Product($key); $this->_page_title = $lC_Product->getTitle(); $this->_page_contents = 'product_reviews.php'; if ($lC_Services->isStarted('breadcrumb')) { $lC_Breadcrumb->add($lC_Product->getTitle(), lc_href_link(FILENAME_PRODUCTS, $this->_module . '&' . $lC_Product->getKeyword())); } } } break; } if ($counter < 2) { if (lC_Reviews::exists() === false) { $this->_page_contents = 'reviews_not_found.php'; } } }