Advertisement:

Author Topic: [Plugin]Related ads on Item Page Version 2.2 released[Updated 25/Aug/2013]  (Read 36402 times)

navjottomer

  • Tutor
  • Sr. Member
  • *
  • Posts: 373
  • I am here
Related Ads Plugin Version 2.2.2

Related ads plugin is very easy to use plugin which will show latest related ads on Item page and helps you to reduce bounce rate of your classified portal.
In order to use this plugin, you should enable Auto-embed feature in plugin configuration screen or edit your theme file item.php and add the following line anywhere in the code you want related ads to display.
Code: [Select]
<?php if (function_exists('related_ads_start')) {related_ads_start();} ?>
This plugin is provided as is without any guarantee. I am not responsible if your server gets cry or throw your site out. ;)

First uninstall the old version before upgrading to New version.
25/Aug/2013 Version 2.2.2
Fixed Menu bug with osclass 3.2

30/May/2013 Version 2.2 (Please Upgrade to this version as soon as possible because of security flaw in older version.)
1. Added option to show premium ads.
2. Updated some internal functions.
3. Added Dutch, Spanish and French languages. Translated by google. (Help me to translate this plugin in other languages.)
4. Updated version and security fix.



11/April/2013 Version 2.1

1. Added Options filter by category,regions and by country.
2. Improved Duplicated ad removal (Now current item will not be included in related ads while showing proper number of ads).
3. Refined User Interface to resemble Osclass 3.0 look.
4. Upgraded to Version 2.1
5. Only tested with Osclass 3.0 - 3.1.1 , may not work with older versions of osclass.

16/05/2012 Version 2.0.0
1. Added Option to disable stylesheet from Admin Panel
2. Now Related ads can be added to your Item page Automatically. So now you don't have to edit your theme file.
3. Added Option to Enable/Disable Auto Embed feature from Admin Panel.
4. Upgraded to Version 2.0.0
5. Updated Help content.

16/05/2012 Version 1.1.3
Fixed Fatal Error while installing plugin version 1.1.2

16/05/2012 Version 1.1.2
Made changes, suggested by Jay

16/05/2012 Version 1.1.1
Fixed duplicate ad problem


15/05/2012 Version 1.1
1. Added option to select pictures ads only within Admin Screen.
2. Added option to set numbers of ads to display.
3. Changed php code. Now you can add related ads by adding one line function in item.php .

14/05/2012 Version 1.0
1. Initial plugin release.

Screenshot





Have to work on
1. Option to edit css from Admin Screen.
2. Auto embed of related ads in item page, so you don't have to edit item.php.
3. Option to show premium related ads only.
4. Making ads more related to current item.

Don't forget to share your feedback, suggestions or any bug you found in this plugin. Huge thanks to Jay for his suggestions


Open your issues here

https://github.com/navjottomer/related_ads/issues
« Last Edit: August 25, 2013, 11:24:59 am by navjottomer »

trains58554

  • Osclass contributor
  • Hero Member
  • *****
  • Posts: 3642
  • osCanyon, the class of Osclass
Re: [Plugin][WIP]Related ads on Item Page
« Reply #1 on: May 14, 2012, 08:15:57 am »
Hi navjottomer,

Great plugin. I just have a few suggestions. why not just put all the code in one function that way you only have to call one function to show the related ads
ex.

