Ejemplo n.º 1
0
 public function initialize()
 {
     global $current_category_id;
     $OSCOM_PDO = Registry::get('PDO');
     $OSCOM_Language = Registry::get('Language');
     if (isset($current_category_id) && $current_category_id > 0) {
         $Qbestsellers = $OSCOM_PDO->prepare('select distinct p.products_id, pd.products_name, pd.products_keyword from :table_products p, :table_products_description pd, :table_products_to_categories p2c, :table_categories c where p.products_status = 1 and p.products_ordered > 0 and p.products_id = pd.products_id and pd.language_id = :language_id and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and :current_category_id in (c.categories_id, c.parent_id) order by p.products_ordered desc, pd.products_name limit :max_display_bestsellers');
         $Qbestsellers->bindInt(':language_id', $OSCOM_Language->getID());
         $Qbestsellers->bindInt(':current_category_id', $current_category_id);
         $Qbestsellers->bindInt(':max_display_bestsellers', BOX_BEST_SELLERS_MAX_LIST);
         if (BOX_BEST_SELLERS_CACHE > 0) {
             $Qbestsellers->setCache('box_best_sellers-' . $current_category_id . '-' . $OSCOM_Language->getCode(), BOX_BEST_SELLERS_CACHE);
         }
         $Qbestsellers->execute();
     } else {
         $Qbestsellers = $OSCOM_PDO->prepare('select p.products_id, pd.products_name, pd.products_keyword from :table_products p, :table_products_description pd where p.products_status = 1 and p.products_ordered > 0 and p.products_id = pd.products_id and pd.language_id = :language_id order by p.products_ordered desc, pd.products_name limit :max_display_bestsellers');
         $Qbestsellers->bindInt(':language_id', $OSCOM_Language->getID());
         $Qbestsellers->bindInt(':max_display_bestsellers', BOX_BEST_SELLERS_MAX_LIST);
         if (BOX_BEST_SELLERS_CACHE > 0) {
             $Qbestsellers->setCache('box_best_sellers-0-' . $OSCOM_Language->getCode(), BOX_BEST_SELLERS_CACHE);
         }
         $Qbestsellers->execute();
     }
     $result = $Qbestsellers->fetchAll();
     if (count($result) >= BOX_BEST_SELLERS_MIN_LIST) {
         $this->_content = '<ol style="margin: 0; padding: 0 0 0 20px;">';
         foreach ($result as $r) {
             $this->_content .= '<li>' . HTML::link(OSCOM::getLink(null, 'Products', $r['products_keyword']), $r['products_name']) . '</li>';
         }
         $this->_content .= '</ol>';
     }
 }
Ejemplo n.º 2
0
 public function initialize()
 {
     $OSCOM_ShoppingCart = Registry::get('ShoppingCart');
     $OSCOM_Template = Registry::get('Template');
     $steps = array();
     if ($OSCOM_ShoppingCart->getContentType() != 'virtual') {
         $steps[] = array('title' => OSCOM::getDef('box_ordering_steps_delivery'), 'code' => 'shipping', 'active' => $OSCOM_Template->getModule() == 'Shipping' || $OSCOM_Template->getModule() == 'ShippingAddress' ? true : false);
     }
     $steps[] = array('title' => OSCOM::getDef('box_ordering_steps_payment'), 'code' => 'payment', 'active' => $OSCOM_Template->getModule() == 'Payment' || $OSCOM_Template->getModule() == 'PaymentAddress' ? true : false);
     $steps[] = array('title' => OSCOM::getDef('box_ordering_steps_confirmation'), 'code' => 'confirmation', 'active' => $OSCOM_Template->getModule() == 'Confirmation' ? true : false);
     $steps[] = array('title' => OSCOM::getDef('box_ordering_steps_complete'), 'active' => $OSCOM_Template->getModule() == 'Success' ? true : false);
     $content = HTML::image('templates/' . $OSCOM_Template->getCode() . '/images/icons/32x32/checkout_preparing_to_ship.gif') . '<br />';
     $counter = 0;
     foreach ($steps as $step) {
         $counter++;
         $content .= '<span style="white-space: nowrap;">&nbsp;' . HTML::image('templates/' . $OSCOM_Template->getCode() . '/images/icons/24x24/checkout_' . $counter . ($step['active'] === true ? '_on' : '') . '.gif', $step['title'], 24, 24, 'align="absmiddle"');
         if (isset($step['code'])) {
             $content .= HTML::link(OSCOM::getLink(null, 'Checkout', $step['code'], 'SSL'), $step['title'], 'class="boxCheckoutTrail' . ($step['active'] === true ? 'Active' : '') . '"');
         } else {
             $content .= '<span class="boxCheckoutTrail' . ($step['active'] === true ? 'Active' : '') . '">' . $step['title'] . '</span>';
         }
         $content .= '</span><br />';
     }
     $content .= HTML::image('templates/' . $OSCOM_Template->getCode() . '/images/icons/32x32/checkout_ready_to_ship.gif');
     $this->_content = $content;
 }
