Example #1
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 #2
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');
 }
 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 #4
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 #5
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 #6
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 #8
0
 function hasProducts()
 {
     if (SERVICE_RECENTLY_VISITED_SHOW_PRODUCTS == '1') {
         if (isset($this->visits['products']) && !empty($this->visits['products'])) {
             foreach ($this->visits['products'] as $k => $v) {
                 if (!Product::checkEntry($v['id'])) {
                     unset($this->visits['products'][$k]);
                 }
             }
             return sizeof($this->visits['products']) > 0;
         }
     }
     return false;
 }
Example #9
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()));
     }
 }