Esempio n. 1
0
 function listAbandonedCart()
 {
     global $toC_Json, $osC_Database, $osC_Language;
     $start = empty($_REQUEST['start']) ? 0 : $_REQUEST['start'];
     $limit = empty($_REQUEST['limit']) ? MAX_DISPLAY_SEARCH_RESULTS : $_REQUEST['limit'];
     $osC_Currencies = new osC_Currencies();
     $customers_id = osc_get_session_customers_id();
     $Qcustomers = $osC_Database->query("select SQL_CALC_FOUND_ROWS DISTINCT cb.customers_id, cb.products_id, cb.customers_basket_quantity, max(cb.customers_basket_date_added) date_added, c.customers_firstname, c.customers_lastname, c.customers_telephone phone, c.customers_email_address email, c.abandoned_cart_last_contact_date date_contacted from " . TABLE_CUSTOMERS_BASKET . " cb, " . TABLE_CUSTOMERS . " c where c.customers_id not in ('" . implode(',', $customers_id) . "') and cb.customers_id = c.customers_id  group by cb.customers_id order by cb.customers_id, cb.customers_basket_date_added desc ");
     $Qcustomers->setExtBatchLimit($start, $limit);
     $Qcustomers->execute();
     $records = array();
     while ($Qcustomers->next()) {
         $action = array();
         $action[] = array('class' => 'icon-send-email-record', 'qtip' => $osC_Language->get('icon_email_send'));
         $action[] = array('class' => 'icon-delete-record', 'qtip' => $osC_Language->get('icon_trash'));
         $cart_contents = toC_Abandoned_Cart_Admin::getCartContents($Qcustomers->valueInt('customers_id'));
         $total = 0;
         $products = array();
         foreach ($cart_contents as $product) {
             $total += $product['price'] * $product['qty'];
             $products[] = $product['qty'] . ' x ' . $product['name'];
         }
         $date_contacted = $Qcustomers->value('date_contacted');
         $records[] = array('customers_id' => $Qcustomers->valueInt('customers_id'), 'products' => implode('<br />', $products), 'date_contacted' => empty($date_contacted) ? '---' : osC_DateTime::getShort($date_contacted), 'date_added' => osC_DateTime::getShort($Qcustomers->value('date_added')), 'customers_name' => $Qcustomers->value('customers_firstname') . '&nbsp;' . $Qcustomers->value('customers_lastname'), 'email' => $Qcustomers->value('email'), 'action' => $action, 'total' => $osC_Currencies->format($total));
     }
     $Qcustomers->freeResult();
     $response = array(EXT_JSON_READER_TOTAL => sizeof($records), EXT_JSON_READER_ROOT => $records);
     echo $toC_Json->encode($response);
 }
Esempio n. 2
0
 function _setData()
 {
     global $osC_Database, $osC_Language, $osC_Currencies;
     if (!isset($osC_Currencies)) {
         if (!class_exists('osC_Currencies')) {
             include '../includes/classes/currencies.php';
         }
         $osC_Currencies = new osC_Currencies();
     }
     $this->_data = '<table border="0" width="100%" cellspacing="0" cellpadding="2" class="dataTable">' . '  <thead>' . '    <tr>' . '      <th>' . $osC_Language->get('summary_products_table_heading_products') . '</th>' . '      <th>' . $osC_Language->get('summary_products_table_heading_price') . '</th>' . '      <th>' . $osC_Language->get('summary_products_table_heading_date') . '</th>' . '      <th>' . $osC_Language->get('summary_products_table_heading_status') . '</th>' . '    </tr>' . '  </thead>' . '  <tbody>';
     $Qproducts = $osC_Database->query('select products_id, greatest(products_date_added, products_last_modified) as date_last_modified from :table_products where parent_id = 0 order by date_last_modified desc limit 6');
     $Qproducts->bindTable(':table_products', TABLE_PRODUCTS);
     $Qproducts->execute();
     while ($Qproducts->next()) {
         $data = osC_Products_Admin::get($Qproducts->valueInt('products_id'));
         $products_icon = osc_icon('products.png');
         $products_price = $data['products_price'];
         if (!empty($data['variants'])) {
             $products_icon = osc_icon('attach.png');
             $products_price = null;
             foreach ($data['variants'] as $variant) {
                 if ($products_price === null || $variant['data']['price'] < $products_price) {
                     $products_price = $variant['data']['price'];
                 }
             }
             if ($products_price === null) {
                 $products_price = 0;
             }
         }
         $this->_data .= '    <tr onmouseover="rowOverEffect(this);" onmouseout="rowOutEffect(this);">' . '      <td>' . osc_link_object(osc_href_link_admin(FILENAME_DEFAULT, 'products=' . (int) $data['products_id'] . '&action=save'), $products_icon . '&nbsp;' . osc_output_string_protected($data['products_name'])) . '</td>' . '      <td>' . (!empty($data['variants']) ? 'from ' : '') . $osC_Currencies->format($products_price) . '</td>' . '      <td>' . $Qproducts->value('date_last_modified') . '</td>' . '      <td align="center">' . osc_icon((int) $data['products_status'] === 1 ? 'checkbox_ticked.gif' : 'checkbox_crossed.gif', null, null) . '</td>' . '    </tr>';
     }
     $this->_data .= '  </tbody>' . '</table>';
     $Qproducts->freeResult();
 }
Esempio n. 3
0
 function listVariantsSpecials()
 {
     global $toC_Json, $osC_Language, $osC_Database;
     require_once 'includes/classes/currencies.php';
     $osC_Currencies = new osC_Currencies();
     $osC_CategoryTree = new osC_CategoryTree_Admin();
     $start = empty($_REQUEST['start']) ? 0 : $_REQUEST['start'];
     $limit = empty($_REQUEST['limit']) ? MAX_DISPLAY_SEARCH_RESULTS : $_REQUEST['limit'];
     $search = !empty($_REQUEST['search']) ? $_REQUEST['search'] : null;
     $manufacturers_id = !empty($_REQUEST['manufacturers_id']) ? $_REQUEST['manufacturers_id'] : null;
     $current_category_id = end(explode('_', empty($_REQUEST['category_id']) ? 0 : $_REQUEST['category_id']));
     $in_categories = array();
     if ($current_category_id > 0) {
         $osC_CategoryTree->setBreadcrumbUsage(false);
         $in_categories = array($current_category_id);
         foreach ($osC_CategoryTree->getTree($current_category_id) as $category) {
             $in_categories[] = $category['id'];
         }
     }
     //get the variants specials
     $result = osC_Specials_Admin::getVariantsSpecials($start, $limit, $in_categories, $search, $manufacturers_id);
     $records = array();
     if (count($result['special_products']) > 0) {
         foreach ($result['special_products'] as $special_product) {
             $records[] = array('specials_id' => $special_product['specials_id'], 'products_id' => $special_product['products_id'], 'products_name' => $special_product['products_name'], 'products_price' => $special_product['products_price'], 'specials_new_products_price' => '<span class="oldPrice">' . $osC_Currencies->format($special_product['products_price']) . '</span> <span class="specialPrice">' . $osC_Currencies->format($special_product['variants_specials_price']) . '</span>');
         }
     }
     $response = array(EXT_JSON_READER_TOTAL => $result['total'], EXT_JSON_READER_ROOT => $records);
     echo $toC_Json->encode($response);
 }
Esempio n. 4
0
 function start()
 {
     global $osC_Language, $osC_Currencies;
     include 'includes/classes/currencies.php';
     $osC_Currencies = new osC_Currencies();
     if (isset($_SESSION['currency']) == false || isset($_GET['currency']) || USE_DEFAULT_LANGUAGE_CURRENCY == '1' && $osC_Currencies->getCode($osC_Language->getCurrencyID()) != $_SESSION['currency']) {
         if (isset($_GET['currency']) && $osC_Currencies->exists($_GET['currency'])) {
             $_SESSION['currency'] = $_GET['currency'];
         } else {
             $_SESSION['currency'] = USE_DEFAULT_LANGUAGE_CURRENCY == '1' ? $osC_Currencies->getCode($osC_Language->getCurrencyID()) : DEFAULT_CURRENCY;
         }
         if (isset($_SESSION['cartID'])) {
             unset($_SESSION['cartID']);
         }
     }
     return true;
 }
