function initialize()
 {
     $OSCOM_Cache = Registry::get('Cache');
     $OSCOM_Language = Registry::get('Language');
     $OSCOM_Currencies = Registry::get('Currencies');
     $OSCOM_PDO = Registry::get('PDO');
     $OSCOM_Image = Registry::get('Image');
     $this->_title_link = OSCOM::getLink(null, 'Products', 'All');
     $data = array();
     if (BOX_WHATS_NEW_CACHE > 0 && $OSCOM_Cache->read('box-whats_new-' . $OSCOM_Language->getCode() . '-' . $OSCOM_Currencies->getCode(), BOX_WHATS_NEW_CACHE)) {
         $data = $OSCOM_Cache->getCache();
     } else {
         $Qnew = $OSCOM_PDO->prepare('select products_id from :table_products where products_status = :products_status order by products_date_added desc limit :max_random_select_new');
         $Qnew->bindInt(':products_status', 1);
         $Qnew->bindInt(':max_random_select_new', BOX_WHATS_NEW_RANDOM_SELECT);
         $Qnew->execute();
         $result = $Qnew->fetchAll();
         if (count($result) > 0) {
             $result = $result[rand(0, count($result) - 1)];
             $OSCOM_Product = new Product($result['products_id']);
             $data = $OSCOM_Product->getData();
             $data['display_price'] = $OSCOM_Product->getPriceFormated(true);
             $data['display_image'] = $OSCOM_Product->getImage();
         }
         $OSCOM_Cache->write($data);
     }
     if (!empty($data)) {
         $this->_content = '';
         if (!empty($data['display_image'])) {
             $this->_content .= HTML::link(OSCOM::getLink(null, 'Products', $data['keyword']), $OSCOM_Image->show($data['display_image'], $data['name'])) . '<br />';
         }
         $this->_content .= HTML::link(OSCOM::getLink(null, 'Products', $data['keyword']), $data['name']) . '<br />' . $data['display_price'];
     }
 }
Example #2
0
 function initialize()
 {
     $OSCOM_Cache = Registry::get('Cache');
     $OSCOM_Language = Registry::get('Language');
     $OSCOM_Currencies = Registry::get('Currencies');
     $OSCOM_Database = Registry::get('Database');
     $OSCOM_Image = Registry::get('Image');
     $this->_title_link = OSCOM::getLink(null, 'Products', 'All');
     $data = array();
     if (BOX_WHATS_NEW_CACHE > 0 && $OSCOM_Cache->read('box-whats_new-' . $OSCOM_Language->getCode() . '-' . $OSCOM_Currencies->getCode(), BOX_WHATS_NEW_CACHE)) {
         $data = $OSCOM_Cache->getCache();
     } else {
         $Qnew = $OSCOM_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->bindInt(':products_status', 1);
         $Qnew->bindInt(':max_random_select_new', BOX_WHATS_NEW_RANDOM_SELECT);
         $Qnew->executeRandomMulti();
         if ($Qnew->numberOfRows()) {
             $OSCOM_Product = new Product($Qnew->valueInt('products_id'));
             $data = $OSCOM_Product->getData();
             $data['display_price'] = $OSCOM_Product->getPriceFormated(true);
             $data['display_image'] = $OSCOM_Product->getImage();
         }
         $OSCOM_Cache->write($data);
     }
     if (!empty($data)) {
         $this->_content = '';
         if (!empty($data['display_image'])) {
             $this->_content .= osc_link_object(OSCOM::getLink(null, 'Products', $data['keyword']), $OSCOM_Image->show($data['display_image'], $data['name'])) . '<br />';
         }
         $this->_content .= osc_link_object(OSCOM::getLink(null, 'Products', $data['keyword']), $data['name']) . '<br />' . $data['display_price'];
     }
 }
Example #3
0
 protected function process()
 {
     $OSCOM_ShoppingCart = Registry::get('ShoppingCart');
     $OSCOM_Customer = Registry::get('Customer');
     $OSCOM_Language = Registry::get('Language');
     $OSCOM_Service = Registry::get('Service');
     $OSCOM_Breadcrumb = Registry::get('Breadcrumb');
     $OSCOM_MessageStack = Registry::get('MessageStack');
     // redirect to shopping cart if shopping cart is empty
     if (!$OSCOM_ShoppingCart->hasContents()) {
         osc_redirect(OSCOM::getLink(null, 'Cart'));
     }
     // check for e-mail address
     if (!$OSCOM_Customer->hasEmailAddress()) {
         if (isset($_POST['email']) && strlen(trim($_POST['email'])) >= ACCOUNT_EMAIL_ADDRESS) {
             if (osc_validate_email_address($_POST['email'])) {
                 $OSCOM_Customer->setEmailAddress(trim($_POST['email']));
             } else {
                 $OSCOM_MessageStack->add('Cart', OSCOM::getDef('field_customer_email_address_check_error'));
                 osc_redirect(OSCOM::getLink(null, 'Cart'));
             }
         } else {
             $OSCOM_MessageStack->add('Cart', sprintf(OSCOM::getDef('field_customer_email_address_error'), ACCOUNT_EMAIL_ADDRESS));
             osc_redirect(OSCOM::getLink(null, 'Cart'));
         }
     }
     // check product type perform_order conditions
     foreach ($OSCOM_ShoppingCart->getProducts() as $product) {
         $OSCOM_Product = new Product($product['id']);
         $OSCOM_Product->isTypeActionAllowed('PerformOrder');
     }
     $OSCOM_Language->load('checkout');
     $OSCOM_Language->load('order');
     $this->_page_title = OSCOM::getDef('confirmation_heading');
     if ($OSCOM_Service->isStarted('Breadcrumb')) {
         $OSCOM_Breadcrumb->add(OSCOM::getDef('breadcrumb_checkout_confirmation'), OSCOM::getLink(null, 'Checkout', null, 'SSL'));
     }
     if (isset($_POST['comments']) && isset($_SESSION['comments']) && empty($_POST['comments'])) {
         unset($_SESSION['comments']);
     } elseif (!empty($_POST['comments'])) {
         $_SESSION['comments'] = osc_sanitize_string($_POST['comments']);
     }
     if (DISPLAY_CONDITIONS_ON_CHECKOUT == '1') {
         if (!isset($_POST['conditions']) || $_POST['conditions'] != '1') {
             $OSCOM_MessageStack->add('Checkout', OSCOM::getDef('error_conditions_not_accepted'), 'error');
         }
     }
     if (Registry::exists('Payment') === false) {
         Registry::set('Payment', new Payment());
     }
     if ($OSCOM_ShoppingCart->hasBillingMethod()) {
         $OSCOM_Payment = Registry::get('Payment');
         $OSCOM_Payment->load($OSCOM_ShoppingCart->getBillingMethod('id'));
     }
 }
 public function requireCustomerAccount()
 {
     $OSCOM_ShoppingCart = Registry::get('ShoppingCart');
     foreach ($OSCOM_ShoppingCart->getProducts() as $product) {
         $OSCOM_Product = new Product($product['id']);
         if ($OSCOM_Product->isTypeActionAllowed(array('PerformOrder', 'RequireCustomerAccount'), null, false)) {
             return true;
         }
     }
     return false;
 }