Ejemplo n.º 3
0
 public function initialize()
 {
     $OSCOM_Product = Registry::exists('Product') ? Registry::get('Product') : null;
     $OSCOM_PDO = Registry::get('PDO');
     $OSCOM_Language = Registry::get('Language');
     if (isset($OSCOM_Product) && $OSCOM_Product instanceof \osCommerce\OM\Site\Shop\Product && $OSCOM_Product->isValid()) {
         $Qmanufacturer = $OSCOM_PDO->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->bindInt(':languages_id', $OSCOM_Language->getID());
         $Qmanufacturer->bindInt(':products_id', $OSCOM_Product->getID());
         $Qmanufacturer->execute();
         $result = $Qmanufacturer->fetch();
         if (!empty($result)) {
             $this->_content = '';
             if (strlen($result['manufacturers_image']) > 0) {
                 $this->_content .= '<div style="text-align: center;">' . HTML::link(OSCOM::getLink(null, 'Index', 'Manufacturers=' . $result['manufacturers_id']), HTML::image('public/manufacturers/' . $result['manufacturers_image'], $result['manufacturers_name'])) . '</div>';
             }
             $this->_content .= '<ol style="list-style: none; margin: 0; padding: 0;">';
             if (strlen($result['manufacturers_url']) > 0) {
                 $this->_content .= '<li>' . HTML::link(OSCOM::getLink(null, 'Redirct', 'Manufacturer=' . $result['manufacturers_id']), sprintf(OSCOM::getDef('box_manufacturer_info_website'), $result['manufacturers_name']), 'target="_blank"') . '</li>';
             }
             $this->_content .= '<li>' . HTML::link(OSCOM::getLink(null, 'Index', 'Manufacturers=' . $result['manufacturers_id']), OSCOM::getDef('box_manufacturer_info_products')) . '</li>';
             $this->_content .= '</ol>';
         }
     }
 }
Ejemplo n.º 4
0
 public function getIcon($size = 16, $icon = null, $title = null)
 {
     if (!isset($icon)) {
         $icon = $this->_application->getIcon();
     }
     return HTML::image(OSCOM::getPublicSiteLink('images/applications/' . $size . '/' . $icon), $title, $size, $size);
 }
Ejemplo n.º 5
0
 public static function execute(ApplicationAbstract $application)
 {
     $data = HTML::sanitize(basename($_GET['code']));
     if (!Services::exists($data) || Services::get($data, 'uninstallable') !== true) {
         OSCOM::redirect(OSCOM::getLink());
     }
 }
