Advertisement:

Author Topic: NEW PLUGIN - Business Info Plugin  (Read 16669 times)

ken

  • Full Member
  • ***
  • Posts: 108
NEW PLUGIN - Business Info Plugin
« on: October 23, 2011, 10:43:19 pm »
I am creating a plugin for business info called "businessinfo". I have it working with a few different fields that make the whole plugin. My question is, I have one field named "businessname" within the plugin, I want to only show that field and not the whole plugin on the main page in the latest items next to title. How can I do that.
I tried using
<?php echo item_businessinfo_businessname(); ?> and also <?php echo item_businessinfo_s_businessname(); ?> and it didn't work.

Does anyone know how I can Just put businessname field? It is a regular input field using varchar(100) if tht helps.
« Last Edit: October 24, 2011, 09:20:13 am by ken »

BuySellAndSwap

  • Sr. Member
  • ****
  • Posts: 389
Re: NEW PLUGIN - HELP PLEASE
« Reply #1 on: October 23, 2011, 11:50:29 pm »
Hi
Sorry I'm unable to help but this sounds like a great plugin in if you could let me know when its ready if you wanting to share

Thank you

trains58554

  • Osclass contributor
  • Hero Member
  • *****
  • Posts: 3642
  • osCanyon, the class of Osclass
Re: NEW PLUGIN - HELP PLEASE
« Reply #2 on: October 24, 2011, 12:53:20 am »
Hi Ken

You would have to make a function call like so.

This would be what you would have to call in your main.php file


<?php echo item_businessinfo_businessname(osc_item_id();); ?>


Then your function in your plugin would be something like this


function item_businessinfo_businessname($item_id) {
     
some code to connect to the database and return a record that matches $item_id
     then you would 
return the businessname 
}


I hope this helps.

Jay

ken

  • Full Member
  • ***
  • Posts: 108
Re: NEW PLUGIN - Business Info Plugin
« Reply #3 on: October 24, 2011, 02:28:54 am »
@ Jay.

Thank you for the reply.

After I posted, I kept working on it and did another sort of work around.

I created a second item_detail page, renamed it item_detail1 and added it to the index function and it worked.

@ hunt4it,

Once I fix it up a little bit I will upload it here for you.
« Last Edit: October 24, 2011, 09:20:38 am by ken »

ken

  • Full Member
  • ***
  • Posts: 108
Re: NEW PLUGIN - Business Info Plugin
« Reply #4 on: October 24, 2011, 04:44:33 am »
@ hunt4it,

Attached is the plugin that I created for my site. I hope it is useful for you.
« Last Edit: October 24, 2011, 09:22:05 am by ken »

trains58554

  • Osclass contributor
  • Hero Member
  • *****
  • Posts: 3642
  • osCanyon, the class of Osclass
Re: NEW PLUGIN - HELP PLEASE
« Reply #5 on: October 24, 2011, 07:15:46 am »
Hi Ken

I just tried your plugin but it seems to be missing the second item_detail() function to load just the business name. Other than that the plugin is working great nice work.

Jay

ken

  • Full Member
  • ***
  • Posts: 108
Re: NEW PLUGIN - Business Info Plugin
« Reply #6 on: October 24, 2011, 08:29:44 am »
@ Jay,

I didn't add it to the attached as I'm not sure if anyone would have use for it. If you want it let me know and I will upload it.

@ Everyone else,

I forgot to mention that for the plugin to work, you have to put

<?php businfo_item_detail(); ?>

where ever you want the plugin to show on the item page.

Thanks,

Ken
« Last Edit: October 24, 2011, 09:20:52 am by ken »

ken

  • Full Member
  • ***
  • Posts: 108
Re: NEW PLUGIN - Business Info Plugin
« Reply #7 on: October 24, 2011, 08:39:39 am »
@ Jay,

Attached is the version with the additional detail page to just show the business name.

for the plugin to work, you have to put

<?php businfo_item_detail1(); ?>

where ever you want just the business name to show. I put it on the Search List Page and Main Page, before the Title.

Thanks,

Ken

« Last Edit: October 24, 2011, 09:21:05 am by ken »

trains58554

  • Osclass contributor
  • Hero Member
  • *****
  • Posts: 3642
  • osCanyon, the class of Osclass
Re: NEW PLUGIN - HELP PLEASE
« Reply #8 on: October 24, 2011, 08:43:23 am »
Thanks Ken I will check it out

Jay

trains58554

  • Osclass contributor
  • Hero Member
  • *****
  • Posts: 3642
  • osCanyon, the class of Osclass
Re: NEW PLUGIN - HELP PLEASE
« Reply #9 on: October 24, 2011, 08:50:02 am »
Hi Ken

I was just looking at the code to see how the businfo_item_detail1() function worked and I saw that you could just put the if statement and code right into the businfo_item_detail1() function and then you would not need the extra file.

Jay

ken

  • Full Member
  • ***
  • Posts: 108
Re: NEW PLUGIN - Business Info Plugin
« Reply #10 on: October 24, 2011, 09:03:05 am »
Hi Jay,

Nice. Thanks for checking this out. Can you send me the file revised so I can see how that would work?

Thanks,

Ken
« Last Edit: October 24, 2011, 09:21:23 am by ken »

trains58554

  • Osclass contributor
  • Hero Member
  • *****
  • Posts: 3642
  • osCanyon, the class of Osclass
Re: NEW PLUGIN - HELP PLEASE
« Reply #11 on: October 24, 2011, 09:09:14 am »
This is how I changed the businfo_item_detail1() function


function businfo_item_detail1() {

    
	
$conn   getConnection();

        
$detail $conn->osc_dbFetchResult("SELECT * FROM %st_item_businfo WHERE fk_i_item_id = %d"DB_TABLE_PREFIXosc_item_id());

	
if(@
$detail['s_busname'] != "") {

       
	
     echo @
$detail['s_busname'];   

	
}

       
}


notice I removed the require_once code as it is no longer needed.

Jay

ken

  • Full Member
  • ***
  • Posts: 108
Re: NEW PLUGIN - Business Info Plugin
« Reply #12 on: October 24, 2011, 09:17:08 am »
Thanks Jay. That is definitely better. I will check it out.

Ken
« Last Edit: October 24, 2011, 09:21:34 am by ken »

ken

  • Full Member
  • ***
  • Posts: 108
Re: NEW PLUGIN - Business Info Plugin
« Reply #13 on: October 24, 2011, 09:19:39 am »
We should retitle this thread to: NEW PLUGIN - Business Info Plugin

trains58554

  • Osclass contributor
  • Hero Member
  • *****
  • Posts: 3642
  • osCanyon, the class of Osclass
Re: NEW PLUGIN - Business Info Plugin
« Reply #14 on: October 24, 2011, 09:25:30 am »
Another improvement I think you should do to the plugin is allow the admin set which categories they want this plugin to show up in.