Advertisement:

Author Topic: [SOLVED] Identify if item premium is on.  (Read 890 times)

fog

  • Hero Member
  • *****
  • Posts: 1062
[SOLVED] Identify if item premium is on.
« on: September 05, 2016, 08:05:37 pm »
Hi, how I can identify on plugin with file "item_form.php" , if a item is premium? I need add some specific css on this file, if ad is premium or not premium.
Regards
« Last Edit: September 06, 2016, 02:59:34 am by fog »

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: [Help] Identify if item premium is on.
« Reply #1 on: September 05, 2016, 11:03:15 pm »
Hey fog,

item_form.php? From what plugin is that? ???

Regards

fog

  • Hero Member
  • *****
  • Posts: 1062
Re: [Help] Identify if item premium is on.
« Reply #2 on: September 05, 2016, 11:37:50 pm »
Hi teseo, is my own plugin. I need check when user try editing the ad in question, if that ad is premium or not. In my item_form.php file I need remove the tooltip on a specific field, so I need some function to check if is ad is premium. No make sense exists a message to incentivate user to make ad as premium, when is already is premium.
Problem is not working with different codes I try to make filtering to that tooltip message.

EDIT: per example helpers not working on publish page, or related with item  helpers. I think I need pass something related with ID or check on DB if item in question is $item['b_premium == 1']..

Thanks in advance
« Last Edit: September 05, 2016, 11:42:03 pm by fog »

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: [Help] Identify if item premium is on.
« Reply #3 on: September 06, 2016, 12:53:15 am »
I guess you know the ID of the current ad. Let's think is stored on $itemId, then:

Code: [Select]
<?php
$cItem 
Item::newInstance()->findByPrimaryKey($itemId);
View::newInstance()->_exportVariableToView('item'$cItem);
?>

Now you can use the usual helpers for item.

Regards

fog

  • Hero Member
  • *****
  • Posts: 1062
Re: [Help] Identify if item premium is on.
« Reply #4 on: September 06, 2016, 02:25:51 am »
Continuous not working for helpers on item_form.php:
Code: [Select]
<?php
$cItem 
Item::newInstance()->findByPrimaryKey($itemId);
View::newInstance()->_exportVariableToView('item'$cItem);
if(
osc_item_is_premium($itemId)==1){ echo 'Hello world';}
?>


or

Code: [Select]
<?php
$cItem 
Item::newInstance()->findByPrimaryKey($itemId);
View::newInstance()->_exportVariableToView('item'$cItem);
if(
$itemId['b_premium']==1){ echo 'Hello world';}
?>


or in index.php with some function to check

Code: [Select]
function check_premium($itemId){
$cItem = Item::newInstance()->findByPrimaryKey($itemId);
View::newInstance()->_exportVariableToView('item', $cItem);
if($itemId['b_premium']==1) {
echo 'hello world';
}

 :(

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: [Help] Identify if item premium is on.
« Reply #5 on: September 06, 2016, 02:39:53 am »
Code: [Select]
<?php
$cItem 
Item::newInstance()->findByPrimaryKey($itemId);
View::newInstance()->_exportVariableToView('item'$cItem);
if (
osc_item_is_premium()) { echo 'Hello world';}
?>


fog

  • Hero Member
  • *****
  • Posts: 1062
Re: [Help] Identify if item premium is on.
« Reply #6 on: September 06, 2016, 02:52:55 am »
Sorry teseo, I tried before like you refer, and not working. Just in case, now I copy/paste the code you insert now, and not working when I open a premium to edit, on page not appears "hello world". I'm sure is premium, is the only I have for testing, the rest is all normal ads. I'm testing on lastest Bender theme on latest osclass script.

Maybe tomorrow you can see it on bender theme to check if it working for you with some plugin. If yes, let me know, for I test for my side.

Now I think I need sleep.  :)

Thank you
Regards

fog

  • Hero Member
  • *****
  • Posts: 1062
Re: [SOLVED] Identify if item premium is on.
« Reply #7 on: September 06, 2016, 02:59:15 am »
Ohh man... I'm sorry. I forgot I have ID stored with variable named: $itemID  :o

Solved now. Thank you very much for your line codes. Is a good reference for me.

Have a good week teseo!  :D
Regards

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: [SOLVED] Identify if item premium is on.
« Reply #8 on: September 06, 2016, 01:18:20 pm »
You're welcome. :) Regards