Ejemplo n.º 6
0
 public function initialize()
 {
     $OSCOM_Service = Registry::get('Service');
     $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', 'Specials');
     if ($OSCOM_Service->isStarted('Specials')) {
         if (BOX_SPECIALS_CACHE > 0 && $OSCOM_Cache->read('box-specials-' . $OSCOM_Language->getCode() . '-' . $OSCOM_Currencies->getCode(), BOX_SPECIALS_CACHE)) {
             $data = $OSCOM_Cache->getCache();
         } else {
             $Qspecials = $OSCOM_PDO->prepare('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->bindInt(':default_flag', 1);
             $Qspecials->bindInt(':language_id', $OSCOM_Language->getID());
             $Qspecials->bindInt(':max_random_select_specials', BOX_SPECIALS_RANDOM_SELECT);
             $Qspecials->execute();
             $data = $Qspecials->fetchAll();
             if (count($data) > 0) {
                 $data = $result[rand(0, count($result) - 1)];
                 $data['products_price'] = '<s>' . $OSCOM_Currencies->displayPrice($data['products_price'], $data['products_tax_class_id']) . '</s>&nbsp;<span class="productSpecialPrice">' . $OSCOM_Currencies->displayPrice($data['specials_new_products_price'], $data['products_tax_class_id']) . '</span>';
                 $OSCOM_Cache->write($data);
             }
         }
         if (!empty($data)) {
             $this->_content = '';
             if (!empty($data['image'])) {
                 $this->_content = HTML::link(OSCOM::getLink(null, 'Products', $data['products_keyword']), $OSCOM_Image->show($data['image'], $data['products_name'])) . '<br />';
             }
             $this->_content .= HTML::link(OSCOM::getLink(null, 'Products', $data['products_keyword']), $data['products_name']) . '<br />' . $data['products_price'];
         }
     }
 }
Ejemplo n.º 7
0
 public function initialize()
 {
     if (Registry::exists('Product')) {
         $OSCOM_PDO = Registry::get('PDO');
         $OSCOM_Product = Registry::get('Product');
         $OSCOM_Language = Registry::get('Language');
         $OSCOM_Image = Registry::get('Image');
         $Qorders = $OSCOM_PDO->prepare('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->bindInt(':default_flag', 1);
         $Qorders->bindInt(':products_id', $OSCOM_Product->getID());
         $Qorders->bindInt(':products_id', $OSCOM_Product->getID());
         $Qorders->bindInt(':language_id', $OSCOM_Language->getID());
         $Qorders->bindInt(':limit', MODULE_CONTENT_ALSO_PURCHASED_MAX_DISPLAY);
         if (MODULE_CONTENT_ALSO_PURCHASED_PRODUCTS_CACHE > 0) {
             $Qorders->setCache('also_purchased-' . $OSCOM_Product->getID(), MODULE_CONTENT_ALSO_PURCHASED_PRODUCTS_CACHE);
         }
         $Qorders->execute();
         $result = $Qorders->fetchAll();
         if (count($result) >= MODULE_CONTENT_ALSO_PURCHASED_MIN_DISPLAY) {
             $this->_content = '<div style="overflow: auto;">';
             foreach ($result as $p) {
                 $this->_content .= '<span style="width: 33%; float: left; text-align: center;">';
                 if (strlen($p['image']) > 0) {
                     $this->_content .= HTML::link(OSCOM::getLink(null, 'Products', $p['products_keyword']), $OSCOM_Image->show($p['image'], $p['products_name'])) . '<br />';
                 }
                 $this->_content .= HTML::link(OSCOM::getLink(null, 'Products', $p['products_keyword']), $p['products_name']) . '</span>';
             }
             $this->_content .= '</div>';
         }
     }
 }
Ejemplo n.º 8
0
 /**
  * Adds an entry to the breadcrumb navigation path
  *
  * @param string $title The title of the breadcrumb navigation entry
  * @param string $link The link of the breadcrumb navigation entry
  * @access public
  */
 public function add($title, $link = null)
 {
     if (!empty($link)) {
         $title = HTML::link($link, $title);
     }
     $this->_path[] = $title;
 }
Ejemplo n.º 9
0
 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'];
     }
 }
Ejemplo n.º 10
0
 public static function execute(ApplicationAbstract $application)
 {
     $OSCOM_Shipping = Registry::get('Shipping');
     $OSCOM_ShoppingCart = Registry::get('ShoppingCart');
     if (!empty($_POST['comments'])) {
         $_SESSION['comments'] = HTML::sanitize($_POST['comments']);
     }
     if ($OSCOM_Shipping->hasQuotes()) {
         if (isset($_POST['shipping_mod_sel']) && strpos($_POST['shipping_mod_sel'], '_')) {
             list($module, $method) = explode('_', $_POST['shipping_mod_sel']);
             if (Registry::exists('Shipping_' . $module) && Registry::get('Shipping_' . $module)->isEnabled()) {
                 $quote = $OSCOM_Shipping->getQuote($_POST['shipping_mod_sel']);
                 if (isset($quote['error'])) {
                     $OSCOM_ShoppingCart->resetShippingMethod();
                 } else {
                     $OSCOM_ShoppingCart->setShippingMethod($quote);
                     OSCOM::redirect(OSCOM::getLink(null, null, null, 'SSL'));
                 }
             } else {
                 $OSCOM_ShoppingCart->resetShippingMethod();
             }
         }
     } else {
         $OSCOM_ShoppingCart->resetShippingMethod();
         OSCOM::redirect(OSCOM::getLink(null, null, null, 'SSL'));
     }
 }
