function initialize()
 {
     global $osC_Database, $osC_Language, $osC_Customer;
     if ($osC_Customer->isLoggedOn()) {
         $Qorders = $osC_Database->query('select distinct op.products_id from :table_orders o, :table_orders_products op, :table_products p where o.customers_id = :customers_id and o.orders_id = op.orders_id and op.products_id = p.products_id and p.products_status = 1 group by products_id order by o.date_purchased desc limit :limit');
         $Qorders->bindTable(':table_orders', TABLE_ORDERS);
         $Qorders->bindTable(':table_orders_products', TABLE_ORDERS_PRODUCTS);
         $Qorders->bindTable(':table_products', TABLE_PRODUCTS);
         $Qorders->bindInt(':customers_id', $osC_Customer->getID());
         $Qorders->bindInt(':limit', BOX_ORDER_HISTORY_MAX_LIST);
         $Qorders->execute();
         if ($Qorders->numberOfRows()) {
             $product_ids = '';
             while ($Qorders->next()) {
                 $product_ids .= $Qorders->valueInt('products_id') . ',';
             }
             $product_ids = substr($product_ids, 0, -1);
             $Qproducts = $osC_Database->query('select products_id, products_name, products_keyword from :table_products_description where products_id in (:products_id) and language_id = :language_id order by products_name');
             $Qproducts->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
             $Qproducts->bindRaw(':products_id', $product_ids);
             $Qproducts->bindInt(':language_id', $osC_Language->getID());
             $Qproducts->execute();
             $this->_content = '<ol style="list-style: none; margin: 0; padding: 0;">';
             while ($Qproducts->next()) {
                 $this->_content .= '<li>' . osc_link_object(osc_href_link(FILENAME_PRODUCTS, $Qproducts->value('products_id')), $Qproducts->value('products_name')) . '</li>';
             }
             $this->_content .= '</ol>';
         }
     }
 }
Esempio n. 2
0
 function initialize()
 {
     global $osC_Database, $osC_Services, $osC_Currencies, $osC_Cache, $osC_Language, $osC_Image;
     $this->_title_link = osc_href_link(FILENAME_PRODUCTS, 'specials');
     if ($osC_Services->isStarted('specials')) {
         if (BOX_SPECIALS_CACHE > 0 && $osC_Cache->read('box-specials-' . $osC_Language->getCode() . '-' . $osC_Currencies->getCode(), BOX_SPECIALS_CACHE)) {
             $data = $osC_Cache->getCache();
         } else {
             $Qspecials = $osC_Database->query('select p.products_id, p.products_price, p.products_tax_class_id, pd.products_name, pd.products_keyword, s.specials_new_products_price, i.image from :table_products p left join :table_products_images i on (p.products_id = i.products_id and i.default_flag = :default_flag), :table_products_description pd, :table_specials s where s.status = 1 and s.products_id = p.products_id and p.products_status = 1 and p.products_id = pd.products_id and pd.language_id = :language_id order by s.specials_date_added desc limit :max_random_select_specials');
             $Qspecials->bindTable(':table_products', TABLE_PRODUCTS);
             $Qspecials->bindTable(':table_products_images', TABLE_PRODUCTS_IMAGES);
             $Qspecials->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
             $Qspecials->bindInt(':default_flag', 1);
             $Qspecials->bindTable(':table_specials', TABLE_SPECIALS);
             $Qspecials->bindInt(':language_id', $osC_Language->getID());
             $Qspecials->bindInt(':max_random_select_specials', BOX_SPECIALS_RANDOM_SELECT);
             $Qspecials->executeRandomMulti();
             $data = array();
             if ($Qspecials->numberOfRows()) {
                 $data = $Qspecials->toArray();
                 $data['products_price'] = '<s>' . $osC_Currencies->displayPrice($Qspecials->valueDecimal('products_price'), $Qspecials->valueInt('products_tax_class_id')) . '</s>&nbsp;<span class="productSpecialPrice">' . $osC_Currencies->displayPrice($Qspecials->valueDecimal('specials_new_products_price'), $Qspecials->valueInt('products_tax_class_id')) . '</span>';
                 $osC_Cache->write('box-specials-' . $osC_Language->getCode() . '-' . $osC_Currencies->getCode(), $data);
             }
         }
         if (empty($data) === false) {
             $this->_content = '';
             if (empty($data['image']) === false) {
                 $this->_content = osc_link_object(osc_href_link(FILENAME_PRODUCTS, $data['products_id']), $osC_Image->show($data['image'], $data['products_name'])) . '<br />';
             }
             $this->_content .= '<span>' . osc_link_object(osc_href_link(FILENAME_PRODUCTS, $data['products_id']), $data['products_name']) . '</span><br /><span class="productPrice">' . $data['products_price'] . '</span>';
         }
     }
 }
Esempio n. 3
0
 function _save_orders_returns()
 {
     global $messageStack, $osC_Database, $osC_Language, $osC_Customer;
     $error = false;
     $products = array();
     if (isset($_POST['return_items']) && !empty($_POST['return_items'])) {
         foreach ($_POST['return_items'] as $orders_products_id => $on) {
             if (isset($_POST['quantity'][$orders_products_id]) && $_POST['quantity'][$orders_products_id] > 0) {
                 $products[$orders_products_id] = $_POST['quantity'][$orders_products_id];
             } else {
                 $messageStack->add($this->_module, sprintf($osC_Language->get('error_quantity_for_return_product'), $_POST['products_name'][$orders_products_id]));
             }
         }
     }
     if (sizeof($products) == 0) {
         $messageStack->add($this->_module, $osC_Language->get('error_return_items_empty'));
     }
     if (isset($_POST['comments']) && empty($_POST['comments'])) {
         $messageStack->add($this->_module, $osC_Language->get('error_return_comments_empty'));
     }
     if ($messageStack->size($this->_module) === 0) {
         if (toC_Order_Return::saveReturnRequest($_GET['orders_id'], $products, $_POST['comments'])) {
             $messageStack->add_session($this->_module, $osC_Language->get('success_account_updated'), 'success');
         }
         osc_redirect(osc_href_link(FILENAME_ACCOUNT, 'orders=list_return_requests', 'SSL'));
     }
 }
