Hi Guys,
Here is how I did, and works fine:
Added the below to /oc-includes/osclass/classes/EmailVariables.php "public function init() {
$this->variables = array(
"
Line 71 added
'{REPUBLISH_URL}' => __('Item republish url'),
just below
'{ITEM_EXPIRATION_DATE}' => __('Item expiration date'),
Line 298 added to array 'email_warn_expiration' => array('
'{REPUBLISH_URL}',
just below
'{ITEM_EXPIRATION_DATE}',
/oc-includes/osclass/email.php
around line 1200 added to function:
'function fn_email_warn_expiration($aItem) {'
$republish_url = osc_base_url() . 'item_republish.php?id=' . $aItem['pk_i_id'] . '&repub=republish&secret=' . $aItem['s_secret'] ;
$republish_url = '<a href="' . $republish_url . '" >' . $republish_url . '</a>';
right below
$admin_email = osc_contact_email();
Around line 1218 changed these:
$words[] = array(
'{USER_NAME}',
'{ITEM_TITLE}',
'{ITEM_ID}',
'{ITEM_EXPIRATION_DATE}',
'{REPUBLISH_URL}', //ADDED
'{ITEM_URL}',
'{ITEM_LINK}',
'{SELLER_NAME}',
'{SELLER_EMAIL}',
'{CONTACT_NAME}',
'{CONTACT_EMAIL}'
);
$words[] = array(
$aItem['s_contact_name'],
$aItem['s_title'],
$itemId,
$aItem['dt_expiration'],
$republish_url, //ADDED
osc_item_url(),
$itemURL,
$aItem['s_contact_name'],
$aItem['s_contact_email'],
$aItem['s_contact_name'],
$aItem['s_contact_email']
);
Uploaded item republish php to my root (same folder as config.php)
Used/altered the code from advanced ad management pluguin.
<?php
require_once 'oc-load.php';
$repub = Params::getParam('repub');
if ($repub == 'republish') { // repost item
$secret = (Params::getParam('secret'))? Params::getParam('secret') : '';
$id = (Params::getParam('id'))? Params::getParam('id') : '';
$conn = getConnection();
$item = $conn->osc_dbFetchResult("SELECT * FROM %st_item WHERE pk_i_id = '%d' AND s_secret = '%s'", DB_TABLE_PREFIX, $id, $secret);
$user_id = $item['fk_i_user_id'];
if ($item['dt_expiration'] > date("Y-m-d h:i:s",strtotime("+2days"))) {
osc_add_flash_error_message( __('You already renewed your item.','YOUR_THEME')) ;
header("Location: " . osc_base_url(true) . '?page=item&id=' . $id);
} else {
if ( $item['pk_i_id'] != 0 && $item['s_secret'] != ''){
$date = date("Y-m-d h:i:s",strtotime("+14days"));
$conn->osc_dbExec("UPDATE %st_item SET dt_expiration = '%s' WHERE pk_i_id = '%d' ", DB_TABLE_PREFIX,$date,$id);
osc_add_flash_ok_message( __('Congratulations. Your ad as been republished!','YOUR_THEME') ) ;
header("Location: " . osc_base_url(true) . '?page=item&id=' . $id);
exit;
} else {
// add a flash message [ITEM NO EXISTE]
osc_add_flash_error_message( __('Sorry, we do not have any items with that ID or the secret key is incorrect.','YOUR_THEME')) ;
if(osc_is_web_user_logged_in()) {
// REDIRECT
header("Location: " . osc_user_list_items_url());
} else {
// REDIRECT
header("Location: " . osc_base_url(true));
}
}
}
}
?>
Works for me.
By this way, you have a new item {REPUBLISH_URL} in Email templates, warn_expiration_email that you can include into your email template.
Hope it helps.