Ejemplo n.º 11
0
 public function __construct()
 {
     Registry::get('Language')->loadIniFile('modules/Dashboard/Customers.php');
     $this->_title = OSCOM::getDef('admin_indexmodules_customers_title');
     $this->_title_link = OSCOM::getLink(null, 'Customers');
     if (Access::hasAccess(OSCOM::getSite(), 'Customers')) {
         $this->_data = '<table border="0" width="100%" cellspacing="0" cellpadding="2" class="dataTable">' . '  <thead>' . '    <tr>' . '      <th>' . OSCOM::getDef('admin_indexmodules_customers_table_heading_customers') . '</th>' . '      <th>' . OSCOM::getDef('admin_indexmodules_customers_table_heading_date') . '</th>' . '      <th>' . OSCOM::getDef('admin_indexmodules_customers_table_heading_status') . '</th>' . '    </tr>' . '  </thead>' . '  <tbody>';
         $Qcustomers = Registry::get('PDO')->query('select customers_id, customers_gender, customers_lastname, customers_firstname, customers_status, date_account_created from :table_customers order by date_account_created desc limit 6');
         $Qcustomers->execute();
         $counter = 0;
         while ($Qcustomers->fetch()) {
             $customer_icon = HTML::icon('people.png');
             if (ACCOUNT_GENDER > -1) {
                 switch ($Qcustomers->value('customers_gender')) {
                     case 'm':
                         $customer_icon = HTML::icon('user_male.png');
                         break;
                     case 'f':
                         $customer_icon = HTML::icon('user_female.png');
                         break;
                 }
             }
             $this->_data .= '    <tr onmouseover="$(this).addClass(\'mouseOver\');" onmouseout="$(this).removeClass(\'mouseOver\');"' . ($counter % 2 ? ' class="alt"' : '') . '>' . '      <td>' . HTML::link(OSCOM::getLink(null, 'Customers', 'Save&id=' . $Qcustomers->valueInt('customers_id')), $customer_icon . '&nbsp;' . $Qcustomers->valueProtected('customers_firstname') . ' ' . $Qcustomers->valueProtected('customers_lastname')) . '</td>' . '      <td>' . $Qcustomers->value('date_account_created') . '</td>' . '      <td align="center">' . HTML::icon($Qcustomers->valueInt('customers_status') === 1 ? 'checkbox_ticked.gif' : 'checkbox_crossed.gif', null, null) . '</td>' . '    </tr>';
             $counter++;
         }
         $this->_data .= '  </tbody>' . '</table>';
     }
 }
