Jump to content


  • Posts

  • Joined

  • Last visited

Profile Information

  • Location
  • Activity

nanial's Achievements


Newbie (1/14)



  1. Oh, also for some reason, I could not edit the template for contact correctly in the editor, it would not recognize what was a variable vs static text until I went to tools, source code.
  2. Many Thanks. This worked! Some of the instructions where a bit unclear to me but I was able to get through it. Steps 3-7 could be condenced in to one step. your new file in override should look like this when you are done. <?php class ContactController extends ContactControllerCore { public function postProcess() { if (Tools::isSubmit('submitMessage')) { $extension = array('.txt', '.rtf', '.doc', '.docx', '.pdf', '.zip', '.png', '.jpeg', '.gif', '.jpg'); $file_attachment = Tools::fileAttachment('fileUpload'); $message = Tools::getValue('message'); // 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.'); } 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. '); } elseif (!empty($file_attachment['name']) && $file_attachment['error'] != 0) { $this->errors[] = Tools::displayError('An error occurred during the file-upload process.'); } elseif (!empty($file_attachment['name']) && !in_array(Tools::strtolower(substr($file_attachment['name'], -4)), $extension) && !in_array(Tools::strtolower(substr($file_attachment['name'], -5)), $extension)) { $this->errors[] = Tools::displayError('Bad file extension'); } 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; 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, '{ip_address}' => Tools::getRemoteAddr(), '{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); } } } } } I'd add that in step 8, this is done under the "Modify Translation" section. Then before I could save that config, I needed to save folder permissions for the folder containing my theme and all sub folders and files to 777. This may have been overkill, but it worked.
  3. It seems that the functionality that I need could be solved by providing "combinations" together with "packs" For some reason when using a Pack, combinations are removed from the menu. Should be an easy fix. I should not need a $300.00 module for this? Is there an update in the works for this? Or an alternate way of handling this? Or a cheaper route?
  4. OK so I noticed that this only fixes it until you reboot. The answer to this problem is found at https://docs.bitnami.com/google/apps/prestashop/ In summary there is a file that rewrites both the htaccess.conf as well as prestashop configuration for "shop domain" and "ssl domain" in preferences - SEO and URLs in prestashop. "Updating The IP Address Or Hostname PrestaShop requires updating the IP address/domain name if the machine IP address/domain name changes. The bnconfig tool also has an option which updates the IP address, called –machine_hostname (use –help to check if that option is available for your application). Note that this tool changes the URL to http://NEW_DOMAIN/prestashop. sudo /opt/bitnami/apps/prestashop/bnconfig --machine_hostname NEW_DOMAIN If you have configured your machine to use a static domain name or IP address, you should rename or remove the /opt/bitnami/apps/prestashop/bnconfig file. sudo mv /opt/bitnami/apps/prestashop/bnconfig /opt/bitnami/apps/prestashop/bnconfig.disabled NOTE: Be sure that your domain is propagated. Otherwise, this will not work. You can verify the new DNS record by using the Global DNS Propagation Checker and entering your domain name into the search field." You can also change your hostname by modifying it in your hosts file. Enter the new hostname using your preferred editor." So if you need to fix the problem you can use the "helpful tool" or disable and fix it manually. I renamed my bnconfig because I'm on a static IP via Amazon cloud. On a changing IP address the tool might be helpful. Also you may want to allow remote access to you phpmyadmin while you have SSH access.
  5. I need help finding a module or feature. I make one of a kind necklace charms. I set them in customer's choice of gold, silver, or platinum. Sometimes they also come with choice of different style necklaces. The customer decides at the time of purchase what setting they want. But the problem is that if list one combination of each setting I have to have one of each combination available in inventory. So I might have to put up to 8 combinations in inventory. Now if I run a promotion and 3 people want to buy the same charm. The first person buys it but there are 7 other combinations in inventory. It seems I've seen a "Advanced Pack 5 - Create ​​bundles of products" that may work by tying different inventory items together (Will this module work for me?) But I prefer to not have it bundled to other inventory items since I don't bother tracking inventory of the settings. Also $279 seems like a lot of money for something that may have another solution. In the end if this module will work something like this module is acceptable to me at a lower price point. Let me know what alternatives are out there that I've missed. Thanks.
  6. I found the solution here https://community.bitnami.com/t/friendly-url-stopped-working-after-pointing-domain-to-ec2-ip/31114/3 Summary: Edit the htaccess.conf file under /opt/bithami/apps/prestashop/conf remove all references to your ec2 domain and replace with yourdomain.com Restart apache
  7. I have a Bitname AMI install on Ubuntu on Amazon elastic cloud. I'm running cloudflare for DNS. PrestaShop version I had two issues I wanted to resolve before going live with my site and loading a bunch of products. envyshave.com Frist issue is that the back office displayed envyshave.com just fine, but the front office used my Amazon cloud DNS ec2-50-17-178-69.compute-1.amazonaws.com as my web address. Second issue was that it wasn't loading search friendly trailing portion of the URL. So I created a .htaccess file and gave it 666 permision. then I turned on Friendly URL rewriting in the backoffice. This seemed to work great. I was now getting a URL querry that was search friendly, Now to change the Domain name to match my store in the front office. I changed it from ec2-50-17-178-69.compute-1.amazonaws.com to envyshave.com under Shop Domain and SSL domain in "set up show URL" Now the domain shows envyshave.com in the front office. But if I click on a product I get a 404. If I turn friendly url off, it works, or if I change the shop and SSL domain back to ec2-50-17-178-69.compute-1.amazonaws.com then it works, I just can't have them both on. I tried deleting the .htaccess file and recreating it, but that did not work. I tried changing my hostname on the server by changing the host file as well as the hostname file, then using the command hostname envyshave.com. I then restarted hostname service and ultimately restarted the server. It still does not work. I don't see any problems with cloudflare. Hopefully I'm missing something obvious or i"m making a rookie mistake. I tried adding a products but they have the same problem as the old product. I also tried changing the disable apache's muliview option to YES And tried changing the disable Apache's mod_security Module to YES. May or may not be related, but when the server is freshly restarted it resolves to http://ec2-50-17-178-69.compute-1.amazonaws.com/ instead of envyshave.com for quite a few minutes. There is a note about enabling mod_rewrite but I have not had any luck on figuring it out with bitnami ubuntu, I'm not even sure it's a problem since friendly URL works without my domain.
  8. Nothing yet. Let me know if you find a solution, I'll do the same.
  9. nanial

    Paypal looping

    I'm just going to bump this.
  10. I'm having problems paypal checkout overlapping on the product page. If payment logos activated it overlaps with that, if wishlist is enabled it overlaps with that, if both are disabled, it overlaps with the add to cart button. If add to cart is disabled due to that configuration not in stock it overlaps with selecting a different config. It's as if the paypal checkout does not allocate is own block of space.
  11. nanial

    Paypal looping

    It seem like even when I'm logged in, it doesn't grab the tax rate in the summary.
  12. nanial

    Paypal looping

    I'm having several issues that may or may not be related. Paypal v 1.3.8 - prestashop 1.6.09 express checkout is currently enabled on product page and shopping cart First assuming that a customer starts out on the website, not logged in. When a product is added to the cart, the cart claims "free shipping" instead of some other more appropriate message regarding shipping. then whilst using express checkout paypal from product page it still shows no taxes and no shipping - guess that is fine, they don't know where I am. But then after logging into paypal, still no tax or shipping. So now it take me back to my cart where I can choose shipping providers. Shipping shows up, but taxes no. Then it errors out if I try to check out again. Now I clear the cart, (but I'm still logged into prestashop from some user that presta created for checkout) and I try a different product. and it just has an eternal loop from paypal to shopping cart as follows. I've tried checking out different screens and logged in and not logged in and I have a variety of problems. but none result in checkout. I was able to make orders and recieve payments yesterday,but I was trying to resolve some excessive shipping problems and the whole thing broke. I can't figure it out, but I suspect the issue may be tax related, perhaps shipping. I dunno. But I've read and read, and cant seem to fix any of these issue.
  • Create New...

Important Information

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