function execute() { global $osC_Session, $osC_ShoppingCart, $osC_Product, $osC_Language, $messageStack, $toC_Customization_Fields; if (!isset($osC_Product)) { $id = false; foreach ($_GET as $key => $value) { if ((ereg('^[0-9]+(_?([0-9]+:?[0-9]+)+(;?([0-9]+:?[0-9]+)+)*)*$', $key) || ereg('^[a-zA-Z0-9 -_]*$', $key)) && $key != $osC_Session->getName()) { $id = $key; } break; } if (strpos($id, '_') !== false) { $id = str_replace('_', '#', $id); } if ($id !== false && osC_Product::checkEntry($id)) { $osC_Product = new osC_Product($id); } } if (isset($osC_Product)) { //customization fields check if ($osC_Product->hasRequiredCustomizationFields()) { if (!$toC_Customization_Fields->exists($osC_Product->getID())) { $osC_Language->load('products'); $messageStack->add_session('products', $osC_Language->get('error_customization_fields_missing'), 'error'); osc_redirect(osc_href_link(FILENAME_PRODUCTS, $osC_Product->getID())); } } $variants = null; if (isset($_POST['variants']) && is_array($_POST['variants'])) { $variants = $_POST['variants']; } else { if (isset($_GET['variants']) && !empty($_GET['variants'])) { $variants = osc_parse_variants_string($_GET['variants']); } } $gift_certificate_data = null; if ($osC_Product->isGiftCertificate() && isset($_POST['senders_name']) && isset($_POST['recipients_name']) && isset($_POST['message'])) { if ($osC_Product->isEmailGiftCertificate()) { $gift_certificate_data = array('senders_name' => $_POST['senders_name'], 'senders_email' => $_POST['senders_email'], 'recipients_name' => $_POST['recipients_name'], 'recipients_email' => $_POST['recipients_email'], 'message' => $_POST['message']); } else { $gift_certificate_data = array('senders_name' => $_POST['senders_name'], 'recipients_name' => $_POST['recipients_name'], 'message' => $_POST['message']); } if ($osC_Product->isOpenAmountGiftCertificate()) { $gift_certificate_data['price'] = $_POST['gift_certificate_amount']; } $gift_certificate_data['type'] = $osC_Product->getGiftCertificateType(); } $quantity = null; if (isset($_POST['quantity']) && is_numeric($_POST['quantity'])) { $quantity = $_POST['quantity']; } if ($osC_Product->isGiftCertificate() && $gift_certificate_data == null) { osc_redirect(osc_href_link(FILENAME_PRODUCTS, $osC_Product->getID())); return false; } else { $osC_ShoppingCart->add($osC_Product->getID(), $variants, $quantity, $gift_certificate_data); } } osc_redirect(osc_href_link(FILENAME_CHECKOUT)); }
function osC_Products_Products() { global $osC_Database, $osC_Services, $osC_Session, $osC_Language, $osC_Breadcrumb, $osC_Product; 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) { if ((preg_match('/^[0-9]+(#?([0-9]+:?[0-9]+)+(;?([0-9]+:?[0-9]+)+)*)*$/', $key) || preg_match('/^[a-zA-Z0-9 -_]*$/', $key)) && $key != $osC_Session->getName()) { $id = $key; } break; } if ($id !== false && osC_Product::checkEntry($id)) { $osC_Product = new osC_Product($id); $osC_Product->incrementCounter(); $this->addPageTags('keywords', $osC_Product->getTitle()); $this->addPageTags('keywords', $osC_Product->getModel()); if ($osC_Product->hasTags()) { $this->addPageTags('keywords', $osC_Product->getTags()); } $this->addJavascriptFilename('templates/' . $this->getCode() . '/javascript/' . $this->_group . '/info.js'); osC_Services_category_path::process($osC_Product->getCategoryID()); if ($osC_Services->isStarted('breadcrumb')) { $osC_Breadcrumb->add($osC_Product->getTitle(), osc_href_link(FILENAME_PRODUCTS, $osC_Product->getKeyword())); } $this->_page_title = $osC_Product->getTitle(); } else { $this->_page_title = $osC_Language->get('product_not_found_heading'); $this->_page_contents = 'info_not_found.php'; } } else { $this->_page_title = $osC_Language->get('product_not_found_heading'); $this->_page_contents = 'info_not_found.php'; } }
function execute() { global $osC_Database, $osC_Session, $osC_NavigationHistory, $osC_Customer; if (!$osC_Customer->isLoggedOn()) { $osC_NavigationHistory->setSnapshot(); osc_redirect(osc_href_link(FILENAME_ACCOUNT, 'login', 'SSL')); return false; } $id = false; foreach ($_GET as $key => $value) { if ((ereg('^[0-9]+(#?([0-9]+:?[0-9]+)+(;?([0-9]+:?[0-9]+)+)*)*$', $key) || ereg('^[a-zA-Z0-9 -_]*$', $key)) && $key != $osC_Session->getName()) { $id = $key; } break; } if ($id !== false && osC_Product::checkEntry($id)) { $osC_Product = new osC_Product($id); $Qcheck = $osC_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', $osC_Customer->getID()); $Qcheck->bindInt(':products_id', $osC_Product->getID()); $Qcheck->execute(); if ($Qcheck->numberOfRows() > 0) { $Qn = $osC_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', $osC_Customer->getID()); $Qn->bindInt(':products_id', $osC_Product->getID()); $Qn->execute(); } } osc_redirect(osc_href_link(basename($_SERVER['SCRIPT_FILENAME']), osc_get_all_get_params(array('action')))); }
function execute() { global $osC_Session, $osC_ShoppingCart, $osC_Product; if (!isset($osC_Product)) { $id = false; foreach ($_GET as $key => $value) { if ((is_numeric($key) || ereg('^[a-zA-Z0-9 -_]*$', $key)) && $key != $osC_Session->getName()) { $id = $key; } break; } if ($id !== false && osC_Product::checkEntry($id)) { $osC_Product = new osC_Product($id); } } if (isset($osC_Product)) { if ($osC_Product->hasVariants()) { if (isset($_POST['variants']) && is_array($_POST['variants']) && !empty($_POST['variants'])) { if ($osC_Product->variantExists($_POST['variants'])) { $osC_ShoppingCart->add($osC_Product->getProductVariantID($_POST['variants'])); } else { osc_redirect(osc_href_link(FILENAME_PRODUCTS, $osC_Product->getKeyword())); return false; } } else { osc_redirect(osc_href_link(FILENAME_PRODUCTS, $osC_Product->getKeyword())); return false; } } else { $osC_ShoppingCart->add($osC_Product->getID()); } } osc_redirect(osc_href_link(FILENAME_CHECKOUT)); }
function osC_Products_Images() { global $osC_Session, $osC_Language, $osC_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 != $osC_Session->getName()) { $id = $key; } break; } if ($id !== false && osC_Product::checkEntry($id)) { $osC_Product = new osC_Product($id); $this->addPageTags('keywords', $osC_Product->getTitle()); $this->addPageTags('keywords', $osC_Product->getModel()); if ($osC_Product->hasTags()) { $this->addPageTags('keywords', $osC_Product->getTags()); } $this->_page_title = $osC_Product->getTitle(); } else { $this->_page_title = $osC_Language->get('product_not_found_heading'); $this->_page_contents = 'info_not_found.php'; } } else { $this->_page_title = $osC_Language->get('product_not_found_heading'); $this->_page_contents = 'info_not_found.php'; } }
function execute() { global $osC_Session, $osC_ShoppingCart; $id = false; foreach ($_GET as $key => $value) { if ((ereg('^[0-9]+(#?([0-9]+:?[0-9]+)+(;?([0-9]+:?[0-9]+)+)*)*$', $key) || ereg('^[a-zA-Z0-9 -_]*$', $key)) && $key != $osC_Session->getName()) { $id = $key; } break; } if ($id !== false && osC_Product::checkEntry($id)) { $osC_Product = new osC_Product($id); $product_id = $osC_Product->getID(); //gift certificate use timestamp as variant if ($osC_Product->isGiftCertificate()) { $product_id .= '#' . $_GET['variants']; } else { if (isset($_GET['variants']) && ereg('^([0-9]+:?[0-9]+)+(;?([0-9]+:?[0-9]+)+)*$', $_GET['variants'])) { $product_id .= '#' . $_GET['variants']; } } $osC_ShoppingCart->remove($product_id); } osc_redirect(osc_href_link(FILENAME_CHECKOUT)); }
function execute() { global $osC_Session, $osC_Product, $toC_Customization_Fields, $osC_Language, $messageStack; if (!isset($osC_Product)) { $id = false; foreach ($_GET as $key => $value) { if ((ereg('^[0-9]+(#?([0-9]+:?[0-9]+)+(;?([0-9]+:?[0-9]+)+)*)*$', $key) || ereg('^[a-zA-Z0-9 -_]*$', $key)) && $key != $osC_Session->getName()) { $id = $key; } break; } if ($id !== false && osC_Product::checkEntry($id)) { $osC_Product = new osC_Product($id); } } if (isset($osC_Product)) { $errors = array(); $data = array(); $customizations = $osC_Product->getCustomizations(); foreach ($customizations as $field) { $fields_id = $field['customization_fields_id']; if ($field['type'] == CUSTOMIZATION_FIELD_TYPE_INPUT_TEXT) { $value = isset($_POST['customizations'][$fields_id]) ? $_POST['customizations'][$fields_id] : null; if ($field['is_required'] && $value == null) { $messageStack->add_session('products_customizations', sprintf($osC_Language->get('error_customization_field_must_be_specified'), $field['name']), 'error'); } else { if ($value != null) { $data[$fields_id] = array('customization_fields_id' => $field['customization_fields_id'], 'customization_fields_name' => $field['name'], 'customization_type' => CUSTOMIZATION_FIELD_TYPE_INPUT_TEXT, 'customization_value' => $value); } } } else { $file = new upload('customizations_' . $fields_id, DIR_FS_CACHE . '/products_customizations/'); if ($field['is_required'] && !$file->exists() && !$toC_Customization_Fields->hasCustomizationField($osC_Product->getID(), $fields_id)) { $messageStack->add_session('products', sprintf($osC_Language->get('error_customization_field_must_be_specified'), $field['name']), 'error'); } else { if ($file->exists()) { if ($file->parse() && $file->save()) { $filename = $file->filename; $cache_filename = md5($filename . time()); rename(DIR_FS_CACHE . '/products_customizations/' . $filename, DIR_FS_CACHE . '/products_customizations/' . $cache_filename); $data[$fields_id] = array('customization_fields_id' => $field['customization_fields_id'], 'customization_fields_name' => $field['name'], 'customization_type' => CUSTOMIZATION_FIELD_TYPE_INPUT_FILE, 'customization_value' => $filename, 'cache_filename' => $cache_filename); } else { $messageStack->add_session('products_customizations', $file->getLastError(), 'error'); } } } } } //var_dump($data);exit; if ($messageStack->size('products_customizations') === 0) { $toC_Customization_Fields->set($osC_Product->getID(), $data); } } osc_redirect(osc_href_link(FILENAME_PRODUCTS, $osC_Product->getID())); }
function removeProduct() { global $toC_Json, $osC_ShoppingCart; $products_id = isset($_REQUEST['pID']) ? $_POST['pID'] : null; if (!empty($products_id) && osC_Product::checkEntry($products_id)) { $osC_ShoppingCart->remove($products_id); $response = array('success' => true); } else { $response = array('success' => false); } echo $toC_Json->encode($response); }
function execute() { global $osC_Session, $osC_ShoppingCart, $osC_Product; if (!isset($osC_Product)) { $id = false; foreach ($_GET as $key => $value) { if ((ereg('^[0-9]+(#?([0-9]+:?[0-9]+)+(;?([0-9]+:?[0-9]+)+)*)*$', $key) || ereg('^[a-zA-Z0-9 -_]*$', $key)) && $key != $osC_Session->getName()) { $id = $key; } break; } if ($id !== false && osC_Product::checkEntry($id)) { $osC_Product = new osC_Product($id); } } if (isset($osC_Product)) { $variants = null; if (isset($_POST['variants']) && is_array($_POST['variants'])) { $variants = $_POST['variants']; } else { if (isset($_GET['variants']) && !empty($_GET['variants'])) { $variants = osc_parse_variants_string($_GET['variants']); } } $gift_certificate_data = null; if ($osC_Product->isGiftCertificate() && isset($_POST['senders_name']) && isset($_POST['recipients_name']) && isset($_POST['message'])) { if ($osC_Product->isEmailGiftCertificate()) { $gift_certificate_data = array('senders_name' => $_POST['senders_name'], 'senders_email' => $_POST['senders_email'], 'recipients_name' => $_POST['recipients_name'], 'recipients_email' => $_POST['recipients_email'], 'message' => $_POST['message']); } else { $gift_certificate_data = array('senders_name' => $_POST['senders_name'], 'recipients_name' => $_POST['recipients_name'], 'message' => $_POST['message']); } if ($osC_Product->isOpenAmountGiftCertificate()) { $gift_certificate_data['price'] = $_POST['gift_certificate_amount']; } $gift_certificate_data['type'] = $osC_Product->getGiftCertificateType(); } $quantity = null; if (isset($_POST['quantity']) && is_numeric($_POST['quantity'])) { $quantity = $_POST['quantity']; } if ($osC_Product->hasVariants() && empty($variants) || $osC_Product->isGiftCertificate() && $gift_certificate_data == null) { osc_redirect(osc_href_link(FILENAME_PRODUCTS, $osC_Product->getID())); return false; } else { $osC_ShoppingCart->add($osC_Product->getID(), $variants, $quantity, $gift_certificate_data); } } osc_redirect(osc_href_link(FILENAME_CHECKOUT)); }
function execute() { global $osC_Database, $osC_Session, $osC_NavigationHistory, $osC_Customer; if (!$osC_Customer->isLoggedOn()) { $osC_NavigationHistory->setSnapshot(); osc_redirect(osc_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 ((ereg('^[0-9]+(#?([0-9]+:?[0-9]+)+(;?([0-9]+:?[0-9]+)+)*)*$', $key) || ereg('^[a-zA-Z0-9 -_]*$', $key)) && $key != $osC_Session->getName()) { $id = $key; } break; } if ($id !== false && osC_Product::checkEntry($id)) { $osC_Product = new osC_Product($id); $notifications[] = $osC_Product->getID(); } } if (!empty($notifications)) { foreach ($notifications as $product_id) { $Qcheck = $osC_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', $osC_Customer->getID()); $Qcheck->bindInt(':products_id', $product_id); $Qcheck->execute(); if ($Qcheck->numberOfRows() < 1) { $Qn = $osC_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', $osC_Customer->getID()); $Qn->bindRaw(':date_added', 'now()'); $Qn->execute(); } } } osc_redirect(osc_href_link(basename($_SERVER['SCRIPT_FILENAME']), osc_get_all_get_params(array('action')))); }
function execute() { global $osC_Session, $toC_Wishlist, $osC_Product; if (!isset($osC_Product)) { $id = false; foreach ($_GET as $key => $value) { if ((ereg('^[0-9]+(#?([0-9]+:?[0-9]+)+(;?([0-9]+:?[0-9]+)+)*)*$', $key) || ereg('^[a-zA-Z0-9 -_]*$', $key)) && $key != $osC_Session->getName()) { $id = $key; } break; } if ($id !== false && osC_Product::checkEntry($id)) { $osC_Product = new osC_Product($id); } } if (isset($osC_Product)) { $toC_Wishlist->add($osC_Product->getID()); } osc_redirect(osc_href_link(FILENAME_ACCOUNT, 'wishlist')); }
function execute() { global $osC_Session, $toC_Wishlist, $osC_Product; $id = false; foreach ($_GET as $key => $value) { if ((ereg('^[0-9]+(_?([0-9]+:?[0-9]+)+(;?([0-9]+:?[0-9]+)+)*)*$', $key) || ereg('^[a-zA-Z0-9 -_]*$', $key)) && $key != $osC_Session->getName()) { $id = $key; } break; } //change the variants in the product info page, then attach the wid param to represent the variant product if (isset($_GET['wid']) && preg_match('/^[0-9]+(_?([0-9]+:?[0-9]+)+(;?([0-9]+:?[0-9]+)+)*)*$/', $_GET['wid'])) { $id = $_GET['wid']; } if (strpos($id, '_') !== false) { $id = str_replace('_', '#', $id); } if ($id !== false && osC_Product::checkEntry($id)) { $osC_Product = new osC_Product($id); } if (isset($osC_Product)) { $variants = null; if (isset($_POST['variants']) && is_array($_POST['variants'])) { $variants = $_POST['variants']; } else { if (isset($_GET['variants']) && !empty($_GET['variants'])) { $variants = osc_parse_variants_string($_GET['variants']); } else { if (strpos($id, '#') !== false) { $variants = osc_parse_variants_from_id_string($id); } } } if (!osc_empty($variants)) { $toC_Wishlist->add($osC_Product->getID(), $variants); } else { $toC_Wishlist->add($osC_Product->getID()); } } osc_redirect(osc_href_link(FILENAME_ACCOUNT, 'wishlist')); }
function addProduct() { global $osC_ShoppingCart, $toC_Json, $osC_Language, $toC_Customization_Fields; $osC_Language->load('products'); if (is_numeric($_REQUEST['pID']) && osC_Product::checkEntry($_REQUEST['pID'])) { $osC_Product = new osC_Product($_REQUEST['pID']); //gift certificate check if ($osC_Product->isGiftCertificate() && !isset($_POST['senders_name'])) { $response = array('success' => false, 'feedback' => $osC_Language->get('error_gift_certificate_data_missing')); } else { if ($osC_Product->hasRequiredCustomizationFields() && !$toC_Customization_Fields->exists($osC_Product->getID())) { $response = array('success' => false, 'feedback' => $osC_Language->get('error_customization_fields_missing')); } else { $variants = null; if (isset($_REQUEST['variants']) && !empty($_REQUEST['variants'])) { $variants = osc_parse_variants_string($_REQUEST['variants']); } $gift_certificate_data = null; if ($osC_Product->isGiftCertificate() && isset($_POST['senders_name']) && isset($_POST['recipients_name']) && isset($_POST['message'])) { if ($osC_Product->isEmailGiftCertificate()) { $gift_certificate_data = array('senders_name' => $_POST['senders_name'], 'senders_email' => $_POST['senders_email'], 'recipients_name' => $_POST['recipients_name'], 'recipients_email' => $_POST['recipients_email'], 'message' => $_POST['message']); } else { $gift_certificate_data = array('senders_name' => $_POST['senders_name'], 'recipients_name' => $_POST['recipients_name'], 'message' => $_POST['message']); } if ($osC_Product->isOpenAmountGiftCertificate()) { $gift_certificate_data['price'] = $_POST['gift_certificate_amount']; } $gift_certificate_data['type'] = $osC_Product->getGiftCertificateType(); } $osC_ShoppingCart->add($_REQUEST['pID'], $variants, $_REQUEST['pQty'], $gift_certificate_data); $content = self::_getShoppingCart(); $response = array('success' => true, 'content' => $content, 'cart_items' => $osC_ShoppingCart->numberOfItems()); } } } else { $response = array('success' => false); } echo $toC_Json->encode($response); }
function execute() { global $osC_Session, $toC_Wishlist, $osC_Product, $messageStack, $osC_Language, $osC_Customer, $osC_NavigationHistory; if ($osC_Customer->isLoggedOn() === false) { $osC_NavigationHistory->setSnapshot(); osc_redirect(osc_href_link(FILENAME_ACCOUNT, 'login', 'SSL')); } //load the language definitions in the account group $osC_Language->load('account'); $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 != $osC_Session->getName()) { $id = $key; } break; } //change the variants in the product info page, then attach the wid param to represent the variant product if (isset($_GET['wid']) && preg_match('/^[0-9]+(_?([0-9]+:?[0-9]+)+(;?([0-9]+:?[0-9]+)+)*)*$/', $_GET['wid'])) { $id = $_GET['wid']; } if (strpos($id, '_') !== false) { $id = str_replace('_', '#', $id); } if ($id !== false && osC_Product::checkEntry($id)) { $osC_Product = new osC_Product($id); } if (isset($osC_Product)) { $result = $toC_Wishlist->add($id); if ($result === true) { $messageStack->add_session('wishlist', $osC_Language->get('success_wishlist_entry_updated'), 'success'); } else { $messageStack->add_session('wishlist', $osC_Language->get('error_wishlist_product_existed')); } } osc_redirect(osc_href_link(FILENAME_ACCOUNT, 'wishlist')); }
function osC_Products_Tell_a_friend() { global $osC_Services, $osC_Session, $osC_Language, $osC_Breadcrumb, $osC_Customer, $osC_NavigationHistory, $osC_Product; if (ALLOW_GUEST_TO_TELL_A_FRIEND == '-1' && $osC_Customer->isLoggedOn() === false) { $osC_NavigationHistory->setSnapshot(); osc_redirect(osc_href_link(FILENAME_ACCOUNT, 'login', 'SSL')); } $counter = 0; foreach ($_GET as $key => $value) { $counter++; if ($counter < 2) { continue; } if ((ereg('^[0-9]+(#?([0-9]+:?[0-9]+)+(;?([0-9]+:?[0-9]+)+)*)*$', $key) || ereg('^[a-zA-Z0-9 -_]*$', $key)) && $key != $osC_Session->getName()) { if (osC_Product::checkEntry($key) === false) { $this->_page_title = $osC_Language->get('product_not_found_heading'); $this->_page_contents = 'info_not_found.php'; } else { $osC_Product = new osC_Product($key); $this->_page_title = $osC_Product->getTitle(); if ($osC_Services->isStarted('breadcrumb')) { $osC_Breadcrumb->add($osC_Product->getTitle(), osc_href_link(FILENAME_PRODUCTS, $osC_Product->getKeyword())); $osC_Breadcrumb->add($osC_Language->get('breadcrumb_tell_a_friend'), osc_href_link(FILENAME_PRODUCTS, $this->_module . '&' . $osC_Product->getKeyword())); } if (isset($_GET['action']) && $_GET['action'] == 'process') { $this->_process(); } } break; } } if ($counter < 2) { $this->_page_title = $osC_Language->get('product_not_found_heading'); $this->_page_contents = 'info_not_found.php'; } }
function removeProduct() { global $toC_Json, $osC_ShoppingCart; $products_id = isset($_POST['pID']) ? $_POST['pID'] : null; if (!empty($products_id) && osC_Product::checkEntry($products_id)) { $osC_ShoppingCart->remove($products_id); $osC_ShoppingCart->resetShippingMethod(); if (!$osC_ShoppingCart->hasContents()) { $osC_ShoppingCart->reset(); } //order totals $order_totals = ''; foreach ($osC_ShoppingCart->getOrderTotals() as $module) { $order_totals .= '<tr>' . ' <td class="title"><strong>' . $module['title'] . '</strong></td>' . ' <td class="text"><strong>' . $module['text'] . '</strong></td>' . '</tr>'; } $response = array('success' => true, 'total' => $osC_ShoppingCart->numberOfItems(), 'order_totals' => $order_totals); } else { $response = array('success' => false); } echo $toC_Json->encode($response); }
function osC_Products_Reviews() { global $osC_Services, $osC_Session, $osC_Language, $osC_Breadcrumb, $osC_Product, $osC_Customer, $osC_NavigationHistory; if ($osC_Services->isStarted('reviews') === false) { osc_redirect(osc_href_link(FILENAME_DEFAULT)); } $this->_page_title = $osC_Language->get('reviews_heading'); if ($osC_Services->isStarted('breadcrumb')) { $osC_Breadcrumb->add($osC_Language->get('breadcrumb_reviews'), osc_href_link(FILENAME_PRODUCTS, $this->_module)); } if (is_numeric($_GET[$this->_module])) { if (osC_Reviews::exists($_GET[$this->_module])) { $osC_Product = new osC_Product(osC_Reviews::getProductID($_GET[$this->_module])); $this->_page_title = $osC_Product->getTitle(); $this->_page_contents = 'reviews_info.php'; if ($osC_Services->isStarted('breadcrumb')) { $osC_Breadcrumb->add($osC_Product->getTitle(), osc_href_link(FILENAME_PRODUCTS, $this->_module . '=' . $_GET[$this->_module])); } } else { $this->_page_contents = 'reviews_not_found.php'; } } else { $counter = 0; foreach ($_GET as $key => $value) { $counter++; if ($counter < 2) { continue; } if ((ereg('^[0-9]+(#?([0-9]+:?[0-9]+)+(;?([0-9]+:?[0-9]+)+)*)*$', $key) || ereg('^[a-zA-Z0-9 -_]*$', $key)) && $key != $osC_Session->getName()) { if (osC_Product::checkEntry($key) === false) { $this->_page_contents = 'info_not_found.php'; } elseif ($_GET[$this->_module] == 'new') { if ($osC_Customer->isLoggedOn() === false && SERVICE_REVIEW_ENABLE_REVIEWS == 1) { $osC_NavigationHistory->setSnapshot(); osc_redirect(osc_href_link(FILENAME_ACCOUNT, 'login', 'SSL')); } $osC_Product = new osC_Product($key); $this->_page_title = $osC_Product->getTitle(); $this->_page_contents = 'reviews_new.php'; $this->addJavascriptPhpFilename('templates/' . $this->getCode() . '/javascript/products/reviews_new.php'); if ($osC_Services->isStarted('breadcrumb')) { $osC_Breadcrumb->add($osC_Product->getTitle(), osc_href_link(FILENAME_PRODUCTS, $this->_module . '&' . $osC_Product->getKeyword())); $osC_Breadcrumb->add($osC_Language->get('breadcrumb_reviews_new'), osc_href_link(FILENAME_PRODUCTS, $this->_module . '=new&' . $osC_Product->getKeyword())); } if (isset($_GET['action']) && $_GET['action'] == 'process') { $this->_process($osC_Product->getID()); } } else { $osC_Product = new osC_Product($key); $this->_page_title = $osC_Product->getTitle(); $this->_page_contents = 'product_reviews.php'; if ($osC_Services->isStarted('breadcrumb')) { $osC_Breadcrumb->add($osC_Product->getTitle(), osc_href_link(FILENAME_PRODUCTS, $this->_module . '&' . $osC_Product->getKeyword())); } } } break; } if ($counter < 2) { if (osC_Reviews::exists() === false) { $this->_page_contents = 'reviews_not_found.php'; } } } }
function hasProducts() { if (SERVICE_RECENTLY_VISITED_SHOW_PRODUCTS == '1') { if (isset($this->visits['products']) && !empty($this->visits['products'])) { foreach ($this->visits['products'] as $k => $v) { if (!osC_Product::checkEntry($v['id'])) { unset($this->visits['products'][$k]); } } return sizeof($this->visits['products']) > 0; } } return false; }
function osC_Products_Products() { global $osC_Database, $osC_Services, $osC_Session, $osC_Language, $breadcrumb, $cPath, $cPath_array, $osC_Manufacturer, $osC_Product; 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) { if ((ereg('^[0-9]+(_?([0-9]+:?[0-9]+)+(;?([0-9]+:?[0-9]+)+)*)*$', $key) || ereg('^[a-zA-Z0-9 -_]*$', $key)) && $key != $osC_Session->getName()) { $id = $key; } break; } if (strpos($id, '_') !== false) { $id = str_replace('_', '#', $id); } if ($id !== false && osC_Product::checkEntry($id)) { $osC_Product = new osC_Product($id); $osC_Product->incrementCounter(); $this->_page_title = $osC_Product->getTitle(); $this->addPageTags('keywords', $osC_Product->getTitle()); $this->addPageTags('keywords', $osC_Product->getSKU()); if ($osC_Product->hasPageTitle()) { $this->setMetaPageTitle($osC_Product->getPageTitle()); } if ($osC_Product->hasTags()) { $this->addPageTags('keywords', $osC_Product->getTags()); } if ($osC_Product->hasMetaKeywords()) { $this->addPageTags('keywords', $osC_Product->getMetaKeywords()); } if ($osC_Product->hasMetaDescription()) { $this->addPageTags('description', $osC_Product->getMetaDescription()); } osC_Services_category_path::process($osC_Product->getCategoryID()); if (isset($_GET['manufacturers']) && empty($_GET['manufacturers']) === false) { require_once 'includes/classes/manufacturer.php'; $osC_Manufacturer = new osC_Manufacturer($_GET['manufacturers']); if ($osC_Services->isStarted('breadcrumb')) { $breadcrumb->add($osC_Manufacturer->getTitle(), osc_href_link(FILENAME_DEFAULT, 'manufacturers=' . $_GET['manufacturers'])); $breadcrumb->add($osC_Product->getTitle(), osc_href_link(FILENAME_PRODUCTS, $osC_Product->getID())); } //Using rel=”canonical” links to remove the duplication - same product info page //To fix the bug - [#123] Two Different SEO link for one product if (isset($osC_Services) && $osC_Services->isStarted('sefu')) { $this->_add_canonical($osC_Product->getID()); } } else { 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)))); } $breadcrumb->add($osC_Product->getTitle(), osc_href_link(FILENAME_PRODUCTS, $osC_Product->getID())); } } $this->addStyleSheet('ext/mojozoom/mojozoom.css'); $this->addStyleSheet('templates/' . $this->getCode() . '/javascript/milkbox/milkbox.css'); } else { $this->_page_title = $osC_Language->get('product_not_found_heading'); $this->_page_contents = 'info_not_found.php'; } } else { $this->_page_title = $osC_Language->get('product_not_found_heading'); $this->_page_contents = 'info_not_found.php'; } }