Esempio n. 5
0
 function setData($data)
 {
     global $osC_Currencies;
     $x_labels = array();
     foreach ($data as $date => $order_total) {
         $this->_bar->add($order_total);
         $x_labels[] = osC_DateTime::getShort($date);
     }
     $this->_graph->set_x_labels($x_labels);
     if (!is_object($osC_Currencies)) {
         $osC_Currencies = new osC_Currencies();
     }
     $this->_graph->set_tool_tip(' #x_label# <br>' . $osC_Currencies->getSymbolLeft() . ' #val#');
     $max_total = (int) (floor(max($this->_bar->data) / 100 + 1) * 100);
     $this->_graph->set_y_min(0);
     $this->_graph->set_y_max($max_total);
     $this->_graph->data_sets[] = $this->_bar;
 }
Esempio n. 6
0
 function start()
 {
     if (PHP_VERSION < 4.1) {
         global $_GET;
     }
     global $osC_Currencies, $osC_Session;
     include 'includes/classes/currencies.php';
     $osC_Currencies = new osC_Currencies();
     if ($osC_Session->exists('currency') == false || isset($_GET['currency']) || USE_DEFAULT_LANGUAGE_CURRENCY == 'true' && LANGUAGE_CURRENCY != $osC_Session->value('currency')) {
         if (isset($_GET['currency']) && $osC_Currencies->exists($_GET['currency'])) {
             $currency = $_GET['currency'];
         } else {
             $currency = USE_DEFAULT_LANGUAGE_CURRENCY == 'true' ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY;
         }
         $osC_Session->set('currency', $currency);
     }
     return true;
 }
 function listSpecials()
 {
     global $toC_Json, $osC_Language, $osC_Database;
     require_once 'includes/classes/currencies.php';
     $osC_Currencies = new osC_Currencies();
     $osC_CategoryTree = new osC_CategoryTree_Admin();
     $start = empty($_REQUEST['start']) ? 0 : $_REQUEST['start'];
     $limit = empty($_REQUEST['limit']) ? MAX_DISPLAY_SEARCH_RESULTS : $_REQUEST['limit'];
     $current_category_id = end(explode('_', empty($_REQUEST['category_id']) ? 0 : $_REQUEST['category_id']));
     if ($current_category_id > 0) {
         $osC_CategoryTree->setBreadcrumbUsage(false);
         $in_categories = array($current_category_id);
         foreach ($osC_CategoryTree->getTree($current_category_id) as $category) {
             $in_categories[] = $category['id'];
         }
         $Qspecials = $osC_Database->query('select p.products_id, pd.products_name, p.products_price, s.specials_id, s.specials_new_products_price, s.specials_date_added, s.specials_last_modified, s.expires_date, s.date_status_change, s.status from :table_products p, :table_specials s, :table_products_description pd, :table_products_to_categories p2c where p.products_id = pd.products_id and pd.language_id = :language_id and p.products_id = s.products_id and p.products_id = p2c.products_id and p2c.categories_id in (:categories_id)');
         $Qspecials->bindTable(':table_products_to_categories', TABLE_PRODUCTS_TO_CATEGORIES);
         $Qspecials->bindRaw(':categories_id', implode(',', $in_categories));
     } else {
         $Qspecials = $osC_Database->query('select p.products_id, pd.products_name, p.products_price, s.specials_id, s.specials_new_products_price, s.specials_date_added, s.specials_last_modified, s.expires_date, s.date_status_change, s.status from :table_products p, :table_specials s, :table_products_description pd where p.products_id = pd.products_id and pd.language_id = :language_id and p.products_id = s.products_id');
     }
     if (!empty($_REQUEST['search'])) {
         $Qspecials->appendQuery('and pd.products_name like :products_name');
         $Qspecials->bindValue(':products_name', '%' . $_REQUEST['search'] . '%');
     }
     if (!empty($_REQUEST['manufacturers_id'])) {
         $Qspecials->appendQuery('and p.manufacturers_id = :manufacturers_id');
         $Qspecials->bindValue(':manufacturers_id', $_REQUEST['manufacturers_id']);
     }
     $Qspecials->appendQuery(' order by pd.products_name');
     $Qspecials->bindTable(':table_specials', TABLE_SPECIALS);
     $Qspecials->bindTable(':table_products', TABLE_PRODUCTS);
     $Qspecials->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
     $Qspecials->bindInt(':language_id', $osC_Language->getID());
     $Qspecials->setExtBatchLimit($start, $limit);
     $Qspecials->execute();
     $records = array();
     while ($Qspecials->next()) {
         $records[] = array('specials_id' => $Qspecials->value('specials_id'), 'products_id' => $Qspecials->value('products_id'), 'products_name' => $Qspecials->value('products_name'), 'products_price' => $Qspecials->value('products_price'), 'specials_new_products_price' => '<span class="oldPrice">' . $osC_Currencies->format($Qspecials->value('products_price')) . '</span> <span class="specialPrice">' . $osC_Currencies->format($Qspecials->value('specials_new_products_price')) . '</span>');
     }
     $response = array(EXT_JSON_READER_TOTAL => $Qspecials->getBatchSize(), EXT_JSON_READER_ROOT => $records);
     echo $toC_Json->encode($response);
 }
Esempio n. 8
0
 function _setData()
 {
     global $osC_Database, $osC_Language, $osC_Currencies, $template;
     if (!isset($osC_Currencies)) {
         if (!class_exists('osC_Currencies')) {
             include '../includes/classes/currencies.php';
         }
         $osC_Currencies = new osC_Currencies();
     }
     $this->_data = '<table border="0" width="100%" cellspacing="0" cellpadding="2" class="dataTable">' . '  <thead>' . '    <tr>' . '      <th>' . MODULE_SUMMARY_PRODUCTS_HEADING_PRODUCTS . '</th>' . '      <th>' . MODULE_SUMMARY_PRODUCTS_HEADING_PRICE . '</th>' . '      <th>' . MODULE_SUMMARY_PRODUCTS_HEADING_DATE . '</th>' . '      <th>' . MODULE_SUMMARY_PRODUCTS_HEADING_STATUS . '</th>' . '    </tr>' . '  </thead>' . '  <tbody>';
     $Qproducts = $osC_Database->query('select p.products_id, pd.products_name, p.products_price, greatest(p.products_date_added, p.products_last_modified) as date_last_modified, p.products_status from :table_products p, :table_products_description pd where p.products_id = pd.products_id and pd.language_id = :language_id order by date_last_modified desc, pd.products_name limit 6');
     $Qproducts->bindTable(':table_products', TABLE_PRODUCTS);
     $Qproducts->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
     $Qproducts->bindInt(':language_id', $osC_Language->getID());
     $Qproducts->execute();
     while ($Qproducts->next()) {
         $this->_data .= '    <tr onMouseOver="rowOverEffect(this);" onMouseOut="rowOutEffect(this);">' . '      <td><a href="' . tep_href_link(FILENAME_PRODUCTS, 'pID=' . $Qproducts->valueInt('products_id') . '&action=new_product') . '">' . tep_image('templates/' . $template . '/images/icons/16x16/products.png', ICON_PREVIEW, '16', '16') . '&nbsp;' . $Qproducts->value('products_name') . '</a></td>' . '      <td>' . $osC_Currencies->format($Qproducts->value('products_price')) . '</td>' . '      <td>' . $Qproducts->value('date_last_modified') . '</td>' . '      <td align="center">' . tep_image('templates/' . $template . '/images/icons/' . ($Qproducts->valueInt('products_status') === 1 ? 'checkbox_ticked.gif' : 'checkbox_crossed.gif')) . '</td>' . '    </tr>';
     }
     $Qproducts->freeResult();
     $this->_data .= '  </tbody>' . '</table>';
 }
