Osclass forums

Development => Plugins => Topic started by: keny on July 11, 2011, 10:54:52 pm

Title: Watchlist pluggin done !
Post 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/)

Title: Re: Watchlist pluggin done !
Post by: Swede on July 12, 2011, 03:08:52 pm
Maybe this is a stupid question... whats the purpose of this plugin, what does it do?
Title: Re: Watchlist pluggin done !
Post by: keny on July 12, 2011, 03:56:08 pm
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.
Title: Re: Watchlist pluggin done !
Post by: Swede on July 13, 2011, 02:48:04 pm
Thanks for explaining!
Yep, its a good thing to be able to compare all items of interest on the same side!
Title: Re: Watchlist pluggin done !
Post by: Juan Ramón on July 14, 2011, 03:44:48 pm
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 :)

Title: Re: Watchlist pluggin done !
Post by: keny on July 14, 2011, 05:03:55 pm
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
Title: Re: Watchlist pluggin done !
Post by: Juan Ramón on July 14, 2011, 06:11:15 pm
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.
Title: Re: Watchlist pluggin done !
Post by: Magnettoo on August 04, 2011, 04:56:51 pm
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
Title: Re: Watchlist pluggin done !
Post by: usclassifieds.org on August 04, 2011, 05:37:17 pm
it also doesnt show up on the plugins list for me.
Title: Re: Watchlist pluggin done !
Post by: keny on August 05, 2011, 12:15:04 am
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.
Title: Re: Watchlist pluggin done !
Post by: Magnettoo on August 05, 2011, 01:18:37 am
thanks keny..
Title: Re: Watchlist pluggin done !
Post by: usclassifieds.org on August 05, 2011, 05:53:58 pm
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.
Title: Re: Watchlist pluggin done !
Post by: Magnettoo on August 05, 2011, 06:03:53 pm
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
Title: Re: Watchlist pluggin done !
Post by: keny on August 05, 2011, 08:01:26 pm
Let me check issue will get back later
Title: Re: Watchlist pluggin done !
Post by: keny on August 05, 2011, 09:11:42 pm
Use this version for now is a working version will release a final one later

Title: Re: Watchlist pluggin done !
Post by: Juan Ramón on August 09, 2011, 03:01:22 pm
You can download the version fixed 1.0.1: https://sourceforge.net/projects/osclass/files/Plugins/watchlist/?
Title: Re: Watchlist pluggin done !
Post by: usclassifieds.org on August 09, 2011, 06:07:54 pm
Watch lisr doesnt work for premium ads...
Title: Re: Watchlist pluggin done !
Post by: Juan Ramón on August 09, 2011, 07:13:17 pm
What do you mean that doesn't work? That doesn't appear the premium style?
Title: Re: Watchlist pluggin done !
Post by: usclassifieds.org on August 09, 2011, 07:15:20 pm
The watchlist link doesnt show up for premium ads, it only shows up for regular.
Title: Re: Watchlist pluggin done !
Post by: trains58554 on August 09, 2011, 08:16:05 pm
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
Title: Re: Watchlist pluggin done !
Post by: morvy on August 12, 2011, 02:24:16 pm
support for url rewrite engine on (so breadcrumps can show it etc) would be cool (I've found out that languages are supported :) )
Title: Re: Watchlist pluggin done !
Post by: keny on August 13, 2011, 02:15:30 am
Will check that soon but now i am on vacation so time is missing !
Title: Re: Watchlist pluggin done !
Post by: lutvia on August 13, 2011, 09:12:41 pm
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 ??
Title: Re: Watchlist pluggin done !
Post by: morvy on August 16, 2011, 11:27:10 am
I see that in W3 validator, it throws some errors and warning for watchlist, mainly because of & instead of &amp;
Title: Re: Watchlist pluggin done !
Post by: Juan Ramón on August 16, 2011, 01:47:53 pm
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 &amp;

we'll check out! thank for the warning!
Title: Re: Watchlist pluggin done !
Post by: akapar on October 01, 2011, 05:18:08 pm
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?

Title: Re: Watchlist pluggin done !
Post by: RajaSekar on October 01, 2011, 05:24:18 pm
try this code

add these code to item.php

Code: [Select]

<div id="watchlist"><center><?php watchlist(); ?></center></div>



add these code into style.css

Code: [Select]

#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
Title: Re: Watchlist pluggin done !
Post by: akapar on October 01, 2011, 09:56:02 pm
it didn't work, what I get is below. Thanks for the help anyway.
Title: Re: Watchlist pluggin done !
Post by: trains58554 on October 01, 2011, 10:12:25 pm
Hi akapar

Try removing the <strong> tags.

Jay
Title: Re: Watchlist pluggin done !
Post by: BuySellAndSwap on October 02, 2011, 12:12:43 am
Where should i put the

Code: [Select]
#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

Title: Re: Watchlist pluggin done !
Post by: RajaSekar on October 02, 2011, 09:33:40 am
Hi hunt4it

Place this code at the end of themes style.css file
Title: Re: Watchlist pluggin done !
Post by: globexcam on October 02, 2011, 02:46:33 pm
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 !!!
Title: Re: Watchlist pluggin done !
Post by: RajaSekar on October 02, 2011, 06:29:20 pm
@globexcam

locate these line in item.php

Code: [Select]

<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

Code: [Select]

<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>

Title: Re: Watchlist pluggin with non registed user
Post by: nextpuma on November 01, 2011, 01:42:35 am
how can i make this plugin work with non register user to?
Title: Re: Watchlist pluggin done !
Post by: diego_tucholga on November 15, 2011, 02:03:21 pm
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.
Title: Re: Watchlist pluggin done !
Post by: send4radha on November 16, 2011, 01:52:42 pm
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.
Title: Re: Watchlist pluggin done !
Post by: Diablos on January 19, 2012, 08:29:59 pm
Why my ads have a "t" at the end of title??

tnx http://compro-vendo.org
Title: Re: Watchlist pluggin done !
Post by: Cris on April 05, 2012, 04:50:20 am
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:
Code: [Select]
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>';
        }

   
    }
