Post by Maansy » Thu Aug 26, 2010 8: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 Tue Sep 14, 2010 1:21 am, edited 1 time in total.

ALL Templates :: 1.5.1+ Templates :: 50%-75% PRICE DROP ONLY at OpencartStuff.com


User avatar
Active Member

Posts

Joined
Thu Jun 24, 2010 6:04 am


Post by Qphoria » Thu Aug 26, 2010 8: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


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Maansy » Thu Aug 26, 2010 9: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
Active Member

Posts

Joined
Thu Jun 24, 2010 6:04 am


Post by Qphoria » Thu Aug 26, 2010 9: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


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Maansy » Thu Aug 26, 2010 10: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
Active Member

Posts

Joined
Thu Jun 24, 2010 6:04 am


Post by Qphoria » Thu Aug 26, 2010 10: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


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Maansy » Thu Aug 26, 2010 11: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 Fri Aug 27, 2010 12:30 am, edited 1 time in total.

ALL Templates :: 1.5.1+ Templates :: 50%-75% PRICE DROP ONLY at OpencartStuff.com


User avatar
Active Member

Posts

Joined
Thu Jun 24, 2010 6:04 am


Post by Qphoria » Thu Aug 26, 2010 11: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


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Maansy » Fri Aug 27, 2010 12:17 am

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
Active Member

Posts

Joined
Thu Jun 24, 2010 6:04 am


Post by Qphoria » Fri Aug 27, 2010 12:20 am

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


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Maansy » Fri Aug 27, 2010 12:27 am

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
Active Member

Posts

Joined
Thu Jun 24, 2010 6:04 am


Post by Qphoria » Fri Aug 27, 2010 1:51 am

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


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Maansy » Fri Aug 27, 2010 11: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 5721 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 5721 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 5721 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 11:20 am, edited 1 time in total.

ALL Templates :: 1.5.1+ Templates :: 50%-75% PRICE DROP ONLY at OpencartStuff.com


User avatar
Active Member

Posts

Joined
Thu Jun 24, 2010 6:04 am


Post by Maansy » Fri Aug 27, 2010 11:19 am

and here are the controller/information/contact & contact.tpl 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
Active Member

Posts

Joined
Thu Jun 24, 2010 6:04 am


Post by Maansy » Sun Aug 29, 2010 1:11 am

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
Active Member

Posts

Joined
Thu Jun 24, 2010 6:04 am


Post by dramony » Mon Nov 15, 2010 7:22 pm

i tried this on OC version 1.3.2 but not working.. do you have something for older versions?

Active Member

Posts

Joined
Sat Oct 24, 2009 12:34 pm

Post by thegeekz » Fri Nov 19, 2010 11: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.

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


Active Member

Posts

Joined
Tue Nov 02, 2010 10:24 am
Who is online

Users browsing this forum: Google [Bot] and 373 guests