Exemplo n.º 1
0
 function initialize()
 {
     global $osC_Database, $osC_Language, $osC_Currencies;
     $Qupcoming = $osC_Database->query('select p.products_id, p.products_price, p.products_tax_class_id, p.products_date_available as date_expected, 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) left join :table_specials s on (p.products_id = s.products_id and s.status = 1), :table_products_description pd where to_days(p.products_date_available) >= to_days(now()) and p.products_status = :products_status and p.products_id = pd.products_id and pd.language_id = :language_id order by p.products_date_available limit :max_display_upcoming_products');
     $Qupcoming->bindTable(':table_products', TABLE_PRODUCTS);
     $Qupcoming->bindTable(':table_products_images', TABLE_PRODUCTS_IMAGES);
     $Qupcoming->bindTable(':table_specials', TABLE_SPECIALS);
     $Qupcoming->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
     $Qupcoming->bindInt(':default_flag', 1);
     $Qupcoming->bindInt(':products_status', 1);
     $Qupcoming->bindInt(':language_id', $osC_Language->getID());
     $Qupcoming->bindInt(':max_display_upcoming_products', MODULE_CONTENT_UPCOMING_PRODUCTS_MAX_DISPLAY);
     if (MODULE_CONTENT_UPCOMING_PRODUCTS_CACHE > 0) {
         $Qupcoming->setCache('upcoming_products-' . $osC_Language->getCode() . '-' . $osC_Currencies->getCode(), MODULE_CONTENT_UPCOMING_PRODUCTS_CACHE);
     }
     $Qupcoming->execute();
     if ($Qupcoming->numberOfRows() > 0) {
         $this->_content = '<ol style="list-style: none;">';
         while ($Qupcoming->next()) {
             $this->_content .= '<li>' . osC_DateTime::getLong($Qupcoming->value('date_expected')) . ': ' . osc_link_object(osc_href_link(FILENAME_PRODUCTS, $Qupcoming->value('products_id')), $Qupcoming->value('products_name')) . ' ';
             if (osc_empty($Qupcoming->value('specials_new_products_price'))) {
                 $this->_content .= '(' . $osC_Currencies->displayPrice($Qupcoming->value('products_price'), $Qupcoming->valueInt('products_tax_class_id')) . ')';
             } else {
                 $this->_content .= '(<s>' . $osC_Currencies->displayPrice($Qupcoming->value('products_price'), $Qupcoming->valueInt('products_tax_class_id')) . '</s> <span class="productSpecialPrice">' . $osC_Currencies->displayPrice($Qupcoming->value('specials_new_products_price'), $Qupcoming->valueInt('products_tax_class_id')) . '</span>)';
             }
             $this->_content .= '</li>';
         }
         $this->_content .= '</ol>';
     }
     $Qupcoming->freeResult();
 }
Exemplo n.º 2
0
 function start()
 {
     global $osC_Database, $osC_MessageStack;
     $Qcounter = $osC_Database->query('select startdate, counter from :table_counter');
     $Qcounter->bindTable(':table_counter', TABLE_COUNTER);
     $Qcounter->execute();
     if ($Qcounter->numberOfRows()) {
         $counter_startdate = $Qcounter->value('startdate');
         $counter_now = $Qcounter->valueInt('counter') + 1;
         $Qcounterupdate = $osC_Database->query('update :table_counter set counter = counter+1');
         $Qcounterupdate->bindTable(':table_counter', TABLE_COUNTER);
         $Qcounterupdate->execute();
         $Qcounterupdate->freeResult();
     } else {
         $counter_startdate = osC_DateTime::getNow();
         $counter_now = 1;
         $Qcounterupdate = $osC_Database->query('insert into :table_counter (startdate, counter) values (:start_date, 1)');
         $Qcounterupdate->bindTable(':table_counter', TABLE_COUNTER);
         $Qcounterupdate->bindValue(':start_date', $counter_startdate);
         $Qcounterupdate->execute();
         $Qcounterupdate->freeResult();
     }
     $Qcounter->freeResult();
     return true;
 }
Exemplo n.º 3
0
 function listPurchasedDownloadables()
 {
     global $osC_Database, $toC_Json, $osC_Language, $osC_Currencies;
     $start = empty($_REQUEST['start']) ? 0 : $_REQUEST['start'];
     $limit = empty($_REQUEST['limit']) ? MAX_DISPLAY_SEARCH_RESULTS : $_REQUEST['limit'];
     $Qdownloadables = $osC_Database->query('select opd.orders_products_download_id, op.products_name, opd.orders_products_filename, o.customers_name, o.date_purchased, opd.status from :table_orders o, :table_orders_products op, :table_orders_products_download opd where o.orders_id =  op.orders_id and op.orders_products_id = opd.orders_products_id ');
     if (!empty($_REQUEST['search'])) {
         $Qdownloadables->appendQuery('and o.customers_name like :customers_name');
         $Qdownloadables->bindValue(':customers_name', '%' . $_REQUEST['search'] . '%');
     }
     $Qdownloadables->bindTable(':table_orders', TABLE_ORDERS);
     $Qdownloadables->bindTable(':table_orders_products', TABLE_ORDERS_PRODUCTS);
     $Qdownloadables->bindTable(':table_orders_products_download', TABLE_ORDERS_PRODUCTS_DOWNLOAD);
     $Qdownloadables->setExtBatchLimit($start, $limit);
     $Qdownloadables->execute();
     $records = array();
     while ($Qdownloadables->next()) {
         $Qhistory = $osC_Database->query('select * from :table_products_download_history where orders_products_download_id = :orders_products_download_id');
         $Qhistory->bindTable(':table_products_download_history', TABLE_PRODUCTS_DOWNLOAD_HISTORY);
         $Qhistory->bindInt(':orders_products_download_id', $Qdownloadables->ValueInt('orders_products_download_id'));
         $Qhistory->execute();
         $total_downloads = 0;
         $history = '<table style="padding-left: 20px;" cellspacing="5">
                  <tr><td>' . $osC_Language->get('table_heading_download_date') . '</td></tr>';
         while ($Qhistory->next()) {
             $history .= '<tr><td>' . osC_DateTime::getShort($Qhistory->Value('download_date')) . '</td></tr>';
             $total_downloads++;
         }
         $history .= '</table>';
         $Qhistory->freeResult();
         $records[] = array('orders_products_download_id' => $Qdownloadables->ValueInt('orders_products_download_id'), 'products_name' => $Qdownloadables->Value('products_name'), 'file_name' => $Qdownloadables->Value('orders_products_filename'), 'customer' => $Qdownloadables->Value('customers_name'), 'date_purchased' => osC_DateTime::getShort($Qdownloadables->Value('date_purchased'), true), 'total_downloads' => $total_downloads, 'status' => $Qdownloadables->Value('status'), 'history' => $history);
     }
     $response = array(EXT_JSON_READER_TOTAL => $Qdownloadables->getBatchSize(), EXT_JSON_READER_ROOT => $records);
     echo $toC_Json->encode($response);
 }
