Osclass forums
Development => Plugins => Topic started by: keny on July 11, 2011, 10:54:52 pm
-
Hi,
Just to let you know that i have finished the watchlist pluggin. It will be released whith OsClass v 2.2.
Include French language and English language
This pluggin will display a link so user can "watch item" everything is done via ajax and pluggin had a link into user control panel to display items watched.
Juan and Conejo have send a pull request to make a new branch Watchlist to github so you can test it already and if you want include it with osclass 2.2
So for people that want to download it you can go here :https://github.com/keny10/My-Osclass-pluggin/tree/Watchlist (https://github.com/keny10/My-Osclass-pluggin/tree/Watchlist)
But again will work only with OsClass 2.2 and up
Thanks to Juan that give me some 2.2 function !!
Here is some preview that display the pluggin running under french language
(http://img641.imageshack.us/img641/234/watchlispreview2.jpg) (http://imageshack.us/photo/my-images/641/watchlispreview2.jpg/)
(http://img685.imageshack.us/img685/7383/watchlispreview1.jpg) (http://imageshack.us/photo/my-images/685/watchlispreview1.jpg/)
-
Maybe this is a stupid question... whats the purpose of this plugin, what does it do?
-
The watchlist allows you to remember Ads so that you can come back to the Ad later on. It also allows you to easily compare multiple Ads at one time.
Without that pluggin your user will not love your site every classified site must have this.
-
Thanks for explaining!
Yep, its a good thing to be able to compare all items of interest on the same side!
-
I've merged the plugin into the osclass-plugin repository: https://github.com/osclass/osclass-plugins/tree/watchlist
the most interesting changes are in this file: https://github.com/osclass/osclass-plugins/blob/watchlist/watchlist/watchlist.php
1. Now I'm using Search class to get the results
2. I'm using osc_pagination helper to get the pagination too :)
-
Hi Juan,
The way you make it is so easy i was scratched my head to do the search and you make it with 3 lines !!
Even if i read the code i don not understand well the search function in OsClass can you explain me more about that because i will have to work with this function in about every pluggin i will mada so ist better to ask question now.
Search::newInstance()->addConditions(sprintf("%st_item_watchlist.fk_i_user_id = %d", DB_TABLE_PREFIX, $i_userId));
That will result in :
SELECT * FROM oc_t_item LEFT JOIN oc_t_item_watchlist ON (pk_i_id = fk_i_item_id) WHERE oc_t_item_watchlist.fk_i_user_id = 1 LIMIT 0,5
So addConditions is only use when we are dealing with items ?
%st_item_watchlist.fk_i_user_id = %d" will be parse to make that condition : ON (pk_i_id = fk_i_item_id) ?
Search::newInstance()->addTable(sprintf("%st_item_watchlist", DB_TABLE_PREFIX));
What exactly this is doing ?
Search::newInstance()->page($iPage, $itemsPerPage);
This had the Limit 0,5 at the end of the query i am correct ?
$aItems = Search::newInstance()->doSearch();
Make the search and return it in a array()
$iTotalItems = Search::newInstance()->count();
Will return number of row from this query, but this ignore the page function ?
Did i understand it like it suppose to be ?
Thanks
-
Search::newInstance()->addConditions(sprintf("%st_item_watchlist.fk_i_user_id = %d", DB_TABLE_PREFIX, $i_userId));
That will result in :
SELECT * FROM oc_t_item LEFT JOIN oc_t_item_watchlist ON (pk_i_id = fk_i_item_id) WHERE oc_t_item_watchlist.fk_i_user_id = 1 LIMIT 0,5
So addConditions is only use when we are dealing with items ?
The search class is to deal with items. However, it returns the title, description, location...
%st_item_watchlist.fk_i_user_id = %d" will be parse to make that condition : ON (pk_i_id = fk_i_item_id) ?
It doesn't make the JOIN... we should add this option as... ->join('table', 'condition') or something like this.
Search::newInstance()->addTable(sprintf("%st_item_watchlist", DB_TABLE_PREFIX));
What exactly this is doing ?
It's added after the FROM
Search::newInstance()->page($iPage, $itemsPerPage);
This had the Limit 0,5 at the end of the query i am correct ?
Extactly. It append the limit at the end of the query.
$iTotalItems = Search::newInstance()->count();
Will return number of row from this query, but this ignore the page function ?
It returns the number of rows of the query without limits.
-
Hi mate,
how cam I install it.. I uploded the zip file in OC-admin Control panel, but in plugins list this plugin is not, so I am not sure what to do now, or how to install it...
Thanks,
Peter
I do appreciate any advice.. THANKS
-
it also doesnt show up on the plugins list for me.
-
Ok sorry it a Github problem that put another folder ...
Use this zip file inclued here
Edit you theme file search_list.php
put this on line 76
<p align="right"><?php watchlist();?><p>
Note only resgistrated user can use this pluggin if not login pluggin will ask to.
-
thanks keny..
-
Hey watchlist doesnt work for premium ads and latest items also when u click on ad to watchlist it ads all the items on the website to the watchlist....
if im doing anything wrong my searchlist.php is attached.
-
Everytime I click on "Wiew your watch list", It shows me my watch list and I have all ads from my website there.. Not just that one I clicked on.. If I delete that item from watch list, all those "watched" idems go as well.
Do anyone knows why that happens..?
Thanks
-
Let me check issue will get back later
-
Use this version for now is a working version will release a final one later
-
You can download the version fixed 1.0.1: https://sourceforge.net/projects/osclass/files/Plugins/watchlist/?
-
Watch lisr doesnt work for premium ads...
-
What do you mean that doesn't work? That doesn't appear the premium style?
-
The watchlist link doesnt show up for premium ads, it only shows up for regular.
-
I have tried it with premium ads and it does not add them to my watchlist it adds the first non premium ad instead.
Jay
-
support for url rewrite engine on (so breadcrumps can show it etc) would be cool (I've found out that languages are supported :) )
-
Will check that soon but now i am on vacation so time is missing !
-
when I click "Add to watchlist" there goes
Parse error: parse error in C:\wamp\www\****\oc-content\plugins\watchlist\ajax_watchlist.php on line 33
:'( :'( :'( :'( :'( :'( :'(
please help.. why ??
-
I see that in W3 validator, it throws some errors and warning for watchlist, mainly because of & instead of &
-
when I click "Add to watchlist" there goes
Parse error: parse error in C:\wamp\www\****\oc-content\plugins\watchlist\ajax_watchlist.php on line 33
:'( :'( :'( :'( :'( :'( :'(
please help.. why ??
can you paste the code of this line? in the last version this line is the php close tag ?> last version: http://sourceforge.net/projects/osclass/files/Plugins/watchlist/
I see that in W3 validator, it throws some errors and warning for watchlist, mainly because of & instead of &
we'll check out! thank for the warning!
-
Hi there,
I tried to add watchlist as a button to item.php. I am using the following code:
<strong><?php watchlist(); ?><strong>
However there is a small box inside the button. Any ideas how I can make it look right?
-
try this code
add these code to item.php
<div id="watchlist"><center><?php watchlist(); ?></center></div>
add these code into style.css
#watchlist{
background: #FFA237 url(../images/button_light_orange_bg.gif); width: 100px; height: 20px; padding-top: 5px; -moz-border-radius:4px;-webkit-border-radius:4px;border-radius:4px; border: solid #FF0033 1px;
}
add the attached image into themes images folder
I am not sure how it works
-
it didn't work, what I get is below. Thanks for the help anyway.
-
Hi akapar
Try removing the <strong> tags.
Jay
-
Where should i put the
#watchlist{
background: #FFA237 url(../images/button_light_orange_bg.gif); width: 100px; height: 20px; padding-top: 5px; -moz-border-radius:4px;-webkit-border-radius:4px;border-radius:4px; border: solid #FF0033 1px;
}
please
Thank you
-
Hi hunt4it
Place this code at the end of themes style.css file
-
Hi friends
I installed the watchlist plugin.
IT shows on the dashboard but i can't see it on items.
where should i put this code: "<p align="right"><?php watchlist();?><p>"
I am using the Bcute them please!!
Please tell me what to do next.
Thanks !!!
-
@globexcam
locate these line in item.php
<strong class="share"><a href="<?php echo osc_item_send_friend_url() ; ?>" rel="nofollow"><?php _e('Share', 'modern') ; ?></a></strong>
Replace the above line with this
<strong class="share"><a href="<?php echo osc_item_send_friend_url() ; ?>" rel="nofollow"><?php _e('Share', 'modern') ; ?></a></strong>
<strong class="share"><?php watchlist(); ?></strong>
-
how can i make this plugin work with non register user to?
-
Hi,
thanks for sharing that plugin, it´s that what I searched for.
But I have two problems:
1.) The watchlist only does his job on the first time, if I click now on 'add to watchlist', it doesn´t do anything
2.) On the first time (When the submit works) I only came to the start page (wheter I clicked on watch watchlist), but the url looks like page.php?name=custom... this.
-
Watchlist pluggin works fine to all.
Parse error: parse error in D:\wamp\wamp\www\osclass223\oc-content\plugins\watchlist\ajax_watchlist.php on line 33
Can you please help me on this.
-
Why my ads have a "t" at the end of title??
tnx http://compro-vendo.org
-
Hello!
i've fixed some problems! the old function watchlist() alway show "Add to watchlist", but now:
if you are not logged in -> message is "Please Login"
if you are logged in -> message is "Add to watchlist"
if ad is in watchlist -> message is "Is in my watchlist"
here is the function:
function watchlist() {
$id = Params::getParam('id');
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'])) {
echo '<a href="javascript://" class="watchlist" id="' . osc_item_id() . '">' ;
echo '<span>' . __('Add to watchlist', 'watchlist') . '</span>' ;
echo '</a>' ;
}
else
{
//Already in watchlist !
echo '<span align="left"><a href="' . osc_base_url(true) . '?page=custom&file=watchlist/watchlist.php">' . __('Is in my watchlist','watchlist') . '</a></span>';
}
}
else {
//error user is not login in
echo '<a href="' . osc_user_login_url() . '">' . __('Please login', 'watchlist') . '</a>';
}
}
-
Hello.
I want to suggest a feature.
If an item of watchlist change, 'cause the owner change the price/description/availability etc. etc., it would be nice if the user who have this item in the watchlist can receive an alert about the event.
Do you think this is possible?
-
Watchlist pluggin works fine to all.
Parse error: parse error in D:\wamp\wamp\www\osclass223\oc-content\plugins\watchlist\ajax_watchlist.php on line 33
Can you please help me on this.
This error, PHP Parse Error: syntax error, unexpected $end, is most likely caused by the use of 'short open tags'. Verify the opening tags are <?php and not <? (short open).
-
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.
-
Hi! When click on add to watch list this is the error:
( ! ) Parse error: syntax error, unexpected $end in oc-content\plugins\watchlist\ajax_watchlist.php on line 33
Call Stack
# Time Memory Function Location
1 0.0011 438088 {main}( ) ..\index.php:0
2 1.0880 12280448 CWebAjax->doModel( ) ..\index.php:111
-
Hello !
Today I downloaded your plugin and translated it to pt_BR, please tell me when you add this to the original download site, so I can check this tell-author todo from my list : )
Thanks
[]s
-
Does anybody know how to fix css problem on user menu on realestate template?
-
Can anyone help me with issue I'm having with the watchlist feature.
The watchlist button partially disappears when clicked and does not add the item to my watchlist.
Cheers,
Stan
-
Can anyone help me with issue I'm having with the watchlist feature.
The watchlist button partially disappears when clicked and does not add the item to my watchlist.
Cheers,
Stan
Hello soluoma, did you find a solution? I have the same problem. Using Bcute theme
-
Have you tried the updated version on the market?
http://market.osclass.org/plugins/watchlist_36
Jay
-
Have you tried the updated version on the market?
http://market.osclass.org/plugins/watchlist_36
Jay
Works fine now, thank you Jay
-
There is a bug if you can use: " in the item's description, this part of text appears where is the button of watch plugin.
-
Does anyone have any idea why my Add to Watchlist button doesn't do anything, code was placed as per instructions, when you hover over button it just displays: javascript://
Struggling with this, any help would be appreciated
-
I'm using the last version of watch-list on a twiiter theme installation, and all I have is a link . Which is normal. Now I would like to transform it to a button, like the "share" button which is next to add to watch-list.I know it can be made from CSS, using the same class the "share" button is using, but I'm not that good.
<a class="btn primary item-share-button" data-controls-modal="item-sendfriend" data-backdrop="true" data-keyboard="true" href="javascript://"><?php _e('Share', 'twitter') ; ?></a>
<?php watchlist(); ?> </p>
This is the code in the item.php file.
-
I'm using the last version of watch-list on a twiiter theme installation, and all I have is a link . Which is normal. Now I would like to transform it to a button, like the "share" button which is next to add to watch-list.I know it can be made from CSS, using the same class the "share" button is using, but I'm not that good.
<a class="btn primary item-share-button" data-controls-modal="item-sendfriend" data-backdrop="true" data-keyboard="true" href="javascript://"><?php _e('Share', 'twitter') ; ?></a>
<?php watchlist(); ?> </p>
This is the code in the item.php file.
same here, tried both normal theme and my downloaded twitter theme, still not working. Think the code needs changing to work
-
I'm using the last version of watch-list on a twiiter theme installation, and all I have is a link . Which is normal. Now I would like to transform it to a button, like the "share" button which is next to add to watch-list.I know it can be made from CSS, using the same class the "share" button is using, but I'm not that good.
<a class="btn primary item-share-button" data-controls-modal="item-sendfriend" data-backdrop="true" data-keyboard="true" href="javascript://"><?php _e('Share', 'twitter') ; ?></a>
<?php watchlist(); ?> </p>
This is the code in the item.php file.
same here, tried both normal theme and my downloaded twitter theme, still not working. Think the code needs changing to work
The code is working on my instance but it's not apealing. It's just a text like you can see in the screenshot. What I want is to apply the same css to the watchlist like Share button.
-
2. I'm using osc_pagination helper to get the pagination too :)
Pagination does not work. I see ads only on first page on other pages it says that there are no ads in the watchlist. Osclass 3.02 here. Any ideas how to solve it?
-
2. I'm using osc_pagination helper to get the pagination too :)
Pagination does not work. I see ads only on first page on other pages it says that there are no ads in the watchlist. Osclass 3.02 here. Any ideas how to solve it?
same issue here with modern theme
-
hi
the last update of the plugin is or? in french
thank you
-
Firstly what a great plugin!
I'd like to be able to make the watchlist appear as a button in the twitter bootstrap theme next to the "Share" button.
Is this doable? I'm guessing I would need to be editing the /plugins/watchlist/index.php folder? I can create a button using the code below:
<a href="#" class="btn btn-success"><i class="icon-white icon-flag"></i> Add to watchlist</a> in the item.php but I don't know how to make this work with the plugin.
Sorry I'm very new to using php etc.
Thanks in advance!
-
Firstly what a great plugin!
I'd like to be able to make the watchlist appear as a button in the twitter bootstrap theme next to the "Share" button.
Is this doable? I'm guessing I would need to be editing the /plugins/watchlist/index.php folder? I can create a button using the code below:
<a href="#" class="btn btn-success"><i class="icon-white icon-flag"></i> Add to watchlist</a> in the item.php but I don't know how to make this work with the plugin.
Sorry I'm very new to using php etc.
Thanks in advance!
Yes this is doable, if you want to have a demo have a look at bikersbay.co.uk, it took me about 10 mins to work it out.
Let me know if you need the info to change. 3 files need changing
-
Hi aide2001
Do you have the code to add the buttonfor the watchlist plugin?
Thanks!
AVBestDeals
Firstly what a great plugin!
I'd like to be able to make the watchlist appear as a button in the twitter bootstrap theme next to the "Share" button.
Is this doable? I'm guessing I would need to be editing the /plugins/watchlist/index.php folder? I can create a button using the code below:
<a href="#" class="btn btn-success"><i class="icon-white icon-flag"></i> Add to watchlist</a> in the item.php but I don't know how to make this work with the plugin.
Sorry I'm very new to using php etc.
Thanks in advance!
Yes this is doable, if you want to have a demo have a look at bikersbay.co.uk, it took me about 10 mins to work it out.
Let me know if you need the info to change. 3 files need changing
-
I am using OSclass v3.2.1 repurpose theme. Install add to Watchlist plugin but my add to Watchlist button doesn't do anything, code was placed as per instructions, when you hover over button it just displays: javascript://
Struggling with this, any help would be appreciated.
-
watchlist pluggin is great, but it does not work correctly for the lastest osclass. Ive emailed the developer and had no response, which is a shame, because this is great. I might have to sort this out myself (when i get a minute!)
-
good evening
I have a bug with this plugin as soon as I get more active to click on my map of France ellle blocks and small bar menu?
could help me resodre the problem
who can help me I'd like to add a favorite icon on it that the code to add css block thank you
<php watchlist ();?>
-
good evening
could you help me please I have a problem bug that install the module happens more go to my map of France and the search bar and small devenur?
thank you :-[
-
good evening
person solution
-
Can some admin PLEASE BAN "Plesk" user ?
Enough of this crap.
-
good evening
remains polite stp
-
good evening
remains polite stp
Please stop poluting the forums with the very same questions and with a language that nobody (but you) understands.
Pay someone to solve your huge problems and questions. 170 posts all with same and same questions and problems about ALMOST anything related to Osclass.
-
Watchlist delete from user dashboard doesn't seem to work when you have permalinks enabled.
If permalinks is off the delete watchlist link is working.
Anybody...How to fix this? ;)
-
Pagination doesn't work too.
With permalinks on...I receive '404 page not found'.
With permalinks off...I receive 'No ads in list'.
Too pity... :(
It needs some fixes and updates.
-
Solution is here http://forums.osclass.org/general-help/watchlist-and-3-2/
Watchlist delete from user dashboard doesn't seem to work when you have permalinks enabled.
If permalinks is off the delete watchlist link is working.
Anybody...How to fix this? ;)
Has anyone having problems with user dashboard watchlist pagination?
Found any solution?
-
Hello.
I want to suggest a feature.
If an item of watchlist change, 'cause the owner change the price/description/availability etc. etc., it would be nice if the user who have this item in the watchlist can receive an alert about the event.
Do you think this is possible?
This sounds like a great feature and would add usability to our buyers. Is there anyone who would know if it could be done easily?
-
I can confirm the Watchlist 1.0.7 works on OSClass 3.2.0
But there is some kind of mistake,
When a user clicked on a "Add to watchlist" link and the item is added, when next time user reload the page with same item, it shows again message "Add to watchlist", but the item is already into the watchlist.
I suggest after the user is reloading the item page, should shows up a message like: "Remove from watchlist" and right next to it another one: "Watchlist"
10x
-
Well, the page 2 and so on doesn't work
-
Any luck?
-
jepp, same problem, add to watchlist comes again, and pages not working...
i would like to have the watchlist in dashboard (symnel) for user, now it is the on custom page,
does someone know how i can put it to user-custom?
thx
attached german language 1.0.7 changed watchlist -> Favoriten
to fix the paginaton for the moment i change itemsperpage to "0" now you see all
OK, just for the moment i fixed the the add to watchlist problem for me
change function watchlist (u need to style your button)
the ajax button when adding to watchlist is still working
function watchlist() {
// echo '<a href="javascript://" class="watchlist seller btn btn-default btn-xs" id="' . osc_item_id() . '">';
// echo '' . __('Add to watchlist', 'watchlist') . '';
// echo '</a>';
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, osc_item_id() , osc_logged_user_id());
}
//If nothing returned then we can process
if (!isset($detail['fk_i_item_id'])) {
echo '<a href="javascript://" class="watchlist seller btn btn-default btn-xs" id="' . osc_item_id() . '">';
echo '' . __('Add to watchlist', 'watchlist') . '';
echo '</a>';
} else {
echo '<a href="' . osc_base_url(true) . '?page=custom&file=watchlist/watchlist.php" class="watchlist seller btn btn-default btn-xs">' . __('View your watchlist', 'watchlist') . '</a>';
}
}
-
How I configure the page when someone click at "Watchlist" at user-dashboard
At this time the page shows like this http://prntscr.com/5960rn (http://prntscr.com/5960rn)
but i want same like my theme dashboard. http://prntscr.com/5969tp (http://prntscr.com/5969tp)
I use Tuffclassified theme... can anyone knows??
Thanks
-
jepp, same problem, add to watchlist comes again, and pages not working...
i would like to have the watchlist in dashboard (symnel) for user, now it is the on custom page,
does someone know how i can put it to user-custom?
thx
attached german language 1.0.7 changed watchlist -> Favoriten
to fix the paginaton for the moment i change itemsperpage to "0" now you see all
OK, just for the moment i fixed the the add to watchlist problem for me
change function watchlist (u need to style your button)
the ajax button when adding to watchlist is still working
function watchlist() {
// echo '<a href="javascript://" class="watchlist seller btn btn-default btn-xs" id="' . osc_item_id() . '">';
// echo '' . __('Add to watchlist', 'watchlist') . '';
// echo '</a>';
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, osc_item_id() , osc_logged_user_id());
}
//If nothing returned then we can process
if (!isset($detail['fk_i_item_id'])) {
echo '<a href="javascript://" class="watchlist seller btn btn-default btn-xs" id="' . osc_item_id() . '">';
echo '' . __('Add to watchlist', 'watchlist') . '';
echo '</a>';
} else {
echo '<a href="' . osc_base_url(true) . '?page=custom&file=watchlist/watchlist.php" class="watchlist seller btn btn-default btn-xs">' . __('View your watchlist', 'watchlist') . '</a>';
}
}
I try this code but when I click "Add to Watchlist" I receive an error :/
-
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.
help help problem
-
Hi @nicat323,
To fix that you need to modify watchlist() function on oc-content/plugins/watchlist/index.php, from the original:
function watchlist() {
echo '<a href="javascript://" class="watchlist" id="' . osc_item_id() . '">';
echo '<span>' . __('Add to watchlist', 'watchlist') . '</span>';
echo '</a>';
}
to:
function watchlist() {
$conn = getConnection();
$watched = $conn->osc_dbFetchResult("SELECT *
FROM %st_item_watchlist
WHERE fk_i_item_id = '%d'
AND fk_i_user_id = '%d'", DB_TABLE_PREFIX, osc_item_id(), osc_logged_user_id());
if ($watched) {
echo '<span align="left"><a href="' . osc_base_url(true) . '?page=custom&file=watchlist/watchlist.php">' . __('View your watchlist', 'watchlist') . '</a></span>';
} else {
echo '<a href="javascript://" class="watchlist" id="' . osc_item_id() . '">';
echo '<span>' . __('Add to watchlist', 'watchlist') . '</span>';
echo '</a>';
}
}
Regards
-
When my members logged out from my website then, If they inside the watchlist URL like: http://someone_page/index.php?page=custom&file=watchlist/watchlist.php (http://someone_page/index.php?page=custom&file=watchlist/watchlist.php) in browser address bar. After that, they still show the watchlist page with user menu with a massage (You don't have any items yet). But, why my member see the page? Why they does not go on the login page automatically when they are not logged in?
-
Just for sharing, I created a double function similar to what teseo and others already showed earlier in index.php.
The function should be put in the index.php file.
//Retreive either nr. of items in watchlist of user or check for specific item in user watchlist
function in_watchlist($userid, $itemid = '') {
if(!isset($userid) || $userid == '') {return 0;}
$conn = getConnection();
if($itemid != '') {
$result = $conn->osc_dbFetchValue("SELECT Count(*) FROM %st_item_watchlist WHERE fk_i_item_id = '%d' AND fk_i_user_id = '%d'", DB_TABLE_PREFIX, $itemid, $userid);
} else {
$result = $conn->osc_dbFetchValue("SELECT Count(*) FROM %st_item_watchlist WHERE fk_i_user_id = '%d'", DB_TABLE_PREFIX, $userid);
}
return $result;
}
You can use the function in your theme either by calling it with item_id or without item_id but always with user_id as it will return a value of 0 or 1 when item_id is given. Without item_id it will return the actual nr. of items being watched with the given user_id. I use this for similar reason as earlier code sample to determine if an item for a logged in user is already in the watchlist. The total count of items in a user's watchlist can be used in a similar way the wishlist plugin is showing but this plugin is only for logged-in users.
PS. If you use it in your theme(s) make sure to check if the function exists ie. if the watchlist plugin is installed.
Regards,
Eric
-
Hi @nicat323,
To fix that you need to modify watchlist() function on oc-content/plugins/watchlist/index.php, from the original:
function watchlist() {
echo '<a href="javascript://" class="watchlist" id="' . osc_item_id() . '">';
echo '<span>' . __('Add to watchlist', 'watchlist') . '</span>';
echo '</a>';
}
to:
function watchlist() {
$conn = getConnection();
$watched = $conn->osc_dbFetchResult("SELECT *
FROM %st_item_watchlist
WHERE fk_i_item_id = '%d'
AND fk_i_user_id = '%d'", DB_TABLE_PREFIX, osc_item_id(), osc_logged_user_id());
if ($watched) {
echo '<span align="left"><a href="' . osc_base_url(true) . '?page=custom&file=watchlist/watchlist.php">' . __('View your watchlist', 'watchlist') . '</a></span>';
} else {
echo '<a href="javascript://" class="watchlist" id="' . osc_item_id() . '">';
echo '<span>' . __('Add to watchlist', 'watchlist') . '</span>';
echo '</a>';
}
}
Regards
@teseo
What would the fix be if my watchlist/index.php looks like this:
function watchlist() {
echo '<span class="fa-stack fa-lg">';
echo '<i class="fa fa-circle fa-stack-2x"></i><a href="javascript://" class="watchlist" id="' . osc_item_id() . '" title="' . __('Add to watchlist', 'watchlist') . '" rel="nofollow"><i class="fa fa-heart fa-stack-1x fa-inverse"></i></a>';
echo '</span>';
}
Thank you!
-
Hello ) I have a few questions for the plugin .
1. Is it possible to display in the ad how many users is the current ads in favorites ?
2. I made a reference to the header in the favorites and I want it displays the number of selected announcements ? How to do it?
sorry for my english)
-
1. not yet but that is something I want to have as well so I will look into it. Should not be hard to create.
2. I do not quite understand, that nr. of selected announcements, can you explain a bit more?
Hello ) I have a few questions for the plugin .
1. Is it possible to display in the ad how many users is the current ads in favorites ?
2. I made a reference to the header in the favorites and I want it displays the number of selected announcements ? How to do it?
sorry for my english)
-
Hi,
here is a function I created to get the nr. of followers with a specific item.
I haven't tested it yet but I think it should work okay.
Place the following function inside the file index.php of your watchlist plugin:
//Retreive nr. of users following specific item
function followers_count($itemid) {
$count = 0;
$conn = getConnection();
if($itemid != '') {
$count = $conn->osc_dbFetchValue("SELECT Count(fk_i_item_id) FROM %st_item_watchlist WHERE fk_i_item_id = '%d'", DB_TABLE_PREFIX, $itemid);
}
return $count;
}
Regards,
Eric
-
Hi,
here is a function I created to get the nr. of followers with a specific item.
I haven't tested it yet but I think it should work okay.
Place the following function inside the file index.php of your watchlist plugin:
//Retreive nr. of users following specific item
function followers_count($itemid) {
$count = 0;
$conn = getConnection();
if($itemid != '') {
$count = $conn->osc_dbFetchValue("SELECT Count(fk_i_item_id) FROM %st_item_watchlist WHERE fk_i_item_id = '%d'", DB_TABLE_PREFIX, $itemid);
}
return $count;
}
Regards,
Eric
thank you ) and tell me how to get the result in user-items.php?
-
I use the following code in item.php:
<?php if(function_exists('followers_count')) {
$followers = followers_count(osc_item_id());
if($followers > 0) { ?>
<p style="margin-left:8px;"><?php echo $followers .' '. __('user(s) is/are following this item.','watchlist'); ?></p>
<?php }
} ?>
To show something similar is user-items.php you need to use above code (or maybe change it a little) in file "loop-single.php" which is used by loop.php which is used by user-items.php
Regards,
Eric
-
insert the number of active listings in favorites
-
The function I created does NOT look if ad is still active but when it is in Watchlist the ad most likely is active.
So with regard to your last post Monah, you have a problem or question?
-
on a site I am working on I need to allow users to save watchlist items into folders they can create
all items added whould just be added to the default folder, without extra folders, but if a users decides to make extra folders to store watchlist items into, they could select
thinking its quite a bit of work to allow users to create folders into which they can save the items into,
example:
default watchlist
watchlist folder 1
watchlist folder 2
etc
will need to add more elements to the sql to allow this and expand the functions more, anyone ever done anything like this??
-
This plugin works with the current version of osclass without any changes but there are 2 issues -
1) it paginates for just 2 items on each page - 10 item pagination would be better - does anyone know how to change that?
2) once an item is added to the watchlist, there seems to be no way for the user to delete the one or all items from the watchlist (or I haven't figured out a way yet)
I was wondering if anyone else have the same issues and if there are any fixes?
Thanks!
-
function for count favorite
в functions.php theme add function
function countFavorite() {
$count = 0;
$conn = getConnection();
$count = $conn->osc_dbFetchValue("SELECT COUNT(fk_i_item_id) FROM %st_item_watchlist WHERE fk_i_user_id = '%d'" , DB_TABLE_PREFIX, osc_logged_user_id());
return $count;
}
Show count in header
<span class="count"><?= countFavorite(); ?></span> </a>
-
function for count favorite
в functions.php theme add function
function countFavorite() {
$count = 0;
$conn = getConnection();
$count = $conn->osc_dbFetchValue("SELECT COUNT(fk_i_item_id) FROM %st_item_watchlist WHERE fk_i_user_id = '%d'" , DB_TABLE_PREFIX, osc_logged_user_id());
return $count;
}
Show count in header
<span class="count"><?= countFavorite(); ?></span> </a>
Didn't want to reply, but this bugs me...
Just two recommendations:
use DAO instead of 'getConnection' function.
don't use php short tags '<?=' as they might be disabled on some servers.
Regards.