Advertisement:

Author Topic: [SOLVED]voting plugin, not works with premium php code  (Read 1013 times)

fog

  • Hero Member
  • *****
  • Posts: 1062
[SOLVED]voting plugin, not works with premium php code
« on: March 04, 2014, 07:22:23 pm »
Hi, the voting plugin, not works with premium php code

osc_count_premiums()
osc_has_premiums()
osc_count_premium_resources()
etc with premium code

the votes results stay zero stars, in premium listing

Does anyone have a solution for this situation?
Voting system
Version: 1.0.1 (the latest version 1.1.0 have the same problem)
I'm using version 3.1.2 osclass
« Last Edit: August 19, 2014, 08:55:23 pm by fog »

garciademarina

  • Administrator
  • Hero Member
  • *****
  • Posts: 974
Re: voting plugin, not works with premium php code
« Reply #1 on: August 19, 2014, 06:24:23 pm »
Hi fog,

Can you explain exactly what is not working ?  What are you trying to do ?

Do not you can qualify premium ads or show the rating in the premium listing detail page ? 

Regards

fog

  • Hero Member
  • *****
  • Posts: 1062
Re: voting plugin, not works with premium php code
« Reply #2 on: August 19, 2014, 06:28:22 pm »
Hi garciademarina, I solved my problem for a long time. I apologize, I forgot to come here. I need some time to post the solution here. Can be useful for someone.

Regards

fog

  • Hero Member
  • *****
  • Posts: 1062
[SOLVED] voting plugin, not works with premium php code
« Reply #3 on: August 19, 2014, 06:41:42 pm »
Ok, I remember. In premium listings, tables are different to other tables for normal items. So what I did was clone the function below and switch to the correct tables of premium items names. The rest was customized as I wanted.

Basically everything goes through the clone function (for premium items).

Thanks for your plugin!

Regards

Code: [Select]
function voting_item_result()
    {
            $conn = getConnection();
            $aux_vote  = $conn->osc_dbFetchResult('SELECT format(avg(i_vote),1) as vote FROM %st_voting_item WHERE fk_i_item_id = %s', DB_TABLE_PREFIX, osc_item_id());
            $aux_count = $conn->osc_dbFetchResult('SELECT count(*) as total FROM %st_voting_item WHERE fk_i_item_id = %s', DB_TABLE_PREFIX, osc_item_id());
            $vote['vote']  = $aux_vote['vote'];
            $vote['total'] = $aux_count['total'];
           
             
            require 'item_result.php';
         
    }
function voting_premium_result()
    {
            $conn = getConnection();
            $aux_vote  = $conn->osc_dbFetchResult('SELECT format(avg(i_vote),1) as vote FROM %st_voting_item WHERE fk_i_item_id = %s', DB_TABLE_PREFIX, osc_premium_id());
            $aux_count = $conn->osc_dbFetchResult('SELECT count(*) as total FROM %st_voting_item WHERE fk_i_item_id = %s', DB_TABLE_PREFIX, osc_premium_id());
            $vote['vote']  = $aux_vote['vote'];
            $vote['total'] = $aux_count['total'];
           
             
            require 'item_result.php';
         
    }
« Last Edit: August 19, 2014, 08:56:30 pm by fog »

servicesmary

  • Newbie
  • *
  • Posts: 37
Re: [SOLVED]voting plugin, not works with premium php code
« Reply #4 on: March 09, 2016, 06:49:32 pm »
Hi,

someone have find the solution for premium ads (Osclass 3.6.1 Osclasswizards 2.0.4) ?