Ejemplo n.º 12
0
 public function initialize()
 {
     $OSCOM_Customer = Registry::get('Customer');
     $OSCOM_PDO = Registry::get('PDO');
     $OSCOM_Language = Registry::get('Language');
     if ($OSCOM_Customer->isLoggedOn()) {
         $Qorders = $OSCOM_PDO->prepare('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->bindInt(':customers_id', $OSCOM_Customer->getID());
         $Qorders->bindInt(':limit', BOX_ORDER_HISTORY_MAX_LIST);
         $Qorders->execute();
         $result = $Qorders->fetchAll();
         if (count($result) > 0) {
             $product_ids = '';
             foreach ($result as $r) {
                 $product_ids .= $r['products_id'] . ',';
             }
             $product_ids = substr($product_ids, 0, -1);
             $Qproducts = $OSCOM_PDO->prepare('select products_id, products_name, products_keyword from :table_products_description where products_id in (' . $product_ids . ') and language_id = :language_id order by products_name');
             $Qproducts->bindInt(':language_id', $OSCOM_Language->getID());
             $Qproducts->execute();
             $this->_content = '<ol style="list-style: none; margin: 0; padding: 0;">';
             while ($Qproducts->fetch()) {
                 $this->_content .= '<li>' . HTML::link(OSCOM::getLink(null, 'Products', $Qproducts->value('products_keyword')), $Qproducts->value('products_name')) . '</li>';
             }
             $this->_content .= '</ol>';
         }
     }
 }
Ejemplo n.º 13
0
 public function quote()
 {
     $this->quotes = array('id' => $this->_code, 'module' => $this->_title, 'methods' => array(array('id' => $this->_code, 'title' => OSCOM::getDef('shipping_flat_method'), 'cost' => MODULE_SHIPPING_FLAT_COST)), 'tax_class_id' => $this->tax_class);
     if (!empty($this->icon)) {
         $this->quotes['icon'] = HTML::image($this->icon, $this->_title);
     }
     return $this->quotes;
 }
Ejemplo n.º 14
0
 public function initialize()
 {
     $OSCOM_Product = Registry::exists('Product') ? Registry::get('Product') : null;
     if (isset($OSCOM_Product) && $OSCOM_Product instanceof \osCommerce\OM\Site\Shop\Product && $OSCOM_Product->isValid()) {
         // HPDL && ($osC_Template->getModule() != 'tell_a_friend')) {
         $this->_content = '<form name="tell_a_friend" action="' . OSCOM::getLink(null, null, 'TellAFriend&' . $OSCOM_Product->getKeyword()) . '" method="post">' . "\n" . HTML::inputField('to_email_address', null, 'style="width: 80%;"') . '&nbsp;' . HTML::submitImage('button_tell_a_friend.gif', OSCOM::getDef('box_tell_a_friend_text')) . '<br />' . OSCOM::getDef('box_tell_a_friend_text') . "\n" . '</form>' . "\n";
     }
 }
function osc_cfg_set_countries_pulldown_menu($default, $key = null)
{
    $name = !empty($key) ? 'configuration[' . $key . ']' : 'configuration_value';
    $countries_array = array();
    foreach (Address::getCountries() as $country) {
        $countries_array[] = array('id' => $country['id'], 'text' => $country['name']);
    }
    return HTML::selectMenu($name, $countries_array, $default);
}
function osc_cfg_set_weight_classes_pulldown_menu($default, $key = null)
{
    $name = empty($key) ? 'configuration_value' : 'configuration[' . $key . ']';
    $weight_class_array = array();
    foreach (Weight::getClasses() as $class) {
        $weight_class_array[] = array('id' => $class['id'], 'text' => $class['title']);
    }
    return HTML::selectMenu($name, $weight_class_array, $default);
}
 public function __construct()
 {
     $this->initialize();
     if (isset($_GET['action']) && !empty($_GET['action'])) {
         $action = HTML::sanitize(basename($_GET['action']));
         if (class_exists('osCommerce\\OM\\Core\\Site\\' . OSCOM::getSite() . '\\Application\\' . OSCOM::getSiteApplication() . '\\Action\\' . $action)) {
             call_user_func(array('osCommerce\\OM\\Core\\Site\\' . OSCOM::getSite() . '\\Application\\' . OSCOM::getSiteApplication() . '\\Action\\' . $action, 'execute'), $this);
         }
     }
 }
Ejemplo n.º 18
0
 public static function execute(ApplicationAbstract $application)
 {
     $data = HTML::sanitize(basename($_GET['code']));
     if (Services::uninstall($data)) {
         Registry::get('MessageStack')->add(null, OSCOM::getDef('ms_success_action_performed'), 'success');
     } else {
         Registry::get('MessageStack')->add(null, OSCOM::getDef('ms_error_action_not_performed'), 'error');
     }
     OSCOM::redirect(OSCOM::getLink());
 }
Ejemplo n.º 19
0
 public static function execute(ApplicationAbstract $application)
 {
     $data = HTML::sanitize(basename($_GET['code']));
     if (PaymentModules::install($data)) {
         OSCOM::redirect(OSCOM::getLink(null, null, 'Save&code=' . $_GET['code']));
     } else {
         Registry::get('MessageStack')->add(null, OSCOM::getDef('ms_error_action_not_performed'), 'error');
         OSCOM::redirect(OSCOM::getLink());
     }
 }
Ejemplo n.º 20
0
 protected function initialize()
 {
     $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()) {
         OSCOM::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 (filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
                 $OSCOM_Customer->setEmailAddress(trim($_POST['email']));
             } else {
                 $OSCOM_MessageStack->add('Cart', OSCOM::getDef('field_customer_email_address_check_error'));
                 OSCOM::redirect(OSCOM::getLink(null, 'Cart'));
             }
         } else {
             $OSCOM_MessageStack->add('Cart', sprintf(OSCOM::getDef('field_customer_email_address_error'), ACCOUNT_EMAIL_ADDRESS));
             OSCOM::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'] = HTML::sanitize($_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'));
     }
 }
