Post by poseidon » Tue Sep 18, 2007 6:13 am

Hi friends... do you know where i can modify the code in order to send the invoice by mail also to the admin's email address automatically when the customer makes the checkout???

Take care that i have "Opencart PHP4 version".

Thanks ;)
PoSeiDoN.

Newbie

Posts

Joined
Tue Sep 18, 2007 5:24 am

Post by Tokai » Tue Sep 18, 2007 8:24 pm

Yes this would be extremely useful!

For 5 as well, plus I am trying to find the language file for the invoice as I see there's a grammatical error, and also would like to add address in which to send cheques...I am sure their hiding from me ;D

Spirit Mind Body UK Directory | iPyramidia Holistic Web Design


New member

Posts

Joined
Tue Aug 14, 2007 4:55 pm


Post by d77 » Tue Sep 18, 2007 11:53 pm

this is being discussed here as well:

http://forum.opencart.com/index.php?topic=373.0

i am simply looking for the admin to get a notification email - ie.  "You have a new order from " , but maybe a simpler change is just to CC the admin on the invoice e-mail that is sent to the customer.

as for PHP4 - i think any new feature like this is going to be added to the current version, but if anything is implemented for this it might not be too difficult to apply the same customization to your own branch.

User avatar
d77
Active Member

Posts

Joined
Sat Apr 14, 2007 8:04 am

Post by poseidon » Wed Sep 19, 2007 1:55 am

Yes sorry... i searched a previous post but i didn't find anything...

Let's to check if "SOMEONE" find the solution... and post it... i'm working on it.

Best Regards.
POSEIDON.

Newbie

Posts

Joined
Tue Sep 18, 2007 5:24 am

Post by Tokai » Wed Sep 19, 2007 2:15 am

I did a search too, so thanks D77 for highlighting a different thread. Shame no real answer but I guess it's something to do with COD, guess that's a start, for me it's cheque  ;)

Spirit Mind Body UK Directory | iPyramidia Holistic Web Design


New member

Posts

Joined
Tue Aug 14, 2007 4:55 pm


Post by d77 » Wed Sep 19, 2007 2:20 am

not quite - i don't believe the issue has to do with a particular payment type. this feature is just not part of opencart.

the issue (for me, at least), is that for non-paypal payments i will receive no email notification. if they happen to pay through paypal, paypal sends their own email confirmation to tell you that money has been sent.

i plan to research a modification to have the customer invoice email cc'd to the admin e-mail, but this is probably something that should be properly integrated into the core code so it can be configured in the admin tool.
Last edited by d77 on Wed Sep 19, 2007 2:21 am, edited 1 time in total.

User avatar
d77
Active Member

Posts

Joined
Sat Apr 14, 2007 8:04 am

Post by poseidon » Wed Sep 19, 2007 7:15 am

Hi folks!

I have solved my problem...

Insert this line into "mail.php" inside the "inlcude" folder:
    //-- At the end of the 'send email' function....
    if (@$this->bcc) {
      $this->headers .= 'Bcc: ' . $this->bcc . "\n";
    }
    mail("your@address.com",  $this->subject, $this->message, $this->headers);
    return mail($this->to,  $this->subject, $this->message, $this->headers);

  }
}
?>
Now system send a mail to the customer and another to the mail you want...  ;)

(Nice for a noob or not??? jajajjaja)

Saludos!!!
POSEIDON
Last edited by poseidon on Wed Sep 19, 2007 7:17 am, edited 1 time in total.

Newbie

Posts

Joined
Tue Sep 18, 2007 5:24 am

Post by d77 » Wed Sep 19, 2007 7:27 am

thanks!! i plan to take it one step further and retrieve the email address input in the admin.

User avatar
d77
Active Member

Posts

Joined
Sat Apr 14, 2007 8:04 am

Post by d77 » Wed Sep 19, 2007 7:29 am

i don't have the php4 version on hand, but did you edit the mail class that is used to generically send email? that would mean all emails sent through opencart would get sent to the admin address. not sure this is what you want.
Last edited by d77 on Wed Sep 19, 2007 7:32 am, edited 1 time in total.

User avatar
d77
Active Member

Posts

Joined
Sat Apr 14, 2007 8:04 am

Post by d77 » Wed Sep 19, 2007 8:53 am

for anyone that's interested, here is some code for opencart 0.7.6.1.

i have attached a mod for library\mail\mail.php

this updates the Mail() class to support blind carbon-copying (BCC) email addresses. currently, opencart sends mass (multiple address) emails all in the TO field, which means all of the addresses in the TO list are exposed to everyone who gets the email.

using this new mail class, i can make a simple modification to the Order() class in library\cart\order.php:

below the line:

Code: Select all

