Example #1
0
 function getProducts()
 {
     global $toC_Json, $osC_Language;
     $osC_Tax = new osC_Tax_Admin();
     $osC_Currencies = new osC_Currencies_Admin();
     $osC_Order = new osC_Order($_REQUEST['orders_id']);
     $records = array();
     foreach ($osC_Order->getProducts() as $product) {
         $product_info = $product['quantity'] . ' x ' . $product['name'];
         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>';
             }
         }
         if ($product['type'] == PRODUCT_TYPE_GIFT_CERTIFICATE) {
             $product_info .= '<br /><nobr>&nbsp;&nbsp;&nbsp;<i>' . $osC_Language->get('senders_name') . ': ' . $product['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['senders_email'] . '</i></nobr>';
             }
             $product_info .= '<br /><nobr>&nbsp;&nbsp;&nbsp;<i>' . $osC_Language->get('recipients_name') . ': ' . $product['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['recipients_email'] . '</i></nobr>';
             }
             $product_info .= '<br /><nobr>&nbsp;&nbsp;&nbsp;<i>' . $osC_Language->get('messages') . ': ' . $product['messages'] . '</i></nobr>';
         }
         $records[] = array('products' => $product_info, 'return_quantity' => $product['return_quantity'] > 0 ? $product['return_quantity'] : '', 'model' => $product['model'], 'tax' => $osC_Tax->displayTaxRateValue($product['tax']), 'price_net' => $osC_Currencies->format($product['final_price'], $osC_Order->getCurrency(), $osC_Order->getCurrencyValue()), 'price_gross' => $osC_Currencies->displayPriceWithTaxRate($product['final_price'], $product['tax'], 1, $osC_Order->getCurrency(), $osC_Order->getCurrencyValue()), 'total_net' => $osC_Currencies->format($product['final_price'] * $product['quantity'], $osC_Order->getCurrency(), $osC_Order->getCurrencyValue()), 'total_gross' => $osC_Currencies->displayPriceWithTaxRate($product['final_price'], $product['tax'], $product['quantity'], $osC_Order->getCurrency(), $osC_Order->getCurrencyValue()));
     }
     foreach ($osC_Order->getTotals() as $totals) {
         $records[] = array('products' => '', 'model' => '', 'tax' => '', 'price_net' => '', 'price_gross' => $totals['title'], 'total_net' => '', 'total_gross' => $totals['text']);
     }
     $response = array(EXT_JSON_READER_ROOT => $records);
     echo $toC_Json->encode($response);
 }
 function deleteTaxRates()
 {
     global $toC_Json, $osC_Language;
     $error = false;
     $batch = explode(',', $_REQUEST['batch']);
     foreach ($batch as $id) {
         if (!osC_Tax_Admin::deleteEntry($id)) {
             $error = true;
             break;
         }
     }
     if ($error === false) {
         $response = array('success' => true, 'feedback' => $osC_Language->get('ms_success_action_performed'));
     } else {
         $response = array('success' => false, 'feedback' => $osC_Language->get('ms_error_action_not_performed'));
     }
     echo $toC_Json->encode($response);
 }
