Community Forums

Enhance the Contact us page

General support for technical problems with OpenCart v1.x

Enhance the Contact us page

Postby Maansy » Thu Aug 26, 2010 12:41 pm

i edited the contact us form. i added more fields to be emailed.

after send i get this:
Code: Select all

Warning
: html_entity_decode() expects at most 3 parameters, 5 given in /home/XXXXXX/public_html/demo1/catalog/controller/information/contact2.php on line 23Error: E-Mail message required!
 


expects at most 3 parameters, how can i set it to 5 or more?
Last edited by Maansy on Mon Sep 13, 2010 5:21 pm, edited 1 time in total.
ALL Templates :: 1.5.1+ Templates :: 50%-75% PRICE DROP ONLY at OpencartStuff.com
User avatar
Maansy
 
Posts: 930
Joined: Wed Jun 23, 2010 10:04 pm

Re: html_entity_decode() ISSUE

Postby Qphoria » Thu Aug 26, 2010 12:44 pm

Maansy wrote:i edited the contact us form. i added more fields to be emailed.

after send i get this:
Code: Select all

Warning
: html_entity_decode() expects at most 3 parameters, 5 given in /home/XXXXXX/public_html/demo1/catalog/controller/information/contact2.php on line 23Error: E-Mail message required!
 


expects at most 3 parameters, how can i set it to 5 or more?


5 what? It's parameters for a function
http://php.net/manual/en/function.html- ... decode.php
Image Image
Donate!|OpenCart Basics|GeoZones
Help me get more development cloud storage - Click Here to get DropBox
User avatar
Qphoria
Administrator
 
Posts: 18209
Joined: Mon Jul 21, 2008 7:02 pm
Donate to Qphoria

Re: html_entity_decode() ISSUE

Postby Maansy » Thu Aug 26, 2010 1:11 pm

thanks
i tried this :

Code: Select all

$mail
->setText(strip_tags(html_entity_decode($this->request->post['website'], ENT_QUOTES, 'UTF-8')));
            $mail->setText(strip_tags(html_entity_decode($this->request->post['job'], ENT_QUOTES, 'UTF-8')));
              $mail->setText(strip_tags(html_entity_decode($this->request->post['date'], ENT_QUOTES, 'UTF-8')));
            $mail->setText(strip_tags(html_entity_decode($this->request->post['enquiry'], ENT_QUOTES, 'UTF-8')));
 


but the only line get sent is the last one

Code: Select all

$mail
->setText(strip_tags(html_entity_decode($this->request->post['enquiry'], ENT_QUOTES'UTF-8')));
 


how can i let it send all 4 lines?

thanks
ALL Templates :: 1.5.1+ Templates :: 50%-75% PRICE DROP ONLY at OpencartStuff.com
User avatar
Maansy
 
Posts: 930
Joined: Wed Jun 23, 2010 10:04 pm

Re: html_entity_decode() ISSUE

Postby Qphoria » Thu Aug 26, 2010 1:43 pm

Code: Select all
$msg  = strip_tags(html_entity_decode($this->request->post['website'], ENT_QUOTES, 'UTF-8')) . "\r\n";
$msg .= strip_tags(html_entity_decode($this->request->post['job'], ENT_QUOTES, 'UTF-8')) . "\r\n";
$msg .= strip_tags(html_entity_decode($this->request->post['date'], ENT_QUOTES, 'UTF-8')) . "\r\n";
$msg .= strip_tags(html_entity_decode($this->request->post['enquiry'], ENT_QUOTES, 'UTF-8')) . "\r\n";

$mail->setText($msg);
Image Image
Donate!|OpenCart Basics|GeoZones
Help me get more development cloud storage - Click Here to get DropBox
User avatar
Qphoria
Administrator
 
Posts: 18209
Joined: Mon Jul 21, 2008 7:02 pm
Donate to Qphoria

Re: html_entity_decode() ISSUE

Postby Maansy » Thu Aug 26, 2010 2:00 pm

thanks Q for replying.
i tried your code but nothing gets send.
so i tried:
1st line: $msg =
changed it to: $msg .=
i got an error.

thanks for trying to help Q :)
ALL Templates :: 1.5.1+ Templates :: 50%-75% PRICE DROP ONLY at OpencartStuff.com
User avatar
Maansy
 
Posts: 930
Joined: Wed Jun 23, 2010 10:04 pm

Re: html_entity_decode() ISSUE

Postby Qphoria » Thu Aug 26, 2010 2:15 pm

Maansy wrote:thanks Q for replying.
i tried your code but nothing gets send.
so i tried:
1st line: $msg =
changed it to: $msg .=
i got an error.

thanks for trying to help Q :)


