示例#1
0
         }
     }
     if (isset($default_model)) {
         $imgq['products_model'] = $default_model;
     }
     if ($imgq) {
         tep_db_perform(TABLE_PRODUCTS, $imgq, 'update', "products_id='" . (int) $products_id . "'");
     }
 }
 foreach ($cus_groups as $cgrp => $cgname) {
     if ($cgrp && $_POST['sppcoption'][$cgrp] && $_POST['sppcprice'][$cgrp]) {
         $prc = $_POST['sppcprice'][$cgrp];
         $rate = $_POST['products_price'] > 0 ? $prc / $_POST['products_price'] : 1;
         foreach ($product_ids as $pid) {
             $mprc = isset($prDiff[$pid][$cgrp]) ? $prc + $prDiff[$pid][$cgrp] : $prc + $rate * $prDiff[$pid][0];
             IXdb::query("REPLACE into products_groups (products_id, customers_group_id, customers_group_price) VALUES ('{$pid}','{$cgrp}','{$mprc}')");
         }
     } else {
         tep_db_query("delete from " . TABLE_PRODUCTS_GROUPS . " where customers_group_id = '" . $cgrp . "' and products_id IN (" . join(',', $product_ids) . ")");
     }
     if (isset($_POST[discount_qty][$cgrp])) {
         tep_db_query("DELETE FROM products_discount WHERE products_id='" . $products_id . "' AND customers_group_id='" . $cgrp . "'");
         for ($i = 0; isset($_POST[discount_qty][$cgrp][$i]); $i++) {
             if ($_POST[discount_qty][$cgrp][$i] > 0) {
                 tep_db_query("INSERT INTO products_discount (products_id,customers_group_id,discount_qty,discount_percent) VALUES ('{$products_id}','{$cgrp}','" . addslashes($_POST[discount_qty][$cgrp][$i]) . "','" . addslashes($_POST[discount_percent][$cgrp][$i]) . "')");
             }
         }
     }
 }
 // # END Separate Pricing Per Customer
 // # XSell - Cross sell