Exemplo n.º 4
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'] . '&nbsp;x&nbsp;' . $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);
 }
Exemplo n.º 5
0
 function listDirectory()
 {
     global $osC_Language, $toC_Json, $osC_MessageStack;
     $directory = OSC_ADMIN_FILE_MANAGER_ROOT_PATH;
     if (isset($_REQUEST['directory']) && !empty($_REQUEST['directory'])) {
         $directory .= '/' . urldecode($_REQUEST['directory']);
     } elseif (isset($_REQUEST['goto']) && !empty($_REQUEST['goto'])) {
         $directory .= '/' . urldecode($_REQUEST['goto']);
     }
     $osC_DirectoryListing = new osC_DirectoryListing($directory);
     $osC_DirectoryListing->setStats(true);
     $records = array();
     foreach ($osC_DirectoryListing->getFiles() as $file) {
         $file_owner = function_exists('posix_getpwuid') ? posix_getpwuid($file['user_id']) : '-?-';
         $group_owner = function_exists('posix_getgrgid') ? posix_getgrgid($file['group_id']) : '-?-';
         if ($file['is_directory'] === true) {
             $entry_icon = osc_icon('folder_red.png');
             $action = array(array('class' => 'icon-empty-record', 'qtip' => ''), array('class' => 'icon-empty-record', 'qtip' => ''), array('class' => 'icon-delete-record', 'qtip' => $osC_Language->get('icon_trash')));
         } else {
             $entry_icon = osc_icon('file.png');
             $action = array(array('class' => 'icon-edit-record', 'qtip' => $osC_Language->get('icon_edit')), array('class' => 'icon-download-record', 'qtip' => $osC_Language->get('icon_download')), array('class' => 'icon-delete-record', 'qtip' => $osC_Language->get('icon_trash')));
         }
         $records[] = array('icon' => $entry_icon, 'file_name' => $file['name'], 'is_directory' => $file['is_directory'], 'size' => number_format($file['size']), 'permission' => osc_get_file_permissions($file['permissions']), 'file_owner' => $file_owner, 'group_owner' => $group_owner, 'writeable' => osc_icon(is_writable($osC_DirectoryListing->getDirectory() . '/' . $file['name']) ? 'checkbox_ticked.gif' : 'checkbox_crossed.gif'), 'last_modified_date' => osC_DateTime::getShort(osC_DateTime::fromUnixTimestamp($file['last_modified']), true), 'action' => $action);
     }
     $response = array(EXT_JSON_READER_ROOT => $records);
     echo $toC_Json->encode($response);
 }
 function listAdministratorsLog()
 {
     global $toC_Json, $osC_Database;
     $start = empty($_REQUEST['start']) ? 0 : $_REQUEST['start'];
     $limit = empty($_REQUEST['limit']) ? MAX_DISPLAY_SEARCH_RESULTS : $_REQUEST['limit'];
     $Qlog = $osC_Database->query('select SQL_CALC_FOUND_ROWS count(al.id) as total, al.id, al.module, al.module_action, al.module_id, al.action, a.user_name, unix_timestamp(al.datestamp) as datestamp from :table_administrators_log al, :table_administrators a where');
     if (!empty($_REQUEST['fm']) && in_array($_REQUEST['fm'], $_SESSION['admin']['access'])) {
         $Qlog->appendQuery('al.module = :module');
         $Qlog->bindValue(':module', $_REQUEST['fm']);
     } else {
         $Qlog->appendQuery('al.module in (":modules")');
         $Qlog->bindRaw(':modules', implode('", "', $_SESSION['admin']['access']));
     }
     $Qlog->appendQuery('and');
     if (is_numeric($_REQUEST['fu']) && !empty($_REQUEST['fu'])) {
         $Qlog->appendQuery('al.administrators_id = :administrators_id and');
         $Qlog->bindInt(':administrators_id', $_REQUEST['fu']);
     }
     $Qlog->appendQuery('al.administrators_id = a.id group by al.id order by al.id desc');
     $Qlog->bindTable(':table_administrators_log', TABLE_ADMINISTRATORS_LOG);
     $Qlog->bindTable(':table_administrators', TABLE_ADMINISTRATORS);
     $Qlog->setExtBatchLimit($start, $limit);
     $Qlog->execute();
     $records = array();
     while ($Qlog->next()) {
         $records[] = array('administrators_log_id' => $Qlog->valueInt('id'), 'administrators_id' => $Qlog->valueInt('administrators_id'), 'module' => $Qlog->value('module') . ' (' . $Qlog->valueInt('total') . ')', 'module_id' => $Qlog->valueInt('module_id'), 'module_action' => $Qlog->valueProtected('module_action'), 'user_name' => $Qlog->valueProtected('user_name'), 'date' => osC_DateTime::getShort(osC_DateTime::fromUnixTimestamp($Qlog->value('datestamp')), true), 'logo_info_title' => osc_icon('info.png') . ' ' . $Qlog->valueProtected('user_name') . ' &raquo; ' . $Qlog->valueProtected('module_action') . ' &raquo; ' . $Qlog->value('module') . ' &raquo; ' . $Qlog->valueInt('module_id'));
     }
     $Qlog->freeResult();
     $response = array(EXT_JSON_READER_TOTAL => $Qlog->getBatchSize(), EXT_JSON_READER_ROOT => $records);
     echo $toC_Json->encode($response);
 }
Exemplo n.º 7
0
 function buildMessage()
 {
     global $osC_Database, $osC_Language, $osC_Currencies;
     $Qorder = $osC_Database->query('select * from :table_orders where orders_id = :orders_id limit 1');
     $Qorder->bindTable(':table_orders', TABLE_ORDERS);
     $Qorder->bindInt(':orders_id', $this->_order_id);
     $Qorder->execute();
     if ($Qorder->numberOfRows() === 1) {
         $order_number = $this->_order_id;
         $date_ordered = osC_DateTime::getShort();
         $payment_method = $Qorder->value('payment_method');
         $customer_name = $Qorder->value('billing_name');
         $customer_phone = $Qorder->value('billing_telephone');
         $Qstatus = $osC_Database->query('select orders_status_name from :table_orders_status where orders_status_id = :orders_status_id and language_id = :language_id');
         $Qstatus->bindTable(':table_orders_status', TABLE_ORDERS_STATUS);
         $Qstatus->bindInt(':orders_status_id', $Qorder->valueInt('orders_status'));
         $Qstatus->bindInt(':language_id', $osC_Language->getID());
         $Qstatus->execute();
         $order_status = $Qstatus->value('orders_status_name');
         unset($Qstatus);
         $replaces = array($order_number, $date_ordered, $payment_method, $customer_name, $order_status, STORE_NAME);
         $this->_sms_text = str_replace($this->_keywords, $replaces, $this->_content);
         $this->addRecipient($customer_phone);
     }
     unset($Qorder);
 }