Example #5
0
 public static function execute(ApplicationAbstract $application)
 {
     $OSCOM_ShoppingCart = Registry::get('ShoppingCart');
     $requested_product = null;
     if (count($_GET) > 2) {
         $requested_product = basename(key(array_slice($_GET, 2, 1, true)));
         if ($requested_product == 'Add') {
             unset($requested_product);
             if (count($_GET) > 3) {
                 $requested_product = basename(key(array_slice($_GET, 3, 1, true)));
             }
         }
     }
     if (isset($requested_product)) {
         if (Product::checkEntry($requested_product)) {
             $OSCOM_Product = new Product($requested_product);
             if ($OSCOM_Product->isTypeActionAllowed('AddToShoppingCart')) {
                 if ($OSCOM_Product->hasVariants()) {
                     if (isset($_POST['variants']) && is_array($_POST['variants']) && !empty($_POST['variants'])) {
                         if ($OSCOM_Product->variantExists($_POST['variants'])) {
                             $OSCOM_ShoppingCart->add($OSCOM_Product->getProductVariantID($_POST['variants']));
                         } else {
                             OSCOM::redirect(OSCOM::getLink(null, 'Products', $OSCOM_Product->getKeyword()));
                         }
                     } else {
                         OSCOM::redirect(OSCOM::getLink(null, 'Products', $OSCOM_Product->getKeyword()));
                     }
                 } else {
                     $OSCOM_ShoppingCart->add($OSCOM_Product->getID());
                 }
             }
         }
     }
     OSCOM::redirect(OSCOM::getLink(null, 'Cart'));
 }
Example #6
0
 public static function execute(ApplicationAbstract $application)
 {
     $OSCOM_Customer = Registry::get('Customer');
     $OSCOM_NavigationHistory = Registry::get('NavigationHistory');
     $OSCOM_MessageStack = Registry::get('MessageStack');
     $OSCOM_Service = Registry::get('Service');
     $OSCOM_Breadcrumb = Registry::get('Breadcrumb');
     if (ALLOW_GUEST_TO_TELL_A_FRIEND == '-1' && $OSCOM_Customer->isLoggedOn() === false) {
         $OSCOM_NavigationHistory->setSnapshot();
         osc_redirect(OSCOM::getLink(null, 'Account', 'LogIn', 'SSL'));
     }
     $requested_product = null;
     $product_check = false;
     if (count($_GET) > 3) {
         $requested_product = basename(key(array_slice($_GET, 3, 1, true)));
         if ($requested_product == 'Write') {
             unset($requested_product);
             if (count($_GET) > 4) {
                 $requested_product = basename(key(array_slice($_GET, 4, 1, true)));
             }
         }
     }
     if (isset($requested_product)) {
         if (Product::checkEntry($requested_product)) {
             $product_check = true;
         }
     }
     if ($product_check === false) {
         $application->setPageContent('not_found.php');
         return false;
     }
     Registry::set('Product', new Product($requested_product));
     $OSCOM_Product = Registry::get('Product');
     if (empty($_POST['from_name'])) {
         $OSCOM_MessageStack->add('TellAFriend', OSCOM::getDef('error_tell_a_friend_customers_name_empty'));
     }
     if (!osc_validate_email_address($_POST['from_email_address'])) {
         $OSCOM_MessageStack->add('TellAFriend', OSCOM::getDef('error_tell_a_friend_invalid_customers_email_address'));
     }
     if (empty($_POST['to_name'])) {
         $OSCOM_MessageStack->add('TellAFriend', OSCOM::getDef('error_tell_a_friend_friends_name_empty'));
     }
     if (!osc_validate_email_address($_POST['to_email_address'])) {
         $OSCOM_MessageStack->add('TellAFriend', OSCOM::getDef('error_tell_a_friend_invalid_friends_email_address'));
     }
     if ($OSCOM_MessageStack->size('TellAFriend') < 1) {
         $email_subject = sprintf(OSCOM::getDef('email_tell_a_friend_subject'), osc_sanitize_string($_POST['from_name']), STORE_NAME);
         $email_body = sprintf(OSCOM::getDef('email_tell_a_friend_intro'), osc_sanitize_string($_POST['to_name']), osc_sanitize_string($_POST['from_name']), $OSCOM_Product->getTitle(), STORE_NAME) . "\n\n";
         if (!empty($_POST['message'])) {
             $email_body .= osc_sanitize_string($_POST['message']) . "\n\n";
         }
         $email_body .= sprintf(OSCOM::getDef('email_tell_a_friend_link'), OSCOM::getLink(null, null, $OSCOM_Product->getKeyword(), 'NONSSL', false)) . "\n\n" . sprintf(OSCOM::getDef('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']));
         $OSCOM_MessageStack->add('header', sprintf(OSCOM::getDef('success_tell_a_friend_email_sent'), $OSCOM_Product->getTitle(), osc_output_string_protected($_POST['to_name'])), 'success');
         osc_redirect(OSCOM::getLink(null, null, $OSCOM_Product->getKeyword()));
     }
     $application->setPageTitle($OSCOM_Product->getTitle());
     $application->setPageContent('tell_a_friend.php');
 }