I didn't say to use .= for the first one.. so don't.
The code above isn't finished. I was only correcting your example. You still need to add the rest of the mail stuff like mail->send()
Image Image
Donate!|OpenCart Basics|GeoZones
Help me get more development cloud storage - Click Here to get DropBox
User avatar
Qphoria
Administrator
 
Posts: 18209
Joined: Mon Jul 21, 2008 7:02 pm
Donate to Qphoria

Re: html_entity_decode() ISSUE

Postby Maansy » Thu Aug 26, 2010 3:32 pm

Qphoria wrote:I didn't say to use .= for the first one.. so don't.
The code above isn't finished. I was only correcting your example. You still need to add the rest of the mail stuff like mail->send()


i was only trying
ok, i see
here is the rest of the email stuff
Code: Select all

    if 
(($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
            $mail = new Mail();
            $mail->protocol = $this->config->get('config_mail_protocol');
            $mail->parameter = $this->config->get('config_mail_parameter');
            $mail->hostname = $this->config->get('config_smtp_host');
            $mail->username = $this->config->get('config_smtp_username');
            $mail->password = $this->config->get('config_smtp_password');
            $mail->port = $this->config->get('config_smtp_port');
            $mail->timeout = $this->config->get('config_smtp_timeout');                
            $mail
->setTo($this->config->get('config_email'));
            $mail->setFrom($this->request->post['email']);
            $mail->setSender($this->request->post['name']);
            $mail->setSubject(sprintf($this->language->get('email_subject'), $this->request->post['name']));
            $msg = strip_tags(html_entity_decode($this->request->post['website'], ENT_QUOTES, 'UTF-8')) . "\r\n";
            $msg = strip_tags(html_entity_decode($this->request->post['job'], ENT_QUOTES, 'UTF-8')) . "\r\n";
            $msg = strip_tags(html_entity_decode($this->request->post['date'], ENT_QUOTES, 'UTF-8')) . "\r\n";
            $msg = strip_tags(html_entity_decode($this->request->post['enquiry'], ENT_QUOTES, 'UTF-8')) . "\r\n";

            $mail->setText($msg);
 





if you could take a look at the code and help correcting it, i would be so greatful
Last edited by Maansy on Thu Aug 26, 2010 4:30 pm, edited 1 time in total.
ALL Templates :: 1.5.1+ Templates :: 50%-75% PRICE DROP ONLY at OpencartStuff.com
User avatar
Maansy
 
Posts: 930
Joined: Wed Jun 23, 2010 10:04 pm

Re: html_entity_decode() ISSUE

Postby Qphoria » Thu Aug 26, 2010 3:57 pm

I thought i was clear

Qphoria wrote:The code above isn't finished. I was only correcting your example. You still need to add the rest of the mail stuff like mail->send()

I don't see a $mail->send(); at the end
Image Image
Donate!|OpenCart Basics|GeoZones
Help me get more development cloud storage - Click Here to get DropBox
User avatar
Qphoria
Administrator
 
Posts: 18209
Joined: Mon Jul 21, 2008 7:02 pm
Donate to Qphoria

Re: html_entity_decode() ISSUE

Postby Maansy » Thu Aug 26, 2010 4:17 pm

yes, added now.
mail is sent fine.
but again the last line only gets sent:
Code: Select all
$msg strip_tags(html_entity_decode($this->request->post['enquiry'], ENT_QUOTES'UTF-8')) . "\r\n"
ALL Templates :: 1.5.1+ Templates :: 50%-75% PRICE DROP ONLY at OpencartStuff.com
User avatar
Maansy
 
Posts: 930
Joined: Wed Jun 23, 2010 10:04 pm

Re: html_entity_decode() ISSUE

Postby Qphoria » Thu Aug 26, 2010 4:20 pm

I don't understand why you keep changing what I write.
I said remove the .= from the FIRST $msg only. All other $msg after that have the .=
Image Image
Donate!|OpenCart Basics|GeoZones
Help me get more development cloud storage - Click Here to get DropBox
User avatar
Qphoria
Administrator
 
Posts: 18209
Joined: Mon Jul 21, 2008 7:02 pm
Donate to Qphoria

Re: html_entity_decode() ISSUE

Postby Maansy » Thu Aug 26, 2010 4:27 pm

sorry, i was editing the old file. i paid attention this time.
did all what you have instructed. now its working fine.
one last thing if you dont mind.
how would i get the upload file working in the form?
do you advice against it?
thanks
ALL Templates :: 1.5.1+ Templates :: 50%-75% PRICE DROP ONLY at OpencartStuff.com
User avatar
Maansy
 
Posts: 930
Joined: Wed Jun 23, 2010 10:04 pm

Re: html_entity_decode() ISSUE

Postby Qphoria » Thu Aug 26, 2010 5:51 pm

Take a look at the admin/controller/tool/backup.php to get a good example of how to use file upload

Make a field in the contact form for file upload
Code: Select all
<input type="file" name="upload" />


For the controller, try something like:
Code: Select all
if (is_uploaded_file($this->request->files['upload']['tmp_name'])) {
   $mail->attachment(file_get_contents($this->request->files['upload']['tmp_name']));
}


I've not tested this but it should get the ball rolling a bit.
Image Image
Donate!|OpenCart Basics|GeoZones
Help me get more development cloud storage - Click Here to get DropBox
User avatar
Qphoria
Administrator
 
Posts: 18209
Joined: Mon Jul 21, 2008 7:02 pm
Donate to Qphoria

Re: html_entity_decode() ISSUE

Postby Maansy » Fri Aug 27, 2010 3:16 am

Thanks Q for baring with me
i have managed to add:
textbox
checkbox (having some issue with it)
dropdown
datepicker
file upload (not working yet)
to the existing field in the defualt contact us form
____________________________________________

i made 3 tests to check if everything working.

TEST 1
contact_form1.gif
contact_form1.gif (11.93 KiB) Viewed 1376 times


as you can see. i filled everything up but not the file upload field.
after sent, i recieved an email with every field i filled. thats great.


TEST 2 (checkbox test)
contact_form2.png
contact_form2.png (8.81 KiB) Viewed 1376 times


as you can see. i filled everything up but not the logo design checkbox and the file upload.
after sent i got this error, but the email was recieved:
Code: Select all
[b]Notice[/b]: Undefined index: cb_logo in /home/xxxxx/public_html/demo1/catalog/controller/information/contact4.php on line 40
[b]Warning[/b]: Cannot modify header information - headers already sent by (output started at /home/xxxxx/public_html/demo1/index.php:92) in /home/xxxxx/public_html/demo1/system/engine/controller.php on line 27


TEST 3 (file upload test)
contact_form3.png
contact_form3.png (8.16 KiB) Viewed 1376 times


as you can see. i filled EVERYTHING this time even the file upload.
after sent i got this error:
Code: Select all
[b]Fatal error[/b]: Call to undefined method Mail::attachment() in /home/xxxxx/public_html/demo1/catalog/controller/information/contact4.php on line 25


files in next post...
Last edited by Maansy on Fri Aug 27, 2010 3:20 am, edited 1 time in total.
ALL Templates :: 1.5.1+ Templates :: 50%-75% PRICE DROP ONLY at OpencartStuff.com
User avatar
Maansy
 
Posts: 930
Joined: Wed Jun 23, 2010 10:04 pm

Re: html_entity_decode() ISSUE

Postby Maansy » Fri Aug 27, 2010 3:19 am

and here are the controller/information/contact & contact.tpl
contact4.zip
(3.37 KiB) Downloaded 123 times


i hope the fix is not complicated

thanks Q
ALL Templates :: 1.5.1+ Templates :: 50%-75% PRICE DROP ONLY at OpencartStuff.com
User avatar
Maansy
 
Posts: 930
Joined: Wed Jun 23, 2010 10:04 pm

Re: html_entity_decode() ISSUE

Postby Maansy » Sat Aug 28, 2010 5:11 pm

maybe i will wait on this one, since everyone is having fun with 1.49 ;)
ALL Templates :: 1.5.1+ Templates :: 50%-75% PRICE DROP ONLY at OpencartStuff.com
User avatar
Maansy
 
Posts: 930
Joined: Wed Jun 23, 2010 10:04 pm

Re: Enhance the Contact us page

Postby dramony » Mon Nov 15, 2010 11:22 am

i tried this on OC version 1.3.2 but not working.. do you have something for older versions?
User avatar
dramony
 
Posts: 258
Joined: Sat Oct 24, 2009 4:34 am

Re: Enhance the Contact us page

Postby thegeekz » Fri Nov 19, 2010 3:47 am

HI Maansy ,

After reading through the thread.. am still confused.

I have a similar enhancement I'll like to make...

Need drop down boxes & checkboxes in the Contact us form as well:

Drop down -- Subject Line

Checkboxes -- : how do you find us?

Do I just use the zip file, that you've done and edit the codes accordingly to what I need?

Thank you.
Production Cart @ http://eshop.kgshop-sg.com -- OC 1.5.4.1 -- pending
No more using Apsona, as they are not updated.
    Every upgrade -- rem. 2 reinstall vqmod & mindful of modules w/ VQmod -- E.g Import / Export Tool by MHC
Test cart @ http://tshop.kgshop-sg.com -- pending -- still busy with friend's OC cart.
thegeekz
 
Posts: 326
Joined: Tue Nov 02, 2010 2:24 am


Return to General Support

Who is online

Users browsing this forum: mminten and 52 guests

Hosted by Arvixe Web Hosting