Exemplo n.º 8
0
 function listCache()
 {
     global $toC_Json;
     $osC_DirectoryListing = new osC_DirectoryListing(DIR_FS_WORK);
     $osC_DirectoryListing->setIncludeDirectories(false);
     $osC_DirectoryListing->setCheckExtension('cache');
     $response = array();
     foreach ($osC_DirectoryListing->getFiles() as $file) {
         $last_modified = filemtime(DIR_FS_WORK . '/' . $file['name']);
         if (strpos($file['name'], '-') !== false) {
             $code = substr($file['name'], 0, strpos($file['name'], '-'));
         } else {
             $code = substr($file['name'], 0, strpos($file['name'], '.'));
         }
         if (isset($cached_files[$code])) {
             $cached_files[$code]['total']++;
             if ($last_modified > $cached_files[$code]['last_modified']) {
                 $cached_files[$code]['last_modified'] = $last_modified;
             }
         } else {
             $cached_files[$code] = array('total' => 1, 'last_modified' => $last_modified);
         }
         $response[] = array('code' => $code, 'total' => $cached_files[$code]['total'], 'last_modified' => osC_DateTime::getShort(osC_DateTime::fromUnixTimestamp($cached_files[$code]['last_modified']), true));
     }
     $response = array(EXT_JSON_READER_ROOT => $response);
     echo $toC_Json->encode($response);
 }
Exemplo n.º 9
0
 function listBestOrders()
 {
     global $osC_Database, $toC_Json;
     $Qorders = $osC_Database->query('select o.orders_id, o.customers_id, o.customers_name, ot.value, o.date_purchased from :table_orders o, :table_orders_total ot where o.orders_id = ot.orders_id and ot.class = :class ');
     if (!empty($_REQUEST['start_date'])) {
         $Qorders->appendQuery('and o.date_purchased >= :start_date ');
         $Qorders->bindValue(':start_date', $_REQUEST['start_date']);
     }
     if (!empty($_REQUEST['end_date'])) {
         $Qorders->appendQuery('and o.date_purchased <= :end_date ');
         $Qorders->bindValue(':end_date', $_REQUEST['end_date']);
     }
     $Qorders->appendQuery(' order by value desc');
     $Qorders->bindTable(':table_orders', TABLE_ORDERS);
     $Qorders->bindTable(':table_orders_total', TABLE_ORDERS_TOTAL);
     $Qorders->bindValue(':class', 'total');
     $Qorders->setExtBatchLimit($start, MAX_DISPLAY_SEARCH_RESULTS);
     $Qorders->execute();
     $records = array();
     while ($Qorders->next()) {
         $records[] = array('orders_id' => $Qorders->ValueInt('orders_id'), 'customers_id' => $Qorders->ValueInt('customers_id'), 'customers_name' => osc_icon('orders.png') . '&nbsp;' . $Qorders->Value('customers_name'), 'date_purchased' => osC_DateTime::getShort($Qorders->value('date_purchased'), true), 'value' => (double) $Qorders->Value('value'));
     }
     $response = array(EXT_JSON_READER_TOTAL => $Qorders->getBatchSize(), EXT_JSON_READER_ROOT => $records);
     echo $toC_Json->encode($response);
 }
Exemplo n.º 10
0
 function loadReviews()
 {
     global $toC_Json;
     $data = osC_Reviews_Admin::getData($_REQUEST['reviews_id']);
     $data['date_added'] = osC_DateTime::getShort($data['date_added']);
     $response = array('success' => true, 'data' => $data);
     echo $toC_Json->encode($response);
 }
 function loadProductsExpected()
 {
     global $toC_Json;
     $data = osC_Products_Admin::getData($_REQUEST['products_id']);
     $data['products_date_available'] = osC_DateTime::getDate($data['products_date_available']);
     $response = array('success' => true, 'data' => $data);
     echo $toC_Json->encode($response);
 }
Exemplo n.º 12
0
/**
 * Retrieve web server and database server information
 *
 * @access public
 */