Example #3
0
 function listOrdersEditProducts()
 {
     global $toC_Json, $osC_Database, $osC_Language, $osC_ShoppingCart, $osC_Currencies, $osC_Weight, $osC_Tax;
     $osC_Tax = new osC_Tax_Admin();
     $osC_Weight = new osC_Weight();
     $osC_Currencies = new osC_Currencies();
     $osC_Order = new osC_Order($_REQUEST['orders_id']);
     $records = array();
     foreach ($osC_Order->getProducts() as $products_id_string => $product) {
         $product_info = $product['name'];
         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>';
             }
         }
         if ($product['type'] == PRODUCT_TYPE_GIFT_CERTIFICATE) {
             $product_info .= '&nbsp;(' . $product['gift_certificates_code'] . ')';
             $product_info .= '<br /><nobr>&nbsp;&nbsp;&nbsp;<i>' . $osC_Language->get('senders_name') . ': ' . $product['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['senders_email'] . '</i></nobr>';
             }
             $product_info .= '<br /><nobr>&nbsp;&nbsp;&nbsp;<i>' . $osC_Language->get('recipients_name') . ': ' . $product['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['recipients_email'] . '</i></nobr>';
             }
             $product_info .= '<br /><nobr>&nbsp;&nbsp;&nbsp;<i>' . $osC_Language->get('messages') . ': ' . $product['messages'] . '</i></nobr>';
         }
         $osC_Product = new osC_Product($product['id'], $osC_Order->getCustomer('customers_id'));
         $records[] = array('orders_products_id' => $product['orders_products_id'], 'products_id' => $product['id'], 'products_type' => $product['type'], 'products' => $product_info, 'quantity' => $product['quantity'] > 0 ? $product['quantity'] : '', 'qty_in_stock' => $osC_Product->getQuantity($products_id_string), 'sku' => $product['sku'], 'tax' => $osC_Tax->displayTaxRateValue($product['tax']), 'price_net' => round($product['final_price'] * $osC_Order->getCurrencyValue(), 2), 'price_gross' => $osC_Currencies->displayPriceWithTaxRate($product['final_price'], $product['tax'], 1, $osC_Order->getCurrency(), $osC_Order->getCurrencyValue()), 'total_net' => $osC_Currencies->format($product['final_price'] * $product['quantity'], $osC_Order->getCurrency(), $osC_Order->getCurrencyValue()), 'total_gross' => $osC_Currencies->displayPriceWithTaxRate($product['final_price'], $product['tax'], $product['quantity'], $osC_Order->getCurrency(), $osC_Order->getCurrencyValue()), 'action' => array('class' => 'icon-delete-record', 'qtip' => ''));
     }
     $order_totals = '<table cellspacing="5" cellpadding="5" width="300" border="0">';
     foreach ($osC_Order->getTotals() as $totals) {
         $order_totals .= '<tr><td align="right">' . $totals['title'] . '&nbsp;&nbsp;&nbsp;&nbsp;</td><td width="60">' . $totals['text'] . '</td></tr>';
     }
     $order_totals .= '</table>';
     $response = array(EXT_JSON_READER_ROOT => $records, 'totals' => $order_totals, 'shipping_method' => $osC_Order->getDeliverMethod());
     echo $toC_Json->encode($response);
 }
