First of all many thanks for sharing this information!!! It's quite unbelievable that these features are not part of core OSCLASS yet...
I'm struggling to implement these ad management features but I'm facing some difficulties.
The first one relates to the fact that despite the ads are renewed I don't receive the message (osc_add_flash_ok_message...) with that information. Instead when I click "renew" I receive a "500 Internal Server Error". When I go back to the website the ad was renewed although... Any clues on what might be causing this problem and what should I do to fix it?
The second doubt relates on how to properly update the email_warn_expiration to include a "renew" link. I've made following changes:
im not new on this kind of programming but sometimes we meet some strange problem and ask for a solution, and in that email templates whatever i put,a link,a php code, a href etc.....will be send exactly word by word!
p.s sorry for i waste your time but this is a forum anyway!if u have a problem with this just "log out" and let the "amateur" to fix their own bugs/problems!
hi serjuc11111,
This is my code at osclass/emails.php. May be this can give you some idea about warn_expiration email
function fn_email_warn_expiration($aItem) {
$itemId = $aItem['pk_i_id'];
$admin_email = osc_contact_email();
View::newInstance()->_exportVariableToView('item', $aItem);
$itemURL = osc_item_url();
$itemURL = '<a href="'.$itemURL.'" >'.$itemURL.'</a>';
$renew_url = osc_item_renew_url( $aItem['s_secret'], $aItem['pk_i_id'] );
$renew_url = '<a href="'.$renew_url.'" >'.$renew_url.'</a>';
$mPages = new Page();
$aPage = $mPages->findByInternalName('email_warn_expiration');
$locale = osc_current_user_locale();
$content = array();
if(isset($aPage['locale'][$locale]['s_title'])) {
$content = $aPage['locale'][$locale];
} else {
$content = current($aPage['locale']);
}
$words = array();
$words[] = array(
'{USER_NAME}',
'{ITEM_TITLE}',
'{ITEM_ID}',
'{ITEM_EXPIRATION_DATE}',
'{ITEM_URL}',
'{ITEM_LINK}',
'{RENEW_LINK}',
'{SELLER_NAME}',
'{SELLER_EMAIL}'
);
$words[] = array(
$aItem['s_contact_name'],
$aItem['s_title'],
$itemId,
$aItem['dt_expiration'],
osc_item_url(),
$itemURL,
$renew_url,
$aItem['s_contact_name'],
$aItem['s_contact_email']
);
$title_email = osc_apply_filter('email_warn_expiration_title_after', osc_mailBeauty(osc_apply_filter('email_title', osc_apply_filter('email_warn_expiration_title', $content['s_title'])), $words));
$body_email = osc_apply_filter('email_warn_expiration_description_after', osc_mailBeauty(osc_apply_filter('email_description', osc_apply_filter('email_warn_expiration_description', $content['s_text'])), $words));
$emailParams = array(
'from' => $admin_email,
'subject' => $title_email,
'to' => $aItem['s_contact_email'],
'to_name' => $aItem['s_contact_name'],
'body' => $body_email,
'alt_body' => $body_email
);
osc_sendMail($emailParams);
}
osc_add_hook('hook_email_warn_expiration', 'fn_email_warn_expiration');
But I still can't figure out what I should include in the email template. serjuc11111 can you show us the html you considered for the email_warn_expiration?
The html I'm using is the following (no idea if it will work...):
<p>Hello {USER_NAME},</p>
<p>Your ad: <a href="{ITEM_URL}">{ITEM_TITLE}</a> at {WEB_LINK} finishes in {ITEM_EXPIRATION_DATE}.</p>
<p>If you wish you can renew it <a href="{RENEW_LINK}">here</a></p>
<p>Best regards,</p>
<p>{WEB_TITLE}</p>
Please help!!!