function osc_get_system_information()
{
    global $osC_Database;
    $Qdb_date = $osC_Database->query('select now() as datetime');
    $Qdb_uptime = $osC_Database->query('show status like "Uptime"');
    @(list($system, $host, $kernel) = preg_split('/[\\s,]+/', @exec('uname -a'), 5));
    $db_uptime = intval($Qdb_uptime->valueInt('Value') / 3600) . ':' . str_pad(intval($Qdb_uptime->valueInt('Value') / 60 % 60), 2, '0', STR_PAD_LEFT);
    return array('date' => osC_DateTime::getShort(null, true), 'system' => $system, 'kernel' => $kernel, 'host' => $host, 'ip' => gethostbyname($host), 'uptime' => @exec('uptime'), 'http_server' => $_SERVER['SERVER_SOFTWARE'], 'php' => PHP_VERSION, 'zend' => function_exists('zend_version') ? zend_version() : '', 'db_server' => DB_SERVER, 'db_ip' => gethostbyname(DB_SERVER), 'db_version' => 'MySQL ' . (function_exists('mysql_get_server_info') ? mysql_get_server_info() : ''), 'db_date' => osC_DateTime::getShort($Qdb_date->value('datetime'), true), 'db_uptime' => $db_uptime);
}
Exemplo n.º 13
0
 function listGiftCertificates()
 {
     global $osC_Database, $toC_Json, $osC_Language, $osC_Currencies;
     $osC_Currencies = new osC_Currencies_Admin();
     $start = empty($_REQUEST['start']) ? 0 : $_REQUEST['start'];
     $limit = empty($_REQUEST['limit']) ? MAX_DISPLAY_SEARCH_RESULTS : $_REQUEST['limit'];
     $Qcertificates = $osC_Database->query('select gc.*, o.customers_name, o.date_purchased from :table_gift_certificates gc, :table_orders o, :table_orders_products op where gc.orders_products_id = op.orders_products_id and op.orders_id = o.orders_id ');
     if (!empty($_REQUEST['search'])) {
         $Qcertificates->appendQuery('and o.customers_name like :customers_name');
         $Qcertificates->bindValue(':customers_name', '%' . $_REQUEST['search'] . '%');
     }
     $Qcertificates->bindTable(':table_gift_certificates', TABLE_GIFT_CERTIFICATES);
     $Qcertificates->bindTable(':table_orders', TABLE_ORDERS);
     $Qcertificates->bindTable(':table_orders_products', TABLE_ORDERS_PRODUCTS);
     $Qcertificates->setExtBatchLimit($start, $limit);
     $Qcertificates->execute();
     $records = array();
     while ($Qcertificates->next()) {
         $Qhistory = $osC_Database->query('select gcrh.*, o.customers_name from :table_gift_certificates_redeem_history gcrh, :table_orders o where gcrh.orders_id = o.orders_id and gcrh.gift_certificates_id = :gift_certificates_id');
         $Qhistory->bindTable(':table_gift_certificates_redeem_history', TABLE_GIFT_CERTIFICATES_REDEEM_HISTORY);
         $Qhistory->bindTable(':table_orders', TABLE_ORDERS);
         $Qhistory->bindInt(':gift_certificates_id', $Qcertificates->ValueInt('gift_certificates_id'));
         $Qhistory->execute();
         $history = '<table style="padding-left: 20px;" cellspacing="5">
                  <tr>
                    <td>' . $osC_Language->get('table_heading_customer') . '</td>
                    <td>' . $osC_Language->get('table_heading_redeem_date') . '</td>
                    <td>' . $osC_Language->get('table_heading_redeem_amount') . '</td>
                  </tr>';
         $redeem_amount = 0;
         while ($Qhistory->next()) {
             $redeem_amount += $Qhistory->Value('redeem_amount');
             $history .= '<tr><td>' . $Qhistory->Value('customers_name') . '</td>
                        <td>' . osC_DateTime::getShort($Qhistory->Value('redeem_date')) . '</td>
                        <td>' . $osC_Currencies->format($Qhistory->Value('redeem_amount')) . '</td></tr>';
         }
         $history .= '</table>';
         $Qhistory->freeResult();
         $certificate_details = '<table style="padding-left: 20px" cellspacing="5">';
         $certificate_details .= '<tr><td>' . $osC_Language->get('field_recipient_name') . '</td><td>' . $Qcertificates->Value('recipients_name') . '</td></tr>';
         if ($Qcertificates->valueInt('gift_certificates_type') == GIFT_CERTIFICATE_TYPE_EMAIL) {
             $certificate_details .= '<tr><td>' . $osC_Language->get('field_recipient_email') . '</td><td>' . $Qcertificates->Value('recipients_email') . '</td></tr>';
         }
         $certificate_details .= '<tr><td>' . $osC_Language->get('field_recipient_sender_name') . '</td><td>' . $Qcertificates->Value('senders_name') . '</td></tr>';
         if ($Qcertificates->valueInt('gift_certificates_type') == GIFT_CERTIFICATE_TYPE_EMAIL) {
             $certificate_details .= '<tr><td>' . $osC_Language->get('field_recipient_sender_email') . '</td><td>' . $Qcertificates->Value('senders_email') . '</td></tr>';
         }
         $certificate_details .= '<tr><td>' . $osC_Language->get('field_message') . '</td><td>' . $Qcertificates->Value('messages') . '</td></tr>';
         $certificate_details .= '</table>';
         $records[] = array('gift_certificates_id' => $Qcertificates->ValueInt('gift_certificates_id'), 'orders_products_id' => $Qcertificates->ValueInt('orders_products_id'), 'gift_certificates_code' => $Qcertificates->Value('gift_certificates_code'), 'gift_certificates_customer' => $Qcertificates->Value('customers_name'), 'gift_certificates_amount' => $osC_Currencies->format($Qcertificates->Value('amount')), 'gift_certificates_balance' => $osC_Currencies->format($Qcertificates->Value('amount') - $redeem_amount), 'gift_certificates_date_purchased' => osC_DateTime::getShort($Qcertificates->Value('date_purchased')), 'gift_certificates_date_status' => $Qcertificates->Value('status'), 'recipients_name' => $Qcertificates->Value('recipients_name'), 'recipients_email' => $Qcertificates->Value('recipients_email'), 'senders_name' => $Qcertificates->Value('senders_name'), 'senders_email' => $Qcertificates->Value('senders_email'), 'messages' => $Qcertificates->Value('messages'), 'certificate_details' => $certificate_details, 'history' => $history);
     }
     $response = array(EXT_JSON_READER_TOTAL => $Qcertificates->getBatchSize(), EXT_JSON_READER_ROOT => $records);
     echo $toC_Json->encode($response);
 }
Exemplo n.º 14
0
 function listBackup()
 {
     global $toC_Json;
     $osC_DirectoryListing = new osC_DirectoryListing(DIR_FS_BACKUP);
     $osC_DirectoryListing->setIncludeDirectories(false);
     $osC_DirectoryListing->setExcludeEntries('.htaccess');
     $response = array();
     foreach ($osC_DirectoryListing->getFiles() as $file) {
         $response[] = array('file' => $file['name'], 'date' => osC_DateTime::getDate(osC_DateTime::fromUnixTimestamp(filemtime(DIR_FS_BACKUP . $file['name'])), true), 'size' => number_format(filesize(DIR_FS_BACKUP . $file['name'])));
     }
     $response = array(EXT_JSON_READER_ROOT => $response);
     echo $toC_Json->encode($response);
 }
Exemplo n.º 15
0
 function getTimestamp($date = '')
 {
     global $osC_Language;
     if (empty($date)) {
         $date = osC_DateTime::getNow();
     }
     $year = substr($date, 0, 4);
     $month = (int) substr($date, 5, 2);
     $day = (int) substr($date, 8, 2);
     $hour = (int) substr($date, 11, 2);
     $minute = (int) substr($date, 14, 2);
     $second = (int) substr($date, 17, 2);
     return mktime($hour, $minute, $second, $month, $day, $year);
 }
