本文整理汇总了PHP中cw_array2update函数的典型用法代码示例。如果您正苦于以下问题:PHP cw_array2update函数的具体用法?PHP cw_array2update怎么用?PHP cw_array2update使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cw_array2update函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cw_fbauth_user_login
function cw_fbauth_user_login($user)
{
global $tables, $current_area;
cw_load('crypt', 'user', 'mail');
$user_data = cw_query_first("SELECT customer_id, email, password\n\t\t\t\t\t\t\t\t\tFROM {$tables['customers']} \n\t\t\t\t\t\t\t\t\tWHERE oauth_uid='" . $user['id'] . "' AND oauth_type='F' \n\t\t\t\t\t\t\t\t\t\tAND usertype='" . $current_area . "' \n\t\t\t\t\t\t\t\t\t\tAND status='Y'");
if (!empty($user_data)) {
// login user
global $email, $password, $action;
$email = $user_data['email'];
$password = text_decrypt($user_data['password']);
$action = 'login';
cw_include('include/login.php');
} else {
// create user
$register = array();
$register['email'] = $user['email'];
if (strpos($user['email'], "proxymail.facebook.com") !== FALSE) {
cw_header_location("index.php?target=fb_auth_get_email", TRUE);
}
$register['password'] = $register['password2'] = md5(uniqid('cw_', TRUE), TRUE);
$register['usertype'] = $current_area;
$partner_membership =& cw_session_register('partner_membership');
$register['membership_id'] = $partner_membership;
$customer_id = cw_user_create_profile($register);
$identifiers =& cw_session_register('identifiers', array());
$identifiers[$current_area] = array('customer_id' => $customer_id);
$customer = array('oauth_uid' => $user['id']);
cw_array2update('customers', $customer, "customer_id='{$customer_id}'");
$address = array('main' => 1, 'firstname' => $user['first_name'], 'lastname' => $user['last_name']);
$additional_info = array('sex' => $user['gender'] == 'male' ? 1 : 0);
$userinfo = array('addresses' => $address, 'additional_info' => $additional_info);
cw_user_update($userinfo, $customer_id, $customer_id);
cw_user_send_modification_mail($customer_id, TRUE);
}
}
示例2: cw_ps_bundle_update
function cw_ps_bundle_update($product_id)
{
global $tables, $config;
$product_id = (int) $product_id;
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
cw_ps_bundle_redirect($product_id);
}
$offer_id = cw_call('cw_ps_offer_bundle_update', array($product_id, $_POST));
// Delete selected products
if (is_array($_POST['del_cond'])) {
foreach ($_POST['del_cond'] as $k => $v) {
$k = intval($k);
db_query("DELETE FROM {$tables['ps_cond_details']} WHERE offer_id='{$offer_id}' AND object_id='{$k}' AND object_type='" . PS_OBJ_TYPE_PRODS . "'");
db_query("DELETE FROM {$tables['ps_bonus_details']} WHERE offer_id='{$offer_id}' AND object_id='{$k}' AND object_type='" . PS_OBJ_TYPE_PRODS . "'");
}
}
$cond_products = cw_query_column("SELECT object_id FROM {$tables['ps_cond_details']} WHERE offer_id='{$offer_id}' AND object_type='" . PS_OBJ_TYPE_PRODS . "'");
if (count($cond_products) <= 1) {
//delete offer
cw_call('cw_ps_offer_delete', array($offer_id));
}
cw_array2update('ps_offers', array('auto' => 0), "offer_id='{$offer_id}'");
// TODO: Domain assignation
cw_ps_bundle_redirect($product_id);
}
示例3: cw_edit_on_place_product
function cw_edit_on_place_product($token_data, $value)
{
$edited_language =& cw_session_register('edited_language');
if ($token_data['table'] == 'products' && $token_data['field'] == 'product' && !empty($token_data['pk'])) {
$lng_data = array('product' => $value);
cw_array2update('products_lng', $lng_data, "code='{$edited_language}' AND product_id='{$token_data['pk']}'");
}
}
示例4: update_video
function update_video($product_id)
{
global $tables;
assert('!empty($product_id) /* ' . __FUNCTION__ . ' */');
$video = $_POST['video'];
foreach ($video as $vid => $v) {
cw_array2update('product_video', $v, "video_id='{$vid}'", array('pos', 'title', 'descr', 'code'));
}
return true;
}
示例5: cw_add_class_data
function cw_add_class_data($data, $product_id)
{
global $tables;
# Update class data
$comp = $data['class'];
$comp['product_id'] = $product_id;
cw_unset($comp, "product_option_id");
$comp = cw_addslashes($comp);
$product_option_id = cw_query_first_cell("SELECT product_option_id FROM {$tables['product_options']} WHERE class = '{$comp['class']}' AND product_id = '{$comp['product_id']}'");
$is_new = empty($product_option_id);
if (!empty($product_option_id)) {
cw_array2update("product_options", $comp, "product_option_id = '{$product_option_id}'");
} else {
$product_option_id = cw_array2insert("product_options", $comp);
}
# Update class multilanguage data
db_query("DELETE FROM {$tables['product_options_lng']} WHERE product_option_id = '{$product_option_id}'");
foreach ($data['product_options_lng'] as $v) {
$v['product_option_id'] = $product_option_id;
$v = cw_addslashes($v);
cw_array2insert("product_options_lng", $v, true);
}
# Update class options
$ids = array();
foreach ($data['product_options_values'] as $k => $opt) {
$opt['product_option_id'] = $product_option_id;
$old_option_id = $opt['option_id'];
cw_unset($opt, "option_id");
$opt = cw_addslashes($opt);
$option_id = cw_query_first_cell("SELECT option_id FROM {$tables['product_options_values']} WHERE product_option_id = '{$product_option_id}' AND name = '{$opt['name']}'");
if (empty($option_id)) {
$option_id = cw_array2insert("product_options_values", $opt);
} else {
cw_array2update("product_options_values", $opt, "option_id = '{$option_id}'");
}
$ids[$old_option_id] = $option_id;
}
# Update class option multilanguage data
db_query("DELETE FROM {$tables['product_options_values_lng']} WHERE option_id = '{$option_id}'");
foreach ($data['product_options_values_lng'] as $v) {
if (!isset($ids[$v['option_id']])) {
continue;
}
$v['option_id'] = $ids[$v['option_id']];
$v = cw_addslashes($v);
cw_array2insert("product_options_values_lng", $v, true);
}
# Detect and delete old product option class options
$ids = cw_query_column("SELECT option_id FROM {$tables['product_options_values']} WHERE product_option_id = '{$product_option_id}' AND option_id NOT IN ('" . implode("','", $ids) . "')");
if (!empty($ids)) {
db_query("DELETE FROM {$tables['product_options_values']} WHERE product_option_id = '{$product_option_id}' AND option_id IN ('" . implode("','", $ids) . "')");
db_query("DELETE FROM {$tables['product_options_values_lng']} WHERE option_id IN ('" . implode("','", $ids) . "')");
db_query("DELETE FROM {$tables['products_options_ex']} WHERE option_id IN ('" . implode("','", $ids) . "')");
}
}
示例6: cw_web_set_layout_width
function cw_web_set_layout_width($layout, $id, $width, $height)
{
global $tables;
if (empty($id)) {
return;
}
if (!cw_query_first_cell($sql = "select count(*) from {$tables['layouts_elements']} where layout_id='{$layout}' and id = '{$id}'")) {
cw_array2insert('layouts_elements', array('layout_id' => $layout, 'id' => $id));
}
cw_array2update('layouts_elements', array('width' => $width, 'height' => $height), "layout_id='{$layout}' and id = '{$id}'");
}
示例7: modify
function modify()
{
global $posted_data, $REQUEST_METHOD;
if ($REQUEST_METHOD == "POST") {
foreach ($posted_data as $lib_id => $stage_data) {
if (!empty($stage_data['default_status']) && is_array($stage_data['default_status'])) {
$stage_data['default_status'] = serialize($stage_data['default_status']);
}
cw_array2update('product_stages_library', $stage_data, "stage_lib_id='{$lib_id}'");
}
cw_header_location("index.php?target=product_stages");
}
}
示例8: product_stages_modify
function product_stages_modify()
{
global $posted_data, $default_status, $REQUEST_METHOD, $product_id;
if ($REQUEST_METHOD == "POST") {
foreach ($posted_data as $setting_id => $stage_data) {
$update_stage_data = array('period' => $stage_data['period'], 'active' => !empty($stage_data['active']) ? 1 : 0);
if ($default_status[$setting_id]) {
$update_stage_data['status'] = -1;
} else {
$update_stage_data['status'] = serialize($stage_data['status']);
}
cw_array2update('product_stages_product_settings', $update_stage_data, "setting_id='{$setting_id}'");
}
cw_header_location("index.php?target=products&mode=details&product_id={$product_id}&js_tab=product_stages");
}
}
示例9: cw_system_messages_add
function cw_system_messages_add($code, $msg, $type = SYSTEM_MESSAGE_COMMON, $severity = SYSTEM_MESSAGE_INFO)
{
global $tables;
$code = mysql_real_escape_string($code);
$msg = mysql_real_escape_string($msg);
$type = intval($type);
$existing = cw_query_first("SELECT code, hidden FROM {$tables['system_messages']} WHERE code='{$code}'");
$data = array('date' => cw_core_get_time(), 'message' => $msg, 'type' => $type, 'severity' => $severity);
if ($existing) {
$ret = cw_array2update('system_messages', $data, "code='{$code}'");
} else {
$data['code'] = $code;
$data['hidden'] = 0;
$ret = cw_array2insert('system_messages', $data);
}
return $ret;
}
示例10: cw_flexible_import_save_profile
function cw_flexible_import_save_profile($params, $profile_type)
{
global $tables, $var_dirs;
$id = $params['id'];
$name = $params['name'];
$descr = $params['description'];
$test_import_file_tmp = $params['test_import_file']['tmp_name'];
if (!empty($params['test_import_file'])) {
unset($params['test_import_file']['tmp_name'], $params['test_import_file']['error']);
}
unset($params['id'], $params['name'], $params['description'], $params['type']);
$profile_options = serialize($params);
if ($id) {
$res = cw_array2update($tables['flexible_import_profiles'], array('name' => $name, 'description' => $descr, 'type' => $profile_type, 'options' => $profile_options), "id='" . $id . "'");
} else {
$res = cw_array2insert($tables['flexible_import_profiles'], array('name' => $name, 'description' => $descr, 'type' => $profile_type, 'options' => $profile_options));
}
if (!empty($params['test_import_file']) && $res && file_exists($test_import_file_tmp)) {
if ($id) {
$test_import_file_path = $var_dirs['flex_import_test'] . '/' . $id;
} else {
$test_import_file_path = $var_dirs['flex_import_test'] . '/' . $res;
}
if (!file_exists($var_dirs['flex_import_test'])) {
mkdir($var_dirs['flex_import_test']);
}
if (!file_exists($test_import_file_path)) {
mkdir($test_import_file_path);
}
if ($test_import_file_path . '/' . $params['test_import_file']['name'] != $test_import_file_tmp) {
@unlink($test_import_file_path . '/' . $params['test_import_file']['name']);
rename($test_import_file_tmp, $test_import_file_path . '/' . $params['test_import_file']['name']);
}
}
return $res;
}
示例11: cw_user_delete_memberships
function cw_user_delete_memberships($del)
{
global $tables;
if (!is_array($del)) {
$del[] = $del;
}
if (!count($del)) {
return;
}
$delete_string = "membership_id IN ('" . implode("','", $del) . "')";
if (cw_query_first_cell("SELECT COUNT(*) FROM {$tables['memberships']} WHERE area IN ('C', 'R') AND " . $delete_string)) {
$recalc_subcat_count = true;
}
db_query("DELETE FROM {$tables['memberships']} WHERE " . $delete_string);
db_query("DELETE FROM {$tables['super_deals']} WHERE " . $delete_string);
db_query("DELETE FROM {$tables['categories_memberships']} WHERE " . $delete_string);
db_query("DELETE FROM {$tables['products_memberships']} WHERE " . $delete_string);
db_query("DELETE FROM {$tables['tax_rate_memberships']} WHERE " . $delete_string);
db_query("DELETE FROM {$tables['memberships_lng']} WHERE " . $delete_string);
db_query("DELETE FROM {$tables['payment_methods_memberships']} WHERE " . $delete_string);
db_query("DELETE FROM {$tables['discounts_memberships']} WHERE " . $delete_string);
db_query("DELETE FROM {$tables['access_levels']} WHERE " . $delete_string);
db_query("DELETE FROM {$tables['newslists_memberships']} WHERE " . $delete_string);
db_query("DELETE FROM {$tables['products_prices']} WHERE " . $delete_string);
db_query("DELETE FROM {$tables['tax_rate_memberships']} WHERE " . $delete_string);
foreach ($del as $id) {
// TODO: move to addon
global $addons;
if ($addons['faq']) {
cw_load('faq');
cw_faq_delete_membership($id);
}
db_query("DELETE FROM {$tables['register_fields_avails']} WHERE area LIKE '%_{$id}'");
}
cw_array2update("customers", array("membership_id" => 0), $delete_string);
if ($recalc_subcat_count) {
cw_load('category');
cw_recalc_subcat_count(0, 100);
}
}
示例12: setMain
function setMain($product_id, $category_id = null)
{
if (empty($product_id)) {
return false;
}
$data = array('main' => 0);
cw_array2update('products_categories', $data, 'product_id = "' . intval($product_id) . '"');
$data = array('main' => 1);
cw_array2update('products_categories', $data, 'product_id = "' . intval($product_id) . '"' . (!is_null($category_id) ? ' AND category_id = "' . intval($category_id) . '"' : '') . ' LIMIT 1');
}
示例13: db_query
}
db_query("DELETE FROM {$tables['shipping_rates']} WHERE rate_id='{$rate_id}' {$warehouse_condition} {$type_condition}");
$deleted = true;
}
if ($deleted) {
$top_message['content'] = cw_get_langvar_by_name("msg_shipping_rates_del");
}
}
}
if ($action == "update") {
#
# Update shipping table
#
if (is_array($posted_data)) {
foreach ($posted_data as $rate_id => $v) {
cw_array2update("shipping_rates", array("minweight" => cw_convert_number($v['minweight']), "maxweight" => cw_convert_number($v['maxweight']), "mintotal" => cw_convert_number($v['mintotal']), "maxtotal" => cw_convert_number($v['maxtotal']), "rate" => cw_convert_number($v['rate']), "item_rate" => cw_convert_number($v['item_rate']), "rate_p" => cw_convert_number($v['rate_p']), "overweight" => cw_convert_number($v['overweight']), "overweight_rate" => cw_convert_number($v['overweight_rate']), "rate_p" => cw_convert_number($v['rate_p']), "weight_rate" => cw_convert_number($v['weight_rate'])), "rate_id='{$rate_id}' {$warehouse_condition} {$type_condition}");
}
$top_message['content'] = cw_get_langvar_by_name("msg_shipping_rates_upd");
}
}
if ($action == "add") {
#
# Add new shipping rate
#
if ($shipping_id_new) {
cw_array2insert("shipping_rates", array("shipping_id" => $shipping_id_new, "minweight" => cw_convert_number($minweight_new), "maxweight" => cw_convert_number($maxweight_new), "maxamount" => cw_convert_number($maxamount_new), "mintotal" => cw_convert_number($mintotal_new), "maxtotal" => cw_convert_number($maxtotal_new), "rate" => cw_convert_number($rate_new), "item_rate" => cw_convert_number($item_rate_new), "rate_p" => cw_convert_number($rate_p_new), "weight_rate" => cw_convert_number($weight_rate_new), "warehouse_customer_id" => $user_account['warehouse_customer_id'], "zone_id" => $zone_id_new, "type" => $type, "overweight" => cw_convert_number($overweight_new), "overweight_rate" => cw_convert_number($overweight_rate_new)));
$top_message['content'] = cw_get_langvar_by_name("msg_shipping_rate_add");
}
}
cw_header_location("index.php?target=shipping_rates&zone_id={$zone_id}&shipping_id={$shipping_id}&type={$type}");
}
示例14: ppd_modify
function ppd_modify($product_id)
{
global $tables, $top_message, $smarty, $available_fields;
global $extra_fields, $optional_fields, $skip_striptags_fields;
$product_id = (int) $product_id;
global $file_id;
if (!isset($file_id)) {
$file_id = isset($_POST['file_id']) ? (int) $_POST['file_id'] : 0;
}
$file_id = (int) $file_id;
global $file_data;
if (!isset($file_data)) {
$file_data = null;
if (isset($_POST['file_data'])) {
$file_data =& $_POST['file_data'];
}
}
if (empty($file_id) || empty($file_data) || !is_array($file_data) || $_SERVER['REQUEST_METHOD'] != 'POST') {
ppd_redirect($product_id);
}
$table = $tables['ppd_files'];
$file_id = cw_query_first_cell('SELECT file_id FROM ' . $table . ' WHERE file_id = \'' . $file_id . '\'');
if (empty($file_id)) {
ppd_redirect($product_id);
}
$error = null;
$data = array();
if (isset($available_fields['file_id'])) {
unset($available_fields['file_id']);
}
$additional_lang_data = array();
foreach ($available_fields as $field => $field_type) {
if (isset($file_data[$field])) {
if (isset($extra_fields[$field]) && is_array($extra_fields[$field])) {
$_total_value = $_value = null;
foreach ($extra_fields[$field] as $extra_field) {
$_value = isset($file_data[$field][$extra_field]) ? $file_data[$field][$extra_field] : null;
@settype($_value, $field_type);
$_total_value += $_value;
}
$file_data[$field] = $_total_value;
}
$result = settype($file_data[$field], $field_type);
if ($result === false) {
$error = 'msg_ppd_incorrect_field_type';
$additional_lang_data = array('field_name' => $field);
break;
}
if (empty($file_data[$field])) {
if (in_array($field, $optional_fields)) {
$data[$field] = null;
}
} else {
if ($field_type == 'string' && !in_array($field, $skip_striptags_fields)) {
$file_data[$field] = cw_strip_tags($file_data[$field]);
}
$data[$field] =& $file_data[$field];
}
} else {
if ($field_type == 'bool') {
$data[$field] = 0;
}
if (isset($extra_fields[$field])) {
$data[$field] = 0;
}
}
}
if (!empty($error)) {
$top_message = array('content' => cw_get_langvar_by_name($error, $additional_lang_data), 'type' => 'E');
ppd_redirect($product_id, $file_id);
}
if (empty($data)) {
$error = 'msg_ppd_nothing_to_update';
$top_message = array('content' => cw_get_langvar_by_name($error, $additional_lang_data), 'type' => 'E');
ppd_redirect($product_id, $file_id);
}
if (isset($data['type_id']) && !empty($data['type_id'])) {
$_type_id = cw_query_first_cell('SELECT type_id FROM ' . $tables['ppd_types'] . ' WHERE type_id = \'' . $data['type_id'] . '\'');
if ($_type_id != $data['type_id']) {
$error = 'msg_ppd_incorrect_filetype';
$top_message = array('content' => cw_get_langvar_by_name($error, $additional_lang_data), 'type' => 'E');
ppd_redirect($product_id, $file_id);
}
}
if (isset($data['type_id']) && empty($data['type_id'])) {
unset($data['type_id']);
}
$product_id_condition = 'product_id = \'' . $product_id . '\' AND ';
cw_array2update($table, $data, $product_id_condition . 'file_id = \'' . $file_id . '\'');
$top_message = array('content' => cw_get_langvar_by_name('msg_ppd_updated_succes'), 'type' => 'I');
ppd_redirect($product_id);
}
示例15: cw_dod_generate
//.........这里部分代码省略.........
if ($generator['no_item_repeat']) {
break;
} else {
if (!empty($used_pids)) {
array_shift($used_pids);
} else {
break;
}
}
}
$safety_cnt--;
}
//die;
if ($new_pid) {
$used_pids[] = $new_pid;
}
$generator['used_pids'] = implode(';', $used_pids);
$regenerate_offer = true;
if ($regenerate_offer) {
//regenerate offer
if (!empty($generator['current_offer_id'])) {
$offer_ids = array($generator['current_offer_id']);
$offer_ids_query = implode("', '", $offer_ids);
db_query("DELETE FROM {$tables['ps_offers']} WHERE offer_id IN ('" . $offer_ids_query . "')");
db_query("DELETE FROM {$tables['ps_bonuses']} WHERE offer_id IN ('" . $offer_ids_query . "')");
db_query("DELETE FROM {$tables['ps_bonus_details']} WHERE offer_id IN ('" . $offer_ids_query . "')");
db_query("DELETE FROM {$tables['ps_conditions']} WHERE offer_id IN ('" . $offer_ids_query . "')");
db_query("DELETE FROM {$tables['ps_cond_details']} WHERE offer_id IN ('" . $offer_ids_query . "')");
db_query("DELETE FROM {$tables['attributes_values']} WHERE item_id IN ('" . $offer_ids_query . "') and item_type='PS'");
foreach ($offer_ids as $offer_id) {
cw_image_delete($offer_id, PS_IMG_TYPE);
}
cw_attributes_cleanup($offer_ids, PS_ATTR_ITEM_TYPE);
cw_cache_clean('shipping_rates');
}
if ($new_pid) {
cw_log_add('dod_generator', array('new DOD product selected' => $new_pid));
$new_offer_id = cw_array2insert('ps_offers', array('title' => 'Deal Of The Day', 'description' => $generator['description'], 'startdate' => time(), 'enddate' => $offer_enddate, 'active' => 1));
}
$current_offer_id = 0;
if ($new_offer_id) {
$mdm_attribute_id = cw_query_first_cell("select attribute_id from {$tables['attributes']} where addon='multi_domains' and item_type='PS'");
if ($mdm_attribute_id) {
cw_array2insert('attributes_values', array('item_id' => $new_offer_id, 'attribute_id' => $mdm_attribute_id, 'value' => 0, 'code' => '', 'item_type' => 'PS'));
}
//copy bonus and bonus details
$dod_bonuses = cw_query("select * from {$tables['dod_bonuses']} where generator_id='{$generator['generator_id']}' and unused=0");
foreach ($dod_bonuses as $dod_bonus) {
$_dod_bonus = $dod_bonus;
unset($_dod_bonus['generator_id']);
$_dod_bonus['offer_id'] = $new_offer_id;
$new_bonus_id = cw_array2insert('ps_bonuses', $_dod_bonus);
if ($_dod_bonus['type'] == 'D' && $_dod_bonus['apply'] == 3) {
cw_array2insert('ps_bonus_details', array('bonus_id' => $new_bonus_id, 'offer_id' => $new_offer_id, 'object_id' => $new_pid, 'quantity' => 1, 'object_type' => DOD_OBJ_TYPE_PRODS));
} else {
$dod_bonus_details = cw_query("select * from {$tables['dod_bonus_details']} where generator_id='{$generator['generator_id']}' and bonus_id='{$dod_bonus['bonus_id']}'");
if (!empty($dod_bonus_details)) {
foreach ($dod_bonus_details as $dod_bonus_detail) {
$_dod_bonus_detail = $dod_bonus_detail;
unset($_dod_bonus_detail['generator_id']);
$_dod_bonus_detail['offer_id'] = $new_offer_id;
$_dod_bonus_detail['bonus_id'] = $new_bonus_id;
cw_array2insert('ps_bonus_details', $_dod_bonus_detail);
}
}
}
}
$new_cond_id = cw_array2insert('ps_conditions', array('type' => 'P', 'total' => '0.00', 'offer_id' => $new_offer_id));
if ($new_cond_id) {
cw_array2insert('ps_cond_details', array('cond_id' => $new_cond_id, 'offer_id' => $new_offer_id, 'object_id' => $new_pid, 'quantity' => 1, 'object_type' => DOD_OBJ_TYPE_PRODS));
}
$current_offer_id = $new_offer_id;
}
}
//update dod_generator fields
cw_array2update('dod_generators', array('current_offer_id' => $current_offer_id, 'used_pids' => $generator['used_pids'], 'current_offer_date' => $current_offer_id ? time() : 0), "generator_id='{$generator['generator_id']}'");
if ($current_offer_id && !empty($config['deal_of_day']['dod_news_template']) && $config['deal_of_day']['dod_newslist']) {
$newslist = cw_query_first("select * from {$tables['newslists']} where list_id='" . $config['deal_of_day']['dod_newslist'] . "' and avail=1");
if (!empty($newslist)) {
//create message
global $smarty;
$smarty->assign('promotion', $generator);
$smarty->assign('product_id', $new_pid);
$product_info = cw_func_call('cw_product_get', array('id' => $new_pid, 'user_account' => $user_account, 'info_type' => 65535));
$smarty->assign('product', $product_info);
$smarty->assign('news_message', $config['deal_of_day']['dod_news_template']);
$message = cw_display("addons/deal_of_day/admin/generate_news.tpl", $smarty, false, $newslist['lngcode']);
$smarty->assign('news_message', $config['deal_of_day']['dod_news_template_subject']);
$message_subject = cw_display("addons/deal_of_day/admin/generate_news.tpl", $smarty, false, $newslist['lngcode']);
// $message = $smarty->display('addons/deal_of_day/admin/generate_news.tpl');
print $message_subject . "<hr />" . $message;
if (!empty($message)) {
cw_array2insert('newsletter', array('subject' => $message_subject, 'body' => $message, 'created_date' => time(), 'send_date' => time(), 'updated_date' => time(), 'status' => 'N', 'list_id' => $config['deal_of_day']['dod_newslist'], 'show_as_news' => 1, 'allow_html' => 1));
}
}
}
}
}
return $new_pid;
}