Advertisement:

Author Topic: Watchlist pluggin done !  (Read 32209 times)

keny

  • Full Member
  • ***
  • Posts: 137
Watchlist pluggin done !
« 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
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





« Last Edit: July 11, 2011, 11:29:02 pm by keny »

Swede

  • Sr. Member
  • ****
  • Posts: 388
Re: Watchlist pluggin done !
« Reply #1 on: July 12, 2011, 03:08:52 pm »
Maybe this is a stupid question... whats the purpose of this plugin, what does it do?

keny

  • Full Member
  • ***
  • Posts: 137
Re: Watchlist pluggin done !
« Reply #2 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.

Swede

  • Sr. Member
  • ****
  • Posts: 388
Re: Watchlist pluggin done !
« Reply #3 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!

Juan Ramón

  • Osclass Developer
  • Hero Member
  • *****
  • Posts: 2382
Re: Watchlist pluggin done !
« Reply #4 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 :)


keny

  • Full Member
  • ***
  • Posts: 137
Re: Watchlist pluggin done !
« Reply #5 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

Juan Ramón

  • Osclass Developer
  • Hero Member
  • *****
  • Posts: 2382
Re: Watchlist pluggin done !
« Reply #6 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.

Magnettoo

  • Full Member
  • ***
  • Posts: 216
Re: Watchlist pluggin done !
« Reply #7 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

usclassifieds.org

  • Sr. Member
  • ****
  • Posts: 268
Re: Watchlist pluggin done !
« Reply #8 on: August 04, 2011, 05:37:17 pm »
it also doesnt show up on the plugins list for me.

keny

  • Full Member
  • ***
  • Posts: 137
Re: Watchlist pluggin done !
« Reply #9 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.

Magnettoo

  • Full Member
  • ***
  • Posts: 216
Re: Watchlist pluggin done !
« Reply #10 on: August 05, 2011, 01:18:37 am »
thanks keny..

usclassifieds.org

  • Sr. Member
  • ****
  • Posts: 268
Re: Watchlist pluggin done !
« Reply #11 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.
« Last Edit: August 05, 2011, 05:57:17 pm by usclassifieds.org »

Magnettoo

  • Full Member
  • ***
  • Posts: 216
Re: Watchlist pluggin done !
« Reply #12 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

keny

  • Full Member
  • ***
  • Posts: 137
Re: Watchlist pluggin done !
« Reply #13 on: August 05, 2011, 08:01:26 pm »
Let me check issue will get back later

keny

  • Full Member
  • ***
  • Posts: 137
Re: Watchlist pluggin done !
« Reply #14 on: August 05, 2011, 09:11:42 pm »
Use this version for now is a working version will release a final one later

« Last Edit: August 05, 2011, 10:50:49 pm by keny »