Exemple #1
0
/**
 * getting store hanging methods array from databas
 * @param int $store_id
 * @return array
 */
function get_store_hanging_methods($store_id)
{
    $store_id = abs((int) $store_id);
    $query = "SELECT h.* FROM stores_hanging_methods as s INNER JOIN hanging_methods AS h ON h.id = s.hanging_method_id WHERE s.store_id = {$store_id}";
    $result = db_query_to_array($query);
    return $result;
}
Exemple #2
0
/**
 * Gets the system settings from the database
 *
 * @return array list with system settings
 * the KEY column becomes the array key and
 * the VALUE column becomes the corresponding value
 * for that key
 */
function get_settings()
{
    $return = [];
    $query = "SELECT * FROM system_settings";
    $data = db_query_to_array($query);
    if (!empty($data)) {
        foreach ($data as $_row) {
            $return[$_row['KEY']] = $_row['VALUE'];
        }
    }
    return $return;
}
Exemple #3
0
/**
 * Gets the attibutes of a contact
 *
 * @param string $contact_mech_id the id of the contact mech
 * @return array list with attribures and their values
 */
function contact_mech_get_attributes($contact_mech_id)
{
    $query = "SELECT ATTR_NAME, ATTR_VALUE\n\t\t\t  FROM contact_mech_attribute\n\t\t\t  WHERE CONTACT_MECH_ID = '" . esc($contact_mech_id) . "'";
    return db_query_to_array($query);
}
Exemple #4
0
/**
 * getting order week numbers by order id
 * @return array $weeks
 */
function get_order_weeks($order_id)
{
    $week_numbers = db_query_to_array("SELECT week_number, type FROM orders_weeks WHERE order_id = {$order_id} ORDER BY type");
    $weeks = array();
    foreach ($week_numbers as $w) {
        $weeks[$w['type']] = $w['week_number'];
    }
    return $weeks;
}
Exemple #5
0
/**
 * Gets the categories that are part of a catalog
 *
 * @param string $catalog_id the id of the product catalog
 * @return array list with categories and their data
 */
function catalog_categories_get($catalog_id)
{
    $query = "SELECT pcc.PROD_CATALOG_ID, pcc.PRODUCT_CATEGORY_ID, pc.DESCRIPTION, pc.CATEGORY_NAME\n\t\t\t  FROM prod_catalog_category pcc\n\t\t\t  JOIN product_category pc ON pcc.PRODUCT_CATEGORY_ID = pc.PRODUCT_CATEGORY_ID\n\t\t\t  WHERE pcc.PROD_CATALOG_ID ='" . esc($catalog_id) . "'\n\t\t\t  ORDER BY pcc.SEQUENCE_NUM ASC";
    return db_query_to_array($query);
}
Exemple #6
0
/**
 * Gets all possible product features
 *
 * @param boolean $list if we want a list with PRODUCT_FEATURE_ID-s only
 * @return array list with product features
 */
function product_feature_all($list = false)
{
    $query = "SELECT PRODUCT_FEATURE_ID, PRODUCT_FEATURE_TYPE_ID, DESCRIPTION\n\t\t\t  FROM product_feature\n\t\t\t  ORDER BY PRODUCT_FEATURE_ID ASC";
    if ($list) {
        return db_query_to_list($query, 'PRODUCT_FEATURE_ID');
    }
    return db_query_to_array($query);
}
Exemple #7
0
/**
 * Returns a list with values from the result
 * of the specified query
 *
 * @param string $query the MySQL query
 * @param string $column the column from the result
 * @return array list with values
 */
function db_query_to_list($query, $column)
{
    $return = array();
    $data = db_query_to_array($query);
    if (!empty($data)) {
        foreach ($data as $row) {
            if (isset($row[$column])) {
                $return[] = $row[$column];
            }
        }
    }
    return $return;
}
Exemple #8
0
/**
 * Gets orders on a page
 *
 * @param int $page - number of the page
 * @param str $status_id - status of the orders
 * @param str $type      - type of the orders
 * @param str $search    - a search keyphrase
 * @param date $from_date - starting date of the orders
 * @param date $to_date   - ending date of the orders
 * @param bool $delivery_date - whether a delivery date(true) or order date (fasle)
 * @return arr - list with orders
 */