Esempio n. 9
0
 public function __construct()
 {
     Registry::get('Language')->loadIniFile('modules/Dashboard/Products.php');
     $this->_title = OSCOM::getDef('admin_indexmodules_products_title');
     $this->_title_link = OSCOM::getLink(null, 'Products');
     if (Access::hasAccess(OSCOM::getSite(), 'Products')) {
         if (!isset($osC_Currencies)) {
             if (!class_exists('osC_Currencies')) {
                 include 'includes/classes/currencies.php';
             }
             $osC_Currencies = new osC_Currencies();
         }
         $this->_data = '<table border="0" width="100%" cellspacing="0" cellpadding="2" class="dataTable">' . '  <thead>' . '    <tr>' . '      <th>' . OSCOM::getDef('admin_indexmodules_products_table_heading_products') . '</th>' . '      <th>' . OSCOM::getDef('admin_indexmodules_products_table_heading_price') . '</th>' . '      <th>' . OSCOM::getDef('admin_indexmodules_products_table_heading_date') . '</th>' . '      <th>' . OSCOM::getDef('admin_indexmodules_products_table_heading_status') . '</th>' . '    </tr>' . '  </thead>' . '  <tbody>';
         $Qproducts = Registry::get('PDO')->query('select products_id, greatest(products_date_added, products_last_modified) as date_last_modified from :table_products where parent_id is null order by date_last_modified desc limit 6');
         $Qproducts->execute();
         $counter = 0;
         while ($Qproducts->fetch()) {
             $data = osC_Products_Admin::get($Qproducts->valueInt('products_id'));
             $products_icon = osc_icon('products.png');
             $products_price = $data['products_price'];
             if (!empty($data['variants'])) {
                 $products_icon = osc_icon('attach.png');
                 $products_price = null;
                 foreach ($data['variants'] as $variant) {
                     if ($products_price === null || $variant['data']['price'] < $products_price) {
                         $products_price = $variant['data']['price'];
                     }
                 }
                 if ($products_price === null) {
                     $products_price = 0;
                 }
             }
             $this->_data .= '    <tr onmouseover="$(this).addClass(\'mouseOver\');" onmouseout="$(this).removeClass(\'mouseOver\');"' . ($counter % 2 ? ' class="alt"' : '') . '>' . '      <td>' . osc_link_object(OSCOM::getLink(null, 'Products', 'id=' . (int) $data['products_id'] . '&action=save'), $products_icon . '&nbsp;' . osc_output_string_protected($data['products_name'])) . '</td>' . '      <td>' . (!empty($data['variants']) ? 'from ' : '') . $osC_Currencies->format($products_price) . '</td>' . '      <td>' . $Qproducts->value('date_last_modified') . '</td>' . '      <td align="center">' . osc_icon((int) $data['products_status'] === 1 ? 'checkbox_ticked.gif' : 'checkbox_crossed.gif', null, null) . '</td>' . '    </tr>';
             $counter++;
         }
         $this->_data .= '  </tbody>' . '</table>';
     }
 }
Esempio n. 10
0
 function start()
 {
     global $osC_Language, $osC_Currencies;
     include 'includes/classes/currencies.php';
     $osC_Currencies = new osC_Currencies();
     //Keep currency selection from currency box for the following requests
     if (isset($_GET['currency']) && $osC_Currencies->exists($_GET['currency'])) {
         $_SESSION['currency'] = $_GET['currency'];
         $_SESSION['currency_set'] = true;
         if (isset($_SESSION['cartID'])) {
             unset($_SESSION['cartID']);
         }
     }
     //set the currency with default language currency or default currency
     if (!isset($_SESSION['currency_set'])) {
         if (isset($_SESSION['currency']) == false || USE_DEFAULT_LANGUAGE_CURRENCY == '1' && $osC_Currencies->getCode($osC_Language->getCurrencyID()) != $_SESSION['currency'] || USE_DEFAULT_LANGUAGE_CURRENCY != '1' && DEFAULT_CURRENCY != $_SESSION['currency']) {
             $_SESSION['currency'] = USE_DEFAULT_LANGUAGE_CURRENCY == '1' ? $osC_Currencies->getCode($osC_Language->getCurrencyID()) : DEFAULT_CURRENCY;
             if (isset($_SESSION['cartID'])) {
                 unset($_SESSION['cartID']);
             }
         }
     }
     return true;
 }