Example #4
0
 function listOrdersEditProducts()
 {
     global $toC_Json, $osC_Database, $osC_Language, $osC_ShoppingCart, $osC_Currencies, $osC_Weight, $osC_Tax;
     $osC_Tax = new osC_Tax_Admin();
     $osC_Weight = new osC_Weight();
     $osC_Currencies = new osC_Currencies();
     $osC_Order = new osC_Order($_REQUEST['orders_id']);
     $records = array();
     foreach ($osC_Order->getProducts() as $products_id_string => $product) {
         $product_info = $product['name'];
         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>';
             }
         }
         if (isset($product['customizations']) && !empty($product['customizations'])) {
             $product_info .= '<p>';
             foreach ($product['customizations'] as $key => $customization) {
                 $product_info .= '<div style="float: left">' . $customization['qty'] . ' x ' . '</div>';
                 $product_info .= '<div style="margin-left: 25px">';
                 foreach ($customization['fields'] as $orders_products_customizations_values_id => $field) {
                     if ($field['customization_type'] == CUSTOMIZATION_FIELD_TYPE_INPUT_TEXT) {
                         $product_info .= $field['customization_fields_name'] . ': ' . $field['customization_value'] . '<br />';
                     } else {
                         $product_info .= $field['customization_fields_name'] . ': <a href="' . osc_href_link_admin(FILENAME_JSON, 'module=orders&action=download_customization_file&file=' . $field['customization_value'] . '&cache_file=' . $field['cache_filename']) . '">' . $field['customization_value'] . '</a>' . '<br />';
                     }
                 }
                 $product_info .= '</div>';
             }
             $product_info .= '</p>';
         }
         if ($product['type'] == PRODUCT_TYPE_GIFT_CERTIFICATE) {
             $product_info .= '&nbsp;(' . $product['gift_certificates_code'] . ')';
             $product_info .= '<br /><nobr>&nbsp;&nbsp;&nbsp;<i>' . $osC_Language->get('senders_name') . ': ' . $product['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['senders_email'] . '</i></nobr>';
             }
             $product_info .= '<br /><nobr>&nbsp;&nbsp;&nbsp;<i>' . $osC_Language->get('recipients_name') . ': ' . $product['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['recipients_email'] . '</i></nobr>';
             }
             $product_info .= '<br /><nobr>&nbsp;&nbsp;&nbsp;<i>' . $osC_Language->get('messages') . ': ' . $product['messages'] . '</i></nobr>';
         }
         $osC_Product = new osC_Product($product['id'], $osC_Order->getCustomer('customers_id'));
         $records[] = array('orders_products_id' => $product['orders_products_id'], 'products_id' => $product['id'], 'products_type' => $product['type'], 'products' => $product_info, 'quantity' => $product['quantity'] > 0 ? $product['quantity'] : '', 'qty_in_stock' => $osC_Product->getQuantity($products_id_string), 'sku' => $product['sku'], 'tax' => $osC_Tax->displayTaxRateValue($product['tax']), 'price_net' => round($product['final_price'] * $osC_Order->getCurrencyValue(), 2), 'price_gross' => $osC_Currencies->displayPriceWithTaxRate($product['final_price'], $product['tax'], 1, $osC_Order->getCurrency(), $osC_Order->getCurrencyValue()), 'total_net' => $osC_Currencies->format($product['final_price'] * $product['quantity'], $osC_Order->getCurrency(), $osC_Order->getCurrencyValue()), 'total_gross' => $osC_Currencies->displayPriceWithTaxRate($product['final_price'], $product['tax'], $product['quantity'], $osC_Order->getCurrency(), $osC_Order->getCurrencyValue()), 'action' => array('class' => 'icon-delete-record', 'qtip' => ''));
     }
     $order_totals = '<table cellspacing="5" cellpadding="5" width="300" border="0">';
     foreach ($osC_Order->getTotals() as $totals) {
         $order_totals .= '<tr><td align="right">' . $totals['title'] . '&nbsp;&nbsp;&nbsp;&nbsp;</td><td width="60">' . $totals['text'] . '</td></tr>';
     }
     $order_totals .= '</table>';
     $response = array(EXT_JSON_READER_ROOT => $records, 'totals' => $order_totals, 'shipping_method' => $osC_Order->getDeliverMethod());
     echo $toC_Json->encode($response);
 }
Example #5
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.
*/
require 'includes/classes/tax.php';
$osC_Tax = new osC_Tax_Admin();
$osC_Order = new osC_Order($_GET['oID']);
?>

<table border="0" width="100%" cellspacing="0" cellpadding="2">
  <tr>
    <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
      <tr>
        <td class="pageHeading"><?php 
echo nl2br(STORE_NAME_ADDRESS);
?>
</td>
        <td class="pageHeading" align="right"><?php 