示例#2
0
header("Content-Type: text/csv; charset=utf8");
header('Content-Disposition: attachment; filename="products_' . $date . '.csv"');
header('Cache-Control: public');
$cols = array();
$attr_qry = tep_db_query("SELECT * from products_options WHERE language_id='{$languages_id}' AND products_options_name!=''");
while ($attr_row = tep_db_fetch_array($attr_qry)) {
    $cols[$attr_row['products_options_id']] = 'attr_' . strtolower(str_replace(' ', '_', $attr_row['products_options_name']));
}
?>
categories_name,products_name,products_model,products_sku,products_price,products_quantity,products_info,products_description,products_head_keywords_tag,manufacturers_name<?php 
echo $cols ? ',' . join(',', $cols) : '';
?>
,xsell
<?php 
if ($_GET['data']) {
    $qry = IXdb::query("SELECT m.*,pd.*,p.* \n\t\t\t    FROM products p \n\t\t\t    LEFT JOIN products_description pd ON (p.master_products_id = pd.products_id AND language_id='{$languages_id}') \n\t\t\t    LEFT JOIN manufacturers m ON (m.manufacturers_id = p.manufacturers_id) \n\t\t\t    ORDER BY p.master_products_id,p.products_id = p.master_products_id");
    $pf = array();
    while ($row = IXdb::fetch($qry)) {
        if ($pf[$row['master_products_id']] && $row['products_id'] == $row['master_products_id']) {
            continue;
        }
        $pf[$row['master_products_id']]++;
        $cat = array();
        $cid = IXdb::read("SELECT categories_id FROM products_to_categories WHERE products_id='{$row['master_products_id']}'", NULL, 'categories_id');
        while ($cid) {
            $cinfo = IXdb::read("SELECT * FROM categories c LEFT JOIN categories_description cd ON (c.categories_id=cd.categories_id AND cd.language_id='{$languages_id}') WHERE c.categories_id='{$cid}'");
            $cat[] = $cinfo['categories_name'];
            $cid = $cinfo['parent_id'];
        }
        $csv = array(join(' >> ', array_reverse($cat)), $row['products_name'], $row['products_model'], $row['products_sku'], $row['products_price'], $row['products_quantity'], $row['products_info'], $row['products_description'], $row['products_head_keywords_tag'], $row['manufacturers_name']);
        $attrs = IXdb::read("SELECT * FROM products_attributes pa LEFT JOIN products_options_values pov ON (pa.options_values_id=pov.products_options_values_id AND pov.language_id='{$languages_id}') WHERE pa.products_id='{$row['products_id']}'", 'options_id', 'products_options_values_name');
示例#3
0
 if ($error == false) {
     $sql_data_array = array('customers_firstname' => $customers_firstname, 'customers_lastname' => $customers_lastname, 'customers_email_address' => $customers_email_address, 'customers_telephone' => $customers_telephone, 'customers_fax' => $customers_fax, 'customers_newsletter' => $customers_newsletter, 'customers_group_id' => $customers_group_id, 'customers_group_ra' => $customers_group_ra, 'customers_payment_allowed' => $customers_payment_allowed, 'customers_shipment_allowed' => $customers_shipment_allowed, 'customers_referred_by' => $customers_referred_by, 'member_flag' => $member_flag, 'customers_password' => !empty($_POST['customers_password']) ? $customers_password : $existing_customers_password);
     if (ACCOUNT_GENDER == 'true') {
         $sql_data_array['customers_gender'] = $customers_gender;
     }
     if (ACCOUNT_DOB == 'true') {
         $sql_data_array['customers_dob'] = tep_date_raw($customers_dob);
     }
     tep_db_perform(TABLE_CUSTOMERS, $sql_data_array, 'update', "customers_id = '" . (int) $customers_id . "'");
     if (isset($_POST['extra'])) {
         $xlst = array();
         foreach ($_POST['extra'] as $xkey => $xval) {
             $xlst[] = "('{$customers_id}','{$xkey}','{$xval}')";
         }
         if ($xlst) {
             IXdb::query("REPLACE INTO customers_extra (customers_id,customers_extra_key,customers_extra_value) VALUES " . join(',', $xlst));
         }
     }
     tep_db_query("update " . TABLE_CUSTOMERS_INFO . " set customers_info_date_account_last_modified = now() where customers_info_id = '" . (int) $customers_id . "'");
     if ($entry_zone_id > 0) {
         $entry_state = '';
     }
     $sql_data_array = array('entry_firstname' => $customers_firstname, 'entry_lastname' => $customers_lastname, 'entry_street_address' => $entry_street_address, 'entry_postcode' => $entry_postcode, 'entry_city' => $entry_city, 'entry_country_id' => $entry_country_id);
     if (ACCOUNT_COMPANY == 'true') {
         $sql_data_array['entry_company'] = $entry_company;
         $sql_data_array['entry_company_tax_id'] = $entry_company_tax_id;
     }
     if (ACCOUNT_COMPANY == 'true') {
         $sql_data_array['entry_company'] = $entry_company;
     }
     if (ACCOUNT_SUBURB == 'true') {
示例#4
0
        $result = tep_db_query($query);
        if (tep_db_num_rows($result)) {
            $row = tep_db_fetch_array($result);
            $master_products_id = $row["products_id"];
            $new_master = 0;
            $lst = array();
            foreach (array('products_info', 'products_description', 'products_url', 'products_head_keywords_tag') as $k) {
                if ($product[$k] != '') {
                    $lst[] = $k . '="' . mysql_real_escape_string($product[$k]) . '"';
                }
            }
            if ($lst) {
                tep_db_query("UPDATE products_description SET " . join(',', $lst) . " WHERE products_id='{$master_products_id}'");
            }
            if ($product["categories_id"]) {
                IXdb::query('INSERT IGNORE INTO products_to_categories SET products_id=' . $master_products_id . ',categories_id=' . $product["categories_id"]);
            }
        } else {
            // insert master
            $new_master = 1;
            $query = 'INSERT INTO products SET
			products_sku ="' . mysql_real_escape_string($product["products_sku"]) . '",
			products_model ="' . mysql_real_escape_string($product["products_model"]) . '",
			products_price =' . floatval($product["products_price"]) . ',
			products_weight =' . floatval($product["products_weight"]) . ',
			products_quantity =' . intval($cells[$column_names["products_quantity"]]) . ',
			products_image =' . floatval($product["products_image"]) . ',
			manufacturers_id =' . intval($manufacturers[$column_names["manufacturers_name"]] . ',
			products_status=' . $product["products_status"]);
            $result = tep_db_query($query);
            $master_products_id = tep_db_insert_id();