<?php

/**
 * Retrieves all the organisations
 */
include_once 'database.php';
include_once 'functions.php';
include_once '../includes/configure.php';
include_once '../includes/database_tables.php';
include_once '../includes/functions/database.php';
if (postOK('organisation_id') && !verifyExistence(TABLE_ADDRESS_BOOK, 'address_book_id', $_POST['organisation_id'])) {
    header('Content-type: text/xml');
    echo '<xml></xml>';
    die;
}
$query = 'select ab.address_book_id as id, ab.entry_country_id as country_id, ab.entry_company as title, c.customers_email_address as email, c.customers_telephone as phone, c.customers_fax as fax, ctr.countries_name as country ' . 'from ' . TABLE_ADDRESS_BOOK . ' as ab, ' . TABLE_CUSTOMERS . ' as c, ' . TABLE_COUNTRIES . ' as ctr ' . 'where ab.customers_id = c.customers_id and ab.entry_company != "" and ctr.countries_id = ab.entry_country_id';
if (postOK('organisation_id')) {
    $query .= ' and ab.address_book_id = ' . $_POST['organisation_id'];
}
include_once 'object_query.php';
$query = new Object_query($query);
if ($query->isRequestOk()) {
    $xml = '<xml>';
    $organisations = array();
    foreach ($query->getCollection() as $organisation) {
        if (!isKnownOrganisation($organisations, $organisation['title'])) {
            $organisations[$organisation['title']] = array();
        } else {
            if (isKnownCountryForOrg($organisations, $organisation['title'], $organisation['country_id'])) {
                continue;
            }
<?php

/**
 * Retrieves all the lines (products linked with an order) of an order
 */
include_once 'database.php';
include_once 'functions.php';
include_once '../includes/configure.php';
include_once '../includes/functions/database.php';
include_once '../includes/database_tables.php';
include_once '../includes/functions/general.php';
tep_db_connect() or die('Unable to connect to database');
if (!postOK('sale_order_id') or !verifyExistence(TABLE_ORDERS_PRODUCTS, 'orders_id', $_POST['sale_order_id'])) {
    header('Content-type: text/xml');
    echo '<xml></xml>';
    die;
}
$query = 'select orders_products_id as id, products_name as title, concat_ws(" ", "", products_name) as reference, products_price as price, products_quantity as quantity, products_tax as vat from ' . TABLE_ORDERS_PRODUCTS . ' where orders_id = ' . $_POST['sale_order_id'];
header('Content-type: text/xml');
echo executeSQL($query);
tep_db_close();
/**
 * Retrieves all the persons who are on the addresses and different from the owner of the address
 */
include_once 'database.php';
include_once 'functions.php';
include_once '../includes/configure.php';
include_once '../includes/database_tables.php';
include_once '../includes/functions/database.php';
if (postOK('person_id')) {
    if (!(int) $_POST['person_id']) {
        header('Content-type: text/xml');
        echo '<xml></xml>';
        die;
    }
}
if (!verifyExistence(TABLE_ADDRESS_BOOK, 'address_book_id', $_POST['person_id'])) {
    header('Content-type: text/xml');
    echo '<xml></xml>';
    die;
}
tep_db_connect() or die('Unable to connect to database');
$query = 'select ab.address_book_id as id, ab.entry_firstname as firstname, ab.entry_lastname as lastname, c.customers_email_address as email, c.customers_dob as birthday, concat_ws(" ", ab.entry_company, c.customers_email_address) as relation ' . 'from ' . TABLE_ADDRESS_BOOK . ' as ab, ' . TABLE_CUSTOMERS . ' as c ' . 'where c.customers_id = ab.customers_id and ((ab.entry_firstname != c.customers_firstname) or (ab.entry_lastname != c.customers_lastname)) ' . 'and ab.entry_firstname != "" and ab.entry_lastname != ""';
if (postOK('person_id')) {
    $query .= ' and ab.address_book_id = ' . $_POST['person_id'];
}
include_once 'object_query.php';
$query = new Object_query($query);
if ($query->isRequestOk()) {
    $xml = '<xml>';
    foreach ($query->getCollection() as $person) {
        $xml .= '<object>';
Example #4
0
<?php

/**
 * Retrieves all the products of the products table
 */
include_once 'database.php';
include_once 'functions.php';
include_once '../includes/configure.php';
include_once '../includes/database_tables.php';
include_once '../includes/functions/database.php';
tep_db_connect() or die('Unable to connect to database');
if (postOK('products_id') && !verifyExistence(TABLE_PRODUCTS, 'products_id', $_POST['product_id'])) {
    header('Content-type: text/xml');
    echo '<xml></xml>';
    die;
}
$language_id = getDefaultLanguageID();
$query = 'select p.products_id as id, p.products_id as reference, pd.products_name as title from ' . TABLE_PRODUCTS . ' as p, ' . TABLE_PRODUCTS_DESCRIPTION . ' as pd where p.products_id = pd.products_id and pd.language_id = ' . $language_id;
if (postOK('product_id')) {
    $query .= ' and p.products_id = ' . $_POST['product_id'];
}
header('Content-type: text/xml');
echo executeSQL($query);
tep_db_close();
Example #5
0
<?php

/**
 * Retrieves all the orders in the orders table
 */
include_once 'database.php';
include_once 'functions.php';
include_once '../includes/configure.php';
include_once '../includes/database_tables.php';
include_once '../includes/functions/database.php';
tep_db_connect() or die('Unable to connect to database');
if (postOK('sale_order_id') && !verifyExistence(TABLE_ORDERS, 'orders_id', $_POST['sale_order_id'])) {
    header('Content-type: text/xml');
    echo "<xml></xml>";
    die;
}
$destination = 'concat(" ", concat_ws(" ", o.delivery_name, o.customers_email_address))';
$destination_ownership = 'concat(" ", concat_ws(" ", c.customers_firstname, c.customers_lastname, c.customers_email_address))';
$destination_administration = 'concat(" ", concat_ws(" ", o.billing_name, c.customers_email_address))';
$destination_decision = 'concat(" ", concat_ws(" ", o.customers_name, c.customers_email_address))';
// Getting only delivered orders ie orders_status=3
$query = 'select o.orders_id as id, o.orders_id as reference, o.currency as currency, ' . $destination . ' as destination, ' . $destination_administration . ' as destination_administration, ' . $destination_decision . ' as destination_decision, ' . $destination_ownership . ' as destination_ownership, o.payment_method as payment_mode ' . 'from ' . TABLE_ORDERS . ' as o, ' . TABLE_CUSTOMERS . ' as c  where c.customers_id = o.customers_id and orders_status = 3';
if (postOK('sale_order_id')) {
    $query .= ' and o.orders_id = ' . $_POST['sale_order_id'];
}
header('Content-type: text/xml');
echo executeSQL($query);
tep_db_close();
?>