if ($this->config->get('config_email_send')) {
insert the following:

Code: Select all

$this->mail->setBcc($this->config->get('config_email'));
now whenever an order notification is sent to the customer, it will be blind carbon-copied to the admin/shop email address!

Attachments

Last edited by d77 on Wed Sep 19, 2007 8:56 am, edited 1 time in total.

User avatar
d77
Active Member

Posts

Joined
Sat Apr 14, 2007 8:04 am

Post by poseidon » Wed Sep 19, 2007 2:11 pm

In PHP4 i can not  :-[

If someone find another solution please send it to me please...

THANKS!!

Newbie

Posts

Joined
Tue Sep 18, 2007 5:24 am

Post by petpetep » Wed Sep 19, 2007 3:59 pm

thank you very much d77 for this mod ;)

New member

Posts

Joined
Sat Aug 11, 2007 4:19 pm


Post by Tokai » Wed Sep 19, 2007 6:56 pm

poseidon wrote: Hi folks!

I have solved my problem...

Insert this line into "mail.php" inside the "inlcude" folder:
    //-- At the end of the 'send email' function....
    if (@$this->bcc) {
      $this->headers .= 'Bcc: ' . $this->bcc . "\n";
    }
    mail("your@address.com",  $this->subject, $this->message, $this->headers);
    return mail($this->to,  $this->subject, $this->message, $this->headers);

  }
}
?>
Now system send a mail to the customer and another to the mail you want...  ;)

(Nice for a noob or not??? jajajjaja)

Saludos!!!
POSEIDON
Well done POSEIDON in finding a solution to your problem...or have you wasn't too sure :)? You should really upgrade thought to a new server, so many new script now depend on higher php versions...can't you get your hosting company to upgrade?  Solve a lot of issues... I have in my CPanel 2 version options, do you not have this?

D77 Thank Petal, you're a star!

Think it's gonna get lost in the numerous threads, can I suggest it be placed in the MOD section too?

Spirit Mind Body UK Directory | iPyramidia Holistic Web Design


New member

Posts

Joined
Tue Aug 14, 2007 4:55 pm


Post by poseidon » Wed Sep 19, 2007 9:26 pm

Sorry Tokai, my server administrator services told me by mail that "at that moment they are not considerating about to upgrade the PHP version...

You know in the admin page:

Code: Select all

Server Info
This page shows some general information about your OpenCart installation.
PHP Version: 4.3.10-18 
DB Version: MySQL 4.1.11-Debian_4sarge4-log 
Database Server: localhost 
Database Name: opencart 
Uptime: 9 days, 8:11 
So... i need to use the PHP4 version instead the 5...

Thanks anyway friends :) I'll continue looking for better solutions  ::)
Last edited by poseidon on Wed Sep 19, 2007 9:30 pm, edited 1 time in total.

Newbie

Posts

Joined
Tue Sep 18, 2007 5:24 am

Post by Tokai » Wed Sep 19, 2007 10:38 pm

Offtopic-Can I ask how much you pay for your hosting per year? Consider moving my friend, it always seems like a drag but if your on a too cheap hosting package, you will be limited continuously.

Spirit Mind Body UK Directory | iPyramidia Holistic Web Design


New member

Posts

Joined
Tue Aug 14, 2007 4:55 pm


Post by d77 » Wed Sep 19, 2007 11:08 pm

yeah, that was the response i got a few months ago as well. i inquired with my host about php5 so i could continue looking at projects like opencart, but many hosts will be concerned about an upgrade affecting other users on their servers.

i decided to say bye bye to that host and look for a more forward moving one.

you could also ask if they have any other servers already running php5 that you could be moved to

User avatar
d77
Active Member

Posts

Joined
Sat Apr 14, 2007 8:04 am

Post by poseidon » Thu Sep 20, 2007 2:54 am

THE FINAL SOLUTION!! about this:

How to send the checkout order to admin address and to customer???

1. Forget the "mail.php" file...

2. Use the "checkout_process.php" file using PHP4 version at catalog/plugin

3. insert this line at the end of the file...:

Code: Select all

  // if sending mail fails (and they'll think the order failed too)

  @$mail->send($customer->email, $language->_('email_subject', $insert_id), $message, $cfg['store_name'], $cfg['email']);
Insert this line now:

@$mail->send($cfg['email'], $language->_('email_subject', $insert_id), $message, $cfg['store_name'], $cfg['email']);

Code: Select all

}

unset($_SESSION['products']);
unset($_SESSION['charges']);
unset($_SESSION['shipping']);
unset($_SESSION['payment']);
unset($_SESSION['total']);
unset($_SESSION['comment']);

header('Location: ' . $url->ssl('checkout_success'));
exit;
?>
Yeah!!! ;)

Newbie

Posts

Joined
Tue Sep 18, 2007 5:24 am

Post by Tokai » Thu Sep 20, 2007 3:06 am

Well done Poseidon! If this works for the php 4 version, I think you also need to put it as a mod.

I am sorry just I am a Moderator on the best directory script on the net  ;D, and I hate to see MODs go unnoticed or lost. Forgive me, I am a woman we always nag  ;D

Spirit Mind Body UK Directory | iPyramidia Holistic Web Design


New member

Posts

Joined
Tue Aug 14, 2007 4:55 pm


Post by turb0 » Sun Oct 07, 2007 7:25 am

Tokai wrote: Yes this would be extremely useful!

For 5 as well, plus I am trying to find the language file for the invoice as I see there's a grammatical error, and also would like to add address in which to send cheques...I am sure their hiding from me ;D
If you are referring to the interesting instead of your interest in, that can be fixed in this file:

catalog/language/english/controller/checkout_confirm.php

Newbie

Posts

Joined
Sun Oct 07, 2007 6:34 am

Post by luvz2drv » Sun Oct 07, 2007 7:49 am

I offer a great deal for 1.99 a month ..

and offer to beat any other offer out there...

-=Luvz2drv=-

luvz2drv

Who is online

Users browsing this forum: No registered users and 4 guests