I was recently asked by a client who purchased our Premiere addon how they could update their cron_daily_auction_newsletter email template so that the listing includes whether or not the New projects are premiere only or not. So I thought I would share that information here, incase anyone else has a similar request.
This tutorial is being written for ilance version 3.1.9, while it should stand true for 3.1.8 and the upcoming 3.2.0, you should make sure you pay extra close attention to your files if you aren’t using a vanilla installation of iLance 3.1.9.
Now, we will want to open up our class.subscription.inc.php located in theĀ root/functions/api directory of your site.
Next you will want to do a Find (cntrl+f) for cron_daily_auction_newsletter, your first location should be around line #1948. This is where the iLance system kicks off who get’s which daily service auction announcements from the site for their selected categories. Of course this spot in the code really just loads the template from the database and then replaces variable parameters with actual information which is created prior to this snippet of code.
Step 1:
// email user
$ilance->email->mail = $seller['email'];
$ilance->email->slng = fetch_user_slng($seller['user_id']);
$ilance->email->get('cron_daily_auction_newsletter');
$ilance->email->set(array(
'{{newsletterbody}}' => $messagebody,
'{{total}}' => count($projectsToSend),
));
$ilance->email->send();
Step 2:
So now that we have a starting point, we need to scroll back up in the file to around line #1894 (your line numbers may very) where you will find the following code:
if ($ilance->db->num_rows($buyerinfo) > 0)
{
$res_buyer_name = $ilance->db->fetch_array($buyerinfo);</pre>
$messagebody .= strip_vulgar_words(un_htmlspecialchars(stripslashes($project['project_title']))) . "\n";
// todo: check for seo
$messagebody .= HTTP_SERVER . "rfp.php?id=" . $project['project_id'] . "\n";
$messagebody .= $phrase['_category'] . ": " . $ilance->categories->title(fetch_user_slng($seller['user_id']), 'service', $project['cid']) . "\n";
$messagebody .= $phrase['_buyer'] . ": " . $res_buyer_name['username'] . "\n";
$messagebody .= $phrase['_time_left'] . ": " . $ilance->auction->auction_timeleft($project['project_id'], '', '', 0, 0, 1) . "\n";
$messagebody .= "************\n";
}
Step 3:
Now we need to edit the code from above. You can put it anywhere in there really, but we will put it after the category for our example. First we will check to see if this is a premiere only auction. Do do this we will write the following code.
if($project['premiere_only'] == 1)
{
}
We will then create our additional text if the if statement is valid.
if($project['premiere_only'] == 1)
{
$messagebody .= "Project Type: Premiere Only\n";
}
If we want to keep our listings similar we could add an else statement as well like so…
if($project['premiere_only'] == 1)
{
$messagebody .= "Project Type: Premiere Only\n";
}else{
$messagebody .= "Project Type: Standard\n";
}
Putting it all together:
if ($ilance->db->num_rows($buyerinfo) > 0)
{
$res_buyer_name = $ilance->db->fetch_array($buyerinfo);</pre>
$messagebody .= strip_vulgar_words(un_htmlspecialchars(stripslashes($project['project_title']))) . "\n";
// todo: check for seo
$messagebody .= HTTP_SERVER . "rfp.php?id=" . $project['project_id'] . "\n";
$messagebody .= $phrase['_category'] . ": " . $ilance->categories->title(fetch_user_slng($seller['user_id']), 'service', $project['cid']) . "\n";
if($project['premiere_only'] == 1)
{
$messagebody .= "Project Type: Premiere Only\n";
}else{
$messagebody .= "Project Type: Standard\n";
}
$messagebody .= $phrase['_buyer'] . ": " . $res_buyer_name['username'] . "\n";
$messagebody .= $phrase['_time_left'] . ": " . $ilance->auction->auction_timeleft($project['project_id'], '', '', 0, 0, 1) . "\n";
$messagebody .= "************\n";
}