Exemplo n.º 16
0
 function renderData()
 {
     global $toC_Json, $osC_Database, $osC_Language;
     $Qreviews = $osC_Database->query('select r.reviews_id, r.products_id, greatest(r.date_added, ifnull(r.last_modified, 0)) as date_last_modified, r.reviews_rating, pd.products_name, l.name as languages_name, l.code as languages_code from :table_reviews r left join :table_products_description pd on (r.products_id = pd.products_id and r.languages_id = pd.language_id), :table_languages l where r.languages_id = l.languages_id order by date_last_modified desc limit 6');
     $Qreviews->bindTable(':table_reviews', TABLE_REVIEWS);
     $Qreviews->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
     $Qreviews->bindTable(':table_languages', TABLE_LANGUAGES);
     $Qreviews->execute();
     $records = array();
     while ($Qreviews->next()) {
         $records[] = array('reviews_id' => $Qreviews->valueInt('reviews_id'), 'products_name' => $Qreviews->value('products_name'), 'languages_code' => $osC_Language->showImage($Qreviews->value('languages_code')), 'reviews_rating' => osc_image('../images/stars_' . $Qreviews->valueInt('reviews_rating') . '.png', $Qreviews->valueInt('reviews_rating') . '/5'), 'date_last_modified' => osC_DateTime::getShort($Qreviews->value('date_last_modified')));
     }
     $response = array(EXT_JSON_READER_TOTAL => sizeof($records), EXT_JSON_READER_ROOT => $records);
     echo $toC_Json->encode($response);
 }
Exemplo n.º 17
0
 function renderData()
 {
     global $toC_Json, $osC_Database, $osC_Language;
     $Qorders = $osC_Database->query('select o.orders_id, o.customers_name, greatest(o.date_purchased, ifnull(o.last_modified, 0)) as date_last_modified, s.orders_status_name, ot.text as order_total from :table_orders o, :table_orders_total ot, :table_orders_status s where o.orders_id = ot.orders_id and ot.class = "total" and o.orders_status = s.orders_status_id and s.language_id = :language_id order by date_last_modified desc limit 4');
     $Qorders->bindTable(':table_orders', TABLE_ORDERS);
     $Qorders->bindTable(':table_orders_total', TABLE_ORDERS_TOTAL);
     $Qorders->bindTable(':table_orders_status', TABLE_ORDERS_STATUS);
     $Qorders->bindInt(':language_id', $osC_Language->getID());
     $Qorders->execute();
     $records = array();
     while ($Qorders->next()) {
         $records[] = array('orders_id' => $Qorders->valueInt('orders_id'), 'customers_name' => $Qorders->valueProtected('customers_name'), 'order_total' => strip_tags($Qorders->value('order_total')), 'date_purchased' => osC_DateTime::getShort($Qorders->value('date_last_modified')), 'orders_status_name' => $Qorders->value('orders_status_name'));
     }
     $response = array(EXT_JSON_READER_TOTAL => sizeof($records), EXT_JSON_READER_ROOT => $records);
     echo $toC_Json->encode($response);
 }
Exemplo n.º 18
0
 function listGuestBook()
 {
     global $toC_Json, $osC_Database, $osC_Language;
     $start = empty($_REQUEST['start']) ? 0 : $_REQUEST['start'];
     $limit = empty($_REQUEST['limit']) ? MAX_DISPLAY_SEARCH_RESULTS : $_REQUEST['limit'];
     $QguestBook = $osC_Database->query('select guest_books_id, title, email, url, guest_books_status, languages_id, content, date_added from :table_guest_books order by guest_books_id desc');
     $QguestBook->bindTable(':table_guest_books', TABLE_GUEST_BOOKS);
     $QguestBook->setExtBatchLimit($start, $limit);
     $QguestBook->execute();
     $records = array();
     while ($QguestBook->next()) {
         $records[] = array('guest_books_id' => $QguestBook->valueInt('guest_books_id'), 'title' => $QguestBook->value('title'), 'email' => $QguestBook->value('email'), 'url' => $QguestBook->value('url'), 'guest_books_status' => $QguestBook->value('guest_books_status'), 'languages' => $osC_Language->showImage(osC_Language_Admin::getData($QguestBook->valueInt('languages_id'), 'code')), 'content' => $QguestBook->value('content'), 'date_added' => osC_DateTime::getDate($QguestBook->value('date_added')));
     }
     $QguestBook->freeResult();
     $response = array(EXT_JSON_READER_TOTAL => $QguestBook->getBatchSize(), EXT_JSON_READER_ROOT => $records);
     echo $toC_Json->encode($response);
 }
Exemplo n.º 19
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;
 }