function orders_get($page, $status_id, $type, $search, $from_date, $to_date, $delivery_date)
{
    $where = order_search_build_where_clause($search, $from_date, $to_date, $delivery_date);
    if (is_array($status_id)) {
        $status_check = "AND oh.STATUS_ID IN ('" . implode("','", $status_id) . "')";
    } else {
        $status_check = "AND oh.STATUS_ID = '" . esc($status_id) . "'";
    }
    $query = "SELECT oh.ORDER_ID, oh.COMPANY, oh.CREATED_BY, oh.LOCATION, oh.EXTERNAL_ID, oh.ORDER_DATE, oh.DELIVERY_DATE, oh.STATUS_ID, oro.PARTY_ID, oh.GRAND_TOTAL, oh.DPD_TEXT,\n\t\t\t\t\t oh.GRAND_TOTAL_NO_TAX, oh.CURRENCY_UOM, oh.SYNC_STATUS_ID, oh.COMMENTS, oh.SESSION_SERILIALIZE\n\t\t\t  FROM order_header oh JOIN order_role oro\n\t\t\t  ON oh.ORDER_ID = oro.ORDER_ID\n\t\t\t  WHERE oh.ORDER_TYPE_ID='" . esc($type) . "' {$status_check} AND oro.ROLE_TYPE_ID = '" . ORDER_CUSTOMER . "' {$where}\n\t\t\t  ORDER BY oh.ORDER_DATE DESC ";
    if ($page !== false) {
        $query .= db_get_limit($page);
    }
    return db_query_to_array($query);
}
Exemple #9
0
    if (empty($weeks)) {
        insert_to_db('orders_weeks', array('order_id' => $order_id, 'week_number' => $week_number, 'type' => $type_key));
    } else {
        update_in_db('orders_weeks', array('week_number' => $week_number), 'id = ' . $weeks['id']);
    }
    $_SESSION['order_id'] = $order_id;
    header('location: /test/checkout');
    exit;
}
import('store');
import('checkout');
$template_name = 'additional_' . $type;
// if user clicked last button getting last order details and showing last order template
if ('last' == get_url_param(3)) {
    $additional_orders = get_last_additional_banner_order($_SESSION['user']['id'], $type_key);
    if ($additional_orders) {
        $template_name .= '_last';
    } else {
        header('location: /test/additional/' . $type);
        exit;
    }
}
//setting view template
$template = set_template('test', $template_name);
$link = THEME . 'template2.php';
$stores = db_query_to_array("SELECT * FROM stores");
$stores_methods = array();
foreach ($stores as $store) {
    $stores_methods[$store['id']] = get_store_hanging_methods($store['id']);
}
require_once $link;
Exemple #10
0
/**
 * Gets a list of documents by their associated order
 *
 * @param string $order_id the id of the order
 * @return array list with documents
 */
function documents_get($order_id)
{
    $query = "SELECT * FROM document WHERE DOCUMENT_ID LIKE 'DOC_{$order_id}%'";
    return db_query_to_array($query);
}
Exemple #11
0
/**
 *
 * Gets a list of customers
 * @param int $page     - number of page
 * @param str $order_by - the column to be ordered by
 * @param str $asc      - the orientation of the sorting
 * @return arr - list wiht clients
 */
function users_get_clients($page, $order_by, $asc)
{
    if ($order_by == '') {
        $order_by = 'pe.FIRST_NAME';
    }
    if ($order_by == 'pe.PARTY_ID') {
        $order_by = 'CAST( SUBSTR(pe.PARTY_ID FROM 3) as SIGNED INTEGER)';
    }
    if ($asc == '') {
        $asc = 'ASC';
    }
    $query = "SELECT p.DATA_SOURCE_ID,\n\t\t\t\t\t pe.PARTY_ID, pe.COMPANY, pe.FIRST_NAME, pe.LAST_NAME, pe.STATUS_ID,\n\t\t\t\t\t ul.ENABLED\n\t\t\t  FROM party p JOIN person pe JOIN user_login ul JOIN party_role pr\n\t\t\t  ON p.PARTY_ID = pe.PARTY_ID AND pe.PARTY_ID = ul.PARTY_ID AND pr.PARTY_ID = p.PARTY_ID\n\t\t\t  WHERE pr.ROLE_TYPE_ID = '" . ROLE_CLIENT . "' AND pe.STATUS_ID != '" . DELETED . "'\n\t\t\t  ORDER BY {$order_by} {$asc}";
    if ($page) {
        $query .= db_get_limit($page);
    }
    return db_query_to_array($query);
}
Exemple #12
0
<?php

$store_list = db_query_to_array("SELECT * FROM `stores`");
?>
<!doctype html>
<html>
<head>
	<meta charset="utf-8">
	<title><?php 
echo WEBSITE;
?>
 :: Customer Universe</title>
	<meta content="width=device-width, initial-scale=1.0" name="viewport">
	<meta content="" name="description">
	<meta content="" name="author">

	<!-- Le styles -->
	<link rel="stylesheet" href="/themes/<?php 
echo THEME_NAME;
?>
/css/bootstrap.min.css">
	<link rel="stylesheet" href="/themes/<?php 
echo THEME_NAME;
?>
/css/bootstrap-responsive.min.css">
	<link rel="stylesheet" href="/themes/<?php 
echo THEME_NAME;
?>
/css/bootstrap-responsive-480px.min.css">
	<!--    <link rel="stylesheet" href="/themes/--><?//=THEME_NAME?><!--/css/bootstrap3.css">-->