Esempio n. 11
0
 function listOnlineCustomers()
 {
     global $toC_Json, $osC_Language, $osC_Database;
     require_once 'includes/classes/currencies.php';
     $osC_Currencies = new osC_Currencies();
     require_once 'includes/classes/geoip.php';
     $osC_GeoIP = osC_GeoIP_Admin::load();
     if ($osC_GeoIP->isInstalled()) {
         $osC_GeoIP->activate();
     }
     $active_time = 300;
     $track_time = 900;
     osC_WhosOnline_Admin::removeExpiredEntries($track_time);
     $xx_mins_ago_active = time() - $active_time;
     $start = empty($_REQUEST['start']) ? 0 : $_REQUEST['start'];
     $limit = empty($_REQUEST['limit']) ? MAX_DISPLAY_SEARCH_RESULTS : $_REQUEST['limit'];
     $Qwho = $osC_Database->query('select customer_id, full_name, ip_address, time_entry, time_last_click, session_id, referrer_url from :table_whos_online ');
     $Qwho->bindTable(':table_whos_online', TABLE_WHOS_ONLINE);
     if ($_REQUEST['customers_filter'] == 'customers') {
         $Qwho->appendQuery('where customer_id >= 1 ');
     } else {
         if ($_REQUEST['customers_filter'] == 'guests') {
             $Qwho->appendQuery('where customer_id = 0 ');
         } else {
             if ($_REQUEST['customers_filter'] == 'customers_guests') {
                 $Qwho->appendQuery('where customer_id >= 0 ');
             } else {
                 if ($_REQUEST['customers_filter'] == 'bots') {
                     $Qwho->appendQuery('where customer_id = -1 ');
                 }
             }
         }
     }
     $Qwho->appendQuery('order by time_last_click desc');
     $Qwho->setExtBatchLimit($start, $limit);
     $Qwho->execute();
     $record = array();
     while ($Qwho->next()) {
         $session_data = osC_WhosOnline_Admin::getSessionData($Qwho->value('session_id'));
         $navigation = unserialize(osc_get_serialized_variable($session_data, 'osC_NavigationHistory_data', 'array'));
         if (is_array($navigation)) {
             $last_page = end($navigation);
         }
         $currency = unserialize(osc_get_serialized_variable($session_data, 'currency', 'string'));
         $cart = unserialize(osc_get_serialized_variable($session_data, 'osC_ShoppingCart_data', 'array'));
         $status = '';
         if ($Qwho->value('customer_id') < 0) {
             if ($Qwho->value('time_last_click') < $xx_mins_ago_active) {
                 $status = osc_icon('status_green.png', $osC_Language->get('text_status_inactive_bot'));
             } else {
                 $status = osc_icon('status_red.png', $osC_Language->get('text_status_active_bot'));
             }
         } else {
             if (is_array($cart['contents']) && sizeof($cart['contents']) > 0) {
                 if ($Qwho->value('time_last_click') < $xx_mins_ago_active) {
                     $status = osc_icon('cart_red.png', $osC_Language->get('text_status_inactive_cart'));
                 } else {
                     $status = osc_icon('cart_green.png', $osC_Language->get('text_status_active_cart'));
                 }
             } else {
                 if ($Qwho->value('time_last_click') < $xx_mins_ago_active) {
                     $status = osc_icon('people_red.png', $osC_Language->get('text_status_inactive_nocart'));
                 } else {
                     $status = osc_icon('people_green.png', $osC_Language->get('text_status_active_nocart'));
                 }
             }
         }
         $geoip = '';
         $iso_code_2 = $osC_GeoIP->getCountryISOCode2($Qwho->value('ip_address'));
         if ($osC_GeoIP->isActive() && $osC_GeoIP->isValid($Qwho->value('ip_address')) && !empty($iso_code_2)) {
             $geoip = osc_image('../images/worldflags/' . $iso_code_2 . '.png', $osC_GeoIP->getCountryName($Qwho->value('ip_address')) . ', ' . $Qwho->value('ip_address'), 18, 12) . '&nbsp;' . $Qwho->value('ip_address');
         } else {
             $geoip = $Qwho->value('ip_address');
         }
         $customers_info = '<table width="100%">';
         $customers_info .= '<tr><td width="120"><b>' . $osC_Language->get('field_session_id') . '</b></td><td>' . $Qwho->value('session_id') . '</td></tr>';
         $customers_info .= '<tr><td><b>' . $osC_Language->get('field_customer_name') . '</b></td><td>' . $Qwho->value('full_name') . '</td></tr>';
         $customers_info .= '<tr><td><b>' . $osC_Language->get('field_ip_address') . '</b></td><td>' . $Qwho->value('ip_address') . '</td></tr>';
         $customers_info .= '<tr><td><b>' . $osC_Language->get('field_entry_time') . '</b></td><td>' . date('H:i:s', $Qwho->value('time_entry')) . '</td></tr>';
         $customers_info .= '<tr><td><b>' . $osC_Language->get('field_last_click') . '</b></td><td>' . date('H:i:s', $Qwho->value('time_last_click')) . '</td></tr>';
         $customers_info .= '<tr><td><b>' . $osC_Language->get('field_time_online') . '</b></td><td>' . gmdate('H:i:s', time() - $Qwho->value('time_entry')) . '</td></tr>';
         $customers_info .= '<tr><td><b>' . $osC_Language->get('field_referrer_url') . '</b></td><td>' . $Qwho->value('referrer_url') . '</td></tr>';
         $customers_info .= '</table>';
         $products_table = '<table width="100%">';
         foreach ($cart['contents'] as $product) {
             $product_info = $product['quantity'] . '&nbsp;x&nbsp;' . $product['name'];
             if ($product['type'] == PRODUCT_TYPE_GIFT_CERTIFICATE) {
                 $product_info .= '<br /><nobr>&nbsp;&nbsp;&nbsp;<i>' . $osC_Language->get('senders_name') . ': ' . $product['gc_data']['senders_name'] . '</i></nobr>';
                 if ($product['gift_certificates_type'] == GIFT_CERTIFICATE_TYPE_EMAIL) {
                     $product_info .= '<br /><nobr>&nbsp;&nbsp;&nbsp;<i>' . $osC_Language->get('senders_email') . ': ' . $product['gc_data']['senders_email'] . '</i></nobr>';
                 }
                 $product_info .= '<br /><nobr>&nbsp;&nbsp;&nbsp;<i>' . $osC_Language->get('recipients_name') . ': ' . $product['gc_data']['recipients_name'] . '</i></nobr>';
                 if ($product['gift_certificates_type'] == GIFT_CERTIFICATE_TYPE_EMAIL) {
                     $product_info .= '<br /><nobr>&nbsp;&nbsp;&nbsp;<i>' . $osC_Language->get('recipients_email') . ': ' . $product['gc_data']['recipients_email'] . '</i></nobr>';
                 }
                 $product_info .= '<br /><nobr>&nbsp;&nbsp;&nbsp;<i>' . $osC_Language->get('messages') . ': ' . $product['gc_data']['message'] . '</i></nobr>';
             }
             if (isset($product['variants']) && is_array($product['variants']) && sizeof($product['variants']) > 0) {
                 foreach ($product['variants'] as $variants) {
                     $product_info .= '<br /><nobr>&nbsp;&nbsp;&nbsp;<i>' . $variants['groups_name'] . ': ' . $variants['values_name'] . '</i></nobr>';
                 }
             }
             $products_table .= '<tr><td>' . $product_info . '</td><td width="60" valign="top" align="right">' . $osC_Currencies->displayPriceWithTaxRate($product['final_price'], $product['tax'], 1, $currency) . '</td></tr>';
         }
         $products_table .= '</table>';
         $customers_name = $Qwho->value('full_name') . ' (' . $Qwho->valueInt('customer_id') . ')';
         $customers_name .= ' -- ' . ($geoip === $_SERVER['REMOTE_ADDR'] ? $osC_Language->get('text_administrator') : '');
         $record[] = array('session_id' => $Qwho->value('session_id'), 'status' => $status, 'geoip' => $geoip, 'online_time' => gmdate('H:i:s', time() - $Qwho->value('time_entry')), 'last_url' => $last_page['page'], 'custormers_name' => $customers_name, 'customers_info' => $customers_info, 'products' => $products_table, 'total' => $osC_Currencies->format($cart['total_cost'], true, $currency));
     }
     if ($osC_GeoIP->isActive()) {
         $osC_GeoIP->deactivate();
     }
     $response = array(EXT_JSON_READER_TOTAL => $Qwho->getBatchSize(), EXT_JSON_READER_ROOT => $record);
     echo $toC_Json->encode($response);
 }
