本文整理汇总了PHP中CustomerMessage类的典型用法代码示例。如果您正苦于以下问题:PHP CustomerMessage类的具体用法?PHP CustomerMessage怎么用?PHP CustomerMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CustomerMessage类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: postProcess
//.........这里部分代码省略.........
if ($row['id_contact'] == $id_contact) {
$tmp++;
}
if (Tools::getValue('id_product') != 0 && $row['id_product'] == Tools::getValue('id_product')) {
$tmp += 2;
}
if ($tmp >= 5 && $tmp >= $score) {
$score = $tmp;
$id_customer_thread = $row['id_customer_thread'];
}
}
}
$old_message = Db::getInstance()->getValue('
SELECT cm.message FROM ' . _DB_PREFIX_ . 'customer_message cm
LEFT JOIN ' . _DB_PREFIX_ . 'customer_thread cc on (cm.id_customer_thread = cc.id_customer_thread)
WHERE cc.id_customer_thread = ' . (int) $id_customer_thread . ' AND cc.id_shop = ' . (int) $this->context->shop->id . '
ORDER BY cm.date_add DESC');
if ($old_message == $message) {
$this->context->smarty->assign('alreadySent', 1);
$contact->email = '';
$contact->customer_service = 0;
}
if ($contact->customer_service) {
if ((int) $id_customer_thread) {
$ct = new CustomerThread($id_customer_thread);
$ct->status = 'open';
$ct->id_lang = (int) $this->context->language->id;
$ct->id_contact = (int) $id_contact;
$ct->id_order = (int) $id_order;
if ($id_product = (int) Tools::getValue('id_product')) {
$ct->id_product = $id_product;
}
$ct->update();
} else {
$ct = new CustomerThread();
if (isset($customer->id)) {
$ct->id_customer = (int) $customer->id;
}
$ct->id_shop = (int) $this->context->shop->id;
$ct->id_order = (int) $id_order;
if ($id_product = (int) Tools::getValue('id_product')) {
$ct->id_product = $id_product;
}
$ct->id_contact = (int) $id_contact;
$ct->id_lang = (int) $this->context->language->id;
$ct->email = $from;
$ct->status = 'open';
$ct->token = Tools::passwdGen(12);
$ct->add();
}
if ($ct->id) {
$cm = new CustomerMessage();
$cm->id_customer_thread = $ct->id;
$cm->message = $message;
if (isset($file_attachment['rename']) && !empty($file_attachment['rename']) && rename($file_attachment['tmp_name'], _PS_UPLOAD_DIR_ . basename($file_attachment['rename']))) {
$cm->file_name = $file_attachment['rename'];
@chmod(_PS_UPLOAD_DIR_ . basename($file_attachment['rename']), 0664);
}
$cm->ip_address = (int) ip2long(Tools::getRemoteAddr());
$cm->user_agent = $_SERVER['HTTP_USER_AGENT'];
if (!$cm->add()) {
$this->errors[] = Tools::displayError('An error occurred while sending the message.');
}
} else {
$this->errors[] = Tools::displayError('An error occurred while sending the message.');
}
}
if (!count($this->errors)) {
$var_list = array('{order_name}' => '-', '{attached_file}' => '-', '{message}' => Tools::nl2br(stripslashes($message)), '{email}' => $from, '{product_name}' => '');
if (isset($file_attachment['name'])) {
$var_list['{attached_file}'] = $file_attachment['name'];
}
$id_product = (int) Tools::getValue('id_product');
if (isset($ct) && Validate::isLoadedObject($ct) && $ct->id_order) {
$order = new Order((int) $ct->id_order);
$var_list['{order_name}'] = $order->getUniqReference();
$var_list['{id_order}'] = (int) $order->id;
}
if ($id_product) {
$product = new Product((int) $id_product);
if (Validate::isLoadedObject($product) && isset($product->name[Context::getContext()->language->id])) {
$var_list['{product_name}'] = $product->name[Context::getContext()->language->id];
}
}
if (empty($contact->email)) {
Mail::Send($this->context->language->id, 'contact_form', isset($ct) && Validate::isLoadedObject($ct) ? sprintf(Mail::l('Your message has been correctly sent #ct%1$s #tc%2$s'), $ct->id, $ct->token) : Mail::l('Your message has been correctly sent'), $var_list, $from, null, null, null, $file_attachment);
} else {
if (!Mail::Send($this->context->language->id, 'contact', Mail::l('Message from contact form') . ' [no_sync]', $var_list, $contact->email, $contact->name, null, null, $file_attachment, null, _PS_MAIL_DIR_, false, null, null, $from) || !Mail::Send($this->context->language->id, 'contact_form', isset($ct) && Validate::isLoadedObject($ct) ? sprintf(Mail::l('Your message has been correctly sent #ct%1$s #tc%2$s'), $ct->id, $ct->token) : Mail::l('Your message has been correctly sent'), $var_list, $from, null, null, null, $file_attachment, null, _PS_MAIL_DIR_, false, null, null, $contact->email)) {
$this->errors[] = Tools::displayError('An error occurred while sending the message.');
}
}
}
if (count($this->errors) > 1) {
array_unique($this->errors);
} elseif (!count($this->errors)) {
$this->context->smarty->assign('confirmation', 1);
}
}
}
}
开发者ID:Rohit-jn,项目名称:hotelcommerce,代码行数:101,代码来源:ContactController.php
示例2: postProcess
//.........这里部分代码省略.........
$tmp += 2;
}
if ($tmp >= 5 && $tmp >= $score) {
$score = $tmp;
$id_customer_thread = $row['id_customer_thread'];
}
}
}
$old_message = Db::getInstance()->getValue('
SELECT cm.message FROM ' . _DB_PREFIX_ . 'customer_message cm
LEFT JOIN ' . _DB_PREFIX_ . 'customer_thread cc on (cm.id_customer_thread = cc.id_customer_thread)
WHERE cc.id_customer_thread = ' . (int) $id_customer_thread . ' AND cc.id_shop = ' . (int) $this->context->shop->id . '
ORDER BY cm.date_add DESC');
if ($old_message == $message) {
$this->context->smarty->assign('alreadySent', 1);
$contact->email = '';
$contact->customer_service = 0;
}
if (!empty($contact->email)) {
$id_order = (int) Tools::getValue('id_order', 0);
$order = new Order($id_order);
$mail_var_list = array('{email}' => $from, '{message}' => Tools::nl2br(stripslashes($message)), '{id_order}' => $id_order, '{order_name}' => $order->getUniqReference(), '{attached_file}' => isset($_FILES['fileUpload'], $_FILES['fileUpload']['name']) ? $_FILES['fileUpload']['name'] : '');
if (Mail::Send($this->context->language->id, 'contact', Mail::l('Message from contact form'), $mail_var_list, $contact->email, $contact->name, $from, $customer->id ? $customer->firstname . ' ' . $customer->lastname : '', $fileAttachment) && Mail::Send($this->context->language->id, 'contact_form', Mail::l('Your message has been correctly sent'), $mail_var_list, $from)) {
$this->context->smarty->assign('confirmation', 1);
} else {
$this->errors[] = Tools::displayError('An error occurred while sending message.');
}
}
if ($contact->customer_service) {
if ((int) $id_customer_thread) {
$ct = new CustomerThread($id_customer_thread);
$ct->status = 'open';
$ct->id_lang = (int) $this->context->language->id;
$ct->id_contact = (int) $id_contact;
if ($id_order = (int) Tools::getValue('id_order')) {
$ct->id_order = $id_order;
}
if ($id_product = (int) Tools::getValue('id_product')) {
$ct->id_product = $id_product;
}
$ct->update();
} else {
$ct = new CustomerThread();
if (isset($customer->id)) {
$ct->id_customer = (int) $customer->id;
}
$ct->id_shop = (int) $this->context->shop->id;
if ($id_order = (int) Tools::getValue('id_order')) {
$ct->id_order = $id_order;
}
if ($id_product = (int) Tools::getValue('id_product')) {
$ct->id_product = $id_product;
}
$ct->id_contact = (int) $id_contact;
$ct->id_lang = (int) $this->context->language->id;
$ct->email = $from;
$ct->status = 'open';
$ct->token = Tools::passwdGen(12);
$ct->add();
}
if ($ct->id) {
$cm = new CustomerMessage();
$cm->id_customer_thread = $ct->id;
$cm->message = Tools::htmlentitiesUTF8($message);
if (isset($filename) && rename($_FILES['fileUpload']['tmp_name'], _PS_MODULE_DIR_ . '../upload/' . $filename)) {
$cm->file_name = $filename;
}
$cm->ip_address = ip2long($_SERVER['REMOTE_ADDR']);
$cm->user_agent = $_SERVER['HTTP_USER_AGENT'];
if ($cm->add()) {
if (empty($contact->email)) {
$var_list = array('{order_name}' => '-', '{attached_file}' => '-', '{message}' => stripslashes($message));
if ($ct->id_order) {
$order = new Order($ct->id_order);
$var_list['{order_name}'] = $order->reference;
}
if (isset($filename)) {
$var_list['{attached_file}'] = $_FILES['fileUpload']['name'];
}
Mail::Send($this->context->language->id, 'contact_form', Mail::l('Your message has been correctly sent'), $var_list, $from);
}
$this->context->smarty->assign('confirmation', 1);
} else {
$this->errors[] = Tools::displayError('An error occurred while sending message.');
}
} else {
$this->errors[] = Tools::displayError('An error occurred while sending message.');
}
}
if (count($this->errors) > 1) {
array_unique($this->errors);
}
}
}
}
}
}
}
}
}
开发者ID:jicheng17,项目名称:pengwine,代码行数:101,代码来源:ContactController.php
示例3: pSQL
WHERE `md5_header` = \'' . pSQL($md5) . '\'');
if ($exist) {
if (Configuration::get('PS_SAV_IMAP_DELETE_MSG')) {
if (!imap_delete($mbox, $overview->msgno)) {
$str_error_delete = ', "Fail to delete message"';
}
}
} else {
//check if subject has id_order
preg_match('/\\#ct([0-9]*)/', $subject, $matches1);
preg_match('/\\#tc([0-9-a-z-A-Z]*)/', $subject, $matches2);
if (isset($matches1[1]) && isset($matches2[1])) {
//check if order exist in database
$ct = new CustomerThread((int) $matches1[1]);
if (Validate::isLoadedObject($ct) && $ct->token == $matches2[1]) {
$cm = new CustomerMessage();
$cm->id_customer_thread = $ct->id;
$cm->message = imap_fetchbody($mbox, $overview->msgno, 1);
$cm->add();
}
}
Db::getInstance()->execute('INSERT INTO `' . _DB_PREFIX_ . 'customer_message_sync_imap` (`md5_header`) VALUES (\'' . pSQL($md5) . '\')');
}
}
imap_expunge($mbox);
imap_close($mbox);
die('{"hasError" : false, "errors" : ["' . $str_errors . $str_error_delete . '"]}');
}
if (Tools::isSubmit('searchCategory')) {
$q = Tools::getValue('q');
$limit = Tools::getValue('limit');
开发者ID:rrameshsat,项目名称:Prestashop,代码行数:31,代码来源:ajax.php
示例4: preProcess
//.........这里部分代码省略.........
WHERE email = \'' . pSQL($from) . '\' AND (' . ($customer->id ? 'id_customer = ' . (int) $customer->id . ' OR ' : '') . '
id_order = ' . (int) Tools::getValue('id_order') . ')');
$score = 0;
foreach ($fields as $key => $row) {
$tmp = 0;
if ((int) $row['id_customer'] and $row['id_customer'] != $customer->id and $row['email'] != $from) {
continue;
}
if ($row['id_order'] != 0 and Tools::getValue('id_order') != $row['id_order']) {
continue;
}
if ($row['email'] == $from) {
$tmp += 4;
}
if ($row['id_contact'] == $id_contact) {
$tmp++;
}
if (Tools::getValue('id_product') != 0 and $row['id_product'] == Tools::getValue('id_product')) {
$tmp += 2;
}
if ($tmp >= 5 and $tmp >= $score) {
$score = $tmp;
$id_customer_thread = $row['id_customer_thread'];
}
}
}
$old_message = Db::getInstance()->getValue('
SELECT cm.message FROM ' . _DB_PREFIX_ . 'customer_message cm
WHERE cm.id_customer_thread = ' . (int) $id_customer_thread . '
ORDER BY date_add DESC');
if ($old_message == htmlentities($message, ENT_COMPAT, 'UTF-8')) {
self::$smarty->assign('alreadySent', 1);
$contact->email = '';
$contact->customer_service = 0;
}
if (!empty($contact->email)) {
if (Mail::Send((int) self::$cookie->id_lang, 'contact', Mail::l('Message from contact form'), array('{email}' => $from, '{message}' => stripslashes($message)), $contact->email, $contact->name, $from, (int) self::$cookie->id_customer ? $customer->firstname . ' ' . $customer->lastname : '', $fileAttachment) and Mail::Send((int) self::$cookie->id_lang, 'contact_form', Mail::l('Your message has been correctly sent'), array('{message}' => stripslashes($message)), $from)) {
self::$smarty->assign('confirmation', 1);
} else {
$this->errors[] = Tools::displayError('An error occurred while sending message.');
}
}
if ($contact->customer_service) {
if ((int) $id_customer_thread) {
$ct = new CustomerThread($id_customer_thread);
$ct->status = 'open';
$ct->id_lang = (int) self::$cookie->id_lang;
$ct->id_contact = (int) $id_contact;
if ($id_order = (int) Tools::getValue('id_order')) {
$ct->id_order = $id_order;
}
if ($id_product = (int) Tools::getValue('id_product')) {
$ct->id_product = $id_product;
}
$ct->update();
} else {
$ct = new CustomerThread();
if (isset($customer->id)) {
$ct->id_customer = (int) $customer->id;
}
if ($id_order = (int) Tools::getValue('id_order')) {
$ct->id_order = $id_order;
}
if ($id_product = (int) Tools::getValue('id_product')) {
$ct->id_product = $id_product;
}
$ct->id_contact = (int) $id_contact;
$ct->id_lang = (int) self::$cookie->id_lang;
$ct->email = $from;
$ct->status = 'open';
$ct->token = Tools::passwdGen(12);
$ct->add();
}
if ($ct->id) {
$cm = new CustomerMessage();
$cm->id_customer_thread = $ct->id;
$cm->message = htmlentities($message, ENT_COMPAT, 'UTF-8');
if (isset($filename) and rename($_FILES['fileUpload']['tmp_name'], _PS_MODULE_DIR_ . '../upload/' . $filename)) {
$cm->file_name = $filename;
}
$cm->ip_address = ip2long($_SERVER['REMOTE_ADDR']);
$cm->user_agent = $_SERVER['HTTP_USER_AGENT'];
if ($cm->add()) {
if (empty($contact->email)) {
Mail::Send((int) self::$cookie->id_lang, 'contact_form', Mail::l('Your message has been correctly sent'), array('{message}' => stripslashes($message)), $from);
}
self::$smarty->assign('confirmation', 1);
} else {
$this->errors[] = Tools::displayError('An error occurred while sending message.');
}
} else {
$this->errors[] = Tools::displayError('An error occurred while sending message.');
}
}
if (count($this->errors) > 1) {
array_unique($this->errors);
}
}
}
}
开发者ID:srikanthash09,项目名称:codetestdatld,代码行数:101,代码来源:ContactController.php
示例5: postProcess
/**
* Start forms process
* @see FrontController::postProcess()
*/
public function postProcess()
{
if (Tools::isSubmit('submitMessage')) {
$idOrder = (int) Tools::getValue('id_order');
$msgText = Tools::getValue('msgText');
if (!$idOrder || !Validate::isUnsignedId($idOrder)) {
$this->errors[] = $this->trans('The order is no longer valid.', array(), 'Shop.Notifications.Error');
} elseif (empty($msgText)) {
$this->errors[] = $this->trans('The message cannot be blank.', array(), 'Shop.Notifications.Error');
} elseif (!Validate::isMessage($msgText)) {
$this->errors[] = $this->trans('This message is invalid (HTML is not allowed).', array(), 'Shop.Notifications.Error');
}
if (!count($this->errors)) {
$order = new Order($idOrder);
if (Validate::isLoadedObject($order) && $order->id_customer == $this->context->customer->id) {
//check if a thread already exist
$id_customer_thread = CustomerThread::getIdCustomerThreadByEmailAndIdOrder($this->context->customer->email, $order->id);
$id_product = (int) Tools::getValue('id_product');
$cm = new CustomerMessage();
if (!$id_customer_thread) {
$ct = new CustomerThread();
$ct->id_contact = 0;
$ct->id_customer = (int) $order->id_customer;
$ct->id_shop = (int) $this->context->shop->id;
if ($id_product && $order->orderContainProduct($id_product)) {
$ct->id_product = $id_product;
}
$ct->id_order = (int) $order->id;
$ct->id_lang = (int) $this->context->language->id;
$ct->email = $this->context->customer->email;
$ct->status = 'open';
$ct->token = Tools::passwdGen(12);
$ct->add();
} else {
$ct = new CustomerThread((int) $id_customer_thread);
$ct->status = 'open';
$ct->update();
}
$cm->id_customer_thread = $ct->id;
$cm->message = $msgText;
$cm->ip_address = (int) ip2long($_SERVER['REMOTE_ADDR']);
$cm->add();
if (!Configuration::get('PS_MAIL_EMAIL_MESSAGE')) {
$to = strval(Configuration::get('PS_SHOP_EMAIL'));
} else {
$to = new Contact((int) Configuration::get('PS_MAIL_EMAIL_MESSAGE'));
$to = strval($to->email);
}
$toName = strval(Configuration::get('PS_SHOP_NAME'));
$customer = $this->context->customer;
$product = new Product($id_product);
$product_name = '';
if (Validate::isLoadedObject($product) && isset($product->name[(int) $this->context->language->id])) {
$product_name = $product->name[(int) $this->context->language->id];
}
if (Validate::isLoadedObject($customer)) {
Mail::Send($this->context->language->id, 'order_customer_comment', Mail::l('Message from a customer'), array('{lastname}' => $customer->lastname, '{firstname}' => $customer->firstname, '{email}' => $customer->email, '{id_order}' => (int) $order->id, '{order_name}' => $order->getUniqReference(), '{message}' => Tools::nl2br($msgText), '{product_name}' => $product_name), $to, $toName, $customer->email, $customer->firstname . ' ' . $customer->lastname);
}
Tools::redirect('index.php?controller=order-detail&id_order=' . $idOrder . '&messagesent');
} else {
$this->redirect_after = '404';
$this->redirect();
}
}
}
}
开发者ID:M03G,项目名称:PrestaShop,代码行数:70,代码来源:OrderDetailController.php
示例6: ajaxProcessSyncImap
//.........这里部分代码省略.........
}
if ($conf['PS_SAV_IMAP_OPT_VALIDATE-CERT']) {
$conf_str .= '/validate-cert';
}
if ($conf['PS_SAV_IMAP_OPT_NOVALIDATE-CERT']) {
$conf_str .= '/novalidate-cert';
}
if ($conf['PS_SAV_IMAP_OPT_TLS']) {
$conf_str .= '/tls';
}
if ($conf['PS_SAV_IMAP_OPT_NOTLS']) {
$conf_str .= '/notls';
}
if (!function_exists('imap_open')) {
die('{"hasError" : true, "errors" : ["imap is not installed on this server"]}');
}
$mbox = @imap_open('{' . $url . ':' . $port . $conf_str . '}', $user, $password);
//checks if there is no error when connecting imap server
$errors = imap_errors();
$str_errors = '';
$str_error_delete = '';
if (sizeof($errors) && is_array($errors)) {
$str_errors = '';
foreach ($errors as $error) {
$str_errors .= '"' . $error . '",';
}
$str_errors = rtrim($str_errors, ',') . '';
}
//checks if imap connexion is active
if (!$mbox) {
die('{"hasError" : true, "errors" : ["Cannot connect to the mailbox:.<br />' . addslashes($str_errors) . '"]}');
}
//Returns information about the current mailbox. Returns FALSE on failure.
$check = imap_check($mbox);
if (!$check) {
die('{"hasError" : true, "errors" : ["Fail to get information about the current mailbox"]}');
}
if ($check->Nmsgs == 0) {
die('{"hasError" : true, "errors" : ["NO message to sync"]}');
}
$result = imap_fetch_overview($mbox, "1:{$check->Nmsgs}", 0);
foreach ($result as $overview) {
//check if message exist in database
if (isset($overview->subject)) {
$subject = $overview->subject;
} else {
$subject = '';
}
//Creating an md5 to check if message has been allready processed
$md5 = md5($overview->date . $overview->from . $subject . $overview->msgno);
$exist = Db::getInstance()->getValue('SELECT `md5_header`
FROM `' . _DB_PREFIX_ . 'customer_message_sync_imap`
WHERE `md5_header` = \'' . pSQL($md5) . '\'');
if ($exist) {
if (Configuration::get('PS_SAV_IMAP_DELETE_MSG')) {
if (!imap_delete($mbox, $overview->msgno)) {
$str_error_delete = ', "Fail to delete message"';
}
}
} else {
//check if subject has id_order
preg_match('/\\#ct([0-9]*)/', $subject, $matches1);
preg_match('/\\#tc([0-9-a-z-A-Z]*)/', $subject, $matches2);
$new_ct = Configuration::get('PS_SAV_IMAP_CREATE_THREADS') && !isset($matches1[1]) && !isset($matches2[1]) && !preg_match('/[no_sync]/', $subject);
if (isset($matches1[1]) && isset($matches2[1]) || $new_ct) {
if ($new_ct) {
if (!preg_match('/<(' . Tools::cleanNonUnicodeSupport('[a-z\\p{L}0-9!#$%&\'*+\\/=?^`{}|~_-]+[.a-z\\p{L}0-9!#$%&\'*+\\/=?^`{}|~_-]*@[a-z\\p{L}0-9]+[._a-z\\p{L}0-9-]*\\.[a-z0-9]+') . ')>/', $overview->from, $result) || !Validate::isEmail($from = $result[1])) {
continue;
}
$contacts = Contact::getCategoriesContacts();
if (!$contacts) {
continue;
}
$id_contact = $contacts[0]['id_contact'];
$ct = new CustomerThread();
$ct->email = $from;
$ct->id_contact = $id_contact;
$ct->id_lang = (int) Configuration::get('PS_LANG_DEFAULT');
$ct->status = 'open';
$ct->token = Tools::passwdGen(12);
$ct->add();
} else {
$ct = new CustomerThread((int) $matches1[1]);
}
//check if order exist in database
if (Validate::isLoadedObject($ct) && (isset($matches2[1]) && $ct->token == $matches2[1] || $new_ct)) {
$cm = new CustomerMessage();
$cm->id_customer_thread = $ct->id;
$cm->message = imap_fetchbody($mbox, $overview->msgno, 1);
$cm->add();
}
}
Db::getInstance()->execute('INSERT INTO `' . _DB_PREFIX_ . 'customer_message_sync_imap` (`md5_header`) VALUES (\'' . pSQL($md5) . '\')');
}
}
imap_expunge($mbox);
imap_close($mbox);
die('{"hasError" : false, "errors" : ["' . $str_errors . $str_error_delete . '"]}');
}
}
开发者ID:rongandat,项目名称:vatfairfoot,代码行数:101,代码来源:AdminCustomerThreadsController.php
示例7: initContent
/**
* Assign template vars related to page content
* @see FrontController::initContent()
*/
public function initContent()
{
parent::initContent();
if (!($id_order = (int) Tools::getValue('id_order')) || !Validate::isUnsignedId($id_order)) {
$this->errors[] = Tools::displayError('Order ID required');
} else {
$order = new Order($id_order);
if (Validate::isLoadedObject($order) && $order->id_customer == $this->context->customer->id) {
$id_order_state = (int) $order->getCurrentState();
$carrier = new Carrier((int) $order->id_carrier, (int) $order->id_lang);
$addressInvoice = new Address((int) $order->id_address_invoice);
$addressDelivery = new Address((int) $order->id_address_delivery);
$inv_adr_fields = AddressFormat::getOrderedAddressFields($addressInvoice->id_country);
$dlv_adr_fields = AddressFormat::getOrderedAddressFields($addressDelivery->id_country);
$invoiceAddressFormatedValues = AddressFormat::getFormattedAddressFieldsValues($addressInvoice, $inv_adr_fields);
$deliveryAddressFormatedValues = AddressFormat::getFormattedAddressFieldsValues($addressDelivery, $dlv_adr_fields);
if ($order->total_discounts > 0) {
$this->context->smarty->assign('total_old', (double) $order->total_paid - $order->total_discounts);
}
$products = $order->getProducts();
/* DEPRECATED: customizedDatas @since 1.5 */
$customizedDatas = Product::getAllCustomizedDatas((int) $order->id_cart);
Product::addCustomizationPrice($products, $customizedDatas);
OrderReturn::addReturnedQuantity($products, $order->id);
$order_status = new OrderState((int) $id_order_state, (int) $order->id_lang);
$customer = new Customer($order->id_customer);
//by webkul to show order details properly on order history page
if (Module::isInstalled('hotelreservationsystem')) {
require_once _PS_MODULE_DIR_ . 'hotelreservationsystem/define.php';
$obj_cart_bk_data = new HotelCartBookingData();
$obj_htl_bk_dtl = new HotelBookingDetail();
$obj_rm_type = new HotelRoomType();
if (!empty($products)) {
foreach ($products as $type_key => $type_value) {
$product = new Product($type_value['product_id'], false, $this->context->language->id);
$cover_image_arr = $product->getCover($type_value['product_id']);
if (!empty($cover_image_arr)) {
$cover_img = $this->context->link->getImageLink($product->link_rewrite, $product->id . '-' . $cover_image_arr['id_image'], 'small_default');
} else {
$cover_img = $this->context->link->getImageLink($product->link_rewrite, $this->context->language->iso_code . "-default", 'small_default');
}
$unit_price = Product::getPriceStatic($type_value['product_id'], true, null, 6, null, false, true, 1);
if (isset($customer->id)) {
$cart_bk_data = $obj_cart_bk_data->getOnlyCartBookingData($order->id_cart, (new Cart($order->id_cart))->id_guest, $type_value['product_id'], $customer->id);
} else {
$cart_bk_data = $obj_cart_bk_data->getOnlyCartBookingData($order->id_cart, $customer->id_guest, $type_value['product_id']);
}
$rm_dtl = $obj_rm_type->getRoomTypeInfoByIdProduct($type_value['product_id']);
$cart_htl_data[$type_key]['id_product'] = $type_value['product_id'];
$cart_htl_data[$type_key]['cover_img'] = $cover_img;
$cart_htl_data[$type_key]['name'] = $product->name;
$cart_htl_data[$type_key]['unit_price'] = $unit_price;
$cart_htl_data[$type_key]['adult'] = $rm_dtl['adult'];
$cart_htl_data[$type_key]['children'] = $rm_dtl['children'];
foreach ($cart_bk_data as $data_k => $data_v) {
$date_join = strtotime($data_v['date_from']) . strtotime($data_v['date_to']);
if (isset($cart_htl_data[$type_key]['date_diff'][$date_join])) {
$cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] += 1;
$num_days = $cart_htl_data[$type_key]['date_diff'][$date_join]['num_days'];
$vart_quant = (int) $cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] * $num_days;
$amount = Product::getPriceStatic($type_value['product_id'], true, null, 6, null, false, true, 1);
$amount *= $vart_quant;
$cart_htl_data[$type_key]['date_diff'][$date_join]['amount'] = $amount;
} else {
$num_days = $obj_htl_bk_dtl->getNumberOfDays($data_v['date_from'], $data_v['date_to']);
$cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] = 1;
$cart_htl_data[$type_key]['date_diff'][$date_join]['data_form'] = $data_v['date_from'];
$cart_htl_data[$type_key]['date_diff'][$date_join]['data_to'] = $data_v['date_to'];
$cart_htl_data[$type_key]['date_diff'][$date_join]['num_days'] = $num_days;
$amount = Product::getPriceStatic($type_value['product_id'], true, null, 6, null, false, true, 1);
$amount *= $num_days;
$cart_htl_data[$type_key]['date_diff'][$date_join]['amount'] = $amount;
}
}
}
$this->context->smarty->assign('cart_htl_data', $cart_htl_data);
}
}
//end
$this->context->smarty->assign(array('shop_name' => strval(Configuration::get('PS_SHOP_NAME')), 'order' => $order, 'return_allowed' => (int) $order->isReturnable(), 'currency' => new Currency($order->id_currency), 'order_state' => (int) $id_order_state, 'invoiceAllowed' => (int) Configuration::get('PS_INVOICE'), 'invoice' => OrderState::invoiceAvailable($id_order_state) && count($order->getInvoicesCollection()), 'logable' => (bool) $order_status->logable, 'order_history' => $order->getHistory($this->context->language->id, false, true), 'products' => $products, 'discounts' => $order->getCartRules(), 'carrier' => $carrier, 'address_invoice' => $addressInvoice, 'invoiceState' => Validate::isLoadedObject($addressInvoice) && $addressInvoice->id_state ? new State($addressInvoice->id_state) : false, 'address_delivery' => $addressDelivery, 'inv_adr_fields' => $inv_adr_fields, 'dlv_adr_fields' => $dlv_adr_fields, 'invoiceAddressFormatedValues' => $invoiceAddressFormatedValues, 'deliveryAddressFormatedValues' => $deliveryAddressFormatedValues, 'deliveryState' => Validate::isLoadedObject($addressDelivery) && $addressDelivery->id_state ? new State($addressDelivery->id_state) : false, 'is_guest' => false, 'messages' => CustomerMessage::getMessagesByOrderId((int) $order->id, false), 'CUSTOMIZE_FILE' => Product::CUSTOMIZE_FILE, 'CUSTOMIZE_TEXTFIELD' => Product::CUSTOMIZE_TEXTFIELD, 'isRecyclable' => Configuration::get('PS_RECYCLABLE_PACK'), 'use_tax' => Configuration::get('PS_TAX'), 'group_use_tax' => Group::getPriceDisplayMethod($customer->id_default_group) == PS_TAX_INC, 'customizedDatas' => $customizedDatas, 'reorderingAllowed' => !(bool) Configuration::get('PS_DISALLOW_HISTORY_REORDERING')));
if ($carrier->url && $order->shipping_number) {
$this->context->smarty->assign('followup', str_replace('@', $order->shipping_number, $carrier->url));
}
$this->context->smarty->assign('HOOK_ORDERDETAILDISPLAYED', Hook::exec('displayOrderDetail', array('order' => $order)));
Hook::exec('actionOrderDetail', array('carrier' => $carrier, 'order' => $order));
unset($carrier, $addressInvoice, $addressDelivery);
} else {
$this->errors[] = Tools::displayError('This order cannot be found.');
}
unset($order);
}
$this->setTemplate(_PS_THEME_DIR_ . 'order-detail.tpl');
}
开发者ID:Rohit-jn,项目名称:hotelcommerce,代码行数:97,代码来源:OrderDetailController.php
示例8: saveContact
public function saveContact()
{
$message = Tools::getValue('message');
// Html entities is not usefull, iscleanHtml check there is no bad html tags.
if (!($from = trim(Tools::getValue('email'))) || !Validate::isEmail($from)) {
$this->errors[] = Tools::displayError('Invalid email address.');
} elseif (!$message) {
$this->errors[] = Tools::displayError('The message cannot be blank.');
} elseif (!Validate::isCleanHtml($message)) {
$this->errors[] = Tools::displayError('Invalid message');
} elseif (!($id_contact = (int) Tools::getValue('id_contact')) || !Validate::isLoadedObject($contact = new Contact($id_contact, $this->context->language->id))) {
$this->errors[] = Tools::displayError('Please select a subject from the list provided. ');
} else {
$customer = $this->context->customer;
if (!$customer->id) {
$customer->getByEmail($from);
}
$id_order = (int) $this->getOrder();
if (!(($id_customer_thread = (int) Tools::getValue('id_customer_thread')) && (int) Db::getInstance()->getValue('
SELECT cm.id_customer_thread FROM ' . _DB_PREFIX_ . 'customer_thread cm
WHERE cm.id_customer_thread = ' . (int) $id_customer_thread . ' AND cm.id_shop = ' . (int) $this->context->shop->id . ' AND token = \'' . pSQL(Tools::getValue('token')) . '\'') || ($id_customer_thread = CustomerThread::getIdCustomerThreadByEmailAndIdOrder($from, $id_order)))) {
$fields = Db::getInstance()->executeS('
SELECT cm.id_customer_thread, cm.id_contact, cm.id_customer, cm.id_order, cm.id_product, cm.email
FROM ' . _DB_PREFIX_ . 'customer_thread cm
WHERE email = \'' . pSQL($from) . '\' AND cm.id_shop = ' . (int) $this->context->shop->id . ' AND (' . ($customer->id ? 'id_customer = ' . (int) $customer->id . ' OR ' : '') . '
id_order = ' . (int) $id_order . ')');
$score = 0;
foreach ($fields as $key => $row) {
$tmp = 0;
if ((int) $row['id_customer'] && $row['id_customer'] != $customer->id && $row['email'] != $from) {
continue;
}
if ($row['id_order'] != 0 && $id_order != $row['id_order']) {
continue;
}
if ($row['email'] == $from) {
$tmp += 4;
}
if ($row['id_contact'] == $id_contact) {
$tmp++;
}
if (Tools::getValue('id_product') != 0 && $row['id_product'] == Tools::getValue('id_product')) {
$tmp += 2;
}
if ($tmp >= 5 && $tmp >= $score) {
$score = $tmp;
$id_customer_thread = $row['id_customer_thread'];
}
}
}
$old_message = Db::getInstance()->getValue('
SELECT cm.message FROM ' . _DB_PREFIX_ . 'customer_message cm
LEFT JOIN ' . _DB_PREFIX_ . 'customer_thread cc on (cm.id_customer_thread = cc.id_customer_thread)
WHERE cc.id_customer_thread = ' . (int) $id_customer_thread . ' AND cc.id_shop = ' . (int) $this->context->shop->id . '
ORDER BY cm.date_add DESC');
if ($old_message == $message) {
$this->context->smarty->assign('alreadySent', 1);
$contact->email = '';
$contact->customer_service = 0;
}
if ($contact->customer_service) {
if ((int) $id_customer_thread) {
$ct = new CustomerThread($id_customer_thread);
$ct->status = 'open';
$ct->id_lang = (int) $this->context->language->id;
$ct->id_contact = (int) $id_contact;
$ct->id_order = (int) $id_order;
if ($id_product = (int) Tools::getValue('id_product')) {
$ct->id_product = $id_product;
}
$ct->update();
} else {
$ct = new CustomerThread();
if (isset($customer->id)) {
$ct->id_customer = (int) $customer->id;
}
$ct->id_shop = (int) $this->context->shop->id;
$ct->id_order = (int) $id_order;
if ($id_product = (int) Tools::getValue('id_product')) {
$ct->id_product = $id_product;
}
$ct->id_contact = (int) $id_contact;
$ct->id_lang = (int) $this->context->language->id;
$ct->email = $from;
$ct->status = 'open';
$ct->token = Tools::passwdGen(12);
$ct->add();
}
if ($ct->id) {
$cm = new CustomerMessage();
$cm->id_customer_thread = $ct->id;
$cm->message = $message;
$cm->ip_address = (int) ip2long(Tools::getRemoteAddr());
$cm->user_agent = $_SERVER['HTTP_USER_AGENT'];
if (!$cm->add()) {
$this->errors[] = Tools::displayError('An error occurred while sending the message.');
}
} else {
$this->errors[] = Tools::displayError('An error occurred while sending the message.');
}
//.........这里部分代码省略.........
开发者ID:zangles,项目名称:lennyba,代码行数:101,代码来源:megaboxsAjax.php
示例9: initContent
public function initContent()
{
${"GLOBALS"}["wcbwhorf"] = "id_order";
parent::initContent();
if (!(${${"GLOBALS"}["tdrhijkvhp"]} = (int) Tools::getValue("id_order")) || !Validate::isUnsignedId(${${"GLOBALS"}["wcbwhorf"]})) {
$this->errors[] = Tools::displayError("Order ID required");
} else {
${"GLOBALS"}["vtkcznmlk"] = "id_customer_seller";
${"GLOBALS"}["bwkdjg"] = "id_order";
${${"GLOBALS"}["thtbvco"]} = new Order(${${"GLOBALS"}["bwkdjg"]});
${"GLOBALS"}["tkggscllp"] = "order";
${${"GLOBALS"}["gfrblyem"]} = AgileSellerManager::getObjectOwnerID("order", $order->id);
${${"GLOBALS"}["taultlaseq"]} = AgileSellerManager::getLinkedSellerID($this->context->customer->id);
if (Validate::isLoadedObject(${${"GLOBALS"}["thtbvco"]}) && ${${"GLOBALS"}["gfrblyem"]} == ${${"GLOBALS"}["vtkcznmlk"]} && ${${"GLOBALS"}["taultlaseq"]} > 0) {
$fwsweyfqnpv = "dlv_adr_fields";
$gcjosivnd = "carrier";
${"GLOBALS"}["pffjtshcnb"] = "deliveryAddressFormatedValues";
$uztnjfwuwsv = "customizedDatas";
$uvmwhue = "addressDelivery";
${"GLOBALS"}["atrcjjwf"] = "carrier";
${"GLOBALS"}["flawpcbih"] = "products";
${${"GLOBALS"}["tthrzd"]} = (int) $order->getCurrentState();
${$gcjosivnd} = new Carrier((int) $order->id_carrier, (int) $order->id_lang);
${"GLOBALS"}["rovfqvkjb"] = "addressDelivery";
${${"GLOBALS"}["hoviucftx"]} = new Address((int) $order->id_address_invoice);
$mjqwhmgoyrm = "customizedDatas";
${"GLOBALS"}["qguglflbdd"] = "dlv_adr_fields";
$sitqckqhoebi = "inv_adr_fields";
$vejelhbyrbl = "addressDelivery";
${"GLOBALS"}["zpyvneijb"] = "addressInvoice";
$tsvbkseunn = "dlv_adr_fields";
${"GLOBALS"}["cdlqrupc"] = "inv_adr_fields";
${${"GLOBALS"}["rovfqvkjb"]} = new Address((int) $order->id_address_delivery);
${$sitqckqhoebi} = AddressFormat::getOrderedAddressFields($addressInvoice->id_country);
$shfzuivbjgg = "inv_adr_fields";
${${"GLOBALS"}["qguglflbdd"]} = AddressFormat::getOrderedAddressFields($addressDelivery->id_country);
${${"GLOBALS"}["elucej"]} = AddressFormat::getFormattedAddressFieldsValues(${${"GLOBALS"}["hoviucftx"]}, ${$shfzuivbjgg});
${${"GLOBALS"}["pffjtshcnb"]} = AddressFormat::getFormattedAddressFieldsValues(${${"GLOBALS"}["gkxhkddsjf"]}, ${$fwsweyfqnpv});
$tbfgtqy = "order";
if ($order->total_discounts > 0) {
$this->context->smarty->assign("total_old", (double) ($order->total_paid - $order->total_discounts));
}
${"GLOBALS"}["ikavgzhqpt"] = "deliveryAddressFormatedValues";
${${"GLOBALS"}["flawpcbih"]} = $order->getProducts();
${${"GLOBALS"}["gdodxcerle"]} = Product::getAllCustomizedDatas((int) $order->id_cart);
Product::addCustomizationPrice(${${"GLOBALS"}[&qu
|
请发表评论