Esempio n. 4
0
 function initialize()
 {
     global $osC_Cache, $osC_Database, $osC_Services, $osC_Currencies, $osC_Specials, $osC_Language, $osC_Image;
     $this->_title_link = osc_href_link(FILENAME_PRODUCTS, 'new');
     $data = array();
     if (BOX_WHATS_NEW_CACHE > 0 && $osC_Cache->read('box-whats_new-' . $osC_Language->getCode() . '-' . $osC_Currencies->getCode(), BOX_WHATS_NEW_CACHE)) {
         $data = $osC_Cache->getCache();
     } else {
         $Qnew = $osC_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()) {
             $osC_Product = new osC_Product($Qnew->valueInt('products_id'));
             $data = $osC_Product->getData();
             $data['display_price'] = $osC_Product->getPriceFormated(true);
             $data['display_image'] = $osC_Product->getImage();
         }
         $osC_Cache->write($data);
     }
     if (!empty($data)) {
         $this->_content = '';
         if (!empty($data['display_image'])) {
             $this->_content .= osc_link_object(osc_href_link(FILENAME_PRODUCTS, $data['keyword']), $osC_Image->show($data['display_image'], $data['name'])) . '<br />';
         }
         $this->_content .= osc_link_object(osc_href_link(FILENAME_PRODUCTS, $data['keyword']), $data['name']) . '<br />' . $data['display_price'];
     }
 }
Esempio n. 5
0
 function initialize()
 {
     global $osC_Language, $osC_Template, $osC_Product;
     if (isset($osC_Product) && is_a($osC_Product, 'osC_Product') && $osC_Template->getModule() != 'tell_a_friend') {
         $this->_content = '<form name="tell_a_friend" action="' . osc_href_link(FILENAME_PRODUCTS, 'tell_a_friend&' . $osC_Product->getID()) . '" method="post">' . "\n" . osc_draw_input_field('to_email_address', null, 'style="width: 80%;"') . '&nbsp;' . osc_draw_image_submit_button('button_tell_a_friend.gif', $osC_Language->get('box_tell_a_friend_text')) . '<br />' . $osC_Language->get('box_tell_a_friend_text') . "\n" . '</form>' . "\n";
     }
 }
Esempio n. 6
0
 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));
 }
Esempio n. 7
0
 function getOutput()
 {
     global $osC_Product;
     if (!empty($osC_Product)) {
         return '<a href="http://twitter.com/home?status=' . urlencode(osc_href_link(FILENAME_PRODUCTS, $osC_Product->getID(), 'NONSSL', false, true, true)) . '" target="_blank">' . $this->getIcon() . '</a>';
     }
 }
 function initialize()
 {
     global $osC_Database, $osC_Language, $osC_Product;
     if (isset($osC_Product) && is_a($osC_Product, 'osC_Product')) {
         $Qmanufacturer = $osC_Database->query('select m.manufacturers_id, m.manufacturers_name, m.manufacturers_image, mi.manufacturers_url from :table_manufacturers m left join :table_manufacturers_info mi on (m.manufacturers_id = mi.manufacturers_id and mi.languages_id = :languages_id), :table_products p  where p.products_id = :products_id and p.manufacturers_id = m.manufacturers_id');
         $Qmanufacturer->bindTable(':table_manufacturers', TABLE_MANUFACTURERS);
         $Qmanufacturer->bindTable(':table_manufacturers_info', TABLE_MANUFACTURERS_INFO);
         $Qmanufacturer->bindTable(':table_products', TABLE_PRODUCTS);
         $Qmanufacturer->bindInt(':languages_id', $osC_Language->getID());
         $Qmanufacturer->bindInt(':products_id', $osC_Product->getID());
         $Qmanufacturer->execute();
         if ($Qmanufacturer->numberOfRows()) {
             $this->_content = '';
             if (!osc_empty($Qmanufacturer->value('manufacturers_image'))) {
                 $this->_content .= '<div style="text-align: center;">' . osc_link_object(osc_href_link(FILENAME_DEFAULT, 'manufacturers=' . $Qmanufacturer->valueInt('manufacturers_id')), osc_image(DIR_WS_IMAGES . 'manufacturers/' . $Qmanufacturer->value('manufacturers_image'), $Qmanufacturer->value('manufacturers_name'))) . '</div>';
             }
             $this->_content .= '<ol style="list-style: none; margin: 0; padding: 0;">';
             if (!osc_empty($Qmanufacturer->value('manufacturers_url'))) {
                 $this->_content .= '<li>' . osc_link_object(osc_href_link(FILENAME_REDIRECT, 'action=manufacturer&manufacturers_id=' . $Qmanufacturer->valueInt('manufacturers_id')), sprintf($osC_Language->get('box_manufacturer_info_website'), $Qmanufacturer->value('manufacturers_name')), 'target="_blank"') . '</li>';
             }
             $this->_content .= '<li>' . osc_link_object(osc_href_link(FILENAME_DEFAULT, 'manufacturers=' . $Qmanufacturer->valueInt('manufacturers_id')), $osC_Language->get('box_manufacturer_info_products')) . '</li>';
             $this->_content .= '</ol>';
         }
     }
 }
