Jump to content


  • Posts

  • Joined

  • Last visited

Profile Information

  • Location
  • Activity

kkoci's Achievements


Newbie (1/14)




Community Answers

  1. Alrighty, it was an added } to the code, it "works", partially, i mean, when i go to Clients->Contact->Topic, when i add another email, with a comma, it throws me an error saying isn't a valid email, so it isn't taking the 2nd address
  2. A little long, function PostProcess: public function postProcess() { if (Tools::isSubmit('submitMessage')) { $extension = array('.txt', '.rtf', '.doc', '.docx', '.pdf', '.zip', '.png', '.jpeg', '.gif', '.jpg'); $fileAttachment = Tools::fileAttachment('fileUpload'); $message = Tools::getValue('message'); $phonenumber = Tools::getValue('phone'); $companyname = Tools::getValue('companyname'); // Html entities is not usefull, iscleanHtml check there is no bad html tags. if (!($from = trim(Tools::getValue('from'))) || !Validate::isEmail($from)) $this->errors[] = Tools::displayError('Invalid email address.'); else if (!$message) $this->errors[] = Tools::displayError('The message cannot be blank.'); else if (!Validate::isCleanHtml($message)) $this->errors[] = Tools::displayError('Invalid message'); elseif (!($companyname = Tools::getValue('companyname'))) $this->errors[] = Tools::displayError('Comapny name cannot be blank'); elseif (!($phonenumber = Tools::getValue('phonenumber'))) $this->errors[] = Tools::displayError('Phone Number cannot be blank'); else if (!($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 if (!empty($fileAttachment['name']) && $fileAttachment['error'] != 0) $this->errors[] = Tools::displayError('An error occurred during the file-upload process.'); else if (!empty($fileAttachment['name']) && !in_array( Tools::strtolower(substr($fileAttachment['name'], -4)), $extension) && !in_array( Tools::strtolower(substr($fileAttachment['name'], -5)), $extension)) $this->errors[] = Tools::displayError('Bad file extension'); else { $customer = $this->context->customer; if (!$customer->id) $customer->getByEmail($from); $contact = new Contact($id_contact, $this->context->language->id); 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, (int)Tools::getValue('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)(Tools::getValue('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 && 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 && $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); 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 = $message; if (isset($fileAttachment['rename']) && !empty($fileAttachment['rename']) && rename($fileAttachment['tmp_name'], _PS_MODULE_DIR_.'../upload/'.basename($fileAttachment['rename']))) $cm->file_name = $fileAttachment['rename']; $cm->ip_address = ip2long($_SERVER['REMOTE_ADDR']); $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($fileAttachment['name'])) $var_list['{attached_file}'] = $fileAttachment['name']; $id_order = (int)Tools::getValue('id_order'); $id_product = (int)Tools::getValue('id_product'); if (isset($ct) && Validate::isLoadedObject($ct) && $ct->id_order) $id_order = $ct->id_order; if ($id_order) { $order = new Order((int)$id_order); $var_list['{order_name}'] = $order->getUniqReference(); $var_list['{id_order}'] = $id_order; } 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]; } foreach (Contact::getContacts($this->context->language->id) AS $key=>$value){ 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, $fileAttachment); else { if (!Mail::Send($this->context->language->id, 'contact', Mail::l('Message from contact form').' [no_sync]', $var_list, $value->email, $contact->name, $from, ($customer->id ? $customer->firstname.' '.$customer->lastname : ''), $fileAttachment) || !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, $value->email, $contact->name, $fileAttachment)) $this->errors[] = Tools::displayError('An error occurred while sending the message.'); } } if (count($this->errors) > 1) array_unique($this->errors); else $this->context->smarty->assign('confirmation', 1); } } }
  3. Turned DEBUG On and error on Controller is this: Parse error: syntax error, unexpected 'public' (T_PUBLIC) in C:\xampp\htdocs\prestataxco\controllers\front\ContactController.php on line 218 public function setMedia() { parent::setMedia(); $this->addCSS(_THEME_CSS_DIR_.'contact-form.css'); $this->addJS(_THEME_JS_DIR_.'contact-form.js'); } That's the code @ 218
  4. Thank you very much, but then where can i add more than one email? I mean this code goes into \controllers\front\ContactController.php It's ok, already substituted, but when i go to Clients->Contacts-> where should i put the addresses? By adding more than one Email with same name? Ex: Issues->Email:[email protected] , Issues->Email:[email protected]? Edit: Contact page goes blank after code update
  5. Just send message for all available emails without customer knowledge, PS just let me choose one email per option, i need more than just one, maybe 3 or 4
  6. Hi, i'm using PS I need to send multiple emails from PS contact form, for example i create the 'cases' menu from Client->Contact, put the email for that menu and that's all, but it only allows me to one email per option (menu). I need to send contact form notifications, to more than one email per option. So, Is there a way to do this? I don't know if i need to edit contact-form.tpl or some other file. Or maybe a module that could accomplish this? Thanks in advance!
  7. Hi, i'm using PS version And i have a client, which needs a way to sell taxi cab services from the PS website. However, since this kind of services have variations (hours, km, zones, etc...) For the company would be awesome to find a module (free) or maybe a way to customize orders or cart orders into a kind of selectable fields, to find combinations of distances, hours, type of service, etc... And then do the math and send the request like PS normally do. We'll like something like this : http://tealca.com/servicios/politicas On that website, you can find in the right corner (widget is called: Calcule su tarifa) the type of design my client needs for it's service. I've attached a printscreen too. I hope i've explained myself. Any ideas? Thanks in advance! PS = It'll be something like an accordion where user can choose destinations, km's, hours, etc etc... (Products)
  8. I need to sell taxi cab services from my prestashop website, currently i'm on ps What i need to know, is if there is some module or way to achieve what i'm looking for... That is, a possibility to sell 'addresses' as products, i mean, i'm thinking of adding 'products' as addresses, every 'address' with it's price, so when a user makes his order, the two addresses (origin and destination) as products, will sum the quantity and then send the order. But when a person goes to reservation page, it should have a selectable field with 'products' or addresses to make a selection and then buy the two addresses. Don't know if i'm explaining myself, if you need some further explanation let me know. Thanks in advance!
  9. Vekia, solved it following this thread: http://www.prestashop.com/forums/topic/282637-solucionado-pedido-5-pasos-o-r%C3%A1pido-con-pantalla-en-blanco/ Thank you very much!
  10. Yes, but why? This is the code: {foreach from=$formatedAddressFieldsValuesList key=id_address item=type} formatedAddressFieldsValuesList[{$id_address}] = {ldelim} 'ordered_fields':[ {foreach from=$type.ordered_fields key=num_field item=field_name name=inv_loop} {if !$smarty.foreach.inv_loop.first},{/if}{$field_name|json_encode} {/foreach} ], 'formated_fields_values':{ldelim} {foreach from=$type.formated_fields_values key=pattern_name item=field_name name=inv_loop} {if !$smarty.foreach.inv_loop.first},{/if}{$pattern_name|json_encode}:{$field_name|json_encode} {/foreach} {rdelim} {rdelim} {/foreach} Can't figure it out?
  11. Thanks vekia, you awesome as always... This is the error i'm getting Fatal error: Uncaught exception 'SmartyCompilerException' with message 'Syntax Error in template "/var/www/vhosts/taxco.com.ve/httpdocs/themes/taxco/order-address.tpl" on line 88 "{if !$smarty.foreach.inv_loop.first},{/if}{$field_name|json_encode}" unknown modifier "json_encode"' in /var/www/vhosts/taxco.com.ve/httpdocs/tools/smarty/sysplugins/smarty_internal_templatecompilerbase.php:667 Stack trace: #0 /var/www/vhosts/taxco.com.ve/httpdocs/tools/smarty/sysplugins/smarty_internal_compile_private_modifier.php(132): Smarty_Internal_TemplateCompilerBase->trigger_template_error('unknown modifie...', 88) #1 /var/www/vhosts/taxco.com.ve/httpdocs/tools/smarty/sysplugins/smarty_internal_templatecompilerbase.php(475): Smarty_Internal_Compile_Private_Modifier->compile(Array, Object(Smarty_Internal_SmartyTemplateCompiler), Array, NULL, NULL) #2 /var/www/vhosts/taxco.com.ve/httpdocs/tools/smarty/sysplugins/smarty_internal_templatecompilerbase.php(259): Smarty_Internal_TemplateCompilerBase->callTagCompil in /var/www/vhosts/taxco.com.ve/httpdocs/tools/smarty/sysplugins/smarty_internal_templatecompilerbase.php on line 667 at http://www.taxco.com.ve/index.php?controller=order&step=1 Any ideas?
  12. Really weird then, never happened to me, any clue anybody out there?
  13. Maybe a permission issue on 'controllers' folder and subfolders? Try recursive chmod 777 for controllers->admin and controllers->front folders
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More