Example #7
0
 public function __construct($module = null)
 {
     $OSCOM_ShoppingCart = Registry::get('ShoppingCart');
     $OSCOM_Database = Registry::get('Database');
     $OSCOM_Language = Registry::get('Language');
     $do_shipping = false;
     foreach ($OSCOM_ShoppingCart->getProducts() as $product) {
         $OSCOM_Product = new Product($product['id']);
         if ($OSCOM_Product->isTypeActionAllowed('apply_shipping_fees')) {
             $do_shipping = true;
             break;
         }
     }
     if ($do_shipping === true) {
         $this->_quotes =& $_SESSION['osC_ShoppingCart_data']['shipping_quotes'];
         $Qmodules = $OSCOM_Database->query('select code from :table_templates_boxes where modules_group = "shipping"');
         $Qmodules->setCache('modules-shipping');
         $Qmodules->execute();
         while ($Qmodules->next()) {
             $this->_modules[] = $Qmodules->value('code');
         }
         $Qmodules->freeResult();
         if (!empty($this->_modules)) {
             if (!empty($module) && in_array(substr($module, 0, strpos($module, '_')), $this->_modules)) {
                 $this->_selected_module = $module;
                 $this->_modules = array(substr($module, 0, strpos($module, '_')));
             }
             $OSCOM_Language->load('modules-shipping');
             foreach ($this->_modules as $module) {
                 $module_class = 'osCommerce\\OM\\Core\\Site\\Shop\\Module\\Shipping\\' . $module;
                 Registry::set('Shipping_' . $module, new $module_class(), true);
                 Registry::get('Shipping_' . $module)->initialize();
             }
             usort($this->_modules, function ($a, $b) {
                 if (Registry::get('Shipping_' . $a)->getSortOrder() == Registry::get('Shipping_' . $b)->getSortOrder()) {
                     return strnatcasecmp(Registry::get('Shipping_' . $a)->getTitle(), Registry::get('Shipping_' . $b)->getTitle());
                 }
                 return Registry::get('Shipping_' . $a)->getSortOrder() < Registry::get('Shipping_' . $b)->getSortOrder() ? -1 : 1;
             });
         }
     }
     if (empty($this->_quotes)) {
         $this->_calculate();
     }
 }
 public function initialize()
 {
     $OSCOM_PDO = Registry::get('PDO');
     $OSCOM_Language = Registry::get('Language');
     $OSCOM_Currencies = Registry::get('Currencies');
     $Qupcoming = $OSCOM_PDO->prepare('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, "%Y-%m-%d")) >= 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->bindValue(':code', 'DateAvailable');
     $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-' . $OSCOM_Language->getCode() . '-' . $OSCOM_Currencies->getCode(), MODULE_CONTENT_UPCOMING_PRODUCTS_CACHE);
     }
     $Qupcoming->execute();
     $result = $Qupcoming->fetchAll();
     if (!empty($result)) {
         $this->_content = '<ol style="list-style: none;">';
         foreach ($result as $r) {
             $OSCOM_Product = new Product($r['products_id']);
             $this->_content .= '<li>' . DateTime::getLong($r['date_expected']) . ': ' . HTML::link(OSCOM::getLink(null, 'Products', $OSCOM_Product->getKeyword()), $OSCOM_Product->getTitle()) . ' ' . $OSCOM_Product->getPriceFormated(true) . '</li>';
         }
         $this->_content .= '</ol>';
     }
 }