Esempio n. 9
0
 function initialize()
 {
     global $osC_Database, $osC_Services, $osC_Language, $osC_Currencies, $osC_Image, $osC_Specials, $current_category_id;
     if ($current_category_id < 1) {
         $Qnewproducts = $osC_Database->query('select p.products_id, p.products_tax_class_id, p.products_price, pd.products_name, pd.products_keyword, i.image from :table_products p left join :table_products_images i on (p.products_id = i.products_id and i.default_flag = :default_flag), :table_products_description pd where p.products_status = 1 and p.products_id = pd.products_id and pd.language_id = :language_id order by p.products_date_added desc limit :max_display_new_products');
     } else {
         $Qnewproducts = $osC_Database->query('select distinct p.products_id, p.products_tax_class_id, p.products_price, pd.products_name, pd.products_keyword, i.image from :table_products p left join :table_products_images i on (p.products_id = i.products_id and i.default_flag = :default_flag), :table_products_description pd, :table_products_to_categories p2c, :table_categories c where c.parent_id = :parent_id and c.categories_id = p2c.categories_id and p2c.products_id = p.products_id and p.products_status = 1 and p.products_id = pd.products_id and pd.language_id = :language_id order by p.products_date_added desc limit :max_display_new_products');
         $Qnewproducts->bindTable(':table_products_to_categories', TABLE_PRODUCTS_TO_CATEGORIES);
         $Qnewproducts->bindTable(':table_categories', TABLE_CATEGORIES);
         $Qnewproducts->bindInt(':parent_id', $current_category_id);
     }
     $Qnewproducts->bindTable(':table_products', TABLE_PRODUCTS);
     $Qnewproducts->bindTable(':table_products_images', TABLE_PRODUCTS_IMAGES);
     $Qnewproducts->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
     $Qnewproducts->bindInt(':default_flag', 1);
     $Qnewproducts->bindInt(':language_id', $osC_Language->getID());
     $Qnewproducts->bindInt(':max_display_new_products', MODULE_CONTENT_NEW_PRODUCTS_MAX_DISPLAY);
     if (MODULE_CONTENT_NEW_PRODUCTS_CACHE > 0) {
         $Qnewproducts->setCache('new_products-' . $osC_Language->getCode() . '-' . $osC_Currencies->getCode() . '-' . $current_category_id, MODULE_CONTENT_NEW_PRODUCTS_CACHE);
     }
     $Qnewproducts->execute();
     if ($Qnewproducts->numberOfRows()) {
         $i = 0;
         while ($Qnewproducts->next()) {
             if ($i % 3 == 0 && $i != 0) {
                 $this->_content .= '<div style="clear:both"></div>';
             }
             $product = new osC_Product($Qnewproducts->valueInt('products_id'));
             $this->_content .= '<div style="margin-top: 10px; float:left; width: 33%; text-align: center">' . '<span style="display:block; height: 32px; text-align: center">' . osc_link_object(osc_href_link(FILENAME_PRODUCTS, $Qnewproducts->value('products_id')), $Qnewproducts->value('products_name')) . '</span>' . osc_link_object(osc_href_link(FILENAME_PRODUCTS, $Qnewproducts->value('products_id')), $osC_Image->show($Qnewproducts->value('image'), $Qnewproducts->value('products_name')), 'id="productImage' . $Qnewproducts->value('products_id') . '"') . '<span style="display:block; padding: 3px; text-align: center">' . $product->getPriceFormated(true) . '</span>' . osc_link_object(osc_href_link(FILENAME_PRODUCTS, $Qnewproducts->valueInt('products_id') . '&action=cart_add'), osc_draw_image_button('button_add_to_cart.png', $osC_Language->get('button_add_to_cart'), 'class="ajaxAddToCart" id="ac_newproductsmodule_' . $Qnewproducts->value('products_id') . '"')) . '</div>';
             $i++;
         }
         $this->_content .= '<div style="clear:both"></div>';
     }
     $Qnewproducts->freeResult();
 }
 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'))));
 }
Esempio n. 11
0
 function _process()
 {
     global $osC_Database, $messageStack, $osC_Language;
     $data = array();
     $data['url'] = osc_sanitize_string($_POST['url']);
     if (isset($_POST['title']) && !empty($_POST['title'])) {
         $data['title'] = osc_sanitize_string($_POST['title']);
     } else {
         $messageStack->add('guestbook', $osC_Language->get('field_guestbook_title_error'));
     }
     if (isset($_POST['email']) && !empty($_POST['email']) && osc_validate_email_address($_POST['email'])) {
         $data['email'] = $_POST['email'];
     } else {
         $messageStack->add('guestbook', $osC_Language->get('field_guestbook_email_error'));
     }
     if (isset($_POST['content']) && !empty($_POST['content'])) {
         $data['content'] = osc_sanitize_string($_POST['content']);
     } else {
         $messageStack->add('guestbook', $osC_Language->get('field_guestbook_content_error'));
     }
     if ($_POST['verify_code'] != $_SESSION['verify_code']) {
         $messageStack->add('guestbook', $osC_Language->get('field_guestbook_verify_code_error'));
     }
     if ($messageStack->size('guestbook') === 0) {
         if (toC_Guestbook::saveEntry($data)) {
             $messageStack->add_session('guestbook', $osC_Language->get('success_guestbook_saved'), 'success');
         }
         osc_redirect(osc_href_link(FILENAME_INFO, 'guestbook'));
     }
 }