Esempio n. 12
0
 function render()
 {
     global $osC_Database, $osC_Language;
     //New Page
     $this->_pdf->AddPage();
     //Title
     $this->_pdf->SetFont(TOC_PDF_FONT_B, 'B', TOC_PDF_TITLE_FONT_SIZE);
     $this->_pdf->SetY(TOC_PDF_POS_HEADING_TITLE_Y);
     $Qinvoices = $osC_Database->query('select invoice_number from :table_orders where orders_id = :orders_id');
     $Qinvoices->bindTable(':table_orders', TABLE_ORDERS);
     $Qinvoices->bindInt(':orders_id', $_REQUEST['orders_id']);
     $Qinvoices->execute();
     if ($Qinvoices->value('invoice_number') > 0) {
         //Title
         $this->_pdf->MultiCell(0, 4, $osC_Language->get('pdf_invoice_heading_title') . ' کالا و خدمات', 0, 'C');
     } else {
         //Title
         $this->_pdf->MultiCell(0, 4, $osC_Language->get('pdf_order_heading_title') . ' کالا و خدمات', 0, 'C');
     }
     //Date purchase & order ID field title
     $this->_pdf->SetFont(TOC_PDF_FONT_B, 'B', TOC_PDF_FIELD_DATE_PURCHASE_FONT_SIZE);
     $this->_pdf->SetY(TOC_PDF_POS_DOC_INFO_FIELD_Y);
     $this->_pdf->SetX(150);
     if ($Qinvoices->value('invoice_number') > 0) {
         $this->_pdf->MultiCell(25, 5, $osC_Language->get('operation_heading_invoice_number') . "\n" . $osC_Language->get('operation_heading_invoice_date') . "\n" . $osC_Language->get('operation_heading_order_id'), 0, 'R');
     } else {
         $this->_pdf->MultiCell(25, 5, $osC_Language->get('operation_heading_order_date') . "\n" . $osC_Language->get('operation_heading_order_id'), 0, 'R');
     }
     //Date purchase & order ID field value
     $this->_pdf->SetFont(TOC_PDF_FONT, 'B', TOC_PDF_FIELD_DATE_PURCHASE_FONT_SIZE);
     $this->_pdf->SetY(TOC_PDF_POS_DOC_INFO_VALUE_Y);
     $this->_pdf->SetX(175);
     if ($Qinvoices->value('invoice_number') > 0) {
         $this->_pdf->MultiCell(45, 5, $this->_order->getInvoiceNumber() . "\n" . osC_DateTime::getShort($this->_order->getInvoiceDate()) . "\n" . $this->_order->getOrderID(), 0, 'R');
     } else {
         $this->_pdf->MultiCell(45, 5, osC_DateTime::getShort($this->_order->getDateCreated()) . "\n" . $this->_order->getOrderID(), 0, 'R');
     }
     //Products
     $this->_pdf->SetFont(TOC_PDF_FONT_B, 'B', TOC_PDF_TABLE_HEADING_FONT_SIZE);
     $this->_pdf->SetY(TOC_PDF_POS_PRODUCTS_TABLE_HEADING_Y);
     $this->_pdf->Cell(10, 6, '', 'TB', 0, 'R', 0);
     $this->_pdf->Cell(80, 6, $osC_Language->get('heading_products_name'), 'TB', 0, 'C', 0);
     $this->_pdf->Cell(37, 6, $osC_Language->get('heading_products_quantity'), 'TB', 0, 'C', 0);
     $this->_pdf->Cell(32, 6, $osC_Language->get('heading_products_price'), 'TB', 0, 'C', 0);
     $this->_pdf->Cell(32, 6, $osC_Language->get('heading_products_total'), 'TB', 0, 'C', 0);
     $this->_pdf->Ln();
     $i = 0;
     $y_table_position = TOC_PDF_POS_PRODUCTS_TABLE_CONTENT_Y;
     $osC_Currencies = new osC_Currencies();
     foreach ($this->_order->getProducts() as $index => $products) {
         $rowspan = 1;
         //Pos
         $this->_pdf->SetFont(TOC_PDF_FONT, 'B', TOC_PDF_TABLE_CONTENT_FONT_SIZE);
         $this->_pdf->SetY($y_table_position);
         $this->_pdf->MultiCell(8, 4, $i + 1, 0, 'C');
         //Product
         $this->_pdf->SetY($y_table_position);
         $this->_pdf->SetX(30);
         $product_info = $products['name'];
         if (strlen($products['name']) > 70) {
             $rowspan = 2;
         }
         if ($products['type'] == PRODUCT_TYPE_GIFT_CERTIFICATE) {
             $product_info .= "\n" . '   -' . $osC_Language->get('senders_name') . ': ' . $products['senders_name'];
             if ($products['gift_certificates_type'] == GIFT_CERTIFICATE_TYPE_EMAIL) {
                 $product_info .= "\n" . '   -' . $osC_Language->get('senders_email') . ': ' . $products['senders_email'];
                 $rowspan++;
             }
             $product_info .= "\n" . '   -' . $osC_Language->get('recipients_name') . ': ' . $products['recipients_name'];
             if ($products['gift_certificates_type'] == GIFT_CERTIFICATE_TYPE_EMAIL) {
                 $product_info .= "\n" . '   -' . $osC_Language->get('recipients_email') . ': ' . $products['recipients_email'];
                 $rowspan++;
             }
             $rowspan += 3;
             $product_info .= "\n" . '   -' . $osC_Language->get('messages') . ': ' . $products['messages'];
         }
         if (isset($products['variants']) && sizeof($products['variants']) > 0) {
             foreach ($products['variants'] as $variant) {
                 $product_info .= "\n" . $variant['groups_name'] . ": " . $variant['values_name'];
                 $rowspan++;
             }
         }
         $this->_pdf->MultiCell(80, 4, $product_info, 0, 'R');
         //Quantity
         $this->_pdf->SetY($y_table_position);
         $this->_pdf->SetX(113);
         $this->_pdf->MultiCell(10, 4, $products['qty'], 0, 'C');
         //Price
         $this->_pdf->SetY($y_table_position);
         $this->_pdf->SetX(143);
         $price = $osC_Currencies->displayPriceWithTaxRate($products['final_price'], $products['tax'], 1, $this->_order->getCurrency(), $this->_order->getCurrencyValue());
         $price = str_replace('&nbsp;', ' ', $price);
         $this->_pdf->MultiCell(20, 4, $price, 0, 'C');
         //Total
         $this->_pdf->SetY($y_table_position);
         $this->_pdf->SetX(171);
         $total = $osC_Currencies->displayPriceWithTaxRate($products['final_price'], $products['tax'], $products['qty'], $this->_order->getCurrency(), $this->_order->getCurrencyValue());
         $total = str_replace('&nbsp;', ' ', $total);
         $this->_pdf->MultiCell(30, 4, $total, 0, 'C');
         $y_table_position += $rowspan * TOC_PDF_TABLE_CONTENT_HEIGHT;
         //products list exceed page height, create a new page
         if ($y_table_position - TOC_PDF_POS_CONTENT_Y - 6 > 160) {
             $this->_pdf->AddPage();
             $y_table_position = TOC_PDF_POS_CONTENT_Y + 6;
             $this->_pdf->SetFont(TOC_PDF_FONT_B, 'B', TOC_PDF_TABLE_HEADING_FONT_SIZE);
             $this->_pdf->SetY(TOC_PDF_POS_CONTENT_Y);
             $this->_pdf->Cell(10, 6, '', 'TB', 0, 'C', 0);
             $this->_pdf->Cell(80, 6, $osC_Language->get('heading_products_name'), 'TB', 0, 'C', 0);
             $this->_pdf->Cell(37, 6, $osC_Language->get('heading_products_quantity'), 'TB', 0, 'C', 0);
             $this->_pdf->Cell(32, 6, $osC_Language->get('heading_products_price'), 'TB', 0, 'C', 0);
             $this->_pdf->Cell(32, 6, $osC_Language->get('heading_products_total'), 'TB', 0, 'C', 0);
             $this->_pdf->Ln();
         }
         $i++;
     }
     $this->_pdf->SetY($y_table_position + 1);
     $this->_pdf->Cell(191, 7, '', 'T', 0, 'C', 0);
     //Order Totals
     $this->_pdf->SetFont(TOC_PDF_FONT, 'B', TOC_PDF_TABLE_CONTENT_FONT_SIZE);
     foreach ($this->_order->getTotals() as $totals) {
         $y_table_position += 4;
         $this->_pdf->SetFont(TOC_PDF_FONT_B, 'B', TOC_PDF_TOTAL_FONT_SIZE);
         $this->_pdf->SetY($y_table_position);
         $this->_pdf->SetX(40);
         $this->_pdf->MultiCell(120, 5, $totals['title'], 0, 'L');
         $total_text = str_replace('&nbsp;', ' ', $totals['value']);
         $total_text = $osC_Currencies->format($total_text, $this->_order->getCurrency(), $this->_order->getCurrencyValue());
         $this->_pdf->SetFont(TOC_PDF_FONT, 'B', TOC_PDF_TOTAL_FONT_SIZE);
         $this->_pdf->SetY($y_table_position);
         $this->_pdf->SetX(165);
         $this->_pdf->MultiCell(40, 5, strip_tags($total_text), 0, 'C');
     }
     if ($Qinvoices->value('invoice_number') > 0) {
         $this->_pdf->Output("Invoice.pdf", "I");
     } else {
         $this->_pdf->Output("Orders.pdf", "I");
     }
 }
