Advertisement:

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

Resta

  • Sr. Member
  • ****
  • Posts: 345
Re: Watchlist pluggin done !
« Reply #90 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!
« Last Edit: January 25, 2018, 06:37:51 am by Resta »

san4747

  • Jr. Member
  • **
  • Posts: 54
  • https://san-osclass.com/
Re: Watchlist pluggin done !
« Reply #91 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>

WEBmods

  • Hero Member
  • *****
  • Posts: 936
  • github.com/webmods-croatia/love-osclass/ | patrick
Re: Watchlist pluggin done !
« Reply #92 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.