Esempio n. 12
0
 function _process()
 {
     global $osC_MessageStack, $osC_Database, $osC_Language;
     $Qcheck = $osC_Database->query('select customers_id, customers_firstname, customers_lastname, customers_gender, customers_email_address, customers_password from :table_customers where customers_email_address = :customers_email_address limit 1');
     $Qcheck->bindTable(':table_customers', TABLE_CUSTOMERS);
     $Qcheck->bindValue(':customers_email_address', $_POST['email_address']);
     $Qcheck->execute();
     if ($Qcheck->numberOfRows() === 1) {
         $password = osc_create_random_string(ACCOUNT_PASSWORD);
         if (osC_Account::savePassword($password, $Qcheck->valueInt('customers_id'))) {
             if (ACCOUNT_GENDER > -1) {
                 if ($data['gender'] == 'm') {
                     $email_text = sprintf($osC_Language->get('email_addressing_gender_male'), $Qcheck->valueProtected('customers_lastname')) . "\n\n";
                 } else {
                     $email_text = sprintf($osC_Language->get('email_addressing_gender_female'), $Qcheck->valueProtected('customers_lastname')) . "\n\n";
                 }
             } else {
                 $email_text = sprintf($osC_Language->get('email_addressing_gender_unknown'), $Qcheck->valueProtected('customers_firstname') . ' ' . $Qcheck->valueProtected('customers_lastname')) . "\n\n";
             }
             $email_text .= sprintf($osC_Language->get('email_password_reminder_body'), getenv('REMOTE_ADDR'), STORE_NAME, $password, STORE_OWNER_EMAIL_ADDRESS);
             osc_email($Qcheck->valueProtected('customers_firstname') . ' ' . $Qcheck->valueProtected('customers_lastname'), $Qcheck->valueProtected('customers_email_address'), sprintf($osC_Language->get('email_password_reminder_subject'), STORE_NAME), $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
             $osC_MessageStack->add('login', $osC_Language->get('success_password_forgotten_sent'), 'success');
         }
         osc_redirect(osc_href_link(FILENAME_ACCOUNT, 'login', 'SSL'));
     } else {
         $osC_MessageStack->add('password_forgotten', $osC_Language->get('error_password_forgotten_no_email_address_found'));
     }
 }
Esempio n. 13
0
 function initialize()
 {
     global $osC_Database, $osC_Language, $osC_Currencies;
     $constant = constant('BOX_SHOP_BY_PRICE_' . $osC_Currencies->getCode());
     if (!empty($constant)) {
         $prices = explode(";", $constant);
         if (is_array($prices) && sizeof($prices) > 0) {
             $this->_content = '<ol>';
             $pfrom = 0;
             $pto = 0;
             if (isset($_GET['pfrom']) && !empty($_GET['pfrom'])) {
                 $pfrom = $_GET['pfrom'];
             }
             if (isset($_GET['pto']) && !empty($_GET['pto'])) {
                 $pto = $_GET['pto'];
             }
             for ($n = 0; $n <= sizeof($prices); $n++) {
                 $filters = array();
                 if (isset($_GET['cPath']) && !empty($_GET['cPath'])) {
                     $filters[] = 'cPath=' . $_GET['cPath'];
                     if (isset($_GET['filter']) && !empty($_GET['filter'])) {
                         $filters[] = 'filter=' . $_GET['filter'];
                     }
                 }
                 if (isset($_GET['manufacturers']) && !empty($_GET['manufacturers'])) {
                     $filters[] = 'manufacturers=' . $_GET['manufacturers'];
                     if (isset($_GET['filter']) && !empty($_GET['filter'])) {
                         $filters[] = 'filter=' . $_GET['filter'];
                     }
                 }
                 if ($n == 0) {
                     $price_section = $osC_Currencies->displayRawPrice(0) . ' ~ ' . $osC_Currencies->displayRawPrice($prices[$n]);
                     if ($pfrom == 0 && $pto == $prices[$n]) {
                         $price_section = '<b>' . $price_section . '</b>';
                     }
                     $params = 'keywords=' . $_GET['keywords'] . '&x=0&y=0&pfrom=' . 0 . '&pto=' . $prices[$n] . '&' . implode('&', $filters);
                 } else {
                     if ($n == sizeof($prices)) {
                         $price_section = $osC_Currencies->displayRawPrice($prices[$n - 1]) . ' + ';
                         if ($pfrom == $prices[$n - 1] && $pto == 0) {
                             $price_section = '<b>' . $price_section . '</b>';
                         }
                         $params = 'keywords=' . $_GET['keywords'] . '&x=0&y=0&pfrom=' . $prices[$n - 1] . '&pto=' . '&' . implode('&', $filters);
                     } else {
                         $price_section = $osC_Currencies->displayRawPrice($prices[$n - 1]) . ' ~ ' . $osC_Currencies->displayRawPrice($prices[$n]);
                         if ($pfrom == $prices[$n - 1] && $pto == $prices[$n]) {
                             $price_section = '<b>' . $price_section . '</b>';
                         }
                         $params = 'keywords=' . $_GET['keywords'] . '&x=0&y=0&pfrom=' . $prices[$n - 1] . '&pto=' . $prices[$n] . '&' . implode('&', $filters);
                     }
                 }
                 if (defined('BOX_SHOP_BY_PRICE_RECURSIVE') && (int) BOX_SHOP_BY_PRICE_RECURSIVE == 1) {
                     $params .= '&recursive=1';
                 }
                 $this->_content .= '<li>' . osc_link_object(osc_href_link(FILENAME_SEARCH, $params), $price_section) . '</li>';
             }
             $this->_content .= '</ol>';
         }
     }
 }
Esempio n. 14
0
 function osC_Index_Manufacturers()
 {
     global $osC_Services, $osC_Language, $breadcrumb, $osC_Manufacturer;
     $this->_page_title = sprintf($osC_Language->get('index_heading'), STORE_NAME);
     if (is_numeric($_GET[$this->_module])) {
         include 'includes/classes/manufacturer.php';
         $osC_Manufacturer = new osC_Manufacturer($_GET[$this->_module]);
         if ($osC_Services->isStarted('breadcrumb')) {
             $breadcrumb->add($osC_Manufacturer->getTitle(), osc_href_link(FILENAME_DEFAULT, $this->_module . '=' . $_GET[$this->_module]));
         }
         $this->_page_title = $osC_Manufacturer->getTitle();
         $this->_page_image = 'manufacturers/' . $osC_Manufacturer->getImage();
         $page_title = $osC_Manufacturer->getPageTitle();
         if (!empty($page_title)) {
             $this->setMetaPageTitle($page_title);
         }
         $meta_keywords = $osC_Manufacturer->getMetaKeywords();
         if (!empty($meta_keywords)) {
             $this->addPageTags('keywords', $meta_keywords);
         }
         $meta_description = $osC_Manufacturer->getMetaDescription();
         if (!empty($meta_description)) {
             $this->addPageTags('description', $meta_description);
         }
         $this->_process();
     } else {
         $this->_page_contents = 'index.php';
     }
 }
Esempio n. 15
0
 function _process()
 {
     global $osC_Database, $osC_Session, $osC_Language, $osC_ShoppingCart, $messageStack, $osC_Customer, $osC_NavigationHistory, $toC_Wishlist;
     if (osC_Account::checkEntry($_POST['email_address'])) {
         if (osC_Account::checkPassword($_POST['password'], $_POST['email_address'])) {
             if (osC_Account::checkStatus($_POST['email_address'])) {
                 if (SERVICE_SESSION_REGENERATE_ID == '1') {
                     $osC_Session->recreate();
                 }
                 $osC_Customer->setCustomerData(osC_Account::getID($_POST['email_address']));
                 $Qupdate = $osC_Database->query('update :table_customers set date_last_logon = :date_last_logon, number_of_logons = number_of_logons+1 where customers_id = :customers_id');
                 $Qupdate->bindTable(':table_customers', TABLE_CUSTOMERS);
                 $Qupdate->bindRaw(':date_last_logon', 'now()');
                 $Qupdate->bindInt(':customers_id', $osC_Customer->getID());
                 $Qupdate->execute();
                 $osC_ShoppingCart->synchronizeWithDatabase();
                 $toC_Wishlist->synchronizeWithDatabase();
                 $osC_NavigationHistory->removeCurrentPage();
                 if ($osC_NavigationHistory->hasSnapshot()) {
                     $osC_NavigationHistory->redirectToSnapshot();
                 } else {
                     osc_redirect(osc_href_link(FILENAME_DEFAULT, null, 'AUTO'));
                 }
             } else {
                 $messageStack->add('login', $osC_Language->get('error_login_status_disabled'));
             }
         } else {
             $messageStack->add('login', $osC_Language->get('error_login_no_match'));
         }
     } else {
         $messageStack->add('login', $osC_Language->get('error_login_no_match'));
     }
 }
Esempio n. 16
0
 function _process()
 {
     global $osC_Language, $osC_MessageStack, $osC_Product;
     if (empty($_POST['from_name'])) {
         $osC_MessageStack->add('tell_a_friend', $osC_Language->get('error_tell_a_friend_customers_name_empty'));
     }
     if (!osc_validate_email_address($_POST['from_email_address'])) {
         $osC_MessageStack->add('tell_a_friend', $osC_Language->get('error_tell_a_friend_invalid_customers_email_address'));
     }
     if (empty($_POST['to_name'])) {
         $osC_MessageStack->add('tell_a_friend', $osC_Language->get('error_tell_a_friend_friends_name_empty'));
     }
     if (!osc_validate_email_address($_POST['to_email_address'])) {
         $osC_MessageStack->add('tell_a_friend', $osC_Language->get('error_tell_a_friend_invalid_friends_email_address'));
     }
     if ($osC_MessageStack->size('tell_a_friend') < 1) {
         $email_subject = sprintf($osC_Language->get('email_tell_a_friend_subject'), osc_sanitize_string($_POST['from_name']), STORE_NAME);
         $email_body = sprintf($osC_Language->get('email_tell_a_friend_intro'), osc_sanitize_string($_POST['to_name']), osc_sanitize_string($_POST['from_name']), $osC_Product->getTitle(), STORE_NAME) . "\n\n";
         if (!empty($_POST['message'])) {
             $email_body .= osc_sanitize_string($_POST['message']) . "\n\n";
         }
         $email_body .= sprintf($osC_Language->get('email_tell_a_friend_link'), osc_href_link(FILENAME_PRODUCTS, $osC_Product->getKeyword(), 'NONSSL', false)) . "\n\n" . sprintf($osC_Language->get('email_tell_a_friend_signature'), STORE_NAME . "\n" . HTTP_SERVER . DIR_WS_CATALOG . "\n");
         osc_email(osc_sanitize_string($_POST['to_name']), osc_sanitize_string($_POST['to_email_address']), $email_subject, $email_body, osc_sanitize_string($_POST['from_name']), osc_sanitize_string($_POST['from_email_address']));
         $osC_MessageStack->add('header', sprintf($osC_Language->get('success_tell_a_friend_email_sent'), $osC_Product->getTitle(), osc_output_string_protected($_POST['to_name'])), 'success');
         osc_redirect(osc_href_link(FILENAME_PRODUCTS, $osC_Product->getID()));
     }
 }
 function initialize()
 {
     global $osC_Database, $osC_Language, $osC_Product, $osC_Image;
     if (isset($osC_Product)) {
         $Qproducts = $osC_Database->query('select p.products_id, pd.products_name, i.image from :table_products_xsell px left join :table_products_images i on (px.xsell_products_id = i.products_id and i.default_flag = :default_flag), :table_products p, :table_products_description pd where px.xsell_products_id = p.products_id and p.products_id = pd.products_id and px.products_id = :products_id and p.products_status = 1 and pd.language_id = :language_id');
         $Qproducts->bindTable(':table_products_xsell', TABLE_PRODUCTS_XSELL);
         $Qproducts->bindTable(':table_products_images', TABLE_PRODUCTS_IMAGES);
         $Qproducts->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
         $Qproducts->bindTable(':table_products', TABLE_PRODUCTS);
         $Qproducts->bindInt(':default_flag', 1);
         $Qproducts->bindInt(':products_id', $osC_Product->getID());
         $Qproducts->bindInt(':language_id', $osC_Language->getID());
         $Qproducts->execute();
         if ($Qproducts->numberOfRows() > 0) {
             $this->_content = '<div style="overflow: auto;">';
             while ($Qproducts->next()) {
                 $this->_content .= '<span style="width: 32%; float: left; padding: 3px; text-align: center">';
                 //            if (osc_empty($Qproducts->value('image')) === false) {
                 $this->_content .= osc_link_object(osc_href_link(FILENAME_PRODUCTS, $Qproducts->value('products_id')), $osC_Image->show($Qproducts->value('image'), $Qproducts->value('products_name'))) . '<br />';
                 //            }
                 $this->_content .= osc_link_object(osc_href_link(FILENAME_PRODUCTS, $Qproducts->value('products_id')), $Qproducts->value('products_name')) . '</span>';
             }
             $this->_content .= '</div>';
         }
         $Qproducts->freeResult();
     }
 }
Esempio n. 18
0
 function getOutput()
 {
     global $osC_Product;
     if (!empty($osC_Product)) {
         return osc_link_object(osc_href_link(FILENAME_PRODUCTS, 'tell_a_friend&' . $osC_Product->getID()), $this->getIcon());
     }
 }
 function initialize()
 {
     global $osC_Database, $osC_Language, $osC_Product, $osC_Image;
     if (isset($osC_Product)) {
         $Qorders = $osC_Database->query('select p.products_id, pd.products_name, pd.products_keyword, i.image from :table_orders_products opa, :table_orders_products opb, :table_orders o, :table_products p left join :table_products_images i on (p.products_id = i.products_id and i.default_flag = :default_flag), :table_products_description pd where opa.products_id = :products_id and opa.orders_id = opb.orders_id and opb.products_id != :products_id and opb.products_id = p.products_id and opb.orders_id = o.orders_id and p.products_status = 1 and p.products_id = pd.products_id and pd.language_id = :language_id group by p.products_id order by o.date_purchased desc limit :limit');
         $Qorders->bindTable(':table_orders_products', TABLE_ORDERS_PRODUCTS);
         $Qorders->bindTable(':table_orders_products', TABLE_ORDERS_PRODUCTS);
         $Qorders->bindTable(':table_orders', TABLE_ORDERS);
         $Qorders->bindTable(':table_products', TABLE_PRODUCTS);
         $Qorders->bindTable(':table_products_images', TABLE_PRODUCTS_IMAGES);
         $Qorders->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
         $Qorders->bindInt(':default_flag', 1);
         $Qorders->bindInt(':products_id', $osC_Product->getID());
         $Qorders->bindInt(':products_id', $osC_Product->getID());
         $Qorders->bindInt(':language_id', $osC_Language->getID());
         $Qorders->bindInt(':limit', MODULE_CONTENT_ALSO_PURCHASED_MAX_DISPLAY);
         if (MODULE_CONTENT_ALSO_PURCHASED_PRODUCTS_CACHE > 0) {
             $Qorders->setCache('also_purchased-' . $osC_Product->getID(), MODULE_CONTENT_ALSO_PURCHASED_PRODUCTS_CACHE);
         }
         $Qorders->execute();
         if ($Qorders->numberOfRows() >= MODULE_CONTENT_ALSO_PURCHASED_MIN_DISPLAY) {
             $this->_content = '<div style="overflow: auto;">';
             while ($Qorders->next()) {
                 $this->_content .= '<span style="width: 33%; float: left; text-align: center;">';
                 if (osc_empty($Qorders->value('image')) === false) {
                     $this->_content .= osc_link_object(osc_href_link(FILENAME_PRODUCTS, $Qorders->value('products_id')), $osC_Image->show($Qorders->value('image'), $Qorders->value('products_name'))) . '<br />';
                 }
                 $this->_content .= osc_link_object(osc_href_link(FILENAME_PRODUCTS, $Qorders->value('products_id')), $Qorders->value('products_name')) . '</span>';
             }
             $this->_content .= '</div>';
         }
         $Qorders->freeResult();
     }
 }
Esempio n. 20
0
 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 getProducts()
 {
     global $osC_Database, $osC_Language, $toC_Json, $osC_Image;
     if (defined('IMAGE_GROUP_AUTO_COMPLETER')) {
         $image_group = IMAGE_GROUP_AUTO_COMPLETER;
     } else {
         $image_group = 'mini';
     }
     if (defined('MAX_CHARACTERS_AUTO_COMPLETER')) {
         $max_name_len = MAX_CHARACTERS_AUTO_COMPLETER;
     } else {
         $max_name_len = 40;
     }
     $products = array();
     if (isset($_POST['keywords']) && !empty($_POST['keywords'])) {
         $Qproducts = $osC_Database->query("select distinct p.products_id as products_id, pd.products_name from :table_products_description pd, :table_products p where pd.products_id = p.products_id and p.products_status = :products_status and products_name like :keywords and language_id =" . $osC_Language->getID() . ' limit :max_results');
         $Qproducts->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
         $Qproducts->bindTable(':table_products', TABLE_PRODUCTS);
         $Qproducts->bindInt(':products_status', 1);
         $Qproducts->bindInt(':max_results', MAX_DISPLAY_AUTO_COMPLETER_RESULTS);
         $Qproducts->bindValue(':keywords', '%' . $_POST['keywords'] . '%');
         $Qproducts->execute();
         while ($Qproducts->next()) {
             $osC_Product = new osC_Product($Qproducts->valueInt('products_id'));
             $products_name = $Qproducts->value('products_name');
             if (strlen($products_name) > $max_name_len) {
                 $products_name = substr($products_name, 0, $max_name_len) . '...';
             }
             $products[] = '<div class="image">' . $osC_Image->show($osC_Product->getImage(), null, null, $image_group) . '</div><div class="details">' . osc_link_object(osc_href_link(FILENAME_PRODUCTS, $Qproducts->valueInt('products_id')), $products_name) . '<strong class="price">' . $osC_Product->getPriceFormated(true) . '</strong></div>';
         }
     }
     echo $toC_Json->encode($products);
 }
Esempio n. 22
0
 function osC_Checkout_Process()
 {
     global $osC_Session, $osC_ShoppingCart, $osC_Customer, $osC_NavigationHistory, $osC_Payment;
     if ($osC_ShoppingCart->hasContents() === false) {
         osc_redirect(osc_href_link(FILENAME_CHECKOUT, null, 'SSL'));
     }
     // if no shipping method has been selected, redirect the customer to the shipping method selection page
     if ($osC_ShoppingCart->hasShippingMethod() === false && $osC_ShoppingCart->getContentType() != 'virtual') {
         osc_redirect(osc_href_link(FILENAME_CHECKOUT, 'shipping', 'SSL'));
     }
     if ($osC_ShoppingCart->hasBillingMethod()) {
         // load selected payment module
         include 'includes/classes/payment.php';
         $osC_Payment = new osC_Payment($osC_ShoppingCart->getBillingMethod('id'));
     }
     include 'includes/classes/order.php';
     if ($osC_ShoppingCart->hasBillingMethod()) {
         $osC_Payment->process();
     } else {
         $orders_id = osC_Order::insert();
         osC_Order::process($orders_id, ORDERS_STATUS_PAID);
     }
     $osC_ShoppingCart->reset(true);
     // unregister session variables used during checkout
     unset($_SESSION['comments']);
     osc_redirect(osc_href_link(FILENAME_CHECKOUT, 'success', 'SSL'));
 }
Esempio n. 23
0
 function initialize()
 {
     global $osC_Language, $osC_Template, $osC_Session, $osC_Currencies;
     $this->_title_link = osc_href_link(FILENAME_CHECKOUT, null, 'SSL');
     $content = '<div id="ajaxCartContent">' . '<div id="ajaxCartContentShort" class="collapsed">' . '<span class="cartTotal"></span>' . '<span class="quantity"></span> ' . $osC_Language->get('text_items') . '</div>' . '<div id="ajaxCartContentLong" class="expanded">' . '<ul class="products collapsed" id="ajaxCartContentProducts"><li></li></ul>' . '<p id="ajaxCartContentNoProducts" class="collapsed">' . $osC_Language->get('No products') . '</p>' . '<div id="ajaxCartButtons">' . osc_link_object(osc_href_link(FILENAME_CHECKOUT), osc_draw_image_button('button_ajax_cart.png'), 'id="ajax-shopping-button-cart"') . osc_link_object(osc_href_link(FILENAME_CHECKOUT, 'payment'), osc_draw_image_button('button_ajax_cart_checkout.png')) . '<div style="visibility:hidden">' . '<span>clear-bug-div</span>' . '</div>' . '</div>' . '</div>' . '</div>';
     $css = '#ajaxCartContent {overflow: hidden;}' . chr(13) . '.boxTitle #ajaxCartCollapse, .boxTitle #ajaxCartExpand {cursor:pointer;position:relative;top:3px;}' . chr(13) . '.hidden {display: none;}' . chr(13) . '.expanded {display: block;}' . chr(13) . '.collapsed {display: none;}' . chr(13) . '.strike {text-decoration:line-through;}' . chr(13) . '#ajaxCartContentShort span{ padding: 0 2px;}' . chr(13) . '#ajaxCartButtons {margin-top:10px;}' . chr(13) . '#ajaxCartButtons a {padding: 1px;text-align: center;text-decoration: none;}' . chr(13) . '#ajaxCartOrderTotals span.orderTotalText {float: left}' . chr(13) . '#ajaxCartContentLong ul.products {text-align: right;}' . chr(13) . '#ajaxCartContentLong ul li {padding: 6px 0;font-size: 9px;position: relative;line-height:16px;}' . chr(13) . '#ajaxCartContentLong ul.products span.price {display:block;position:absolute;left:15px;top:8px;}' . chr(13) . '#ajaxCartContentLong ul.products .removeProduct {cursor: pointer;display: block;width: 11px;height: 13px;position: absolute;left: 0;top: 8px;background: url(includes/languages/' . $osC_Language->getCode() . '/images/buttons/button_ajax_cart_delete.gif) no-repeat right top;}' . chr(13) . '#ajaxCartContentLong #ajax_cart_prices {padding: 5px 0;border-top : 1px dashed #777F7D;}' . chr(13) . '#ajaxCartOrderTotals {padding:5px 0;border-top: 1px dashed #CCCCCC;}' . chr(13) . '#ajaxCartContentLong #ajaxCartOrderTotals li {padding: 2px;font-size: 11px}' . chr(13) . '#ajaxCartContentLong p{color: #616060;font-size: 10px;margin: 0}' . chr(13) . '#ajaxCartContentLong p.variants, #ajaxCartContentLong p.customizations { padding: 2px;margin: 0 5px 0 0; }' . chr(13) . '#ajaxCartContentShort span.cartTotal {float:left; font-weight: bold}' . chr(13) . '#ajaxCartContentProducts dd span {display:block;padding-right:32px;}' . "\n\n";
     $osC_Template->addStyleDeclaration($css);
     $osC_Template->addJavascriptFilename('includes/javascript/ajax_shopping_cart.js');
     $enable_confirmation_dlg = false;
     if (defined('ENABLE_CONFIRMATION_DIALOG') && ENABLE_CONFIRMATION_DIALOG == '1') {
         $enable_confirmation_dlg = true;
     }
     $js .= '<script type="text/javascript">
             window.addEvent("domready",function() {
               ajaxCart = new AjaxShoppingCart({
                 sessionId : "' . $osC_Session->getID() . '",
                 currentUrl: "' . osc_get_current_url() . '",
                 error_sender_name_empty: "' . $osC_Language->get('error_sender_name_empty') . '",
                 error_sender_email_empty: "' . $osC_Language->get('error_sender_email_empty') . '",
                 error_recipient_name_empty: "' . $osC_Language->get('error_recipient_name_empty') . '",
                 error_recipient_email_empty: "' . $osC_Language->get('error_recipient_email_empty') . '",
                 error_message_empty: "' . $osC_Language->get('error_message_empty') . '",
                 error_message_open_gift_certificate_amount: "' . $osC_Language->get('error_message_open_gift_certificate_amount') . '",
                 dlgConfirmStatus: ' . $enable_confirmation_dlg . '
               });
             });
           </script>';
     $this->_content = $content . "\n" . $js;
 }
Esempio n. 24
0
 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';
     }
 }