Exemplo n.º 20
0
    function initialize()
    {
        global $osC_Database, $osC_Language, $osC_Currencies, $osC_Image, $osC_Template;
        $Qupcoming = $osC_Database->query('select p.products_id, p.products_price, p.products_tax_class_id, p.products_date_available as date_expected, 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) left join :table_specials s on (p.products_id = s.products_id and s.status = 1), :table_products_description pd where to_days(p.products_date_available) >= to_days(now()) and p.products_status = :products_status and p.products_id = pd.products_id and pd.language_id = :language_id order by p.products_date_available limit :max_display_upcoming_products');
        $Qupcoming->bindTable(':table_products', TABLE_PRODUCTS);
        $Qupcoming->bindTable(':table_products_images', TABLE_PRODUCTS_IMAGES);
        $Qupcoming->bindTable(':table_specials', TABLE_SPECIALS);
        $Qupcoming->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
        $Qupcoming->bindInt(':default_flag', 1);
        $Qupcoming->bindInt(':products_status', 1);
        $Qupcoming->bindInt(':language_id', $osC_Language->getID());
        $Qupcoming->bindInt(':max_display_upcoming_products', MODULE_CONTENT_UPCOMING_PRODUCTS_MAX_DISPLAY);
        if (MODULE_CONTENT_UPCOMING_PRODUCTS_CACHE > 0) {
            $Qupcoming->setCache('upcoming_products-' . $osC_Language->getCode() . '-' . $osC_Currencies->getCode(), MODULE_CONTENT_UPCOMING_PRODUCTS_CACHE);
        }
        $Qupcoming->execute();
        $i = 0;
        if ($Qupcoming->numberOfRows() > 0) {
            $this->_content = '<div class="upcomingProductsModule clearfix">';
            while ($Qupcoming->next()) {
                $osC_Product = new osC_Product($Qupcoming->valueInt('products_id'));
                if ($i % 3 == 0 && $i != 0) {
                    $this->_content .= '<div class="productItem clearLeft">';
                } else {
                    $this->_content .= '<div class="productItem">';
                }
                $this->_content .= '<div class="productName">' . osc_link_object(osc_href_link(FILENAME_PRODUCTS, $Qupcoming->value('products_id')), $Qupcoming->value('products_name')) . '</div>' . '<div>' . osc_link_object(osc_href_link(FILENAME_PRODUCTS, $Qupcoming->value('products_id')), $osC_Image->show($Qupcoming->value('image'), $Qupcoming->value('products_name'))) . '</div>' . '<div>' . $osC_Product->getPriceFormated(true) . '</div>' . '<div><strong>' . osC_DateTime::getLong($Qupcoming->value('date_expected')) . '</strong></div>';
                $this->_content .= '</div>';
                $i++;
            }
            $this->_content .= '</div>';
            //add the css block for this module
            $osC_Template->addStyleDeclaration('.clearLeft{clear:left;}
	                                          .upcomingProductsModule{overflow: auto; height: 100%;}
	                                          .upcomingProductsModule .productItem{width: 32%; float: left; text-align: center; padding: 2px;}
	                                          .upcomingProductsModule .productItem .productName{height:30px;}
	                                          .upcomingProductsModule .productItem div {margin:3px 0;}');
        }
        $Qupcoming->freeResult();
    }
Exemplo n.º 21
0
 function expireAll()
 {
     global $osC_Database;
     $Qbanner = $osC_Database->query('select b.banners_id, b.expires_date, b.expires_impressions, sum(bh.banners_shown) as banners_shown from :table_banners b, :table_banners_history bh where b.status = 1 and b.banners_id = bh.banners_id group by b.banners_id');
     $Qbanner->bindTable(':table_banners', TABLE_BANNERS);
     $Qbanner->bindTable(':table_banners_history', TABLE_BANNERS_HISTORY);
     $Qbanner->execute();
     if ($Qbanner->numberOfRows() > 0) {
         while ($Qbanner->next()) {
             if (!osc_empty($Qbanner->value('expires_date'))) {
                 if (osC_DateTime::getNow() >= $Qbanner->value('expires_date')) {
                     $this->expire($Qbanner->valueInt('banners_id'));
                 }
             } elseif (!osc_empty($Qbanner->valueInt('expires_impressions'))) {
                 if ($Qbanner->valueInt('expires_impressions') > 0 && $Qbanner->valueInt('banners_shown') >= $Qbanner->valueInt('expires_impressions')) {
                     $this->expire($Qbanner->valueInt('banners_id'));
                 }
             }
         }
     }
     $Qbanner->freeResult();
 }
Exemplo n.º 22
0
 function initialize()
 {
     global $osC_Database, $osC_Language, $osC_Currencies;
     $Qupcoming = $osC_Database->query('select p.products_id, pa.value as date_expected from :table_products p, :table_templates_boxes tb, :table_product_attributes pa where tb.code = :code and tb.id = pa.id and to_days(str_to_date(pa.value, "%Y-%m-%d")) >= to_days(now()) and pa.products_id = p.products_id and p.products_status = :products_status order by pa.value limit :max_display_upcoming_products');
     $Qupcoming->bindTable(':table_products', TABLE_PRODUCTS);
     $Qupcoming->bindTable(':table_templates_boxes', TABLE_TEMPLATES_BOXES);
     $Qupcoming->bindTable(':table_product_attributes', TABLE_PRODUCT_ATTRIBUTES);
     $Qupcoming->bindValue(':code', 'date_available');
     $Qupcoming->bindInt(':products_status', 1);
     $Qupcoming->bindInt(':max_display_upcoming_products', MODULE_CONTENT_UPCOMING_PRODUCTS_MAX_DISPLAY);
     if (MODULE_CONTENT_UPCOMING_PRODUCTS_CACHE > 0) {
         $Qupcoming->setCache('upcoming_products-' . $osC_Language->getCode() . '-' . $osC_Currencies->getCode(), MODULE_CONTENT_UPCOMING_PRODUCTS_CACHE);
     }
     $Qupcoming->execute();
     if ($Qupcoming->numberOfRows() > 0) {
         $this->_content = '<ol style="list-style: none;">';
         while ($Qupcoming->next()) {
             $osC_Product = new osC_Product($Qupcoming->valueInt('products_id'));
             $this->_content .= '<li>' . osC_DateTime::getLong($Qupcoming->value('date_expected')) . ': ' . osc_link_object(osc_href_link(FILENAME_PRODUCTS, $osC_Product->getKeyword()), $osC_Product->getTitle()) . ' ' . $osC_Product->getPriceFormated(true) . '</li>';
         }
         $this->_content .= '</ol>';
     }
     $Qupcoming->freeResult();
 }
Exemplo n.º 23
0
 function renderData()
 {
     global $toC_Json, $osC_Database, $osC_Language;
     $Qcustomers = $osC_Database->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->bindTable(':table_customers', TABLE_CUSTOMERS);
     $Qcustomers->execute();
     $records = array();
     while ($Qcustomers->next()) {
         $customer_icon = osc_icon('people.png');
         if (ACCOUNT_GENDER > -1) {
             switch ($Qcustomers->value('customers_gender')) {
                 case 'm':
                     $customer_icon = osc_icon('user_male.png');
                     break;
                 case 'f':
                     $customer_icon = osc_icon('user_female.png');
                     break;
             }
         }
         $records[] = array('customers_name' => $customer_icon . '&nbsp;' . $Qcustomers->valueProtected('customers_firstname') . ' ' . $Qcustomers->valueProtected('customers_lastname'), 'date_account_created' => osC_DateTime::getShort($Qcustomers->value('date_account_created')), 'customers_status' => osc_icon($Qcustomers->valueInt('customers_status') === 1 ? 'checkbox_ticked.gif' : 'checkbox_crossed.gif'));
     }
     $response = array(EXT_JSON_READER_TOTAL => sizeof($records), EXT_JSON_READER_ROOT => $records);
     echo $toC_Json->encode($response);
 }
$Qstatus = $order->getStatusListing();
if ($Qstatus->numberOfRows() > 0) {
    ?>

<div class="moduleBox">
  <h6><?php 
    echo $osC_Language->get('order_history_heading');
    ?>
</h6>

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

<?php 
    while ($Qstatus->next()) {
        echo '    <tr>' . "\n" . '      <td valign="top" width="70">' . osC_DateTime::getShort($Qstatus->value('date_added')) . '</td>' . "\n" . '      <td valign="top" width="200">' . $Qstatus->value('orders_status_name') . '</td>' . "\n" . '      <td valign="top">' . (!osc_empty($Qstatus->valueProtected('comments')) ? nl2br($Qstatus->valueProtected('comments')) : '&nbsp;') . '</td>' . "\n" . '    </tr>' . "\n";
    }
    ?>

    </table>
  </div>
</div>

<?php 
}
?>
<div class="submitFormButtons">
  <?php 
echo osc_link_object(osc_href_link(FILENAME_ACCOUNT, 'orders' . (isset($_GET['page']) ? '&page=' . $_GET['page'] : ''), 'SSL'), osc_draw_image_button('button_back.gif', $osC_Language->get('button_back')));
?>
</div>
Exemplo n.º 25
0
 function _createArticleSitemap()
 {
     global $osC_Database;
     $num_of_entries = 0;
     $num_of_article_file = 0;
     $Qarticles = $osC_Database->query('select articles_id , if( articles_last_modified  is null || articles_last_modified in (\'0000-00-00 00:00:00\'), articles_date_added, articles_last_modified  ) as last_modified from :table_articles order by articles_order asc, articles_id asc');
     $Qarticles->bindTable(':table_articles', TABLE_ARTICLES);
     $Qarticles->execute();
     $handle = $this->_createSitemapFile('Articles');
     $this->_writeFile($handle, $this->_createXmlHeader());
     while ($Qarticles->next()) {
         $location = $this->_base_url . $this->_hrefLink(FILENAME_INFO, 'articles&articles_id=' . $Qarticles->valueInt('articles_id'));
         $last_mod = date("Y-m-d", osC_DateTime::getTimestamp($Qarticles->value('last_modified')));
         $change_freq = $article_change_frequency;
         $this->_writeSitemapFile($handle, $this->_createUrlElement($location, $last_mod, $this->_articles_change_freq, $this->_articles_priority), $num_of_entries, $num_of_article_file, 'Article');
     }
     $Qarticles->freeResult();
     $this->_closeSitemapFile($handle);
     return true;
 }
Exemplo n.º 26
0
 /**
  * Add a product or variant product into the wishlist
  * 
  * @access public
  * @param mixed products id or products id string including the variants such as 1#1:1;2:3
  * @return boolean
  */
 function add($products_id_string)
 {
     global $osC_Database, $osC_Services, $osC_Customer, $osC_Product;
     //flag to reprent the action performed or not
     $error = false;
     // if wishlist empty, create a new wishlist
     if (!$this->hasWishlistID()) {
         $token = $this->generateToken();
         $Qnew = $osC_Database->query('insert into :table_wishlists (customers_id, wishlists_token) values (:customers_id, :wishlists_token)');
         $Qnew->bindTable(':table_wishlists', TABLE_WISHLISTS);
         $Qnew->bindInt(':customers_id', $osC_Customer->getID());
         $Qnew->bindValue(':wishlists_token', $token);
         $Qnew->execute();
         $this->_wishlists_id = $osC_Database->nextID();
         $this->_token = $token;
         $Qnew->freeResult();
     }
     if (!isset($osC_Product)) {
         $osC_Product = new osC_Product($products_id_string);
     }
     if ($osC_Product->getID() > 0) {
         if (!$this->exists($products_id_string)) {
             $product_price = $osC_Product->getPrice();
             $product_name = $osC_Product->getTitle();
             $product_image = $osC_Product->getImage();
             if ($osC_Services->isStarted('specials')) {
                 global $osC_Specials;
                 if ($new_price = $osC_Specials->getPrice($products_id)) {
                     $price = $new_price;
                 }
             }
             // if the product has variants, set the image, price etc according to the variants
             if ($osC_Product->hasVariants()) {
                 $variant_product = $this->_updateProduct($products_id_string, $osC_Product, $product_name);
                 $product_name = $variant_product['name'];
                 $product_price = $variant_product['price'];
                 $product_image = $variant_product['image'];
             }
             $this->_contents[$products_id_string] = array('products_id_string' => $products_id_string, 'name' => $product_name, 'image' => $product_image, 'price' => $product_price, 'date_added' => osC_DateTime::getShort(osC_DateTime::getNow()), 'comments' => '');
             // insert into wishlist products only if there isn't the same product existing in the table
             $QnewCheck = $osC_Database->query('select * from :table_wishlist_products where products_id_string = :products_id_string limit 1');
             $QnewCheck->bindTable(':table_wishlist_products', TABLE_WISHLISTS_PRODUCTS);
             $QnewCheck->bindValue(':products_id_string', $products_id_string);
             $QnewCheck->execute();
             if ($QnewCheck->numberOfRows() < 1) {
                 $Qnew = $osC_Database->query('insert into :table_wishlist_products (wishlists_id, products_id_string, date_added, comments) values (:wishlists_id, :products_id_string, now(), :comments)');
                 $Qnew->bindTable(':table_wishlist_products', TABLE_WISHLISTS_PRODUCTS);
                 $Qnew->bindInt(':wishlists_id', $this->_wishlists_id);
                 $Qnew->bindValue(':products_id_string', $products_id_string);
                 $Qnew->bindValue(':comments', '');
                 $Qnew->execute();
                 $wishlists_products_id = $osC_Database->nextID();
             } else {
                 $wishlists_products_id = $QnewCheck->valueInt('wishlists_products_id');
             }
             $QnewCheck->freeResult();
         } else {
             $error = true;
         }
     }
     if ($error === true) {
         return false;
     }
     return true;
 }
Exemplo n.º 27
0
<!-- left box -->
<?php 
        // The link will appear only if:
        // - Download remaining count is > 0, AND
        // - The file is present in the DOWNLOAD directory, AND EITHER
        // - No expiry date is enforced (maxdays == 0), OR
        // - The expiry date is not reached
        if ($Qdownloads->valueInt('download_count') > 0 && file_exists(DIR_FS_DOWNLOAD . $Qdownloads->value('orders_products_filename')) && ($Qdownloads->value('download_maxdays') == 0 || $download_timestamp > time())) {
            echo '            <td>' . osc_link_object(osc_href_link(FILENAME_DOWNLOAD, 'order=' . $last_order . '&id=' . $Qdownloads->valueInt('orders_products_download_id')), $Qdownloads->value('products_name')) . '</td>' . "\n";
        } else {
            echo '            <td>' . $Qdownloads->value('products_name') . '</td>' . "\n";
        }
        ?>
<!-- right box -->
<?php 
        echo '            <td>' . sprintf($osC_Language->get('download_link_expires'), osC_DateTime::getLong($download_expiry)) . '</td>' . "\n" . '            <td align="left">' . sprintf($osC_Language->get('download_counter_remaining'), $Qdownloads->valueInt('download_count')) . '</td>' . "\n" . '          </tr>' . "\n";
    }
    ?>
          </tr>
        </table></td>
      </tr>