Ejemplo n.º 21
0
 public static function parse($data)
 {
     $string = '<table border="0" cellspacing="0" cellpadding="2">';
     $i = 0;
     foreach ($data['data'] as $field) {
         $i++;
         $string .= '  <tr>' . '    <td width="100">' . $field['text'] . ':</td>' . '    <td>' . HTML::inputField('variants[' . $data['group_id'] . '][' . $field['id'] . ']', null, 'id="variants_' . $data['group_id'] . '_' . $i . '"') . '</td>' . '  </tr>';
     }
     $string .= '</table>';
     return $string;
 }
Ejemplo n.º 22
0
 public static function execute(ApplicationAbstract $application)
 {
     if (isset($_GET['module']) && !empty($_GET['module'])) {
         $module = HTML::sanitize($_GET['module']);
         if (class_exists('osCommerce\\OM\\Core\\Site\\Shop\\Module\\Payment\\' . $module)) {
             $module = 'osCommerce\\OM\\Core\\Site\\Shop\\Module\\Payment\\' . $module;
             $module = new $module();
             $module->callback();
         }
     }
     exit;
 }
Ejemplo n.º 23
0
 public function initialize()
 {
     $OSCOM_PDO = Registry::get('PDO');
     $Qmanufacturers = $OSCOM_PDO->query('select manufacturers_id as id, manufacturers_name as text from :table_manufacturers order by manufacturers_name');
     $Qmanufacturers->setCache('manufacturers');
     $Qmanufacturers->execute();
     $manufacturers_array = array(array('id' => '', 'text' => OSCOM::getDef('pull_down_default')));
     foreach ($Qmanufacturers->fetchAll() as $m) {
         $manufacturers_array[] = $m;
     }
     $this->_content = '<form name="manufacturers" action="' . OSCOM::getLink() . '" method="get">' . HTML::hiddenField('Index', null) . HTML::selectMenu('Manufacturers', $manufacturers_array, null, 'onchange="this.form.submit();" size="' . BOX_MANUFACTURERS_LIST_SIZE . '" style="width: 100%"') . HTML::hiddenSessionIDField() . '</form>';
 }
Ejemplo n.º 24
0
 public static function parse($data)
 {
     $default_value = null;
     foreach ($data['data'] as $variant) {
         if ($variant['default'] === true) {
             $default_value = (string) $variant['id'];
             break;
         }
     }
     $string = '<table border="0" cellspacing="0" cellpadding="2">' . '  <tr>' . '    <td width="100">' . $data['title'] . ':</td>' . '    <td>' . HTML::radioField('variants[' . $data['group_id'] . ']', $data['data'], $default_value, 'onchange="refreshVariants();" id="variants_' . $data['group_id'] . '"') . '</td>' . '  </tr>' . '</table>';
     return $string;
 }