Esempio n. 25
0
 function execute()
 {
     global $osC_ShoppingCart;
     if (isset($_POST['products']) && is_array($_POST['products']) && !empty($_POST['products'])) {
         foreach ($_POST['products'] as $product => $quantity) {
             if (!is_numeric($quantity)) {
                 return false;
             }
             $product = explode('#', $product, 2);
             $variants_array = array();
             if (isset($product[1])) {
                 $variants = explode(';', $product[1]);
                 foreach ($variants as $set) {
                     $variant = explode(':', $set);
                     if (is_numeric($variant[0]) && is_numeric($variant[1])) {
                         $variants_array[$variant[0]] = $variant[1];
                     }
                 }
             }
             $osC_Product = new osC_Product($product[0]);
             if ($osC_Product->isGiftCertificate()) {
                 $variants_array = $product[1];
             }
             $osC_ShoppingCart->add($product[0], $variants_array, $quantity, null, 'update');
         }
     }
     osc_redirect(osc_href_link(FILENAME_CHECKOUT));
 }
 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 initialize()
 {
     global $osC_Database, $osC_Language, $osC_Product, $osC_Customer;
     $this->_title_link = osc_href_link(FILENAME_ACCOUNT, 'notifications', 'SSL');
     if (isset($osC_Product) && is_a($osC_Product, 'osC_Product')) {
         if ($osC_Customer->isLoggedOn()) {
             $Qcheck = $osC_Database->query('select global_product_notifications from :table_customers where customers_id = :customers_id');
             $Qcheck->bindTable(':table_customers', TABLE_CUSTOMERS);
             $Qcheck->bindInt(':customers_id', $osC_Customer->getID());
             $Qcheck->execute();
             if ($Qcheck->valueInt('global_product_notifications') === 0) {
                 $Qcheck = $osC_Database->query('select products_id from :table_products_notifications where products_id = :products_id and customers_id = :customers_id limit 1');
                 $Qcheck->bindTable(':table_products_notifications', TABLE_PRODUCTS_NOTIFICATIONS);
                 $Qcheck->bindInt(':products_id', $osC_Product->getID());
                 $Qcheck->bindInt(':customers_id', $osC_Customer->getID());
                 $Qcheck->execute();
                 if ($Qcheck->numberOfRows() > 0) {
                     $this->_content = '<div style="float: left; width: 55px;">' . osc_link_object(osc_href_link(basename($_SERVER['SCRIPT_FILENAME']), osc_get_all_get_params(array('action')) . '&action=notify_remove', 'AUTO'), osc_image(DIR_WS_IMAGES . 'box_products_notifications_remove.gif', sprintf($osC_Language->get('box_product_notifications_remove'), $osC_Product->getTitle()))) . '</div>' . osc_link_object(osc_href_link(basename($_SERVER['SCRIPT_FILENAME']), osc_get_all_get_params(array('action')) . '&action=notify_remove', 'AUTO'), sprintf($osC_Language->get('box_product_notifications_remove'), $osC_Product->getTitle()));
                 } else {
                     $this->_content = '<div style="float: left; width: 55px;">' . osc_link_object(osc_href_link(basename($_SERVER['SCRIPT_FILENAME']), osc_get_all_get_params(array('action')) . '&action=notify_add', 'AUTO'), osc_image(DIR_WS_IMAGES . 'box_products_notifications.gif', sprintf($osC_Language->get('box_product_notifications_add'), $osC_Product->getTitle()))) . '</div>' . osc_link_object(osc_href_link(basename($_SERVER['SCRIPT_FILENAME']), osc_get_all_get_params(array('action')) . '&action=notify_add', 'AUTO'), sprintf($osC_Language->get('box_product_notifications_add'), $osC_Product->getTitle()));
                 }
                 $this->_content .= '<div style="clear: both;"></div>';
             }
         } else {
             $this->_content = '<div style="float: left; width: 55px;">' . osc_link_object(osc_href_link(basename($_SERVER['SCRIPT_FILENAME']), osc_get_all_get_params(array('action')) . '&action=notify_add', 'AUTO'), osc_image(DIR_WS_IMAGES . 'box_products_notifications.gif', sprintf($osC_Language->get('box_product_notifications_add'), $osC_Product->getTitle()))) . '</div>' . osc_link_object(osc_href_link(basename($_SERVER['SCRIPT_FILENAME']), osc_get_all_get_params(array('action')) . '&action=notify_add', 'AUTO'), sprintf($osC_Language->get('box_product_notifications_add'), $osC_Product->getTitle())) . '<div style="clear: both;"></div>';
         }
     }
 }
