Support Forums

Passing Listing ID to notification emails

This is a discussion on Passing Listing ID to notification emails within the v3.1 Questions & Support forums, part of the Legacy Help & Support category; I have modified our 68 Classifieds installation so that notification emails get sent to the user after posting an ad, ...


Go Back   68 Classifieds Forums > Archives > Legacy Help & Support > v3.1 Questions & Support

Reply
 
Thread Tools Display Modes
Old 08-03-2007, 10:15 PM   #1
Member
 
Join Date: May 2007
Posts: 37
Rep Power: 10
abkeller is on a distinguished road
Default Passing Listing ID to notification emails

I have modified our 68 Classifieds installation so that notification emails get sent to the user after posting an ad, instead of to the admin. I commented out the admin link so the user only gets the first link to view their listing detail page.

What I'd also like to pass in the email is the listing id, sort of like this;

Your listing has successfully been added to GunMountain.com.

Here are the details of your new listing;
Listing ID#: ##listingid##
Title: Sample Ad Title
Price: $0.00

Click to view your ad:
http://www.mydomain.com/classifieds/...g.php?view=427

How can I get the listing ID passed to the email? It's already at the end of the URL string, it should be really simple to call it out separately. What do I add to the functions.php file that formats the notification email to make this happen?

Thanks!
__________________
private signature
68Classifieds - Developer Edition, v.3.1.7

Last edited by abkeller; 09-15-2007 at 06:30 PM. Reason: hide domain from search engines!
abkeller is offline   Reply With Quote
Old 08-03-2007, 11:59 PM   #2
Member
 
Join Date: May 2007
Posts: 37
Rep Power: 10
abkeller is on a distinguished road
Default Got it working...

Figured this one out myself, as well. Insert the following lines of code (in red) into the functions.php file;

$result=$db->query($sSQL);
$rs=$result->fetch();
$subject=$rs['eSubject'];
$htmlContent=$rs['eHTML'];
$sSQL="SELECT title,price FROM ".PREFIX."products WHERE id=".$orderid;
$result=$db->query($sSQL);
$rs=$result->fetch();
$emailmessage.= $htmlContent.'<br>'. LANG_TITLE.": ".safeStripSlashes($rs['title'])."<br>\n";
$emailmessage.= LANG_PRICE .": ".FormatCurrency($rs['price'])."<br>\n";
$emailmessage.= "Listing ID: ".$orderid."<br>\n";
$emailmessage.= "Click to view your ad: <br>\n";
$emailmessage.= "<a href='".URL."/viewlisting.php?view=".$orderid."'>".URL."/viewlisting.php?view=".$orderid."</a><br>\n";
//$emailmessage.= "<a href='".URL."/administration/listinginfo.php?view=".trim($orderid)."'>".URL."/administration/listinginfo.php?view=".trim($orderid)."</a>";
__________________
private signature
68Classifieds - Developer Edition, v.3.1.7

Last edited by abkeller; 08-04-2007 at 12:03 AM. Reason: Removing comment
abkeller is offline   Reply With Quote
Old 08-07-2007, 05:52 PM   #3
68 Evangelist & Developer
 
 
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 1,711
Rep Power: 50
Mike-N-Tosh is just really nice Mike-N-Tosh is just really nice
Default

abkeller,

Thanks for posting that code. I never understood why the new listing email went to the admin and not the seller to begin with. I always thought it would be a much better solution to have that as an admin setting that you could choose who gets the notification.

Where and how did you change the code to send the mail to the seller instead? I would like to do that and BCC: the admin.

Thanks,
Mike
__________________
Mike-N-Tosh
IndianaPC.org - A community website (v3.1.10 Developer - heavily modified)
Sandbox (v3.1.10, v4.0.9, 4.1.5)
Visit My blog for tips, tricks, tutorials, reviews for 68 Classifieds as well as my store with Templates, Mods & Docs
Web Hosting | Web Design & Development | 68 Classifieds Customizations
I am not a 68C employee, just a user and try to help out
Mike-N-Tosh is offline   Reply With Quote
Old 08-07-2007, 08:52 PM   #4
Member
 
Join Date: May 2007
Posts: 37
Rep Power: 10
abkeller is on a distinguished road
Default Instructions for changing email notifications to user

To change the email from admin to the user for MODIFYING a listing open modifylisting.php and insert the code below


$sSQL="SELECT eID, eName, eSubject, eHTML, eText FROM ".PREFIX."email_templates WHERE eID=7";
$result=$db->query($sSQL);
$rs=$result->fetch();
$subject=$rs['eSubject'];
$htmlContent=$rs['eHTML'];
$textContent=$rs['eText'];
$sSQL="SELECT title,price FROM ".PREFIX."products WHERE id=".$productid;
$result=$db->query($sSQL);
$rs=$result->fetch();
$emailmessage.= $htmlContent.'<br>'. LANG_TITLE.": ".safeStripSlashes($rs['title'])."<br>\n";
$emailmessage.= LANG_PRICE .": ".FormatCurrency($rs['price'])."<br>\n";
$emailmessage.= "<a href='".URL."/viewlisting.php?view=".$productid."'>".URL."/viewlisting.php?view=".$productid."</a><br>\n";


//my inserted code
$sSQL="SELECT email FROM ".PREFIX."users WHERE id=".$userid;
$result=$db->query($sSQL);
$rs=$result->fetch();
$email=$rs['email'];