Example #9
0
 public function initialize()
 {
     $OSCOM_Database = Registry::get('Database');
     $OSCOM_Language = Registry::get('Language');
     $OSCOM_Currencies = Registry::get('Currencies');
     $Qupcoming = $OSCOM_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, "%Y-%m-%d")) >= 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->bindValue(':code', 'DateAvailable');
     $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-' . $OSCOM_Language->getCode() . '-' . $OSCOM_Currencies->getCode(), MODULE_CONTENT_UPCOMING_PRODUCTS_CACHE);
     }
     $Qupcoming->execute();
     if ($Qupcoming->numberOfRows() > 0) {
         $this->_content = '<ol style="list-style: none;">';
         while ($Qupcoming->next()) {
             $OSCOM_Product = new Product($Qupcoming->valueInt('products_id'));
             $this->_content .= '<li>' . DateTime::getLong($Qupcoming->value('date_expected')) . ': ' . osc_link_object(OSCOM::getLink(null, 'Products', $OSCOM_Product->getKeyword()), $OSCOM_Product->getTitle()) . ' ' . $OSCOM_Product->getPriceFormated(true) . '</li>';
         }
         $this->_content .= '</ol>';
     }
     $Qupcoming->freeResult();
 }
 protected function initialize()
 {
     $OSCOM_Language = Registry::get('Language');
     $OSCOM_Session = Registry::get('Session');
     $OSCOM_Template = Registry::get('Template');
     $OSCOM_Service = Registry::get('Service');
     $OSCOM_Breadcrumb = Registry::get('Breadcrumb');
     $OSCOM_Language->load('products');
     $requested_product = null;
     $product_check = false;
     if (count($_GET) > 1) {
         $requested_product = basename(key(array_slice($_GET, 1, 1, true)));
         if ($requested_product == OSCOM::getSiteApplication()) {
             unset($requested_product);
             if (count($_GET) > 2) {
                 $requested_product = basename(key(array_slice($_GET, 2, 1, true)));
             }
         }
     }
     if (isset($requested_product)) {
         if (!self::siteApplicationActionExists($requested_product)) {
             if (Product::checkEntry($requested_product)) {
                 $product_check = true;
                 Registry::set('Product', new Product($requested_product));
                 $OSCOM_Product = Registry::get('Product');
                 $OSCOM_Product->incrementCounter();
                 $OSCOM_Template->addPageTags('keywords', $OSCOM_Product->getTitle());
                 $OSCOM_Template->addPageTags('keywords', $OSCOM_Product->getModel());
                 if ($OSCOM_Product->hasTags()) {
                     $OSCOM_Template->addPageTags('keywords', $OSCOM_Product->getTags());
                 }
                 $OSCOM_Template->addJavascriptFilename(OSCOM::getPublicSiteLink('javascript/products/info.js'));
                 // HPDL            osC_Services_category_path::process($osC_Product->getCategoryID());
                 if ($OSCOM_Service->isStarted('Breadcrumb')) {
                     $OSCOM_Breadcrumb->add($OSCOM_Product->getTitle(), OSCOM::getLink(null, null, $OSCOM_Product->getKeyword()));
                 }
                 $this->_page_title = $OSCOM_Product->getTitle();
             }
         }
     }
     if ($product_check === false) {
         $this->_page_title = OSCOM::getDef('product_not_found_heading');
         $this->_page_contents = 'not_found.php';
     }
 }
Example #11
0
 public static function execute(ApplicationAbstract $application)
 {
     $OSCOM_Template = Registry::get('Template');
     $OSCOM_NavigationHistory = Registry::get('NavigationHistory');
     // HPDL
     $OSCOM_Template->setHasHeader(false);
     $OSCOM_Template->setHasFooter(false);
     $OSCOM_Template->setHasBoxModules(false);
     $OSCOM_Template->setHasContentModules(false);
     $OSCOM_Template->setShowDebugMessages(false);
     $OSCOM_NavigationHistory->removeCurrentPage();
     $requested_product = null;
     $product_check = false;
     if (count($_GET) > 2) {
         $requested_product = basename(key(array_slice($_GET, 2, 1, true)));
         if ($requested_product == OSCOM::getSiteApplication()) {
             unset($requested_product);
             if (count($_GET) > 3) {
                 $requested_product = basename(key(array_slice($_GET, 3, 1, true)));
             }
         }
     }
     if (isset($requested_product)) {
         if (!$application->siteApplicationActionExists($requested_product)) {
             if (Product::checkEntry($requested_product)) {
                 $product_check = true;
                 Registry::set('Product', new Product($requested_product));
                 $OSCOM_Product = Registry::get('Product');
                 $OSCOM_Template->addPageTags('keywords', $OSCOM_Product->getTitle());
                 $OSCOM_Template->addPageTags('keywords', $OSCOM_Product->getModel());
                 if ($OSCOM_Product->hasTags()) {
                     $OSCOM_Template->addPageTags('keywords', $OSCOM_Product->getTags());
                 }
                 $application->setPageTitle($OSCOM_Product->getTitle());
                 $application->setPageContent('images.php');
             }
         }
     }
     if ($product_check === false) {
         $application->setPageTitle(OSCOM::getDef('product_not_found_heading'));
         $application->setPageContent('not_found.php');
     }
 }
Example #12
0
 public static function execute(ApplicationAbstract $application)
 {
     $OSCOM_Customer = Registry::get('Customer');
     $OSCOM_NavigationHistory = Registry::get('NavigationHistory');
     $OSCOM_Template = Registry::get('Template');
     $OSCOM_Service = Registry::get('Service');
     $OSCOM_Breadcrumb = Registry::get('Breadcrumb');
     $requested_product = null;
     $product_check = false;
     if (count($_GET) > 3) {
         $requested_product = basename(key(array_slice($_GET, 3, 1, true)));
         if ($requested_product == 'Write') {
             unset($requested_product);
             if (count($_GET) > 4) {
                 $requested_product = basename(key(array_slice($_GET, 4, 1, true)));
             }
         }
     }
     if (isset($requested_product)) {
         if (Product::checkEntry($requested_product)) {
             $product_check = true;
         }
     }
     if ($product_check === false) {
         $application->setPageContent('not_found.php');
         return false;
     }
     if ($OSCOM_Customer->isLoggedOn() === false && SERVICE_REVIEW_ENABLE_REVIEWS == 1) {
         $OSCOM_NavigationHistory->setSnapshot();
         osc_redirect(OSCOM::getLink(null, 'Account', 'LogIn', 'SSL'));
     }
     Registry::set('Product', new Product($requested_product));
     $OSCOM_Product = Registry::get('Product');
     $application->setPageTitle($OSCOM_Product->getTitle());
     $application->setPageContent('reviews_write.php');
     $OSCOM_Template->addJavascriptPhpFilename('templates/' . $OSCOM_Template->getCode() . '/javascript/products/reviews_new.php');
     if ($OSCOM_Service->isStarted('Breadcrumb')) {
         $OSCOM_Breadcrumb->add($OSCOM_Product->getTitle(), OSCOM::getLink(null, null, 'Reviews&' . $OSCOM_Product->getKeyword()));
         $OSCOM_Breadcrumb->add(OSCOM::getDef('breadcrumb_reviews_new'), OSCOM::getLink(null, null, 'Reviews&Write&' . $OSCOM_Product->getKeyword()));
     }
 }