<?php 
    if (!strstr($_SERVER['SCRIPT_FILENAME'], FILENAME_ACCOUNT_HISTORY_INFO)) {
        ?>
      <tr>
        <td width="10">&nbsp;</td>
      </tr>
      <tr>
        <td class="smalltext" colspan="4"><p><?php 
        sprintf($osC_Language->get('download_footer'), osc_link_object(osc_href_link(FILENAME_ACCOUNT, null, 'SSL'), $osC_Language->get('my_account')));
        ?>
Exemplo n.º 28
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");
     }
 }
Exemplo n.º 29
0
 function add($products_id, $variants = array())
 {
     global $osC_Database, $osC_Services, $osC_Customer, $osC_Product;
     //if wishlist empty, create a new wishlist
     if (!$this->hasWishlistID()) {
         $token = $this->generateToken();
         $Qnew = $osC_Database->query('insert into :table_wishlists (customers_id, wishlists_token) values (:customers_id, :wishlists_token)');
         $Qnew->bindTable(':table_wishlists', TABLE_WISHLISTS);
         $Qnew->bindInt(':customers_id', $osC_Customer->getID());
         $Qnew->bindValue(':wishlists_token', $token);
         $Qnew->execute();
         $this->_wishlists_id = $osC_Database->nextID();
         $this->_token = $token;
         $Qnew->freeResult();
     }
     if (!isset($osC_Product)) {
         $osC_Product = new osC_Product($products_id);
     }
     if ($osC_Product->getID() > 0) {
         if (!$this->exists($products_id)) {
             $product_price = $osC_Product->getPrice();
             $product_name = $osC_Product->getTitle();
             $product_image = $osC_Product->getImage();
             if ($osC_Services->isStarted('specials')) {
                 global $osC_Specials;
                 if ($new_price = $osC_Specials->getPrice($products_id)) {
                     $price = $new_price;
                 }
             }
             //if the product has variants, set the image, price etc according to the variants
             if ($osC_Product->hasVariants()) {
                 $products_variants = $osC_Product->getVariants();
                 if (is_array($variants) && !osc_empty($variants)) {
                     $product_id_string = osc_get_product_id_string($products_id, $variants);
                     $products_variant = $products_variants[$product_id_string];
                 } else {
                     $products_variant = $osC_Product->getDefaultVariant();
                 }
                 $variants_groups_id = $products_variant['groups_id'];
                 $variants_groups_name = $products_variant['groups_name'];
                 if (!osc_empty($variants_groups_name)) {
                     $product_name .= '<br />';
                     foreach ($variants_groups_name as $group_name => $value_name) {
                         $product_name .= '<em>' . $group_name . ': ' . $value_name . '</em>' . '<br />';
                     }
                 }
                 $product_price = $products_variant['price'];
                 $product_image = $products_variant['image'];
             }
             $this->_contents[$products_id] = array('products_id' => $products_id, 'name' => $product_name, 'image' => $product_image, 'price' => $product_price, 'date_added' => osC_DateTime::getShort(osC_DateTime::getNow()), 'variants' => $variants, 'comments' => '');
             //insert into wishlist products
             $Qnew = $osC_Database->query('insert into :table_wishlist_products (wishlists_id, products_id, date_added, comments) values (:wishlists_id, :products_id, now(), :comments)');
             $Qnew->bindTable(':table_wishlist_products', TABLE_WISHLISTS_PRODUCTS);
             $Qnew->bindInt(':wishlists_id', $this->_wishlists_id);
             $Qnew->bindInt(':products_id', $products_id);
             $Qnew->bindValue(':comments', '');
             $Qnew->execute();
             $wishlists_products_id = $osC_Database->nextID();
             $Qnew->freeResult();
             //if the wishlists products has variants
             $products_variants_groups_id = array();
             $products_variants_groups_name = array();
             if (isset($variants_groups_id) && isset($variants_groups_name)) {
                 foreach ($variants_groups_id as $groups_id => $values_id) {
                     $products_variants_groups_id[] = array('groups_id' => $groups_id, 'values_id' => $values_id);
                 }
                 foreach ($variants_groups_name as $groups_name => $values_name) {
                     $products_variants_groups_name[] = array('groups_name' => $groups_name, 'values_name' => $values_name);
                 }
             }
             if (!osc_empty($products_variants_groups_id)) {
                 foreach ($products_variants_groups_id as $key => $groups_id) {
                     $Qinsert = $osC_Database->query('insert into :table_wishlists_products_variants (wishlists_id, wishlists_products_id, products_variants_groups_id, products_variants_groups, products_variants_values_id, products_variants_values) values (:wishlists_id, :wishlists_products_id, :products_variants_groups_id, :products_variants_groups, :products_variants_values_id, :products_variants_values)');
                     $Qinsert->bindTable(':table_wishlists_products_variants', TABLE_WISHLISTS_PRODUCTS_VARIANTS);
                     $Qinsert->bindInt(':wishlists_id', $this->_wishlists_id);
                     $Qinsert->bindInt(':wishlists_products_id', $wishlists_products_id);
                     $Qinsert->bindInt(':products_variants_groups_id', $groups_id['groups_id']);
                     $Qinsert->bindInt(':products_variants_values_id', $groups_id['values_id']);
                     $Qinsert->bindValue(':products_variants_groups', $products_variants_groups_name[$key]['groups_name']);
                     $Qinsert->bindValue(':products_variants_values', $products_variants_groups_name[$key]['values_name']);
                     $Qinsert->execute();
                 }
             }
         }
     }
 }