Esempio n. 28
0
 function initialize()
 {
     global $osC_Cache, $osC_Database, $osC_Services, $osC_Currencies, $osC_Specials, $osC_Language, $osC_Image;
     $this->_title_link = osc_href_link(FILENAME_PRODUCTS, 'new');
     if (BOX_WHATS_NEW_CACHE > 0 && $osC_Cache->read('box-whats_new-' . $osC_Language->getCode() . '-' . $osC_Currencies->getCode(), BOX_WHATS_NEW_CACHE)) {
         $data = $osC_Cache->getCache();
     } else {
         $data = array();
         $Qnew = $osC_Database->query('select p.products_id, p.products_tax_class_id, p.products_price, pd.products_name, pd.products_keyword, i.image from :table_products p left join :table_products_images i on (p.products_id = i.products_id and i.default_flag = :default_flag), :table_products_description pd where p.products_status = 1 and p.products_id = pd.products_id and pd.language_id = :language_id order by p.products_date_added desc limit :max_random_select_new');
         $Qnew->bindTable(':table_products', TABLE_PRODUCTS);
         $Qnew->bindTable(':table_products_images', TABLE_PRODUCTS_IMAGES);
         $Qnew->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
         $Qnew->bindInt(':default_flag', 1);
         $Qnew->bindInt(':language_id', $osC_Language->getID());
         $Qnew->bindInt(':max_random_select_new', BOX_WHATS_NEW_RANDOM_SELECT);
         $Qnew->executeRandomMulti();
         if ($Qnew->numberOfRows()) {
             $data = $Qnew->toArray();
             $osC_Product = new osC_Product($Qnew->valueInt('products_id'));
             $data['products_price'] = $osC_Product->getPriceFormated(true);
         }
         $osC_Cache->write('box-whats_new-' . $osC_Language->getCode() . '-' . $osC_Currencies->getCode(), $data);
     }
     if (empty($data) === false) {
         $this->_content = '';
         if (empty($data['image']) === false) {
             $this->_content .= osc_link_object(osc_href_link(FILENAME_PRODUCTS, $data['products_id']), $osC_Image->show($data['image'], $data['products_name'])) . '<br />';
         }
         $this->_content .= '<span>' . osc_link_object(osc_href_link(FILENAME_PRODUCTS, $data['products_id']), $data['products_name']) . '</span><br /><span class="productPrice">' . $data['products_price'] . '</span>';
     }
 }