// Instantiate mail class
$mail = new Mailer();
$mail->AddAddress ($email);
$mail->Subject = $subject;
$mail->Body = $emailmessage;
$mail->AltBody = strip_tags($emailmessage);

To change the email notification for new listing open functions.php (in your includes folders) and do the following:

By commenting out the second line of code for the admin link we can remove the embedded URL that goes to the admin link, which users don't need to see;

//should we email?
if($notification=="Y")
{
$sSQL="SELECT eID, eName, eSubject, eHTML, eText FROM ".PREFIX."email_templates WHERE eID=6";
$result=$db->query($sSQL);
$rs=$result->fetch();
$subject=$rs['eSubject'];
$htmlContent=$rs['eHTML'];

$sSQL="SELECT title,price FROM ".PREFIX."products WHERE id=".$orderid;
$result=$db->query($sSQL);
$rs=$result->fetch();
$emailmessage.= $htmlContent.'<br>'. LANG_TITLE.": ".safeStripSlashes($rs['title'])."<br>\n";
$emailmessage.= LANG_PRICE .": ".FormatCurrency($rs['price'])."<br>\n";
$emailmessage.= "Listing ID: ".$orderid."<br>\n";
$emailmessage.= "Click to view your ad: <br>\n";
$emailmessage.= "<a href='".URL."/viewlisting.php?view=".$orderid."'>".URL."/viewlisting.php?view=".$orderid."</a><br>\n";
// Commented out
//$emailmessage.= "<a href='".URL."/administration/listinginfo.php?view=".trim($orderid)."'>".URL."/administration/listinginfo.php?view=".trim($orderid)."</a>";

Then, change the sendmail script to call the user ID and associated email from the dB and use it to populate the "To" field of the email;

$mail = new Mailer();
$mail->Subject = $subject;
$mail->Body = $emailmessage;
$mail->AltBody = strip_tags($emailmessage);

// Comment out the call to ADMIN_EMAIL
// $mail->AddAddress($Core->settings['email']);


$sSQL="SELECT email FROM ".PREFIX."users WHERE id=".$_SESSION['uid'];
$result=$db->query($sSQL);
$rs=$result->fetch();
$xemail = $rs['email'];

$mail->AddAddress("$xemail");
if(!$mail->Send())

Now this sends an email to the user each time an ad is completed.

Unfortunately, I'm still trying to get someone to get back to me on why the email notify is NOT working whenever a registered user uses part of his membership package to post an ad. In this case, an email is not automatically being sent to either the admin or the user. I've looked at the code (until I was cross-eyed) and I don't see anything during the checkout process for members that sends an email after an ad is completed.

I'll keep trying - maybe someone will respond!
__________________
private signature
68Classifieds - Developer Edition, v.3.1.7
abkeller is offline   Reply With Quote
Old 08-07-2007, 09:02 PM   #5
Senior Member
 
CHRD's Avatar
 
Join Date: Nov 2006
Posts: 188
Rep Power: 16
CHRD is on a distinguished road
Default

I always like to validate the new listings before making them live, cos most of them need editing, so I think this hack might just make more dumb ass emails to support, asking where is my advert.

But it would be great to make the system send the email out when its been validated by admin.

Iv put "It can take upto 2-3 days to validate your listing" in the checkout 6 step
__________________
Costa del Sol
Spain
v3.1.10 Dev
V4.09 Dev sweeeet
�Powerful you have become, the dark side I sense in you.�
CHRD is offline   Reply With Quote
Old 08-07-2007, 10:54 PM   #6
Member
 
Join Date: May 2007
Posts: 37
Rep Power: 10
abkeller is on a distinguished road
Default Email notify with manually approved ads

With ads automatically posting to the site after creation you don't have the option, as the admin, to edit or screen out the ads that shouldn't be posted.

If you have opted to manually approve all incoming ads this hack won't work for automatically sending an email to the user after the ad has been approved by the admin.

I've seen several people ask for that option on other threads, but I don't have a solution for that here.
__________________
private signature
68Classifieds - Developer Edition, v.3.1.7
abkeller is offline   Reply With Quote
Old 08-07-2007, 11:20 PM   #7
68 Evangelist & Developer
 
 
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 1,711
Rep Power: 50
Mike-N-Tosh is just really nice Mike-N-Tosh is just really nice
Default

Elizabeth,

Thanks for posting that code. That is very helpful and will resolve complaints that I've been getting about not getting a notification about the new ad listings and modifications.

-Mike
__________________
Mike-N-Tosh
IndianaPC.org - A community website (v3.1.10 Developer - heavily modified)
Sandbox (v3.1.10, v4.0.9, 4.1.5)
Visit My blog for tips, tricks, tutorials, reviews for 68 Classifieds as well as my store with Templates, Mods & Docs
Web Hosting | Web Design & Development | 68 Classifieds Customizations
I am not a 68C employee, just a user and try to help out
Mike-N-Tosh is offline   Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
New Listing Notify Not working for memberships abkeller v3.1 Questions & Support 0 08-03-2007 03:51 AM
User: See's Membership listing package garysr v3.1 Questions & Support 23 11-04-2006 02:08 PM
Problem in ACP with messed up Listing Extras pat01 v3.1 Questions & Support 0 07-18-2006 02:32 PM
View Listing (404 Error) Scooter v3.1 Questions & Support 7 06-08-2006 03:09 PM
Ad notification emails doubling up Bucketman v3.1 Questions & Support 7 05-24-2006 11:34 AM


All times are GMT -4. The time now is 03:33 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0