Great plugin! thanks for taking the time to produce this, I have a small problem however.
It all works fine, if I add the item to the watchlist the button changes to "View your watchlist" but, if I refresh the page it will say "Add to watchlist" even though it's already added.
I have this in the ajax_watchlist.php
<?php
if (Params::getParam('id') != '') {
$id = Params::getParam('id');
$count = 0;
if ( osc_is_web_user_logged_in() ) {
//check if the item is not already in the watchlist
$conn = getConnection();
$detail = $conn->osc_dbFetchResult("SELECT * FROM %st_item_watchlist WHERE fk_i_item_id = %d and fk_i_user_id = %d", DB_TABLE_PREFIX, $id, osc_logged_user_id());
//If nothing returned then we can process
if (!isset($detail['fk_i_item_id'])) {
$conn = getConnection();
$conn->osc_dbExec("INSERT INTO %st_item_watchlist (fk_i_item_id, fk_i_user_id) VALUES (%d, '%d')", DB_TABLE_PREFIX, $id, osc_logged_user_id());
?>
<span align="left">
<a href="<?php echo osc_base_url(true); ?>?page=custom&file=watchlist/watchlist.php">
<?php _e('View your watchlist', 'watchlist') ?>
</a>
</span>
<?
} else {
//Already in watchlist !
echo '<span align="left"><a href="' . osc_base_url(true) . '?page=custom&file=watchlist/watchlist.php">' . __('View your watchlist', 'watchlist') . '</a></span>';
}
} else {
//error user is not login in
echo '<a href="' . osc_user_login_url() . '">' . __('Please login', 'watchlist') . '</a>';
}
}
?>
I tried with both permalinks on and off but same result.
Have this in item.php
<p class="contact_button">
<?php if( !osc_item_is_expired () ) { ?>
<?php if( !( ( osc_logged_user_id() == osc_item_user_id() ) && osc_logged_user_id() != 0 ) ) { ?>
<?php if(osc_reg_user_can_contact() && osc_is_web_user_logged_in() || !osc_reg_user_can_contact() ) { ?>
<strong style="float:right; margin-right:140px; margin-top:-40px; padding-bottom:8px;"><a href="#contact"><?php _e('Contact seller', 'modern') ; ?></a></strong><br />
<strong style="float:right; margin-top:-55px; padding-bottom:8px;"> <a href="#watchlist"> <?php watchlist(); ?></strong>
<?php } ?>
<?php } ?>
<?php } ?>
</p>
Please help.