Example #13
0
 public static function execute(ApplicationAbstract $application)
 {
     $OSCOM_Service = Registry::get('Service');
     $OSCOM_Breadcrumb = Registry::get('Breadcrumb');
     if ($OSCOM_Service->isStarted('Reviews') === false) {
         osc_redirect(OSCOM::getLink(null, OSCOM::getDefaultSiteApplication()));
     }
     $application->setPageTitle(OSCOM::getDef('reviews_heading'));
     $application->setPageContent('reviews.php');
     if ($OSCOM_Service->isStarted('Breadcrumb')) {
         $OSCOM_Breadcrumb->add(OSCOM::getDef('breadcrumb_reviews'), OSCOM::getLink(null, null, 'Reviews'));
     }
     $requested_product = null;
     $product_check = false;
     if (count($_GET) > 2) {
         $requested_product = basename(key(array_slice($_GET, 2, 1, true)));
         if ($requested_product == OSCOM::getSiteApplication()) {
             unset($requested_product);
             if (count($_GET) > 3) {
                 $requested_product = basename(key(array_slice($_GET, 3, 1, true)));
             }
         }
     }
     if (isset($requested_product)) {
         if (Product::checkEntry($requested_product)) {
             $product_check = true;
             Registry::set('Product', new Product($requested_product));
             $OSCOM_Product = Registry::get('Product');
             $application->setPageTitle($OSCOM_Product->getTitle());
             $application->setPageContent('reviews_product.php');
             if ($OSCOM_Service->isStarted('Breadcrumb')) {
                 $OSCOM_Breadcrumb->add($OSCOM_Product->getTitle(), OSCOM::getLink(null, null, 'Reviews&' . $OSCOM_Product->getKeyword()));
             }
         }
         if ($product_check === false) {
             $application->setPageContent('not_found.php');
         }
     }
 }
 public static function execute(ApplicationAbstract $application)
 {
     $OSCOM_Customer = Registry::get('Customer');
     $OSCOM_NavigationHistory = Registry::get('NavigationHistory');
     $OSCOM_Service = Registry::get('Service');
     $OSCOM_Breadcrumb = Registry::get('Breadcrumb');
     if (ALLOW_GUEST_TO_TELL_A_FRIEND == '-1' && $OSCOM_Customer->isLoggedOn() === false) {
         $OSCOM_NavigationHistory->setSnapshot();
         OSCOM::redirect(OSCOM::getLink(null, 'Account', 'LogIn', 'SSL'));
     }
     $requested_product = null;
     $product_check = false;
     if (count($_GET) > 2) {
         $requested_product = basename(key(array_slice($_GET, 2, 1, true)));
         if ($requested_product == OSCOM::getSiteApplication()) {
             unset($requested_product);
             if (count($_GET) > 3) {
                 $requested_product = basename(key(array_slice($_GET, 3, 1, true)));
             }
         }
     }
     if (isset($requested_product)) {
         if (Product::checkEntry($requested_product)) {
             $product_check = true;
             Registry::set('Product', new Product($requested_product));
             $OSCOM_Product = Registry::get('Product');
             $application->setPageTitle($OSCOM_Product->getTitle());
             $application->setPageContent('tell_a_friend.php');
             if ($OSCOM_Service->isStarted('Breadcrumb')) {
                 $OSCOM_Breadcrumb->add($OSCOM_Product->getTitle(), OSCOM::getLink(null, null, $OSCOM_Product->getKeyword()));
                 $OSCOM_Breadcrumb->add(OSCOM::getDef('breadcrumb_tell_a_friend'), OSCOM::getLink(null, null, 'TellAFriend&' . $OSCOM_Product->getKeyword()));
             }
         }
         if ($product_check === false) {
             $application->setPageContent('not_found.php');
         }
     }
 }
Example #15
0
 public function initialize()
 {
     $OSCOM_Cache = Registry::get('Cache');
     $OSCOM_Language = Registry::get('Language');
     $OSCOM_Currencies = Registry::get('Currencies');
     $OSCOM_Category = Registry::get('Category');
     $OSCOM_Database = Registry::get('Database');
     $OSCOM_Image = Registry::get('Image');
     $data = array();
     if (MODULE_CONTENT_NEW_PRODUCTS_CACHE > 0 && $OSCOM_Cache->read('new_products-' . $OSCOM_Language->getCode() . '-' . $OSCOM_Currencies->getCode() . '-' . $OSCOM_Category->getID(), MODULE_CONTENT_NEW_PRODUCTS_CACHE)) {
         $data = $OSCOM_Cache->getCache();
     } else {
         if ($OSCOM_Category->getID() < 1) {
             $Qproducts = $OSCOM_Database->query('select products_id from :table_products where products_status = :products_status and parent_id is null order by products_date_added desc limit :max_display_new_products');
         } else {
             $Qproducts = $OSCOM_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 is null order by p.products_date_added desc limit :max_display_new_products');
             $Qproducts->bindInt(':category_parent_id', $OSCOM_Category->getID());
         }
         $Qproducts->bindInt(':products_status', 1);
         $Qproducts->bindInt(':max_display_new_products', MODULE_CONTENT_NEW_PRODUCTS_MAX_DISPLAY);
         $Qproducts->execute();
         while ($Qproducts->next()) {
             $OSCOM_Product = new Product($Qproducts->valueInt('products_id'));
             $data[$OSCOM_Product->getID()] = $OSCOM_Product->getData();
             $data[$OSCOM_Product->getID()]['display_price'] = $OSCOM_Product->getPriceFormated(true);
             $data[$OSCOM_Product->getID()]['display_image'] = $OSCOM_Product->getImage();
         }
         $OSCOM_Cache->write($data);
     }
     if (!empty($data)) {
         $this->_content = '<div style="overflow: auto; height: 100%;">';
         foreach ($data as $product) {
             $this->_content .= '<span style="width: 33%; float: left; text-align: center;">' . osc_link_object(OSCOM::getLink(null, 'Products', $product['keyword']), $OSCOM_Image->show($product['display_image'], $product['name'])) . '<br />' . osc_link_object(OSCOM::getLink(null, 'Products', $product['keyword']), $product['name']) . '<br />' . $product['display_price'] . '</span>';
         }
         $this->_content .= '</div>';
     }
 }