Esempio n. 13
0
 function listChooseProducts()
 {
     global $toC_Json, $osC_Database, $osC_Language, $osC_Currencies, $osC_Tax;
     $start = empty($_REQUEST['start']) ? 0 : $_REQUEST['start'];
     $limit = empty($_REQUEST['limit']) ? MAX_DISPLAY_SEARCH_RESULTS : $_REQUEST['limit'];
     $Qproducts = $osC_Database->query('select SQL_CALC_FOUND_ROWS * from :table_products p left join :table_products_description pd on p.products_id = pd.products_id where p.products_status = 1 and pd.language_id = :language_id and p.products_status = 1');
     if (!empty($_REQUEST['search'])) {
         $Qproducts->appendQuery('and pd.products_name  like :products_name');
         $Qproducts->bindValue(':products_name', '%' . $_REQUEST['search'] . '%');
     }
     $Qproducts->appendQuery('order by p.products_id ');
     $Qproducts->bindTable(':table_products', TABLE_PRODUCTS);
     $Qproducts->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
     $Qproducts->bindInt(':language_id', $osC_Language->getID());
     $Qproducts->setExtBatchLimit($start, $limit);
     $Qproducts->execute();
     $osC_Currencies = new osC_Currencies();
     $osC_Order = new osC_Order($_REQUEST['orders_id']);
     $osC_Tax = new osC_Tax_Admin();
     $_SESSION['currency'] = $osC_Order->getCurrency();
     $records = array();
     while ($Qproducts->next()) {
         $products_id = $Qproducts->valueInt('products_id');
         $osC_Product = new osC_Product($products_id, $osC_Order->getCustomer('customers_id'));
         if (!$osC_Product->hasVariants()) {
             $products_name = $osC_Product->getTitle();
             $products_price = $osC_Product->getPriceFormated();
             if ($osC_Product->isGiftCertificate()) {
                 $products_name .= '<table cellspacing="0" cellpadding="0" border="0">';
                 if ($osC_Product->isOpenAmountGiftCertificate()) {
                     $products_name .= '<tr><td><i>--&nbsp;&nbsp;' . $osC_Language->get('field_amount') . '</i></td><td><input id="' . $products_id . '_price' . '" type="text" class="x-form-text x-form-field x-form-empty-field" style="width: 140px" value="' . round($osC_Product->getOpenAmountMinValue() * $osC_Order->getCurrencyValue(), 2) . '"/></td></tr>';
                 }
                 if ($osC_Product->isEmailGiftCertificate()) {
                     $products_name .= '<tr><td><i>--&nbsp;&nbsp;' . $osC_Language->get('field_recipient_sender_name') . '</i></td><td><input id="' . $products_id . '_sender_name' . '" type="text" class="x-form-text x-form-field x-form-empty-field" style="width: 140px" /></td></tr>' . '<tr><td><i>--&nbsp;&nbsp;' . $osC_Language->get('field_recipient_sender_email') . '</i></td><td><input id="' . $products_id . '_sender_email' . '" type="text" class="x-form-text x-form-field x-form-empty-field" style="width: 140px" /></td></tr>' . '<tr><td><i>--&nbsp;&nbsp;' . $osC_Language->get('field_recipient_name') . '</i></td><td><input id="' . $products_id . '_recipient_name' . '" type="text" class="x-form-text x-form-field x-form-empty-field" style="width: 140px" /></td></tr>' . '<tr><td><i>--&nbsp;&nbsp;' . $osC_Language->get('field_recipient_email') . '</i></td><td><input id="' . $products_id . '_recipient_email' . '" type="text" class="x-form-text x-form-field x-form-empty-field" style="width: 140px" /></td></tr>' . '<tr><td><i>--&nbsp;&nbsp;' . $osC_Language->get('field_message') . '</i></td><td><textarea id="' . $products_id . '_message' . '" class=" x-form-textarea x-form-field" style="width: 140px" /></textarea></td></tr>';
                 } else {
                     if ($osC_Product->isPhysicalGiftCertificate()) {
                         $products_name .= '<tr><td><i>--&nbsp;&nbsp;' . $osC_Language->get('field_recipient_sender_name') . '</i></td><td><input id="' . $products_id . '_sender_name' . '" type="text" class="x-form-text x-form-field x-form-empty-field" style="width: 140px" /></td></tr>' . '<tr><td><i>--&nbsp;&nbsp;' . $osC_Language->get('field_recipient_name') . '</i></td><td><input id="' . $products_id . '_recipient_name' . '" type="text" class="x-form-text x-form-field x-form-empty-field" style="width: 140px" /></td></tr>' . '<tr><td><i>--&nbsp;&nbsp;' . $osC_Language->get('field_message') . '</i></td><td><textarea id="' . $products_id . '_message' . '" class=" x-form-textarea x-form-field" style="width: 140px" /></textarea></td></tr>';
                     }
                 }
                 $products_name .= '</table>';
             }
             $records[] = array('products_id' => $products_id, 'products_name' => $products_name, 'products_type' => $osC_Product->getProductType(), 'products_sku' => $osC_Product->getSKU(), 'products_price' => $products_price, 'products_quantity' => $osC_Product->getQuantity(), 'new_qty' => $Qproducts->valueInt('products_moq'), 'has_variants' => false);
         } else {
             $records[] = array('products_id' => $products_id, 'products_name' => $osC_Product->getTitle(), 'products_type' => $osC_Product->getProductType(), 'products_sku' => $osC_Product->getSKU(), 'products_price' => $osC_Product->getPriceFormated(), 'products_quantity' => $osC_Product->getQuantity(), 'new_qty' => $Qproducts->valueInt('products_moq'), 'has_variants' => true);
             foreach ($osC_Product->getVariants() as $product_id_string => $details) {
                 $variants = '';
                 foreach ($details['groups_name'] as $groups_name => $values_name) {
                     $variants .= '&nbsp;&nbsp;&nbsp;<i>' . $groups_name . ' : ' . $values_name . '</i><br />';
                 }
                 $records[] = array('products_id' => $product_id_string, 'products_name' => $variants, 'products_type' => $osC_Product->getProductType(), 'products_sku' => $osC_Product->getSKU(osc_parse_variants_from_id_string($product_id_string)), 'products_price' => $osC_Currencies->format($osC_Product->getPrice(osc_parse_variants_from_id_string($product_id_string)), $osC_Order->getCurrency()), 'products_quantity' => $details['quantity'], 'new_qty' => $Qproducts->valueInt('products_moq'), 'has_variants' => false);
             }
         }
     }
     unset($_SESSION['currency']);
     $response = array(EXT_JSON_READER_TOTAL => $Qproducts->getBatchSize(), EXT_JSON_READER_ROOT => $records);
     echo $toC_Json->encode($response);
 }
Esempio n. 14
0
<?php