/**
 * Build categories dropdown menu
 * 
 * @access public
 * @param $categories 
 * @param $data
 * @param $level
 * @param $parents_id
 * @return string
 */
function build_categories_dropdown_menu($parents_id = 0, $categories = null, $data = null, $level = 0)
{
    global $osC_CategoryTree;
    //if it is top category
    if ($parents_id == 0) {
        $data = $osC_CategoryTree->data;
        $categories = $data[0];
        $result = '<ul class="nav">';
    } else {
        $result = $parents_id == 0 ? '<ul role="menu" class="dropdown-menu" aria-labelledby="drop' . $parents_id . '">' : '<ul class="dropdown-menu">';
    }
    //add menu items
    if (is_array($categories) && !empty($categories)) {
        foreach ($categories as $categories_id => $categories) {
            $has_sub_category = in_array($categories_id, array_keys($data));
            $name = $parents_id == 0 && $has_sub_category == TRUE ? $categories['name'] . '&nbsp;&nbsp;<b class="caret"></b>' : $categories['name'];
            //li element
            if ($parents_id == 0) {
                $result .= $has_sub_category == TRUE ? '<li class="dropdown">' : '<li>';
            } else {
                $result .= $has_sub_category == TRUE ? '<li class="dropdown-submenu">' : '<li>';
            }
            $link_attributes = $parents_id == 0 && $has_sub_category == TRUE ? 'data-toggle="dropdown" class="dropdown-toggle" role="button" id="drop' . $categories_id . '"' : '';
            $result .= osc_link_object(osc_href_link(FILENAME_DEFAULT, 'cPath=' . $categories_id), $name, $link_attributes);
            if ($has_sub_category) {
                $result .= build_categories_dropdown_menu($categories_id, $data[$categories_id], $data, $level + 1);
            }
            $result .= '</li>';
        }
    }
    $result .= '</ul>';
    return $result;
}
Esempio n. 30
0
 function initialize()
 {
     global $osC_Language, $osC_Template, $toC_Compare_Products;
     if ($toC_Compare_Products->hasContents()) {
         $osC_Template->addStyleSheet('ext/multibox/multibox.css');
         $osC_Template->addJavascriptFilename('ext/multibox/Overlay.js');
         $osC_Template->addJavascriptFilename('ext/multibox/MultiBox.js');
         $this->_content = '<ul>';
         foreach ($toC_Compare_Products->getProducts() as $products_id) {
             $osC_Product = new osC_Product($products_id);
             $this->_content .= '<li>' . osc_link_object(osc_href_link(basename($_SERVER['SCRIPT_FILENAME']), $products_id . '&' . osc_get_all_get_params(array('action')) . '&action=compare_products_remove'), osc_draw_image_button('button_delete_icon.png', $osC_Language->get('button_delete')), 'style="float: right; margin: 0 3px 1px 3px"') . osc_link_object(osc_href_link(FILENAME_PRODUCTS, $products_id), $osC_Product->getTitle()) . '</li>';
         }
         $this->_content .= '</ul>';
         $this->_content .= '<p>' . '<span style="float: right">' . osc_link_object(osc_href_link(FILENAME_JSON, 'module=products&action=compare_products'), osc_draw_image_button('small_compare_now.png', $osC_Language->get('button_compare_now')), 'class="multibox" rel="width:800,height:400,ajax:true"') . '</span>' . osc_link_object(osc_href_link(basename($_SERVER['SCRIPT_FILENAME']), osc_get_all_get_params(array('action')) . '&action=compare_products_clear'), osc_draw_image_button('small_clear.png', $osC_Language->get('button_clear'))) . '&nbsp;&nbsp;' . '</p>';
         $js .= '<script type="text/javascript">
               window.addEvent("domready",function() {
                 var overlay = new Overlay(); 
                 var box = new MultiBox(\'multibox\', { 
                     overlay: overlay
                 });
               });
             </script>';
         $this->_content .= "\n" . $js;
     }
 }