<?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();
Exemple #2
0
/**
 * Creates a line catgeory variation in osC database
 */
function createValue($value)
{
    tep_db_connect() or die('Unable to connect to database');
    $query = "select max(products_options_values_id) + 1 as id from " . TABLE_PRODUCTS_OPTIONS_VALUES;
    $query = tep_db_query($query);
    $result = tep_db_fetch_array($query);
    $products_options_values_id = $result['id'];
    $language_id = getDefaultLanguageID();
    $sql_array = array('products_options_values_name' => $value, 'language_id' => $language_id, 'products_options_values_id' => $products_options_values_id);
    tep_db_perform(TABLE_PRODUCTS_OPTIONS_VALUES, $sql_array);
    tep_db_close();
    return $products_options_values_id;
}
Exemple #3
0
<?php

include 'tiosafe_config.php';
if (postNotEmpty('title')) {
    $products_name = $_POST['title'];
    $products_sale_price = 0;
    $language_id = getDefaultLanguageID($db);
    $products_date_added = date('Y/m/d h:i:s');
    // Setting the products_status as '1' ie available
    $sql_array = array('products_price' => $products_sale_price, 'products_status' => '1', 'products_date_added' => $products_date_added);
    zen_db_perform(TABLE_PRODUCTS, $sql_array);
    $products_id = zen_db_insert_id();
    $sql_array = array('products_id' => $products_id, 'language_id' => $language_id, 'products_name' => zen_sanitize_string($products_name));
    zen_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_array);
} else {
    echo '\\nInvalid query: The parameter title is required!';
}
$db->close();
Exemple #4
0
<?php

/**
 * Creates a product and returns the ID of the created product in the database
 */
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');
$sql_array = array('products_status' => '1');
tep_db_perform(TABLE_PRODUCTS, $sql_array);
$sql_array = array('products_id' => tep_db_insert_id(), 'language_id' => getDefaultLanguageID(), 'products_name' => $_POST['title']);
tep_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_array);
header('Content-type: text/xml');
echo '<xml><object><id>' . tep_db_insert_id() . '</id></object></xml>';
tep_db_close();