Title: Re: Watchlist pluggin done !
Post by: Karsus on May 04, 2012, 05:42:18 pm
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?
Title: Re: Watchlist pluggin done !
Post by: Noosa on May 31, 2012, 04:23:20 pm
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).
Title: Re: Watchlist pluggin done !
Post by: astroboy on July 04, 2012, 12:29:47 pm
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
Code: [Select]
<?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$idosc_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$idosc_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
Code: [Select]
                    <p class="contact_button">
                        <?php if( !osc_item_is_expired () ) { ?>
                        <?php if( !( ( osc_logged_user_id() == osc_item_user_id() ) && osc_logged_user_id() != ) ) { ?>
                            <?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.
Title: Re: Watchlist pluggin done !
Post by: texthiller on August 23, 2012, 01:11:55 am
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
Title: I wrote a pt_BR translation for your plugin
Post by: yammy on September 30, 2012, 05:57:47 am
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
Title: Re: Watchlist pluggin done !
Post by: anypis on November 03, 2012, 12:54:34 am
Does anybody know how to fix css problem on user menu on realestate template?
Title: Re: Watchlist pluggin done !
Post by: soluoma on February 12, 2013, 02:12:57 am
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
Title: Re: Watchlist pluggin done !
Post by: geo78 on March 11, 2013, 11:59:35 pm
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
Title: Re: Watchlist pluggin done !
Post by: trains58554 on March 12, 2013, 04:23:59 am
Have you tried the updated version on the market?

http://market.osclass.org/plugins/watchlist_36

Jay
Title: Re: Watchlist pluggin done !
Post by: geo78 on March 14, 2013, 01:19:04 am
Have you tried the updated version on the market?

http://market.osclass.org/plugins/watchlist_36

Jay

Works fine now, thank you Jay
Title: Re: Watchlist pluggin done !
Post by: texthiller on March 14, 2013, 11:02:37 am
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.
Title: Re: Watchlist pluggin done !
Post by: mrreference on April 02, 2013, 01:55:22 am
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
Title: Re: Watchlist pluggin done !
Post by: nevermore on April 03, 2013, 01:59:51 pm
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.
Quote
<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.
Title: Re: Watchlist pluggin done !
Post by: aide2001 on April 05, 2013, 10:34:48 pm
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.
Quote
<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
Title: Re: Watchlist pluggin done !
Post by: nevermore on April 05, 2013, 10:38:03 pm
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.
Quote
<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.
Title: Re: Watchlist pluggin done !
Post by: zombie on April 28, 2013, 05:56:08 pm
    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?
Title: Re: Watchlist pluggin done !
Post by: egemen_i on May 26, 2013, 05:29:27 pm
    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
Title: Re: Watchlist pluggin done !
Post by: Hostingames on June 18, 2013, 04:12:36 pm
hi

the last update of the plugin is or? in french

thank you
Title: Re: Watchlist pluggin done !
Post by: matbat on June 22, 2013, 09:34:45 pm
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!
Title: Re: Watchlist pluggin done !
Post by: aide2001 on June 27, 2013, 11:01:38 pm
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
Title: Re: Watchlist pluggin done !
Post by: AVBestDeals on August 22, 2013, 10:05:37 pm
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
Title: Re: Watchlist pluggin done !
Post by: Saina on September 24, 2013, 08:30:47 pm
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.
Title: Re: Watchlist pluggin done !
Post by: aide2001 on September 25, 2013, 01:26:15 pm
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!)
Title: Re: Watchlist pluggin done !
Post by: plesk on November 02, 2013, 02:43:57 am
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 ();?>
Title: Re: Watchlist pluggin done !
Post by: plesk on November 06, 2013, 09:06:28 pm
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 :-[
Title: Re: Watchlist pluggin done !
Post by: plesk on November 10, 2013, 10:14:31 pm
good evening

person solution
Title: Re: Watchlist pluggin done !
Post by: Aficionado on November 10, 2013, 10:51:37 pm
Can some admin PLEASE BAN "Plesk" user ?

Enough of this crap.

Title: Re: Watchlist pluggin done !
Post by: plesk on November 11, 2013, 12:38:33 am
good evening
remains polite stp
Title: Re: Watchlist pluggin done !
Post by: Aficionado on November 11, 2013, 01:08:26 am
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.

Title: Re: Watchlist pluggin done !
Post by: gnoe on January 22, 2014, 08:57:02 pm
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? ;)
Title: Re: Watchlist pluggin done !
Post by: gnoe on January 22, 2014, 10:20:36 pm
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.
Title: Re: Watchlist pluggin done !
Post by: gnoe on January 23, 2014, 11:32:49 am
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?
Title: Re: Watchlist pluggin done !
Post by: kirkwj on April 03, 2014, 07:21:34 pm
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?
Title: Re: Watchlist pluggin done !
Post by: ivv on May 13, 2014, 11:59:40 am
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
Title: Re: Watchlist pluggin done !
Post by: ivv on May 14, 2014, 10:48:07 am
Well, the page 2 and so on doesn't work
Title: Re: Watchlist pluggin done !
Post by: thedaigle on October 25, 2014, 06:00:53 pm
Any luck?
Title: Re: Watchlist pluggin done !
Post by: andrenalin on October 26, 2014, 08:41:32 pm
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

Code: [Select]
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>';
}

    }
