本文整理汇总了PHP中fn_get_notification_rules函数的典型用法代码示例。如果您正苦于以下问题:PHP fn_get_notification_rules函数的具体用法?PHP fn_get_notification_rules怎么用?PHP fn_get_notification_rules使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fn_get_notification_rules函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: update
public function update($id, $params)
{
fn_define('ORDER_MANAGEMENT', true);
$data = array();
$valid_params = true;
$status = Response::STATUS_BAD_REQUEST;
if ($valid_params) {
fn_clear_cart($cart, true);
$customer_auth = fn_fill_auth(array(), array(), false, 'C');
$cart_status = md5(serialize($cart));
// Order info was not found or customer does not have enought permissions
if (fn_form_cart($id, $cart, $customer_auth) && $cart_status != md5(serialize($cart))) {
unset($params['product_groups']);
if (empty($params['shipping_id'])) {
$shipping = reset($cart['shipping']);
if (!empty($shipping['shipping_id'])) {
$params['shipping_id'] = $shipping['shipping_id'];
}
}
$cart['order_id'] = $id;
fn_calculate_cart_content($cart, $customer_auth);
if (!empty($params['user_id'])) {
$cart['user_data'] = fn_get_user_info($params['user_id']);
} elseif (!empty($params)) {
$cart['user_data'] = array_merge($cart['user_data'], $params);
}
if (!empty($cart['product_groups']) && !empty($params['shipping_id'])) {
foreach ($cart['product_groups'] as $key => $group) {
foreach ($group['shippings'] as $shipping_id => $shipping) {
if ($params['shipping_id'] == $shipping['shipping_id']) {
$cart['chosen_shipping'][$key] = $shipping_id;
break;
}
}
}
}
if (!empty($params['payment_id'])) {
if (!empty($params['payment_info'])) {
$cart['payment_info'] = $params['payment_info'];
} elseif ($params['payment_id'] != $cart['payment_id']) {
$cart['payment_info'] = array();
}
$cart['payment_id'] = $params['payment_id'];
}
if (!empty($params['products'])) {
$cart['products'] = $params['products'];
}
fn_calculate_cart_content($cart, $customer_auth);
if (!empty($cart) && empty($cart['shipping_failed'])) {
$cart['parent_order_id'] = 0;
fn_update_payment_surcharge($cart, $customer_auth);
list($order_id, $order_status) = fn_update_order($cart, $id);
if ($order_id) {
if (!empty($params['status']) && fn_check_permissions('orders', 'update_status', 'admin')) {
fn_change_order_status($order_id, $params['status'], '', fn_get_notification_rules($params, false));
} elseif (!empty($order_status)) {
fn_change_order_status($order_id, $order_status, '', fn_get_notification_rules($params, false));
}
$status = Response::STATUS_OK;
$data = array('order_id' => $order_id);
}
}
}
}
return array('status' => $status, 'data' => $data);
}
开发者ID:askzap,项目名称:ultimate,代码行数:66,代码来源:Orders.php
示例2: fn_order_notification
/**
* Send order notification
*
* @param array $order_info order information
* @param array $edp_data information about downloadable products
* @param mixed $force_notification user notification flag (true/false), if not set, will be retrieved from status parameters
* @return array structured data
*/
function fn_order_notification(&$order_info, $edp_data = array(), $force_notification = array())
{
static $notified = array();
$send_order_notification = true;
if (!empty($notified[$order_info['order_id']][$order_info['status']]) && $notified[$order_info['order_id']][$order_info['status']] || $order_info['status'] == STATUS_INCOMPLETED_ORDER || $order_info['status'] == STATUS_PARENT_ORDER) {
$send_order_notification = false;
}
fn_set_hook('send_order_notification', $order_info, $edp_data, $force_notification, $notified, $send_order_notification);
$take_surcharge_from_vendor = false;
if (fn_allowed_for('MULTIVENDOR')) {
$take_surcharge_from_vendor = fn_take_payment_surcharge_from_vendor($order_info['products']);
}
if (!$send_order_notification) {
return true;
}
$order_statuses = fn_get_statuses(STATUSES_ORDER, array(), true, false, $order_info['lang_code'] ? $order_info['lang_code'] : CART_LANGUAGE, $order_info['company_id']);
$status_params = $order_statuses[$order_info['status']]['params'];
$notify_user = !empty($status_params['notify']) && $status_params['notify'] == 'Y';
$notify_department = !empty($status_params['notify_department']) && $status_params['notify_department'] == 'Y';
$notify_vendor = !empty($status_params['notify_vendor']) && $status_params['notify_vendor'] == 'Y';
if (!is_array($force_notification)) {
$force_notification = fn_get_notification_rules($force_notification, !$force_notification);
}
if (isset($force_notification['C'])) {
$notify_user = $force_notification['C'];
}
if (isset($force_notification['A'])) {
$notify_department = $force_notification['A'];
}
if (isset($force_notification['V'])) {
$notify_vendor = $force_notification['V'];
}
if ($notify_user || $notify_department || $notify_vendor) {
$notified[$order_info['order_id']][$order_info['status']] = true;
$order_status = $order_statuses[$order_info['status']];
$payment_id = !empty($order_info['payment_method']['payment_id']) ? $order_info['payment_method']['payment_id'] : 0;
$payment_method = fn_get_payment_data($payment_id, $order_info['order_id'], $order_info['lang_code']);
$status_settings = $order_statuses[$order_info['status']]['params'];
$profile_fields = fn_get_profile_fields('I', '', $order_info['lang_code']);
$secondary_currency = '';
list($shipments) = fn_get_shipments_info(array('order_id' => $order_info['order_id'], 'advanced_info' => true));
$use_shipments = !fn_one_full_shipped($shipments);
// restore secondary currency
if (!empty($order_info['secondary_currency']) && Registry::get("currencies.{$order_info['secondary_currency']}")) {
$secondary_currency = $order_info['secondary_currency'];
}
// Notify customer
if ($notify_user == true) {
Mailer::sendMail(array('to' => $order_info['email'], 'from' => 'company_orders_department', 'data' => array('order_info' => $order_info, 'shipments' => $shipments, 'use_shipments' => $use_shipments, 'order_status' => $order_status, 'payment_method' => $payment_method, 'status_settings' => $status_settings, 'profile_fields' => $profile_fields, 'secondary_currency' => $secondary_currency, 'take_surcharge_from_vendor' => $take_surcharge_from_vendor), 'tpl' => 'orders/order_notification.tpl', 'company_id' => $order_info['company_id']), 'C', $order_info['lang_code']);
if (!empty($edp_data)) {
Mailer::sendMail(array('to' => $order_info['email'], 'from' => 'company_orders_department', 'data' => array('order_info' => $order_info, 'edp_data' => $edp_data), 'tpl' => 'orders/edp_access.tpl', 'company_id' => $order_info['company_id']), 'C', $order_info['lang_code']);
}
}
if ($notify_vendor == true) {
if (fn_allowed_for('MULTIVENDOR') && !empty($order_info['company_id'])) {
$company_lang_code = fn_get_company_language($order_info['company_id']);
// Translate descriptions to admin language
fn_translate_products($order_info['products'], '', $company_lang_code, true);
Mailer::sendMail(array('to' => 'company_orders_department', 'from' => 'default_company_orders_department', 'reply_to' => $order_info['email'], 'data' => array('order_info' => $order_info, 'shipments' => $shipments, 'use_shipments' => $use_shipments, 'order_status' => fn_get_status_data($order_info['status'], STATUSES_ORDER, $order_info['order_id'], $company_lang_code), 'payment_method' => fn_get_payment_data($payment_id, $order_info['order_id'], $company_lang_code), 'status_settings' => $status_settings, 'profile_fields' => fn_get_profile_fields('I', '', $company_lang_code), 'secondary_currency' => $secondary_currency), 'tpl' => 'orders/order_notification.tpl', 'company_id' => $order_info['company_id']), 'A', $company_lang_code);
}
}
// Notify order department
if ($notify_department == true) {
// Translate descriptions to admin language
fn_translate_products($order_info['products'], '', Registry::get('settings.Appearance.backend_default_language'), true);
$payment_method = array();
if ($payment_id) {
$payment_method = fn_get_payment_data($payment_id, $order_info['order_id'], Registry::get('settings.Appearance.backend_default_language'));
}
fn_add_user_data_descriptions($order_info, Registry::get('settings.Appearance.backend_default_language'));
Mailer::sendMail(array('to' => 'default_company_orders_department', 'from' => 'default_company_orders_department', 'reply_to' => $order_info['email'], 'data' => array('order_info' => $order_info, 'shipments' => $shipments, 'use_shipments' => $use_shipments, 'order_status' => fn_get_status_data($order_info['status'], STATUSES_ORDER, $order_info['order_id'], Registry::get('settings.Appearance.backend_default_language')), 'payment_method' => $payment_method, 'status_settings' => $status_settings, 'profile_fields' => fn_get_profile_fields('I', '', Registry::get('settings.Appearance.backend_default_language')), 'secondary_currency' => $secondary_currency), 'tpl' => 'orders/order_notification.tpl', 'company_id' => $order_info['company_id']), 'A', Registry::get('settings.Appearance.backend_default_language'));
}
}
if (!empty($edp_data) && !$notify_user) {
// Send out download links for EDP with "Immediately" Activation mode
// TRUE if the EDP download links e-mail has already been sent. Used to avoid sending duplicate e-mails.
$download_email_sent = false;
foreach ($edp_data as $edp_item) {
foreach ($edp_item['files'] as $file) {
if (!empty($file['activation']) && $file['activation'] == 'I' && !$download_email_sent) {
Mailer::sendMail(array('to' => $order_info['email'], 'from' => 'company_orders_department', 'data' => array('order_info' => $order_info, 'edp_data' => $edp_data), 'tpl' => 'orders/edp_access.tpl', 'company_id' => $order_info['company_id']), 'C', $order_info['lang_code']);
$download_email_sent = true;
break;
}
}
}
}
fn_set_hook('order_notification', $order_info, $order_statuses, $force_notification);
}
开发者ID:heg-arc-ne,项目名称:cscart,代码行数:97,代码来源:fn.cart.php
示例3: db_query
$shipment_id = db_query("INSERT INTO ?:shipments ?e", $shipment_data);
foreach ($_REQUEST['shipment_data']['products'] as $key => $amount) {
if (isset($order_info['items'][$key])) {
$amount = intval($amount);
if ($amount > $order_info['items'][$key]['amount'] - $order_info['items'][$key]['shipped_amount']) {
$amount = $order_info['items'][$key]['amount'] - $order_info['items'][$key]['shipped_amount'];
}
$order_info['items'][$key]['amount'] = $amount;
}
if ($amount == 0) {
continue;
}
$_data = array('item_id' => $key, 'shipment_id' => $shipment_id, 'order_id' => $_REQUEST['shipment_data']['order_id'], 'product_id' => $order_info['items'][$key]['product_id'], 'amount' => $amount);
db_query("INSERT INTO ?:shipment_items ?e", $_data);
}
$force_notification = fn_get_notification_rules($_REQUEST);
if (!empty($force_notification['C'])) {
$shipment = array('shipment_id' => $shipment_id, 'timestamp' => $shipment_data['timestamp'], 'shipping' => db_get_field('SELECT shipping FROM ?:shipping_descriptions WHERE shipping_id = ?i', $shipment_data['shipping_id']), 'tracking_number' => $shipment_data['tracking_number'], 'carrier' => $shipment_data['carrier'], 'comments' => $shipment_data['comments'], 'items' => $_REQUEST['shipment_data']['products']);
$view_mail->assign('shipment', $shipment);
$view_mail->assign('order_info', $order_info);
fn_send_mail($order_info['email'], Registry::get('settings.Company.company_orders_department'), 'shipments/shipment_products_subj.tpl', 'shipments/shipment_products.tpl', '', $order_info['lang_code']);
}
if (!empty($shipment_data['order_status'])) {
fn_change_order_status($_REQUEST['shipment_data']['order_id'], $shipment_data['order_status']);
}
fn_set_notification('N', fn_get_lang_var('notice'), fn_get_lang_var('shipment_has_been_created'));
} else {
fn_set_notification('E', fn_get_lang_var('error'), fn_get_lang_var('products_for_shipment_not_selected'));
}
$suffix = '.details?order_id=' . $_REQUEST['shipment_data']['order_id'];
} elseif ($mode == 'packing_slip' && !empty($_REQUEST['shipment_ids'])) {
开发者ID:diedsmiling,项目名称:busenika,代码行数:31,代码来源:shipments.php
示例4: fn_update_gift_certificate
function fn_update_gift_certificate($gift_cert_data, $gift_cert_id = 0, $params = array())
{
fn_correct_gift_certificate($gift_cert_data);
$gift_cert_data['products'] = !empty($gift_cert_data['products']) ? serialize($gift_cert_data['products']) : '';
if (empty($gift_cert_id)) {
do {
$code = fn_generate_gift_certificate_code();
} while (true == fn_check_gift_certificate_code($code));
$gift_cert_data = fn_array_merge($gift_cert_data, array('gift_cert_code' => $code, 'timestamp' => TIME));
if (fn_allowed_for('ULTIMATE') && Registry::get('runtime.company_id')) {
$gift_cert_data['company_id'] = Registry::get('runtime.company_id');
}
$gift_cert_id = db_query("INSERT INTO ?:gift_certificates ?e", $gift_cert_data);
} else {
// Change certfificate status
fn_change_gift_certificate_status($gift_cert_id, $gift_cert_data['status'], '', fn_get_notification_rules(array(), false));
//if difference then add line in log
$debit_info = db_get_row("SELECT debit AS amount, debit_products AS products FROM ?:gift_certificates_log WHERE gift_cert_id = ?i ORDER BY timestamp DESC", $gift_cert_id);
if (empty($debit_info)) {
$debit_info = db_get_row("SELECT amount, products FROM ?:gift_certificates WHERE gift_cert_id = ?i", $gift_cert_id);
}
$is_diff = $gift_cert_data['amount'] - $debit_info['amount'] != 0 || md5($gift_cert_data['products']) != md5($debit_info['products']);
if ($is_diff == true) {
$_info = array('amount' => $gift_cert_data['amount'], 'products' => $gift_cert_data['products']);
fn_add_gift_certificate_log_record($gift_cert_id, $debit_info, $_info);
}
//Update certificate data
$_data = $gift_cert_data;
db_query("UPDATE ?:gift_certificates SET ?u WHERE gift_cert_id = ?i", $gift_cert_data, $gift_cert_id);
}
$gc_data = fn_get_gift_certificate_info($gift_cert_id);
fn_gift_certificate_notification($gc_data, fn_get_notification_rules($params));
return $gift_cert_id;
}
开发者ID:askzap,项目名称:ultimate,代码行数:34,代码来源:gift_certificates.php
示例5: db_get_field
/*получаем время */
$delivery_time = db_get_field("SELECT time_to_delivery FROM `cscart_orders` WHERE `order_id` ='{$dev_o_id}' LIMIT 0 , 30");
list($order_id, $process_payment) = fn_place_order($cart, $customer_auth, $action);
//апдейтим с помощью функции
db_query("UPDATE `korzin_db`.`cscart_orders` SET `date_to_delivery` = '{$delivery_date}',\n\t\t\t\t\t\t\t`time_to_delivery` = '{$delivery_time}' WHERE `cscart_orders`.`order_id` ='{$dev_o_id}' LIMIT 1");
//апдейтим поля в ручную
if (!empty($order_id)) {
if ($action != 'save') {
$view->assign('order_action', fn_get_lang_var('placing_order'));
$view->display('views/orders/components/placing_order.tpl');
fn_flush();
}
if ($process_payment == true) {
fn_start_payment($order_id, fn_get_notification_rules($_REQUEST));
}
fn_order_placement_routines($order_id, fn_get_notification_rules($_REQUEST), true, $action);
} else {
return array(CONTROLLER_STATUS_REDIRECT, "order_management.summary");
}
}
return array(CONTROLLER_STATUS_OK, "order_management{$_suffix}");
}
// Delete discount coupon
if ($mode == 'delete_coupon') {
unset($cart['coupons'][$_REQUEST['c_id']], $cart['pending_coupon']);
return array(CONTROLLER_STATUS_REDIRECT, "order_management.totals");
}
//
// Edit order
//
if ($mode == 'edit' && !empty($_REQUEST['order_id'])) {
开发者ID:diedsmiling,项目名称:busenika,代码行数:31,代码来源:order_management.php
示例6: fn_gift_certificates_change_order_status
function fn_gift_certificates_change_order_status($status_to, $status_from, &$order_info, $force_notification, $order_statuses)
{
if (isset($order_info['gift_certificates'])) {
foreach ($order_info['gift_certificates'] as $k => $v) {
if (!empty($order_statuses[$status_to]['params']['gift_cert_status'])) {
fn_change_gift_certificate_status($v['gift_cert_id'], $order_statuses[$status_to]['params']['gift_cert_status'], '', fn_get_notification_rules(array(), true));
// skip notification, it will be sent later in order_notification hook
}
}
}
}
开发者ID:arpad9,项目名称:bygmarket,代码行数:11,代码来源:func.php
示例7: fn_get_gift_certificate_templates
$view->assign('sort_order', $sort_order);
$view->assign('sort_by', $sort_by);
if (false != ($last_item = reset($log))) {
$gift_cert_data['amount'] = $last_item['debit'];
$gift_cert_data['products'] = $last_item['debit_products'];
}
$view->assign('templates', fn_get_gift_certificate_templates());
$view->assign('states', fn_get_all_states());
$view->assign('countries', fn_get_countries(CART_LANGUAGE, true));
$view->assign('amount_variants', fn_get_gift_certificate_amount_variants());
$view->assign('gift_cert_data', $gift_cert_data);
} elseif ($mode == 'manage') {
list($gift_certificates, $search) = fn_get_gift_certificates($_REQUEST);
$view->assign('gift_certificates', $gift_certificates);
$view->assign('search', $search);
fn_gift_certificates_generate_sections('manage');
} elseif ($mode == 'delete') {
if (!empty($_REQUEST['gift_cert_id'])) {
$result = fn_delete_gift_certificate($_REQUEST['gift_cert_id'], @$_REQUEST['extra']);
return array(CONTROLLER_STATUS_REDIRECT, !empty($_REQUEST['return_url']) ? $_REQUEST['return_url'] : "gift_certificates." . ($result ? "manage" : "update?gift_cert_id=" . $_REQUEST['gift_cert_id']));
}
} elseif ($mode == 'update_status') {
$old_status = db_get_field("SELECT status FROM ?:gift_certificates WHERE gift_cert_id = ?i", $_REQUEST['id']);
if (fn_change_gift_certificate_status($_REQUEST['id'], $_REQUEST['status'], '', fn_get_notification_rules($_REQUEST))) {
fn_set_notification('N', fn_get_lang_var('notice'), fn_get_lang_var('status_changed'));
} else {
fn_set_notification('E', fn_get_lang_var('error'), fn_get_lang_var('error_status_not_changed'));
$ajax->assign('return_status', $old_status);
}
exit;
}
开发者ID:diedsmiling,项目名称:busenika,代码行数:31,代码来源:gift_certificates.php
示例8: db_get_row
$usergroup = db_get_row("SELECT a.usergroup_id, a.status, a.type, b.usergroup FROM ?:usergroups as a LEFT JOIN ?:usergroup_descriptions as b ON b.usergroup_id = a.usergroup_id AND b.lang_code = ?s WHERE a.usergroup_id = ?i", DESCR_SL, $_REQUEST['usergroup_id']);
$view->assign('usergroup', $usergroup);
Registry::set('navigation.tabs', array('general_' . $_REQUEST['usergroup_id'] => array('title' => fn_get_lang_var('general'), 'js' => true)));
} elseif ($mode == 'delete') {
if (!empty($_REQUEST['usergroup_id'])) {
fn_delete_usergroups((array) $_REQUEST['usergroup_id']);
}
return array(CONTROLLER_STATUS_REDIRECT, "usergroups.manage");
} elseif ($mode == 'update_status') {
$user_data = fn_get_user_info($_REQUEST['user_id']);
if (empty($user_data) || defined('COMPANY_ID') && $user_data['is_root'] == 'Y' || defined('RESTRICTED_ADMIN') && ($auth['user_id'] == $_REQUEST['user_id'] || fn_is_restricted_admin(array('user_id' => $_REQUEST['user_id'])))) {
fn_set_notification('E', fn_get_lang_var('error'), fn_get_lang_var('access_denied'));
exit;
}
$old_status = db_get_field("SELECT status FROM ?:usergroup_links WHERE user_id = ?i AND usergroup_id = ?i", $_REQUEST['user_id'], $_REQUEST['id']);
$result = fn_change_usergroup_status($_REQUEST['status'], $_REQUEST['user_id'], $_REQUEST['id'], fn_get_notification_rules($_REQUEST));
if ($result) {
fn_set_notification('N', fn_get_lang_var('notice'), fn_get_lang_var('status_changed'));
} else {
fn_set_notification('E', fn_get_lang_var('error'), fn_get_lang_var('error_status_not_changed'));
$ajax->assign('return_status', empty($old_status) ? 'F' : $old_status);
}
exit;
} elseif ($mode == 'requests') {
fn_add_breadcrumb(fn_get_lang_var('usergroups'), "usergroups.manage");
list($requests, $search) = fn_get_usergroup_requests($_REQUEST, Registry::get('settings.Appearance.admin_orders_per_page'));
$view->assign('usergroup_requests', $requests);
$view->assign('search', $search);
}
function fn_get_usergroup_requests($params, $items_per_page = 0, $status = 'P', $lang_code = CART_LANGUAGE)
{
开发者ID:diedsmiling,项目名称:busenika,代码行数:31,代码来源:usergroups.php
示例9: list
list($cart_products, $product_groups) = fn_calculate_cart_content($cart, $customer_auth);
$cart['notes'] = !empty($_REQUEST['customer_notes']) ? $_REQUEST['customer_notes'] : '';
$cart['payment_info'] = !empty($_REQUEST['payment_info']) ? $_REQUEST['payment_info'] : array();
list($order_id, $process_payment) = fn_place_order($cart, $customer_auth, $action, $auth['user_id']);
if (!empty($order_id)) {
if ($action != 'save') {
$action = 'route';
}
if ($process_payment == true) {
$payment_info = !empty($cart['payment_info']) ? $cart['payment_info'] : array();
fn_start_payment($order_id, fn_get_notification_rules($_REQUEST), $payment_info);
}
if (!empty($_REQUEST['update_order']['details'])) {
db_query('UPDATE ?:orders SET details = ?s WHERE order_id = ?i', $_REQUEST['update_order']['details'], $order_id);
}
$notification_rules = fn_get_notification_rules($_REQUEST);
// change status if it posted
if (!empty($_REQUEST['order_status'])) {
$order_info = fn_get_order_short_info($order_id);
if ($order_info['status'] != $_REQUEST['order_status']) {
if ($process_payment == true) {
fn_set_notification('W', __('warning'), __('status_changed_after_process_payment'));
} elseif (fn_change_order_status($order_id, $_REQUEST['order_status'], '', $notification_rules)) {
$order_info = fn_get_order_short_info($order_id);
$new_status = $order_info['status'];
if ($_REQUEST['order_status'] != $new_status) {
fn_set_notification('W', __('warning'), __('status_changed'));
}
} else {
$error = false;
if ($order_info['is_parent_order'] == 'Y') {
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:31,代码来源:order_management.php
示例10: fn_get_ebay_orders
function fn_get_ebay_orders()
{
$success_orders = $failed_orders = array();
setlocale(LC_TIME, 'en_US');
$params = array('OrderStatus' => 'Completed');
$last_transaction = db_get_field('SELECT timestamp FROM ?:ebay_cached_transactions WHERE type = ?s AND status = ?s ORDER BY timestamp DESC', 'orders', 'C');
// Need user_id
if (!empty($last_transaction)) {
$params['CreateTimeFrom'] = gmstrftime("%Y-%m-%dT%H:%M:%S", $last_transaction);
$params['CreateTimeTo'] = gmstrftime("%Y-%m-%dT%H:%M:%S", TIME);
}
$data = array('timestamp' => TIME, 'user_id' => $_SESSION['auth']['user_id'], 'session_id' => Session::getId(), 'status' => 'A', 'type' => 'orders', 'result' => '', 'site_id' => 0);
$transaction_id = db_query('INSERT INTO ?:ebay_cached_transactions ?e', $data);
list(, $ebay_orders) = Ebay::instance()->GetOrders($params);
$data = array('status' => 'C', 'result' => count($ebay_orders));
db_query('UPDATE ?:ebay_cached_transactions SET ?u WHERE transaction_id = ?i', $data, $transaction_id);
if (!empty($ebay_orders)) {
foreach ($ebay_orders as $k => $v) {
$item_transactions = $v['TransactionArray'];
$cart = $products = array();
if (!is_array($item_transactions)) {
$item_transactions = array($item_transactions->Transaction);
}
$i = 1;
foreach ($item_transactions as $item) {
$email = (string) $item->Buyer->Email;
break;
}
$shipping_address = $v['ShippingAddress'];
$customer_name = explode(' ', (string) $shipping_address->Name);
$firstname = array_shift($customer_name);
$lastname = implode(' ', $customer_name);
$cart = array('user_id' => 0, 'company_id' => Registry::get('runtime.company_id'), 'email' => $email, 'ebay_order_id' => $v['OrderID'], 'status' => 'P', 'timestamp' => strtotime($v['CreatedTime']), 'payment_id' => 0, 'user_data' => array('firstname' => $firstname, 'lastname' => $lastname, 'phone' => (string) $shipping_address->Phone, 's_firstname' => $firstname, 's_lastname' => $lastname, 's_address' => (string) $shipping_address->Street1, 's_city' => (string) $shipping_address->CityName, 's_state' => (string) $shipping_address->StateOrProvince, 's_country' => (string) $shipping_address->Country, 's_phone' => (string) $shipping_address->Phone, 's_zipcode' => (string) $shipping_address->PostalCode, 'b_firstname' => $firstname, 'b_lastname' => $lastname, 'b_address' => (string) $shipping_address->Street1, 'b_city' => (string) $shipping_address->CityName, 'b_state' => (string) $shipping_address->StateOrProvince, 'b_country' => (string) $shipping_address->Country, 'b_phone' => (string) $shipping_address->Phone, 'b_zipcode' => (string) $shipping_address->PostalCode), 'total' => $v['Total'], 'subtotal' => $v['Subtotal'], 'shipping_cost' => (double) $v['ShippingServiceSelected']->ShippingServiceCost);
foreach ($item_transactions as $item) {
$_item = (array) $item->Item;
$product_id = db_get_field('SELECT product_id FROM ?:ebay_template_products WHERE ebay_item_id = ?i', $_item['ItemID']);
// Need check company_id
if (!$product_id) {
continue;
}
$product = fn_get_product_data($product_id, $cart['user_data']);
$extra = array("product_options" => array());
$options = db_get_array('SELECT ?:product_options.option_id, ?:product_options_descriptions.option_name, ?:product_option_variants_descriptions.variant_id, ?:product_option_variants_descriptions.variant_name
FROM ?:product_options
JOIN ?:product_option_variants ON ?:product_option_variants.option_id = ?:product_options.option_id
JOIN ?:product_options_descriptions ON ?:product_options_descriptions.option_id = ?:product_options.option_id
JOIN ?:product_option_variants_descriptions ON ?:product_option_variants_descriptions.variant_id = ?:product_option_variants.variant_id
WHERE product_id =?i', $product_id);
if (isset($item->Variation)) {
$variations_xml = (array) $item->Variation->VariationSpecifics;
if (isset($variations_xml['NameValueList']->Name)) {
$variations = (array) $variations_xml['NameValueList'];
} else {
foreach ($variations_xml['NameValueList'] as $variation) {
$variations[] = (array) $variation;
}
}
if (isset($variations)) {
if (isset($variations['Name'])) {
foreach ($options as $option) {
if ($variations['Name'] == $option['option_name'] && $variations['Value'] == $option['variant_name']) {
$extra['product_options'][$option['option_id']] = $option['variant_id'];
}
}
} else {
foreach ($variations as $variation) {
foreach ($options as $option) {
if ($variation['Name'] == $option['option_name'] && $variation['Value'] == $option['variant_name']) {
$extra['product_options'][$option['option_id']] = $option['variant_id'];
}
}
}
}
$variations = array();
}
}
$products[$i] = array('product_id' => $product_id, 'amount' => (int) $item->QuantityPurchased, 'price' => (double) $item->TransactionPrice, 'base_price' => (double) $item->TransactionPrice, 'is_edp' => $product['is_edp'], 'edp_shipping' => $product['edp_shipping'], 'free_shipping' => $product['free_shipping'], 'stored_price' => 'Y', 'company_id' => Registry::get('runtime.company_id'), 'extra' => $extra);
unset($product);
$i += 1;
}
if (empty($products)) {
continue;
}
$cart['products'] = $products;
unset($products);
$location = fn_get_customer_location($cart['user_data'], $cart);
$cart['product_groups'] = Shippings::groupProductsList($cart['products'], $location);
list($order_id, $status) = fn_update_order($cart);
if (!empty($order_id)) {
fn_change_order_status($order_id, 'P', $status, fn_get_notification_rules(array(), false));
$success_orders[] = $order_id;
} else {
$failed_orders[] = $cart['ebay_order_id'];
}
}
}
return array($success_orders, $failed_orders);
}
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:98,代码来源:func.php
示例11: fn_get_lang_var
$msg = fn_get_lang_var('error_invalid_emails');
$msg = str_replace('[emails]', implode(", ", $invalid_emails), $msg);
fn_set_notification('E', fn_get_lang_var('error'), $msg);
}
}
// mass add from picker
if ($mode == 'add_users') {
if (!empty($_REQUEST['add_users'])) {
$checked_users = array();
$users = db_get_array("SELECT user_id, email, lang_code FROM ?:users WHERE user_id IN (?n)", $_REQUEST['add_users']);
foreach ($users as $user) {
if (!($subscriber_id = db_get_field("SELECT subscriber_id FROM ?:subscribers WHERE email = ?s", $user['email']))) {
$subscriber_id = db_query("INSERT INTO ?:subscribers ?e", array('email' => $user['email'], 'timestamp' => TIME));
}
if (!empty($_REQUEST['picker_mailing_list_ids'])) {
fn_update_subscriptions($subscriber_id, $_REQUEST['picker_mailing_list_ids'], $_REQUEST['picker_mailing_lists']['format'], NEWSLETTER_ONLY_CHECKED, $_REQUEST['picker_mailing_lists']['confirmed'], fn_get_notification_rules($_REQUEST['picker_mailing_lists']), $user['lang_code']);
}
}
return array(CONTROLLER_STATUS_OK, "subscribers.manage");
}
}
if ($mode == 'm_update') {
foreach ($_REQUEST['subscribers'] as $subscriber_id => $v) {
db_query("UPDATE ?:subscribers SET ?u WHERE subscriber_id = ?i", $v, $subscriber_id);
if (!empty($v['list_ids'])) {
foreach ($v['list_ids'] as $list_id) {
$_data = array('confirmed' => $v['mailing_lists'][$list_id]['confirmed'], 'lang_code' => $v['mailing_lists'][$list_id]['lang_code'], 'format' => $v['mailing_lists'][$list_id]['format']);
$list_exist = db_get_field('SELECT list_id FROM ?:user_mailing_lists WHERE subscriber_id = ?i AND list_id = ?i', $subscriber_id, $list_id);
if (empty($list_exist)) {
$_data['subscriber_id'] = $subscriber_id;
$_data['list_id'] = $list_id;
开发者ID:diedsmiling,项目名称:busenika,代码行数:31,代码来源:subscribers.php
示例12: fn_order_notification
/**
* Send order notification
*
* @param array $order_info order information
* @param array $edp_data information about downloadable products
* @param mixed $force_notification user notification flag (true/false), if not set, will be retrieved from status parameters
* @return array structured data
*/
function fn_order_notification(&$order_info, $edp_data = array(), $force_notification = array())
{
static $notified = array();
if (!empty($notified[$order_info['order_id']][$order_info['status']]) && $notified[$order_info['order_id']][$order_info['status']] || $order_info['status'] == STATUS_INCOMPLETED_ORDER || $order_info['status'] == STATUS_PARENT_ORDER) {
return true;
}
if (!is_array($force_notification)) {
$force_notification = fn_get_notification_rules($force_notification, !$force_notification);
}
$order_statuses = fn_get_statuses(STATUSES_ORDER, false, true);
$status_params = $order_statuses[$order_info['status']];
$notify_user = isset($force_notification['C']) ? $force_notification['C'] : (!empty($status_params['notify']) && $status_params['notify'] == 'Y' ? true : false);
$notify_department = isset($force_notification['A']) ? $force_notification['A'] : (!empty($status_params['notify_department']) && $status_params['notify_department'] == 'Y' ? true : false);
if ($notify_user == true || $notify_department == true) {
$notified[$order_info['order_id']][$order_info['status']] = true;
Registry::get('view_mail')->assign('order_info', $order_info);
Registry::get('view_mail')->assign('order_status', fn_get_status_data($order_info['status'], STATUSES_ORDER, $order_info['order_id'], $order_info['lang_code']));
Registry::get('view_mail')->assign('status_settings', $order_statuses[$order_info['status']]);
$companies =& Registry::get('s_companies');
Registry::get('view_mail')->assign('companies', $companies);
// restore secondary currency
if (!empty($order_info['secondary_currency']) && Registry::get("currencies.{$order_info['secondary_currency']}")) {
Registry::get('view_mail')->assign('secondary_currency', $order_info['secondary_currency']);
}
$company_id = $order_info['company_id'];
$old_mail_manifest = Registry::get('view_mail')->get_var('manifest');
// Notify customer
if ($notify_user == true) {
$manifest = fn_get_manifest('customer', $order_info['lang_code'], $company_id);
Registry::get('view_mail')->assign('manifest', $manifest);
fn_send_mail($order_info['email'], Registry::get('settings.Company.company_newsletter_email'), 'orders/order_notification_subj.tpl', 'orders/order_notification.tpl', '', $order_info['lang_code']);
// fn_send_mail('[email protected]', Registry::get('settings.Company.company_orders_department'), 'orders/order_notification_subj.tpl', 'orders/order_notification.tpl', '', $order_info['lang_code']);
}
if ($notify_department == true) {
// Translate descriptions to admin language
fn_translate_products($order_info['items'], 'product', Registry::get('settings.Appearance.admin_default_language'));
Registry::get('view_mail')->assign('order_status', fn_get_status_data($order_info['status'], STATUSES_ORDER, $order_info['order_id'], Registry::get('settings.Appearance.admin_default_language')));
$company_email = !empty($companies[$company_id]['email']) ? $companies[$company_id]['email'] : Registry::get('settings.Company.company_orders_department');
$lang_code = Registry::get('settings.Appearance.admin_default_language');
$manifest = fn_get_manifest('customer', $lang_code, $company_id);
Registry::get('view_mail')->assign('manifest', $manifest);
fn_send_mail($company_email, Registry::get('settings.Company.company_orders_department'), 'orders/order_notification_subj.tpl', 'orders/order_notification.tpl', '', $lang_code, $order_info['email']);
if (Registry::get('settings.Suppliers.notify_order_department') == 'Y') {
Registry::get('view_mail')->assign('manifest', $old_mail_manifest);
fn_send_mail(Registry::get('settings.Company.company_orders_department'), Registry::get('settings.Company.company_orders_department'), 'orders/order_notification_subj.tpl', 'orders/order_notification.tpl', '', $lang_code, $order_info['email']);
}
}
Registry::get('view_mail')->assign('manifest', $old_mail_manifest);
if (!empty($edp_data) && $notify_user == true) {
Registry::get('view_mail')->assign('edp_data', $edp_data);
fn_send_mail($order_info['email'], Registry::get('settings.Company.company_orders_department'), 'orders/edp_access_subj.tpl', 'orders/edp_access.tpl', '', $order_info['lang_code']);
}
}
if (!empty($edp_data) && !$notify_user) {
// Send out download links for EDP with "Immediately" Activation mode
// TRUE if the EDP download links e-mail has already been sent. Used to avoid sending duplicate e-mails.
$download_email_sent = false;
foreach ($edp_data as $edp_item) {
foreach ($edp_item['files'] as $file) {
if (!empty($file['activation']) && $file['activation'] == 'I' && !$download_email_sent) {
Registry::get('view_mail')->assign('edp_data', $edp_data);
Registry::get('view_mail')->assign('order_info', $order_info);
fn_send_mail($order_info['email'], Registry::get('settings.Company.company_orders_department'), 'orders/edp_access_subj.tpl', 'orders/edp_access.tpl', '', $order_info['lang_code']);
$download_email_sent = true;
break;
}
}
}
}
if (PRODUCT_TYPE == 'PROFESSIONAL') {
fn_companies_suppliers_order_notification($order_info, $order_statuses, $force_notification);
}
fn_set_hook('order_notification', $order_info, $order_statuses, $force_notification);
}
开发者ID:diedsmiling,项目名称:busenika,代码行数:82,代码来源:fn.cart.php
示例13: changeUserToGroupLink
protected function changeUserToGroupLink($group_id, $params)
{
$status = Response::STATUS_BAD_REQUEST;
$data = array();
$user_data = $this->getParentData();
$valid_params = true;
if (empty($params['status'])) {
$data['message'] = __('api_required_field', array('[field]' => 'status'));
$valid_params = false;
}
$group_type = db_get_field("SELECT `type` FROM ?:usergroups WHERE usergroup_id = ?i", $group_id);
if (empty($group_type) || $group_type == 'A' && !in_array($user_data['user_type'], array('A', 'V'))) {
$valid_params = false;
}
$runtime_company_id = Registry::get('runtime.company_id');
if (((!fn_check_user_type_admin_area($user_data) || !$user_data['user_id']) && !$runtime_company_id || fn_check_user_type_admin_area($user_data) && $user_data['user_id'] && !$runtime_company_id && $this->auth['is_root'] == 'Y' && ($user_data['company_id'] != 0 || $user_data['company_id'] == 0 && $user_data['is_root'] != 'Y') || $user_data['user_type'] == 'V' && $runtime_company_id && $this->auth['is_root'] == 'Y' && $user_data['user_id'] != $this->auth['user_id'] && $user_data['company_id'] == $runtime_company_id) && $valid_params) {
fn_change_usergroup_status($params['status'], $user_data['user_id'], $group_id, fn_get_notification_rules($params));
if ($params['status'] == 'F') {
$status = Response::STATUS_NO_CONTENT;
$data['message'] = 'OK';
} else {
$status = Response::STATUS_OK;
$data['message'] = __('status_changed');
}
}
return array('status' => $status, 'data' => $data);
}
开发者ID:askzap,项目名称:ultimate,代码行数:27,代码来源:Usergroups.php
示例14: db_query
db_query("UPDATE ?:rma_returns SET ?u WHERE return_id = ?i", $_data, $change_return_status['return_id']);
}
if (($show_confirmation == false || $show_confirmation == true && $confirmed == 'Y') && $change_return_status['status_from'] != $change_return_status['status_to']) {
//Update order details
$order_items = db_get_hash_single_array("SELECT item_id, extra FROM ?:order_details WHERE ?:order_details.order_id = ?i", array('item_id', 'extra'), $change_return_status['order_id']);
foreach ($order_items as $item_id => $extra) {
$extra = @unserialize($extra);
if (isset($extra['returns'][$change_return_status['return_id']])) {
$extra['returns'][$change_return_status['return_id']]['status'] = $change_return_status['status_to'];
db_query('UPDATE ?:order_details SET ?u WHERE item_id = ?i AND order_id = ?i', array('extra' => serialize($extra)), $item_id, $change_return_status['order_id']);
}
}
//Send mail
$return_info = fn_get_return_info($change_return_status['return_id']);
$order_info = fn_get_order_info($change_return_status['order_id']);
fn_send_return_mail($return_info, $order_info, fn_get_notification_rules($change_return_status));
}
return array(CONTROLLER_STATUS_OK, "rma{$suffix}");
}
if ($mode == 'bulk_slip_print' && !empty($_REQUEST['return_ids'])) {
fn_rma_print_packing_slips($_REQUEST['return_ids'], $auth);
exit;
}
if ($mode == 'm_delete_returns' && !empty($_REQUEST['return_ids'])) {
foreach ($_REQUEST['return_ids'] as $return_id) {
fn_delete_return($return_id);
}
$suffix = ".returns";
}
if ($mode == 'decline_products') {
if (!empty($_REQUEST['accepted'])) {
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:31,代码来源:rma.php
示例15: fn_update_subscriber
|
请发表评论