Support Forums - Classified Ads Script Osclass
Osclass plugin support => Business Profile Plugin => Topic started by: pitbull on March 06, 2019, 10:36:00 AM
-
Hi Frosticek. Is there any way/function to get the total number of users that have upgraded their profile to business just for stats reason? Something similar to this helper :
<?php echo osc_total_users(); ?>
I use the code above to display the total number of registered users. How can i do the same only for users that have business profiles?
Thanx mate.
-
@pitbull
Best way is to create new count funtion in plugin model and use this one.
-
@pitbull
Best way is to create new count funtion in plugin model and use this one.
@Frosticek i tried something like that but didnt work:
function count_number_bpr($bprofiles) {
$this->dao->select("COUNT(*) as i_total");
$this->dao->from(DB_TABLE_PREFIX.'t_user_business_profile');
$this->dao->where($sbpofiles);
$result = $this->dao->get();
if( $result == false || $result->numRows() == 0) {
return 0;
}
$row = $result->row();
return $row['i_total'];
}
Could you point me to the right direction ?
Thanx mate
-
::UPDATE --
inside plugin model there is a function for counting sellers already:
public function countSellers($enabled = -1) {
$this->dao->select('count(*) as i_count');
$this->dao->from($this->getTable_bp());
if($enabled <> -1) {
$this->dao->where('b_enabled', $enabled);
}
$result = $this->dao->get();
if($result) {
$data = $result->row();
return $data['i_count'];
}
return 0;
}
but when i try to echo that function in front end like that :
<?php echo countSellers(); ?>
i m getting the error:
PHP Fatal error: Uncaught Error: Call to undefined function countSellers()
???
i cant understand why as the function is already defined in plugin's Model file.
-
OK Frosticek finally
ModelBPR::newInstance()
did the job done. So mark this as solved as well ;)
-
@pibull
Nice journey :)
<?php echo ModelBPR::newInstance()->countSellers(); ?>