function osc_cfg_set_zone_classes_pull_down_menu($default, $key = null)
{
    $OSCOM_PDO = Registry::get('PDO');
    $name = empty($key) ? 'configuration_value' : 'configuration[' . $key . ']';
    $zone_class_array = array(array('id' => '0', 'text' => OSCOM::getDef('parameter_none')));
    $Qzones = $OSCOM_PDO->query('select geo_zone_id, geo_zone_name from :table_geo_zones order by geo_zone_name');
    $Qzones->execute();
    while ($Qzones->fetch()) {
        $zone_class_array[] = array('id' => $Qzones->valueInt('geo_zone_id'), 'text' => $Qzones->value('geo_zone_name'));
    }
    return HTML::selectMenu($name, $zone_class_array, $default);
}
Ejemplo n.º 26
0
 public function initialize()
 {
     $OSCOM_Service = Registry::get('Service');
     $OSCOM_Cache = Registry::get('Cache');
     $OSCOM_Product = Registry::exists('Product') ? Registry::get('Product') : null;
     $OSCOM_Language = Registry::get('Language');
     $OSCOM_PDO = Registry::get('PDO');
     $OSCOM_Image = Registry::get('Image');
     $this->_title_link = OSCOM::getLink(null, 'Products', 'Reviews');
     if ($OSCOM_Service->isStarted('Reviews')) {
         if (BOX_REVIEWS_CACHE > 0 && $OSCOM_Cache->read('box-reviews' . (isset($OSCOM_Product) && $OSCOM_Product instanceof \osCommerce\OM\Site\Shop\Product && $OSCOM_Product->isValid() ? '-' . $OSCOM_Product->getID() : '') . '-' . $OSCOM_Language->getCode(), BOX_REVIEWS_CACHE)) {
             $data = $OSCOM_Cache->getCache();
         } else {
             $data = array();
             $sql_query = 'select r.reviews_id, r.reviews_rating, p.products_id, pd.products_name, pd.products_keyword, i.image from :table_reviews r, :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 r.products_id = p.products_id and p.products_status = 1 and r.languages_id = :language_id and p.products_id = pd.products_id and pd.language_id = :language_id and r.reviews_status = 1';
             if (isset($OSCOM_Product) && $OSCOM_Product instanceof \osCommerce\OM\Site\Shop\Product && $OSCOM_Product->isValid()) {
                 $sql_query .= ' and p.products_id = :products_id';
             }
             $sql_query .= ' order by r.reviews_id desc limit :max_random_select_reviews';
             $Qreview = $OSCOM_PDO->prepare($sql_query);
             $Qreview->bindInt(':default_flag', 1);
             $Qreview->bindInt(':language_id', $OSCOM_Language->getID());
             $Qreview->bindInt(':language_id', $OSCOM_Language->getID());
             if (isset($OSCOM_Product) && $OSCOM_Product instanceof \osCommerce\OM\Site\Shop\Product && $OSCOM_Product->isValid()) {
                 $Qreview->bindInt(':products_id', $OSCOM_Product->getID());
             }
             $Qreview->bindInt(':max_random_select_reviews', BOX_REVIEWS_RANDOM_SELECT);
             $Qreview->execute();
             $result = $Qreview->fetchAll();
             if (count($result) > 0) {
                 $result = $result[rand(0, count($result) - 1)];
                 $Qtext = $OSCOM_PDO->prepare('select substring(reviews_text, 1, 60) as reviews_text from :table_reviews where reviews_id = :reviews_id and languages_id = :languages_id');
                 $Qtext->bindInt(':reviews_id', $result['reviews_id']);
                 $Qtext->bindInt(':languages_id', $OSCOM_Language->getID());
                 $Qtext->execute();
                 $data = array_merge($result, $Qtext->fetch());
             }
             $OSCOM_Cache->write($data);
         }
         $this->_content = '';
         if (empty($data)) {
             if (isset($OSCOM_Product) && $OSCOM_Product instanceof \osCommerce\OM\Site\Shop\Product && $OSCOM_Product->isValid()) {
                 $this->_content = '<div style="float: left; width: 55px;">' . HTML::button(array('href' => OSCOM::getLink(null, 'Products', 'Reviews&Write&' . $OSCOM_Product->getKeyword()), 'icon' => 'pencil', 'title' => OSCOM::getDef('button_write_review'))) . '</div>' . HTML::link(OSCOM::getLink(null, 'Products', 'Reviews&Write&' . $OSCOM_Product->getKeyword()), OSCOM::getDef('box_reviews_write')) . '<div style="clear: both;"></div>';
             }
         } else {
             if (!empty($data['image'])) {
                 $this->_content = '<div align="center">' . HTML::link(OSCOM::getLink(null, 'Products', 'Reviews&View=' . $data['reviews_id'] . '&' . $data['products_keyword']), $OSCOM_Image->show($data['image'], $data['products_name'])) . '</div>';
             }
             $this->_content .= HTML::link(OSCOM::getLink(null, 'Products', 'Reviews&View=' . $data['reviews_id'] . '&' . $data['products_keyword']), wordwrap(HTML::outputProtected($data['reviews_text']), 15, '&shy;') . ' ..') . '<br /><div align="center">' . HTML::image(OSCOM::getPublicSiteLink('images/stars_' . $data['reviews_rating'] . '.png'), sprintf(OSCOM::getDef('box_reviews_stars_rating'), $data['reviews_rating'])) . '</div>';
         }
     }
 }