Exemplo n.º 30
0
<div class="moduleBox">

  <h6><span style="float: left;"><?php 
        echo $osC_Language->get('order_status') . ' ' . osC_Order::getLastPublicStatus($Qhistory->value('orders_id'));
        ?>
</span><?php 
        echo $osC_Language->get('order_number') . ' ' . $Qhistory->valueInt('orders_id');
        ?>
</h6>

  <div class="content">
    <table border="0" width="100%" cellspacing="2" cellpadding="4">
      <tr>
        <td valign="top"><?php 
        echo '<b>' . $osC_Language->get('order_date') . '</b> ' . osC_DateTime::getLong($Qhistory->value('date_purchased')) . '<br /><b>' . $order_type . '</b> ' . osc_output_string_protected($order_name);
        ?>
</td>
        <td width="150" valign="top"><?php 
        echo '<b>' . $osC_Language->get('order_products') . '</b> ' . osC_Order::numberOfProducts($Qhistory->valueInt('orders_id')) . '<br /><b>' . $osC_Language->get('order_cost') . '</b> ' . strip_tags($Qhistory->value('order_total'));
        ?>
</td>
        <td width="100" align="center">
          <div style = "padding: 2px;"><?php 
        echo osc_link_object(osc_href_link(FILENAME_ACCOUNT, 'orders=' . $Qhistory->valueInt('orders_id') . (isset($_GET['page']) ? '&page=' . $_GET['page'] : ''), 'SSL'), osc_draw_image_button('small_view.gif', $osC_Language->get('button_view')));
        ?>
</div>
          <div style = "padding: 2px;"><?php 
        echo osc_link_object(osc_href_link(FILENAME_PDF, 'module=account&pdf=print_order&orders_id=' . $Qhistory->valueInt('orders_id')), osc_draw_image_button('button_print.png', $osC_Language->get('button_print')), "target=_blank");
        ?>
</div>