function related_ads() {
   
$mSearch = new Search() ;
    
$mSearch->addCategory(osc_item_category_id()) ;
    
//$mSearch->withPicture(true); //Search only Item which have pictures
    
$mSearch->limit(04) ; // in case you want only 4 results
    
    
$aItems $mSearch->doSearch(); 


	
$global_items View::newInstance()->_get('items') ; //save existing item array
	
View::newInstance()->_exportVariableToView('items'$aItems); //exporting our searched item array

<div class="related_ads">            
	
<
h2><strong><?php _e('Related Ads''tuffclassified') ; ?></strong></h2>
	
    <?php if( osc_count_items() == 0) { ?>
	
	
<p class="empty"><?php _e('No Related Ads''tuffclassified') ; ?></p>
	
    <?php } else { ?>
	
	
<table border="0" cellspacing="0">
	
	
    <tbody>
	
	
	
<?php $class "even"?>
	
	
	
<?php while ( osc_has_items() ) { ?>
	
	
	
<tr class="<?php echo $class. (osc_item_is_premium()?" premium":"") ; ?>">
                                            <?php if( osc_images_enabled_at_items() ) { ?>
                                             <td class="photo">
                                                <?php if( osc_count_item_resources() ) { ?>
                                                    <a href="<?php echo osc_item_url() ; ?>">
                                                        <img src="<?php echo osc_resource_thumbnail_url() ; ?>" width="75px" height="56px"  alt="<?php echo osc_item_title() ; ?>" />
                                                    </a>
                                                <?php } else { ?>
                                                    <img src="<?php echo osc_current_web_theme_url('images/no_photo.gif') ; ?>" alt="No image available" width="75px" height="56px" />
                                                <?php ?>
                                             </td>
                                            <?php ?>
                                             <td class="text">
                                                 <h3><a href="<?php echo osc_item_url() ; ?>"><?php echo osc_item_title() ; ?></a></h3>
                                                 <p><strong> <?php  echo osc_item_city(); ?>  -  <?php echo osc_item_category(); ?></strong></p>
                                                 <p><?php echo osc_highlightstrip_tagsosc_item_description() ) ) ; ?></p>
                                             </td>                                       
                                         </tr>
	
	
	
<?php $class = ($class == 'even') ? 'odd' 'even' ?>
	
	
	
<?php ?>
	
	
    </tbody>
	
	
</table>
	
	
</div>
	
	

	
    <?php 

View::newInstance()->_exportVariableToView('items'$global_items); //restore original item array
}


Please note the above will not work just as it is.

Another suggestion you could add function parameters  such as related_ads($num_ads, $images_only) That way the user could set the number of related items they wanted to show and if they wanted to only show related items with images.

Again great plugin.

Jay

PS. I have added your plugin to the list of user contributed plugins.

PS. For in the translation strings you should change them to the name of the plugin folder if you change it to be all in one function.
« Last Edit: May 14, 2012, 08:58:54 am by trains58554 »

navjottomer

  • Tutor
  • Sr. Member
  • *
  • Posts: 373
  • I am here
Re: [Plugin][WIP]Related ads on Item Page
« Reply #2 on: May 14, 2012, 11:05:10 am »
Thanks Jay for your kind suggestions. These are already in my todo list .

Alexandr

  • Full Member
  • ***
  • Posts: 126
Re: [Plugin][WIP]Related ads on Item Page
« Reply #3 on: May 15, 2012, 08:04:51 pm »
hi
Guys this is a modification similar ads?
How can I use?

navjottomer

  • Tutor
  • Sr. Member
  • *
  • Posts: 373
  • I am here
Re: [Plugin][WIP]Related ads on Item Page [Updated 15/May/2012]
« Reply #4 on: May 15, 2012, 08:14:34 pm »
Updated plugin to version 1.1

15/05/2012
1. Added option to select pictures ads only within Admin Screen.
2. Added option to set numbers of ads to display.
3. Changed php code. Now you can add related ads by adding one line function in item.php .
« Last Edit: May 15, 2012, 08:18:26 pm by navjottomer »

Alexandr

  • Full Member
  • ***
  • Posts: 126
Re: [Plugin]Related ads on Item Page [Updated 15/May/2012]
« Reply #5 on: May 15, 2012, 08:47:04 pm »
This is an amazing plugin!
But why is repeated ad
for example
http://tuffclassified.com/business-business-offer-business-opportunity-work-from-home-etc_50069
The first message "Related Ads" leads to the same ad

navjottomer

  • Tutor
  • Sr. Member
  • *
  • Posts: 373
  • I am here
Re: [Plugin]Related ads on Item Page [Updated 15/May/2012]
« Reply #6 on: May 15, 2012, 09:30:57 pm »
This is an amazing plugin!
But why is repeated ad
for example
http://tuffclassified.com/business-business-offer-business-opportunity-work-from-home-etc_50069
The first message "Related Ads" leads to the same ad

Thanks for pointing it out, will update plugin with added fix.

trains58554

  • Osclass contributor
  • Hero Member
  • *****
  • Posts: 3642
  • osCanyon, the class of Osclass
Re: [Plugin]Related ads on Item Page [Updated 15/May/2012]
« Reply #7 on: May 15, 2012, 11:07:10 pm »
Hi navjottomer,

Your plugin is looking great. I just have a few code suggestions.

You do not need this code.

$conn 
getConnection();
	
	
 
$conn->autocommit(false);
	
	
	
try {

}   catch (
Exception $e) {
	
	
	
	
$conn->rollback();
	
	
	
	
echo 
$e->getMessage();
	
	
	
}
	
	
	
$conn->autocommit(true);


You also should not need the global variable as the same variable is used in the same function.

I also have one little suggestion for for the admin menu section.
You should add support for osclass 2.4 menu structure it shows up just fine in 2.4 but with one small change it looks much better.

if( OSCLASS_VERSION '2.4.0') {
  echo 
'<h3><a href="#">Related Ads</a></h3>
        <ul> 
        
	
	
<li><a href="' 
osc_admin_render_plugin_url(osc_plugin_path(dirname(__FILE__)) . '/admin.php') . '">&raquo; ' __('Configure',     'related') . '</a></li>
            <li><a href="' 
osc_admin_render_plugin_url(osc_plugin_path(dirname(__FILE__)) . '/help.php') . '">&raquo; ' __('Help''related') . '</a></li>
        </ul>'
;
} else{
  echo 
'<li id="related_ads"><h3><a href="#">Related Ads</a></h3>
        <ul> 
        
	
	
<li><a href="' 
osc_admin_render_plugin_url(osc_plugin_path(dirname(__FILE__)) . '/admin.php') . '">&raquo; ' __('Configure',     'related') . '</a></li>
            <li><a href="' 
osc_admin_render_plugin_url(osc_plugin_path(dirname(__FILE__)) . '/help.php') . '">&raquo; ' __('Help''related') . '</a></li>
        </ul></li>'
;
}


Thanks for making this plugin and considering my suggestions. I am looking forward to see what other plugins you come up with in the future keep up the good work. :)

Jay

navjottomer

  • Tutor
  • Sr. Member
  • *
  • Posts: 373
  • I am here
Re: [Plugin]Related ads on Item Page [Updated 16/May/2012]
« Reply #8 on: May 15, 2012, 11:27:22 pm »
Hi, Jay
Applied changes as you have suggested. Thank you very much for your kind suggestions.

Regards
Navjot

snirpidotcom

  • Full Member
  • ***
  • Posts: 107
Re: [Plugin]Related ads on Item Page [Updated 16/May/2012]
« Reply #9 on: May 16, 2012, 12:42:43 am »
No, multilingual work. If multiple languages ​​are installed in oscclass and announcement has not been published in English, but in another language, is not in the list of ads.
Only appear in the published list, in English.

Thx.

rebel

  • Newbie
  • *
  • Posts: 5
Re: [Plugin]Related ads on Item Page [Updated 16/May/2012]
« Reply #10 on: May 16, 2012, 08:34:42 am »
Hi Thanks for your plugin

But after uploading and when i tried to install the plugin.

Plugin couldn't be installed because it triggered a fatal error
Notice: Undefined variable: conn in /oc-content/plugins/related_ads/index.php on line 16

Fatal error: Call to a member function commit() on a non-object in /oc-content/plugins/related_ads/index.php on line 16

Please tell me what to do iam also getting similar error,when i try to install car attributes plugin.But other than these two all other plugins are installing well.

Alexandr

  • Full Member
  • ***
  • Posts: 126
Re: [Plugin]Related ads on Item Page [Updated 16/May/2012]
« Reply #11 on: May 16, 2012, 08:35:28 am »
hi
version 1.1.2
new install
Code: [Select]
Notice: Undefined variable: conn in /home/oc-content/plugins/related_ads/index.php on line 16

Fatal error: Call to a member function commit() on a non-object in /home/oc-content/plugins/related_ads/index.php on line 16

navjottomer

  • Tutor
  • Sr. Member
  • *
  • Posts: 373
  • I am here
Re: [Plugin]Related ads on Item Page [Updated 16/May/2012]
« Reply #12 on: May 16, 2012, 09:15:02 am »
hi
version 1.1.2
new install
Code: [Select]
Notice: Undefined variable: conn in /home/oc-content/plugins/related_ads/index.php on line 16

Fatal error: Call to a member function commit() on a non-object in /home/oc-content/plugins/related_ads/index.php on line 16

Download latest zip. fixed

tijo972

  • Newbie
  • *
  • Posts: 32
hello super navjottomer your plugin, very useful to osclass.
works fine on my version 2.3.7 osclass.

Interesting market it will be added to some code    $mSearch->addRegion(osc_item_region());  to show only the region linked to the ads.

otherwise works fine.

navjottomer

  • Tutor
  • Sr. Member
  • *
  • Posts: 373
  • I am here
Thanks for the suggestion, will include this in next version.
Currently i have to work on multilingual support in this plugin as requested by some of forum members.