function osc_cfg_set_credit_cards_checkbox_field($default, $key = null)
{
    $OSCOM_PDO = Registry::get('PDO');
    $name = empty($key) ? 'configuration_value' : 'configuration[' . $key . '][]';
    $cc_array = array();
    $Qcc = $OSCOM_PDO->prepare('select id, credit_card_name from :table_credit_cards where credit_card_status = :credit_card_status order by sort_order, credit_card_name');
    $Qcc->bindInt(':credit_card_status', 1);
    $Qcc->execute();
    while ($Qcc->fetch()) {
        $cc_array[] = array('id' => $Qcc->valueInt('id'), 'text' => $Qcc->value('credit_card_name'));
    }
    return HTML::checkboxField($name, $cc_array, explode(',', $default), null, '<br />');
}
Ejemplo n.º 28
0
 public static function execute(ApplicationAbstract $application)
 {
     if (!empty($_GET['shortcut'])) {
         $application = HTML::sanitize($_GET['shortcut']);
         if (OSCOM::siteApplicationExists($application)) {
             if (Dashboard::deleteShortcut($_SESSION[OSCOM::getSite()]['id'], $application)) {
                 $_SESSION[OSCOM::getSite()]['access'] = Access::getUserLevels($_SESSION[OSCOM::getSite()]['id']);
                 Registry::get('MessageStack')->add('header', OSCOM::getDef('ms_success_shortcut_removed'), 'success');
                 OSCOM::redirect(OSCOM::getLink(null, $application));
             }
         }
     }
     OSCOM::redirect(OSCOM::getLink());
 }
function osc_cfg_set_order_statuses_pull_down_menu($default, $key = null)
{
    $OSCOM_PDO = Registry::get('PDO');
    $OSCOM_Language = Registry::get('Language');
    $name = empty($key) ? 'configuration_value' : 'configuration[' . $key . ']';
    $statuses_array = array(array('id' => '0', 'text' => OSCOM::getDef('default_entry')));
    $Qstatuses = $OSCOM_PDO->prepare('select orders_status_id, orders_status_name from :table_orders_status where language_id = :language_id order by orders_status_name');
    $Qstatuses->bindInt(':language_id', $OSCOM_Language->getID());
    $Qstatuses->execute();
    while ($Qstatuses->fetch()) {
        $statuses_array[] = array('id' => $Qstatuses->valueInt('orders_status_id'), 'text' => $Qstatuses->value('orders_status_name'));
    }
    return HTML::selectMenu($name, $statuses_array, $default);
}
Ejemplo n.º 30
0
 public function initialize()
 {
     $OSCOM_ShoppingCart = Registry::get('ShoppingCart');
     $OSCOM_Currencies = Registry::get('Currencies');
     $this->_title_link = OSCOM::getLink(null, 'Checkout', null, 'SSL');
     if ($OSCOM_ShoppingCart->hasContents()) {
         $this->_content = '<table border="0" width="100%" cellspacing="0" cellpadding="0">';
         foreach ($OSCOM_ShoppingCart->getProducts() as $products) {
             $this->_content .= '  <tr>' . '    <td align="right" valign="top">' . $products['quantity'] . '&nbsp;x&nbsp;</td>' . '    <td valign="top">' . HTML::link(OSCOM::getLink(null, 'Products', $products['keyword']), $products['name']) . '</td>' . '  </tr>';
         }
         $this->_content .= '</table>' . '<p style="text-align: right">' . OSCOM::getDef('box_shopping_cart_subtotal') . ' ' . $OSCOM_Currencies->format($OSCOM_ShoppingCart->getSubTotal()) . '</p>';
     } else {
         $this->_content = OSCOM::getDef('box_shopping_cart_empty');
     }
 }