Example #16
0
?>

<h1><?php 
echo $OSCOM_Template->getPageTitle();
?>
</h1>

<table border="0" width="100%" cellspacing="0" cellpadding="2">

<?php 
$OSCOM_Products = new Products();
$OSCOM_Products->setSortBy('date_added', '-');
$Qproducts = $OSCOM_Products->execute();
if ($Qproducts->numberOfRows() > 0) {
    while ($Qproducts->next()) {
        $OSCOM_Product = new Product($Qproducts->valueInt('products_id'));
        ?>

  <tr>
    <td width="<?php 
        echo $OSCOM_Image->getWidth('thumbnails') + 10;
        ?>
" valign="top" align="center">

<?php 
        if ($OSCOM_Product->hasImage()) {
            echo osc_link_object(OSCOM::getLink(null, null, $OSCOM_Product->getKeyword()), $OSCOM_Image->show($OSCOM_Product->getImage(), $OSCOM_Product->getTitle()));
        }
        ?>

    </td>
Example #17
0
 function getProducts()
 {
     $history = array();
     if (isset($this->visits['products']) && empty($this->visits['products']) === false) {
         $counter = 0;
         foreach ($this->visits['products'] as $k => $v) {
             $counter++;
             $OSCOM_Product = new Product($v['id']);
             $OSCOM_Category = new Category($OSCOM_Product->getCategoryID());
             $history[] = array('name' => $OSCOM_Product->getTitle(), 'id' => $OSCOM_Product->getID(), 'keyword' => $OSCOM_Product->getKeyword(), 'price' => SERVICE_RECENTLY_VISITED_SHOW_PRODUCT_PRICES == '1' ? $OSCOM_Product->getPriceFormated(true) : '', 'image' => $OSCOM_Product->getImage(), 'category_name' => $OSCOM_Category->getTitle(), 'category_path' => $OSCOM_Category->getPath());
             if ($counter == SERVICE_RECENTLY_VISITED_MAX_PRODUCTS) {
                 break;
             }
         }
     }
     return $history;
 }
Example #18
0
?>

<h1><?php 
echo $OSCOM_Template->getPageTitle();
?>
</h1>

<table border="0" width="100%" cellspacing="0" cellpadding="2">

<?php 
$OSCOM_Products = new Products();
$OSCOM_Products->setSortBy('date_added', '-');
$products_listing = $OSCOM_Products->execute();
if ($products_listing['total'] > 0) {
    foreach ($products_listing['entries'] as $p) {
        $OSCOM_Product = new Product($p['products_id']);
        ?>

  <tr>
    <td width="<?php 
        echo $OSCOM_Image->getWidth('thumbnails') + 10;
        ?>
" valign="top" align="center">

<?php 
        if ($OSCOM_Product->hasImage()) {
            echo HTML::link(OSCOM::getLink(null, null, $OSCOM_Product->getKeyword()), $OSCOM_Image->show($OSCOM_Product->getImage(), $OSCOM_Product->getTitle()));
        }
        ?>

    </td>
Example #19
0
                $lc_align = 'center';
                break;
        }
        if ($lc_key !== false) {
            $lc_text = osc_create_sort_heading($lc_key, $lc_text);
        }
        echo '      <td align="' . $lc_align . '" class="productListing-heading">&nbsp;' . $lc_text . '&nbsp;</td>' . "\n";
    }
    ?>

    </tr>

<?php 
    $rows = 0;
    while ($Qlisting->next()) {
        $OSCOM_Product = new Product($Qlisting->valueInt('products_id'));
        $rows++;
        echo '    <tr class="' . ($rows / 2 == floor($rows / 2) ? 'productListing-even' : 'productListing-odd') . '">' . "\n";
        for ($col = 0, $n = sizeof($column_list); $col < $n; $col++) {
            $lc_align = '';
            switch ($column_list[$col]) {
                case 'PRODUCT_LIST_MODEL':
                    $lc_align = '';
                    $lc_text = '&nbsp;' . $OSCOM_Product->getModel() . '&nbsp;';
                    break;
                case 'PRODUCT_LIST_NAME':
                    $lc_align = '';
                    if (isset($_GET['manufacturers'])) {
                        $lc_text = osc_link_object(OSCOM::getLink(null, 'Products', $OSCOM_Product->getKeyword() . '&manufacturers=' . $_GET['manufacturers']), $OSCOM_Product->getTitle());
                    } else {
                        $lc_text = '&nbsp;' . osc_link_object(OSCOM::getLink(null, 'Products', $OSCOM_Product->getKeyword() . ($OSCOM_Category->getID() > 0 ? '&cPath=' . $OSCOM_Category->getPath() : '')), $OSCOM_Product->getTitle()) . '&nbsp;';
Example #20
0
 public static function execute(ApplicationAbstract $application)
 {
     $OSCOM_Customer = Registry::get('Customer');
     $OSCOM_NavigationHistory = Registry::get('NavigationHistory');
     $OSCOM_MessageStack = Registry::get('MessageStack');
     $OSCOM_Reviews = Registry::get('Reviews');
     $OSCOM_Template = Registry::get('Template');
     $OSCOM_Service = Registry::get('Service');
     $OSCOM_Breadcrumb = Registry::get('Breadcrumb');
     $requested_product = null;
     $product_check = false;
     if (count($_GET) > 3) {
         $requested_product = basename(key(array_slice($_GET, 3, 1, true)));
         if ($requested_product == 'Write') {
             unset($requested_product);
             if (count($_GET) > 4) {
                 $requested_product = basename(key(array_slice($_GET, 4, 1, true)));
             }
         }
     }
     if (isset($requested_product)) {
         if (Product::checkEntry($requested_product)) {
             $product_check = true;
         }
     }
     if ($product_check === false) {
         $application->setPageContent('not_found.php');
         return false;
     }
     if ($OSCOM_Customer->isLoggedOn() === false && SERVICE_REVIEW_ENABLE_REVIEWS == 1) {
         $OSCOM_NavigationHistory->setSnapshot();
         OSCOM::redirect(OSCOM::getLink(null, 'Account', 'LogIn', 'SSL'));
     }
     Registry::set('Product', new Product($requested_product));
     $OSCOM_Product = Registry::get('Product');
     $data = array('products_id' => $OSCOM_Product->getID());
     if ($OSCOM_Customer->isLoggedOn()) {
         $data['customer_id'] = $OSCOM_Customer->getID();
         $data['customer_name'] = $OSCOM_Customer->getName();
     } else {
         $data['customer_id'] = '0';
         $data['customer_name'] = $_POST['customer_name'];
     }
     if (strlen(trim($_POST['review'])) < REVIEW_TEXT_MIN_LENGTH) {
         $OSCOM_MessageStack->add('Reviews', sprintf(OSCOM::getDef('js_review_text'), REVIEW_TEXT_MIN_LENGTH));
     } else {
         $data['review'] = $_POST['review'];
     }
     if ($_POST['rating'] < 1 || $_POST['rating'] > 5) {
         $OSCOM_MessageStack->add('Reviews', OSCOM::getDef('js_review_rating'));
     } else {
         $data['rating'] = $_POST['rating'];
     }
     if ($OSCOM_MessageStack->size('Reviews') < 1) {
         if ($OSCOM_Reviews->isModerated()) {
             $data['status'] = '0';
             $OSCOM_MessageStack->add('Reviews', OSCOM::getDef('success_review_moderation'), 'success');
         } else {
             $data['status'] = '1';
             $OSCOM_MessageStack->add('Reviews', OSCOM::getDef('success_review_new'), 'success');
         }
         Reviews::saveEntry($data);
         OSCOM::redirect(OSCOM::getLink(null, null, 'Reviews&' . $OSCOM_Product->getID()));
     }
     $application->setPageTitle($OSCOM_Product->getTitle());
     $application->setPageContent('reviews_write.php');
     $OSCOM_Template->addJavascriptPhpFilename(OSCOM::BASE_DIRECTORY . 'Core/Site/Shop/assets/reviews_new.php');
     if ($OSCOM_Service->isStarted('Breadcrumb')) {
         $OSCOM_Breadcrumb->add($OSCOM_Product->getTitle(), OSCOM::getLink(null, null, 'Reviews&' . $OSCOM_Product->getKeyword()));
         $OSCOM_Breadcrumb->add(OSCOM::getDef('breadcrumb_reviews_new'), OSCOM::getLink(null, null, 'Reviews&Write&' . $OSCOM_Product->getKeyword()));
     }
 }
 public function add($product_id, $quantity = null)
 {
     $OSCOM_Customer = Registry::get('Customer');
     $OSCOM_PDO = Registry::get('PDO');
     $OSCOM_Language = Registry::get('Language');
     if (!is_numeric($product_id)) {
         return false;
     }
     $OSCOM_Product = new Product($product_id);
     if ($OSCOM_Product->isValid()) {
         if ($this->exists($product_id)) {
             $item_id = $this->getBasketID($product_id);
             if (!is_numeric($quantity)) {
                 $quantity = $this->getQuantity($item_id) + 1;
             }
             $this->_contents[$item_id]['quantity'] = $quantity;
             if ($OSCOM_Customer->isLoggedOn()) {
                 $Qupdate = $OSCOM_PDO->prepare('update :table_shopping_carts set quantity = :quantity where customers_id = :customers_id and item_id = :item_id');
                 $Qupdate->bindInt(':quantity', $quantity);
                 $Qupdate->bindInt(':customers_id', $OSCOM_Customer->getID());
                 $Qupdate->bindInt(':item_id', $item_id);
                 $Qupdate->execute();
             }
         } else {
             if (!is_numeric($quantity)) {
                 $quantity = 1;
             }
             if ($OSCOM_Customer->isLoggedOn()) {
                 $Qid = $OSCOM_PDO->prepare('select max(item_id) as item_id from :table_shopping_carts where customers_id = :customers_id');
                 $Qid->bindInt(':customers_id', $OSCOM_Customer->getID());
                 $Qid->execute();
                 $item_id = $Qid->valueInt('item_id') + 1;
             } else {
                 if (empty($this->_contents)) {
                     $item_id = 1;
                 } else {
                     $item_id = max(array_keys($this->_contents)) + 1;
                 }
             }
             $this->_contents[$item_id] = array('item_id' => $item_id, 'id' => $product_id, 'parent_id' => (int) $OSCOM_Product->getData('parent_id'), 'name' => $OSCOM_Product->getTitle(), 'model' => $OSCOM_Product->getModel(), 'keyword' => $OSCOM_Product->getKeyword(), 'image' => $OSCOM_Product->getImage(), 'price' => $OSCOM_Product->getPrice(true), 'quantity' => $quantity, 'weight' => $OSCOM_Product->getData('weight'), 'tax_class_id' => $OSCOM_Product->getData('tax_class_id'), 'date_added' => DateTime::getShort(DateTime::getNow()), 'weight_class_id' => $OSCOM_Product->getData('weight_class_id'));
             if ($OSCOM_Customer->isLoggedOn()) {
                 $Qnew = $OSCOM_PDO->prepare('insert into :table_shopping_carts (customers_id, item_id, products_id, quantity, date_added) values (:customers_id, :item_id, :products_id, :quantity, now())');
                 $Qnew->bindInt(':customers_id', $OSCOM_Customer->getID());
                 $Qnew->bindInt(':item_id', $item_id);
                 $Qnew->bindInt(':products_id', $product_id);
                 $Qnew->bindInt(':quantity', $quantity);
                 $Qnew->execute();
             }
             if ($OSCOM_Product->getData('parent_id') > 0) {
                 $Qvariant = $OSCOM_PDO->prepare('select pvg.id as group_id, pvg.title as group_title, pvg.module, pvv.id as value_id, pvv.title as value_title from :table_products_variants pv, :table_products_variants_values pvv, :table_products_variants_groups pvg where pv.products_id = :products_id and pv.products_variants_values_id = pvv.id and pvv.languages_id = :languages_id_pvv and pvv.products_variants_groups_id = pvg.id and pvg.languages_id = :languages_id_pvg');
                 $Qvariant->bindInt(':products_id', $product_id);
                 $Qvariant->bindInt(':languages_id_pvv', $OSCOM_Language->getID());
                 $Qvariant->bindInt(':languages_id_pvg', $OSCOM_Language->getID());
                 $Qvariant->execute();
                 while ($Qvariant->fetch()) {
                     $group_title = ProductVariants::getGroupTitle($Qvariant->value('module'), $Qvariant->toArray());
                     $value_title = ProductVariants::getValueTitle($Qvariant->value('module'), $Qvariant->toArray());
                     $has_custom_value = ProductVariants::hasCustomValue($Qvariant->value('module'));
                     $this->_contents[$item_id]['variants'][] = array('group_id' => $Qvariant->valueInt('group_id'), 'value_id' => $Qvariant->valueInt('value_id'), 'group_title' => $group_title, 'value_title' => $value_title, 'has_custom_value' => $has_custom_value);
                     if ($OSCOM_Customer->isLoggedOn() && $has_custom_value === true) {
                         $Qnew = $OSCOM_PDO->prepare('insert into :table_shopping_carts_custom_variants_values (shopping_carts_item_id, customers_id, products_id, products_variants_values_id, products_variants_values_text) values (:shopping_carts_item_id, :customers_id, :products_id, :products_variants_values_id, :products_variants_values_text)');
                         $Qnew->bindInt(':shopping_carts_item_id', $item_id);
                         $Qnew->bindInt(':customers_id', $OSCOM_Customer->getID());
                         $Qnew->bindInt(':products_id', $product_id);
                         $Qnew->bindInt(':products_variants_values_id', $Qvariant->valueInt('value_id'));
                         $Qnew->bindValue(':products_variants_values_text', $value_title);
                         $Qnew->execute();
                     }
                 }
             }
         }
         $this->_cleanUp();
         $this->_calculate();
     }
 }
Example #22
0
 public static function isValid(Product $OSCOM_Product)
 {
     $OSCOM_ShoppingCart = Registry::get('ShoppingCart');
     return $OSCOM_Product->getQuantity() - $OSCOM_ShoppingCart->getQuantity($OSCOM_ShoppingCart->getBasketID($OSCOM_Product->getID())) > 0;
 }
                $lc_align = 'center';
                break;
        }
        if ($lc_key !== false) {
            $lc_text = Products::getListingSortLink($lc_key, $lc_text);
        }
        echo '      <td align="' . $lc_align . '" class="productListing-heading">&nbsp;' . $lc_text . '&nbsp;</td>' . "\n";
    }
    ?>

    </tr>

<?php 
    $rows = 0;
    foreach ($products_listing['entries'] as $p) {
        $OSCOM_Product = new Product($p['products_id']);
        $rows++;
        echo '    <tr class="' . ($rows / 2 == floor($rows / 2) ? 'productListing-even' : 'productListing-odd') . '">' . "\n";
        for ($col = 0, $n = sizeof($column_list); $col < $n; $col++) {
            $lc_align = '';
            switch ($column_list[$col]) {
                case 'PRODUCT_LIST_MODEL':
                    $lc_align = '';
                    $lc_text = '&nbsp;' . $OSCOM_Product->getModel() . '&nbsp;';
                    break;
                case 'PRODUCT_LIST_NAME':
                    $lc_align = '';
                    if (isset($_GET['manufacturers'])) {
                        $lc_text = HTML::link(OSCOM::getLink(null, 'Products', $OSCOM_Product->getKeyword() . '&manufacturers=' . $_GET['manufacturers']), $OSCOM_Product->getTitle());
                    } else {
                        $lc_text = '&nbsp;' . HTML::link(OSCOM::getLink(null, 'Products', $OSCOM_Product->getKeyword() . ($OSCOM_Category->getID() > 0 ? '&cPath=' . $OSCOM_Category->getPath() : '')), $OSCOM_Product->getTitle()) . '&nbsp;';