echo osc_image('../images/store_logo.jpg', STORE_NAME);
?>
</td>
Example #6
0
 function getTaxClasses()
 {
     global $toC_Json, $osC_Database, $osC_Language;
     require_once 'includes/classes/tax.php';
     $osC_Tax = new osC_Tax_Admin();
     $Qtc = $osC_Database->query('select tax_class_id, tax_class_title from :table_tax_class order by tax_class_title');
     $Qtc->bindTable(':table_tax_class', TABLE_TAX_CLASS);
     $Qtc->execute();
     $tax_class_array = array(array('id' => '0', 'rate' => '0', 'text' => $osC_Language->get('none')));
     while ($Qtc->next()) {
         $tax_class_array[] = array('id' => $Qtc->valueInt('tax_class_id'), 'rate' => $osC_Tax->getTaxRate($Qtc->valueInt('tax_class_id')), 'text' => $Qtc->value('tax_class_title'));
     }
     $response = array(EXT_JSON_READER_ROOT => $tax_class_array);
     echo $toC_Json->encode($response);
 }
 function listProducts()
 {
     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_Tax = new osC_Tax_Admin();
     $Qtc = $osC_Database->query('select tax_class_id, tax_class_title from :table_tax_class order by tax_class_title');
     $Qtc->bindTable(':table_tax_class', TABLE_TAX_CLASS);
     $Qtc->execute();
     $tax_class_array = array();
     while ($Qtc->next()) {
         $tax_class_array[$Qtc->valueInt('tax_class_id')] = $osC_Tax->getTaxRate($Qtc->valueInt('tax_class_id'));
     }
     $Qproducts = $osC_Database->query('select p.products_id, pd.products_name, p.products_tax_class_id from :table_products p, :table_products_description pd where p.products_id = pd.products_id and pd.language_id = :language_id and p.products_type <> :products_type');
     $Qproducts->appendQuery(' order by pd.products_name');
     $Qproducts->bindTable(':table_products', TABLE_PRODUCTS);
     $Qproducts->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
     $Qproducts->bindInt(':language_id', $osC_Language->getID());
     $Qproducts->bindInt(':products_type', PRODUCT_TYPE_GIFT_CERTIFICATE);
     $Qproducts->setExtBatchLimit($start, $limit);
     $Qproducts->execute();
     $records = array();
     while ($Qproducts->next()) {
         $rate = $Qproducts->valueInt('products_tax_class_id') == 0 ? 0 : $tax_class_array[$Qproducts->valueInt('products_tax_class_id')];
         $records[] = array('products_id' => $Qproducts->value('products_id'), 'products_name' => $Qproducts->value('products_name'), 'rate' => $rate);
     }
     $response = array(EXT_JSON_READER_TOTAL => $Qproducts->getBatchSize(), EXT_JSON_READER_ROOT => $records);
     echo $toC_Json->encode($response);
 }
Example #8
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.
*/
require 'includes/classes/tax.php';
$osC_Tax = new osC_Tax_Admin();
$osC_Order = new osC_Order($_GET['oID']);
if (!$osC_Order->isValid()) {
    $osC_MessageStack->add($osC_Template->getModule(), sprintf(ERROR_ORDER_DOES_NOT_EXIST, $_GET['oID']), 'error');
}
$tabIndex = 0;
if (isset($_GET['tabIndex']) && !empty($_GET['tabIndex'])) {
    switch ($_GET['tabIndex']) {
        case 'tabProducts':
            $tabIndex = 1;
            break;
        case 'tabTransactionHistory':
            $tabIndex = 2;
            break;
        case 'tabStatusHistory':
            $tabIndex = 3;
Example #9
0
 function listProducts()
 {
     global $toC_Json, $osC_Database, $osC_Language;
     $start = empty($_REQUEST['start']) ? 0 : $_REQUEST['start'];
     $limit = empty($_REQUEST['limit']) ? MAX_DISPLAY_SEARCH_RESULTS : $_REQUEST['limit'];
     $variants = isset($_POST['variants']) ? $_POST['variants'] : 0;
     $osC_Tax = new osC_Tax_Admin();
     $Qtc = $osC_Database->query('select tax_class_id, tax_class_title from :table_tax_class order by tax_class_title');
     $Qtc->bindTable(':table_tax_class', TABLE_TAX_CLASS);
     $Qtc->execute();
     $tax_class_array = array();
     while ($Qtc->next()) {
         $tax_class_array[$Qtc->valueInt('tax_class_id')] = $osC_Tax->getTaxRate($Qtc->valueInt('tax_class_id'));
     }
     //get the variants products
     if ($variants == 1) {
         $result = osC_Specials_Admin::getVariantsProducts($start, $limit);
         //get the general products
     } else {
         $result = osC_Specials_Admin::getProducts($start, $limit);
     }
     $records = array();
     if (count($result['products']) > 0) {
         foreach ($result['products'] as $product) {
             $rate = $product['products_tax_class_id'] == 0 ? 0 : $tax_class_array[$product['products_tax_class_id']];
             $records[] = array('products_id' => $product['products_id'], 'products_name' => $product['products_name'], 'rate' => $rate);
         }
     }
     $response = array(EXT_JSON_READER_TOTAL => $result['total'], EXT_JSON_READER_ROOT => $records);
     echo $toC_Json->encode($response);
 }