Title: Re: Watchlist pluggin done !
Post by: AdMeGreek on November 23, 2014, 05:41:31 am
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
Title: Re: Watchlist pluggin done !
Post by: AdMeGreek on November 23, 2014, 06:42:11 am
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

Code: [Select]
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 :/
Title: Re: Watchlist pluggin done !!!
Post by: nicat323 on April 02, 2015, 01:06:06 am
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
Code: [Select]
<?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$idosc_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$idosc_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
Code: [Select]
                    <p class="contact_button">
                        <?php if( !osc_item_is_expired () ) { ?>
                        <?php if( !( ( osc_logged_user_id() == osc_item_user_id() ) && osc_logged_user_id() != ) ) { ?>
                            <?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
Title: Re: Watchlist pluggin done !
Post by: teseo on April 02, 2015, 01:32:39 pm
Hi @nicat323,

To fix that you need to modify watchlist() function on oc-content/plugins/watchlist/index.php, from the original:

Code: [Select]
    function watchlist() {
        echo '<a href="javascript://" class="watchlist" id="' . osc_item_id() . '">';
        echo '<span>' . __('Add to watchlist', 'watchlist') . '</span>';
        echo '</a>';
    }

to:

Code: [Select]
    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
Title: Re: Watchlist pluggin done !
Post by: sonjoy336 on April 10, 2015, 05:37:09 am
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?
Title: Re: Watchlist pluggin done !
Post by: SmaRTeY on June 19, 2015, 11:43:01 am
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.

Code: [Select]
//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
Title: Re: Watchlist pluggin done !
Post by: richieboymx on June 20, 2015, 07:02:20 pm
Hi @nicat323,

To fix that you need to modify watchlist() function on oc-content/plugins/watchlist/index.php, from the original:

Code: [Select]
    function watchlist() {
        echo '<a href="javascript://" class="watchlist" id="' . osc_item_id() . '">';
        echo '<span>' . __('Add to watchlist', 'watchlist') . '</span>';
        echo '</a>';
    }

to:

Code: [Select]
    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:
Code: [Select]
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!
Title: Re: Watchlist pluggin done !
Post by: monah on September 24, 2015, 10:43:39 am
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)
Title: Re: Watchlist pluggin done !
Post by: SmaRTeY on September 24, 2015, 01:55:54 pm
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)
Title: Re: Watchlist pluggin done !
Post by: SmaRTeY on September 24, 2015, 03:16:22 pm
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:
Code: [Select]
//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
Title: Re: Watchlist pluggin done !
Post by: monah on September 24, 2015, 04:19:41 pm
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:
Code: [Select]
//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?
Title: Re: Watchlist pluggin done !
Post by: SmaRTeY on September 24, 2015, 05:38:10 pm
I use the following code in item.php:
Code: [Select]
<?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
Title: Re: Watchlist pluggin done !
Post by: monah on September 24, 2015, 05:55:16 pm
insert the number of active listings in favorites
Title: Re: Watchlist pluggin done !
Post by: SmaRTeY on September 24, 2015, 07:53:45 pm
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?
Title: Re: Watchlist pluggin done !
Post by: xop32 on June 23, 2016, 03:36:59 am
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??

Title: Re: Watchlist pluggin done !
Post by: Resta on January 24, 2018, 06:49:32 am
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!
Title: Re: Watchlist pluggin done !
Post by: san4747 on July 11, 2019, 07:17:18 pm
function for count favorite
в functions.php theme add function
Code: [Select]
       
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
Code: [Select]
<span class="count"><?= countFavorite(); ?></span> </a>
Title: Re: Watchlist pluggin done !
Post by: WEBmods on July 11, 2019, 10:54:29 pm
function for count favorite
в functions.php theme add function
Code: [Select]
       
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
Code: [Select]
<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.