/*
  $Id: $

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2007 osCommerce

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License v2 (1991)
  as published by the Free Software Foundation.
*/
$osC_Currencies = new osC_Currencies();
$osC_Tax = new osC_Tax_Admin();
$osC_Weight = new osC_Weight();
$osC_GeoIP = osC_GeoIP_Admin::load();
if ($osC_GeoIP->isInstalled()) {
    $osC_GeoIP->activate();
}
$osC_ObjectInfo = new osC_ObjectInfo(osC_WhosOnline_Admin::getData($_GET['info']));
if (STORE_SESSIONS == 'database') {
    $Qsession = $osC_Database->query('select value from :table_sessions where id = :id');
    $Qsession->bindTable(':table_sessions', TABLE_SESSIONS);
    $Qsession->bindValue(':id', $osC_ObjectInfo->get('session_id'));
    $Qsession->execute();
    $session_data = trim($Qsession->value('value'));
} else {
    if (file_exists($osC_Session->getSavePath() . '/sess_' . $osC_ObjectInfo->get('session_id')) && filesize($osC_Session->getSavePath() . '/sess_' . $osC_ObjectInfo->get('session_id')) > 0) {
        $session_data = trim(file_get_contents($osC_Session->getSavePath() . '/sess_' . $osC_ObjectInfo->get('session_id')));
Esempio n. 15
0
 function getCurrencies()
 {
     global $toC_Json;
     $osC_Currencies = new osC_Currencies();
     $records = array();
     foreach ($osC_Currencies->getData() as $currency) {
         $records[] = array('currencies_id' => $currency['id'], 'text' => $currency['title']);
     }
     $response = array(EXT_JSON_READER_ROOT => $records);
     echo $toC_Json->encode($response);
 }
Esempio n. 16
0
  Copyright (c) 2009 Wuxi Elootec Technology Co., Ltd

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License v2 (1991)
  as published by the Free Software Foundation.
*/
require_once 'includes/application_top.php';
if (!isset($_SESSION['admin'])) {
    osc_redirect_admin(osc_href_link_admin(FILENAME_DEFAULT));
}
require_once 'includes/classes/json.php';
$toC_Json = new toC_Json();
require_once 'includes/classes/desktop_settings.php';
$toC_Desktop_Settings = new toC_Desktop_Settings();
require_once 'includes/classes/currencies.php';
$osC_Currencies = new osC_Currencies();
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Content-Type: application/x-javascript');
$token = toc_generate_token();
?>

var token = '<?php 
echo $token;
?>
';

Ext.Ajax.extraParams = {token: token};
Ext.data.Connection.prototype.extraParams = {token: token};
Ext.data.ScriptTagProxy.prototype.extraParams = {token: token};
    
Esempio n. 17
0
 function listProducts()
 {
     global $toC_Json, $osC_Database, $osC_Language, $osC_Currencies;
     require_once '../includes/classes/currencies.php';
     $osC_Currencies = new osC_Currencies();
     $start = empty($_REQUEST['start']) ? 0 : $_REQUEST['start'];
     $limit = empty($_REQUEST['limit']) ? MAX_DISPLAY_SEARCH_RESULTS : $_REQUEST['limit'];
     $current_category_id = end(explode('_', empty($_REQUEST['categories_id']) ? 0 : $_REQUEST['categories_id']));
     if ($current_category_id > 0) {
         $osC_CategoryTree = new osC_CategoryTree_Admin();
         $osC_CategoryTree->setBreadcrumbUsage(false);
         $in_categories = array($current_category_id);
         foreach ($osC_CategoryTree->getTree($current_category_id) as $category) {
             $in_categories[] = $category['id'];
         }
         $Qproducts = $osC_Database->query('select distinct p.products_id, p.products_type, pd.products_name, p.products_quantity, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status from :table_products p, :table_products_description pd, :table_products_to_categories p2c where p.products_id = pd.products_id and pd.language_id = :language_id and p.products_id = p2c.products_id and p2c.categories_id in (:categories_id)');
         $Qproducts->bindTable(':table_products_to_categories', TABLE_PRODUCTS_TO_CATEGORIES);
         $Qproducts->bindRaw(':categories_id', implode(',', $in_categories));
     } else {
         $Qproducts = $osC_Database->query('select p.products_id, p.products_type, pd.products_name, p.products_quantity, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status from :table_products p, :table_products_description pd where p.products_id = pd.products_id and pd.language_id = :language_id');
     }
     if (!empty($_REQUEST['search'])) {
         $Qproducts->appendQuery('and pd.products_name like :products_name');
         $Qproducts->bindValue(':products_name', '%' . $_REQUEST['search'] . '%');
     }
     if (!empty($_REQUEST['sort']) && !empty($_REQUEST['dir'])) {
         $Qproducts->appendQuery('order by :sort :dir');
         $Qproducts->bindRaw(':sort', $_REQUEST['sort']);
         $Qproducts->bindRaw(':dir', $_REQUEST['dir']);
     } else {
         $Qproducts->appendQuery(' order by pd.products_id desc');
     }
     $Qproducts->bindTable(':table_products', TABLE_PRODUCTS);
     $Qproducts->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
     $Qproducts->bindInt(':language_id', $osC_Language->getID());
     $Qproducts->setExtBatchLimit($start, $limit);
     $Qproducts->execute();
     $records = array();
     while ($Qproducts->next()) {
         $products_price = $osC_Currencies->format($Qproducts->value('products_price'));
         if ($Qproducts->valueInt('products_type') == PRODUCT_TYPE_GIFT_CERTIFICATE) {
             $Qcertificate = $osC_Database->query('select open_amount_min_value, open_amount_max_value from :table_products_gift_certificates where gift_certificates_amount_type = :gift_certificates_amount_type and products_id = :products_id');
             $Qcertificate->bindTable(':table_products_gift_certificates', TABLE_PRODUCTS_GIFT_CERTIFICATES);
             $Qcertificate->bindInt(':gift_certificates_amount_type', GIFT_CERTIFICATE_TYPE_OPEN_AMOUNT);
             $Qcertificate->bindInt(':products_id', $Qproducts->value('products_id'));
             $Qcertificate->execute();
             if ($Qcertificate->numberOfRows() > 0) {
                 $products_price = $osC_Currencies->format($Qcertificate->value('open_amount_min_value')) . ' ~ ' . $osC_Currencies->format($Qcertificate->value('open_amount_max_value'));
             }
         }
         $Qstatus = $osC_Database->query('select products_id from :table_products_frontpage where products_id = :products_id');
         $Qstatus->bindInt(':products_id', $Qproducts->value('products_id'));
         $Qstatus->bindTable(':table_products_frontpage', TABLE_PRODUCTS_FRONTPAGE);
         $Qstatus->execute();
         if ($Qstatus->numberOfRows() > 0) {
             $products_frontpage = 1;
         } else {
             $products_frontpage = 0;
         }
         $records[] = array('products_id' => $Qproducts->value('products_id'), 'products_name' => $Qproducts->value('products_name'), 'products_frontpage' => $products_frontpage, 'products_status' => $Qproducts->value('products_status'), 'products_price' => $products_price, 'products_quantity' => $Qproducts->value('products_quantity'));
     }
     $response = array(EXT_JSON_READER_TOTAL => $Qproducts->getBatchSize(), EXT_JSON_READER_ROOT => $records);
     echo $toC_Json->encode($response);
 }
Esempio n. 18
0
 function render()
 {
     global $osC_Language;
     //New Page
     $this->_pdf->AddPage();
     //Title
     $this->_pdf->SetFont(TOC_PDF_FONT, 'B', TOC_PDF_TITLE_FONT_SIZE);
     $this->_pdf->SetY(TOC_PDF_POS_HEADING_TITLE_Y);
     $this->_pdf->MultiCell(70, 4, $osC_Language->get('credit_slip_heading_title'), 0, 'L');
     //Date purchase & order ID field title
     $this->_pdf->SetFont(TOC_PDF_FONT, 'B', TOC_PDF_FIELD_DATE_PURCHASE_FONT_SIZE);
     $this->_pdf->SetY(TOC_PDF_POS_DOC_INFO_FIELD_Y);
     $this->_pdf->SetX(135);
     $this->_pdf->MultiCell(55, 4, $osC_Language->get('operation_heading_credit_slip_id') . "\n" . $osC_Language->get('operation_heading_credit_slip_date') . "\n" . $osC_Language->get('operation_heading_order_id') . "\n" . $osC_Language->get('operation_heading_order_date'), 0, 'L');
     //Date purchase & order ID field value
     $this->_pdf->SetFont(TOC_PDF_FONT, '', TOC_PDF_FIELD_DATE_PURCHASE_FONT_SIZE);
     $this->_pdf->SetY(TOC_PDF_POS_DOC_INFO_VALUE_Y);
     $this->_pdf->SetX(150);
     $this->_pdf->MultiCell(40, 4, $this->_credit_slip->getCreditSlipId() . "\n" . osC_DateTime::getShort($this->_credit_slip->getDateAdded()) . "\n" . $this->_credit_slip->getOrdersId() . "\n" . osC_DateTime::getShort($this->_credit_slip->getDatePurchased()), 0, 'R');
     //Products
     $this->_pdf->SetFont(TOC_PDF_FONT, 'B', TOC_PDF_TABLE_HEADING_FONT_SIZE);
     $this->_pdf->SetY(TOC_PDF_POS_PRODUCTS_TABLE_HEADING_Y);
     $this->_pdf->Cell(8, 6, '', 'TB', 0, 'R', 0);
     $this->_pdf->Cell(78, 6, $osC_Language->get('heading_products_name'), 'TB', 0, 'C', 0);
     $this->_pdf->Cell(35, 6, $osC_Language->get('heading_products_quantity'), 'TB', 0, 'C', 0);
     $this->_pdf->Cell(30, 6, $osC_Language->get('heading_products_price'), 'TB', 0, 'R', 0);
     $this->_pdf->Cell(30, 6, $osC_Language->get('heading_products_total'), 'TB', 0, 'R', 0);
     $this->_pdf->Ln();
     $i = 0;
     $y_table_position = TOC_PDF_POS_PRODUCTS_TABLE_CONTENT_Y;
     $osC_Currencies = new osC_Currencies();
     foreach ($this->_credit_slip->getProducts() as $products) {
         $rowspan = 1;
         //Pos
         $this->_pdf->SetFont(TOC_PDF_FONT, 'B', TOC_PDF_TABLE_CONTENT_FONT_SIZE);
         $this->_pdf->SetY($y_table_position);
         $this->_pdf->MultiCell(8, 4, $i + 1, 0, 'C');
         //Product
         $this->_pdf->SetY($y_table_position);
         $this->_pdf->SetX(30);
         $product_info = $products['name'];
         if ($products['type'] == PRODUCT_TYPE_GIFT_CERTIFICATE) {
             $product_info .= "\n" . '   -' . $osC_Language->get('senders_name') . ': ' . $products['senders_name'];
             if ($products['gift_certificates_type'] == GIFT_CERTIFICATE_TYPE_EMAIL) {
                 $product_info .= "\n" . '   -' . $osC_Language->get('senders_email') . ': ' . $products['senders_email'];
                 $rowspan++;
             }
             $product_info .= "\n" . '   -' . $osC_Language->get('recipients_name') . ': ' . $products['recipients_name'];
             if ($products['gift_certificates_type'] == GIFT_CERTIFICATE_TYPE_EMAIL) {
                 $product_info .= "\n" . '   -' . $osC_Language->get('recipients_email') . ': ' . $products['recipients_email'];
                 $rowspan++;
             }
             $rowspan += 3;
             $product_info .= "\n" . '   -' . $osC_Language->get('messages') . ': ' . $products['messages'];
         }
         if (isset($products['variants']) && sizeof($products['variants']) > 0) {
             foreach ($products['variants'] as $variant) {
                 $product_info .= "\n" . $variant['groups_name'] . ": " . $variant['values_name'];
                 $rowspan++;
             }
         }
         $this->_pdf->MultiCell(100, 4, $product_info, 0, 'L');
         //Quantity
         $this->_pdf->SetY($y_table_position);
         $this->_pdf->SetX(110);
         $this->_pdf->MultiCell(5, 4, $products['qty'], 0, 'C');
         //Price
         $this->_pdf->SetY($y_table_position);
         $this->_pdf->SetX(135);
         $price = $osC_Currencies->displayPriceWithTaxRate($products['final_price'], $products['tax'], 1, $this->_credit_slip->getCurrency(), $this->_credit_slip->getCurrencyValue());
         $price = str_replace('&nbsp;', ' ', $price);
         $this->_pdf->MultiCell(20, 4, $price, 0, 'R');
         //Total
         $this->_pdf->SetY($y_table_position);
         $this->_pdf->SetX(165);
         $total = $osC_Currencies->displayPriceWithTaxRate($products['final_price'], $products['tax'], $products['qty'], $this->_credit_slip->getCurrency(), $this->_credit_slip->getCurrencyValue());
         $total = str_replace('&nbsp;', ' ', $total);
         $this->_pdf->MultiCell(20, 4, $total, 0, 'R');
         $y_table_position += $rowspan * TOC_PDF_TABLE_CONTENT_HEIGHT;
         //products list exceed page height, create a new page
         if ($y_table_position - TOC_PDF_POS_CONTENT_Y - 6 > 160) {
             $this->_pdf->AddPage();
             $y_table_position = TOC_PDF_POS_CONTENT_Y + 6;
             $this->_pdf->SetFont(TOC_PDF_FONT, 'B', TOC_PDF_TABLE_HEADING_FONT_SIZE);
             $this->_pdf->SetY(TOC_PDF_POS_CONTENT_Y);
             $this->_pdf->Cell(8, 6, '', 'TB', 0, 'R', 0);
             $this->_pdf->Cell(78, 6, $osC_Language->get('heading_products_name'), 'TB', 0, 'C', 0);
             $this->_pdf->Cell(35, 6, $osC_Language->get('heading_products_quantity'), 'TB', 0, 'C', 0);
             $this->_pdf->Cell(30, 6, $osC_Language->get('heading_products_price'), 'TB', 0, 'R', 0);
             $this->_pdf->Cell(30, 6, $osC_Language->get('heading_products_total'), 'TB', 0, 'R', 0);
             $this->_pdf->Ln();
         }
         $i++;
     }
     $this->_pdf->SetY($y_table_position + 1);
     $this->_pdf->Cell(180, 7, '', 'T', 0, 'C', 0);
     $y_table_position += 4;
     $this->_pdf->SetFont(TOC_PDF_FONT, 'B', TOC_PDF_TOTAL);
     $this->_pdf->SetY($y_table_position);
     $this->_pdf->SetX(40);
     $this->_pdf->MultiCell(120, 5, $osC_Language->get('refund_sub_total') . "\n" . $osC_Language->get('refund_shipping') . "\n" . $osC_Language->get('refund_handling') . "\n" . $osC_Language->get('refund_total') . "\n", 0, 'R');
     $this->_pdf->SetY($y_table_position);
     $this->_pdf->SetX(145);
     $this->_pdf->MultiCell(40, 5, $osC_Currencies->format($this->_credit_slip->getSubTotal(), $this->_credit_slip->getCurrency(), $this->_credit_slip->getCurrencyValue()) . "\n" . $osC_Currencies->format($this->_credit_slip->getShippingFee(), $this->_credit_slip->getCurrency(), $this->_credit_slip->getCurrencyValue()) . "\n" . $osC_Currencies->format($this->_credit_slip->getHandlingFee(), $this->_credit_slip->getCurrency(), $this->_credit_slip->getCurrencyValue()) . "\n" . $osC_Currencies->format($this->_credit_slip->getTotal(), $this->_credit_slip->getCurrency(), $this->_credit_slip->getCurrencyValue()), 0, 'R');
     $this->_pdf->Output("Order", "I");
 }
Esempio n. 19
0
<?php

/*
  $Id: whos_online.php,v 1.3 2004/10/28 12:59:56 hpdl Exp $

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2004 osCommerce

  Released under the GNU General Public License
*/
require '../includes/classes/currencies.php';
$osC_Currencies = new osC_Currencies();
require '../includes/classes/tax.php';
$osC_Tax = new osC_Tax();
require '../includes/classes/weight.php';
$osC_Weight = new osC_Weight();
require '../includes/classes/customer.php';
require '../includes/classes/navigation_history.php';
require '../includes/classes/shopping_cart.php';
require 'includes/classes/ip_locator.php';
$xx_mins_ago = time() - 900;
// remove entries that have expired
$Qdelete = $osC_Database->query('delete from :table_whos_online where time_last_click < :time_last_click');
$Qdelete->bindTable(':table_whos_online', TABLE_WHOS_ONLINE);
$Qdelete->bindValue(':time_last_click', $xx_mins_ago);
$Qdelete->execute();
?>

<h1><?php 
Esempio n. 20
0
<?php

/*
  $Id: invoice.php,v 1.8 2004/11/07 21:00:29 hpdl Exp $

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2004 osCommerce

  Released under the GNU General Public License
*/
require 'includes/application_top.php';
$selected_box = 'customers';
require '../includes/classes/currencies.php';
$osC_Currencies = new osC_Currencies();
require 'includes/classes/order.php';
$osC_Order = new osC_Order($_GET['oID']);
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php 
echo HTML_PARAMS;
?>
>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php 
echo CHARSET;
?>
">
<title><?php 
echo TITLE;
Esempio n. 21
0
<?php

/*
  $Id$

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2007 osCommerce

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License v2 (1991)
  as published by the Free Software Foundation.
*/
$osC_Currencies = new osC_Currencies();
$osC_Tax = new osC_Tax_Admin();
$osC_Weight = new osC_Weight();
$osC_GeoIP = osC_GeoIP_Admin::load();
if ($osC_GeoIP->isInstalled()) {
    $osC_GeoIP->activate();
}
$xx_mins_ago = time() - 900;
// remove entries that have expired
$Qdelete = $osC_Database->query('delete from :table_whos_online where time_last_click < :time_last_click');
$Qdelete->bindTable(':table_whos_online', TABLE_WHOS_ONLINE);
$Qdelete->bindValue(':time_last_click', $xx_mins_ago);
$Qdelete->execute();
?>

<h1><?php 
echo osc_link_object(osc_href_link_admin(FILENAME_DEFAULT, $osC_Template->getModule()), $osC_Template->getPageTitle());
Esempio n. 22
0
<?php

/*
  $Id: packingslip.php,v 1.9 2004/11/07 21:00:30 hpdl Exp $

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2004 osCommerce

  Released under the GNU General Public License
*/
require 'includes/application_top.php';
$selected_box = 'customers';
require '../includes/classes/currencies.php';
$osC_Currencies = new osC_Currencies();
include 'includes/classes/order.php';
$osC_Order = new osC_Order($_GET['oID']);
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php 
echo HTML_PARAMS;
?>
>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php 
echo CHARSET;
?>
">
<title><?php 
echo TITLE;