How could I get second ads mod?

How could I get second ads mod?

 

Hello,everyone

I want two ads mod, one for book, one for movie.

So I do something below:

1. copy ads dir and name the new dir ads2

2. replace all "ads" to "ads2" in ads2 dir 

3. replace all "Ads" to "Ads2" in ads2 dir 

4. change all the files' name under ads2/classes, (e.g BxAdsCalendar.php to BxAds2Calendar.php )

5. change ads.png to ads2.png, bx_ads.png to bx_ads2.png

6. goto website admin panel install the new mod Ads2 sucessfully.

7. goto website homepage, click Ads2 error happen:

"Fatal error: Call to a member function getHomePath() on a non-object in /home3/waaaooco/public_html/bookdir/modules/boonex/ads2/classes/BxAds2SearchUnit.php on line 72"

 

Who can tell me how to clone a ads mod?

Any help is appreciated.

Quote · 15 Sep 2011

Did you also make the new database tables called ads2 I would imagin that your new mod, ads2, would also need you to copy and rename the database tables ect for ads you can find the SQL in the ads install folder.

For example for an ads2 you would need to alter the SQL to ads 2 for examnple you would change

-- create tables
CREATE TABLE `[db_prefix]_rating` (
  `ads_id` int(12) NOT NULL default '0',
  `ads_rating_count` int(11) NOT NULL default '0',
  `ads_rating_sum` int(11) NOT NULL default '0',
  UNIQUE KEY `med_id` (`ads_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

 

TO

 

-- create tables
CREATE TABLE `[db_prefix]_rating` (
  `ads2_id` int(12) NOT NULL default '0',
  `ads2_rating_count` int(11) NOT NULL default '0',
  `ads2_rating_sum` int(11) NOT NULL default '0',
  UNIQUE KEY `med_id` (`ads2_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

 

and so on and so forth untill you had replaced every table with ads2 then run the install again.

My guess is that you have copied the old SQL when copying the ads folder and installing it will just replace the old tables instead of making new ones

then when you have your SQL uploaded into your database you would need to make the changes in the above file you mention and any other files for ads 2.

For example some of the code from the above BXAdsSearchUnit.php you would change

 

var $aCurrent = array(
  'name' => 'ads',
  'title' => '_bx_ads_Ads',
  'table' => 'bx_ads_main',
  'ownFields' => array('ID', 'IDProfile', 'IDClassifiedsSubs', 'DateTime', 'Subject', 'EntryUri', 'Message', 'CustomFieldValue1', 'CustomFieldValue2', 'Media', 'Tags', 'Status', 'Rate', 'RateCount', 'CommentsCount'),
  'searchFields' => array('Subject', 'Message', 'Tags', 'City'),
  'join' => array(
   'subcategory' => array(
    'type' => 'inner',
    'table' => 'bx_ads_category_subs',
    'mainField' => 'IDClassifiedsSubs',
    'onField' => 'ID',
    'joinFields' => array('NameSub', 'SEntryUri', 'ID')
   ),

TO

 

var $aCurrent = array(
  'name' => 'ads2',
  'title' => '_bx_ads2_Ads2',
  'table' => 'bx_ads2_main',
  'ownFields' => array('ID', 'IDProfile', 'IDClassifiedsSubs', 'DateTime', 'Subject', 'EntryUri', 'Message', 'CustomFieldValue1', 'CustomFieldValue2', 'Media', 'Tags', 'Status', 'Rate', 'RateCount', 'CommentsCount'),
  'searchFields' => array('Subject', 'Message', 'Tags', 'City'),
  'join' => array(
   'subcategory' => array(
    'type' => 'inner',
    'table' => 'bx_ads2_category_subs',
    'mainField' => 'IDClassifiedsSubs',
    'onField' => 'ID',
    'joinFields' => array('NameSub', 'SEntryUri', 'ID')
   ),

And so on and so forth.

Where ever you see in the code the words  'table' => this tells you that it is reading a peticular table from the database in the above example it is reading data from  'table' => 'bx_ads_category_subs',
you need it to be reading data from a new ads2 table so you need to create that new table and make the changes in the class to read from the new table 'table' => 'bx_ads2_category_subs',

 

Hope this helps

Quote · 15 Sep 2011

There is also more.

All of the references to the renames class files in all of the files need to be changed as well. For example. in your new file BxAds2SearchUnit.php you will still find a class name that matches the old name.

class BxAdsSearchUnit extends BxTemplSearchResultText {

You need to replace BxAdsSearchUnit with BxAds2SearchUnit

You will need to go through all of class file in the classes folder and change them.

You also will need to go through the language file in the langs folder can change the name of all the language keys so they do not match the old one.

The database prefix in the config file needs to be changed, the class prefix in teh config file, the language catagory in the config file.

The install sql file will also need changes to the name of the ads pages inserted into database, top menu links, permalinks and a number of other items.

If everyting is not properly renamed your new ads module will conflict with the old one.

My guess is becuse not all these changes were made to your new module prior to installing it, it has now damaged the existing origional and that also will need to be removed and reinstalled to correct the damage caused by the conflicts in names of database entries and other items.


https://www.deanbassett.com
Quote · 15 Sep 2011

You might want to test your changes on an installation other than your live site.

BoonEx Certified Host: Zarconia.net - Fully Supported Shared and Dedicated for Dolphin
Quote · 15 Sep 2011

 

I have replaced all used a text replace tool.

2. replace all "ads" to "ads2" in ads2 dir (all *.php, *.sql, *.html,*.css )

3. replace all "Ads" to "Ads2" in ads2 dir (all *.php, *.sql, *.html,*.css )

 

Quote · 16 Sep 2011

Have another read through Deano's post

You also will need to go through the language file in the langs folder can change the name of all the language keys so they do not match the old one.

I think this meens entering new language strings for the new mod

The database prefix in the config file needs to be changed, the class prefix in teh config file, the language catagory in the config file.

Not sure about this one



Quote · 16 Sep 2011

Hi,nay27uk

I have replaced all used a text replace tool.

2. replace all "ads" to "ads2" in ads2 dir (all *.php, *.sql, *.html,*.css )

3. replace all "Ads" to "Ads2" in ads2 dir (all *.php, *.sql, *.html,*.css )

 

so, en.php will become below:

 

    '_bx_ads2_Life_Time' => 'Life Time',

    '_bx_ads2_Filtered_ads2' => 'Filtered ads2',

    '_bx_ads2_Sub_Categories' => 'Sub Categories',

 

config.php will become below:

 

'title' => 'Ads2',

'version' => '1.0.6',

'vendor' => 'Boonex',

'update_url' => '',

'compatible_with' => array(

'7.0.6'

),

 

 

/**

* 'home_dir' and 'home_uri' - should be unique. Don't use spaces in 'home_uri' and the other special chars.

*/

'home_dir' => 'boonex/ads2/',

'home_uri' => 'ads2',

 

'db_prefix' => 'bx_ads2',

'class_prefix' => 'BxAds2',

 

But it always have error:

"Fatal error: Call to a member function getHomePath() on a non-object in /home3/waaaooco/public_html/bookdir/modules/boonex/ads2/classes/BxAds2SearchUnit.php on line 72"

Who know what the error mean?

Quote · 16 Sep 2011

Could you post up the code from around line 70-75 from the BxAds2SearchUnit.php

I am not 100% certain this will work but also try replacing all ocurences of $oAds to $oAds2

for example

 

$oAds = new BxAdsModule($aModule);
$oAds->sCurrBrowsedFile = bx_html_attribute($_SERVER['PHP_SELF']);

 

Would become

 

$oAds2 = new BxAds2Module($aModule);
$oAds2->sCurrBrowsedFile = bx_html_attribute($_SERVER['PHP_SELF']);

 

I know you said you have changed everything but this sujestion is just in case

Quote · 16 Sep 2011

function BxAds2SearchUnit() {

$oMain = $this->getAds2Main();

 

$this->sHomePath = $oMain->_oConfig->getHomePath();  //line 72

$this->sHomeUrl = $oMain->_oConfig->getHomeUrl();

 

$this->aPermalinks = array(

Quote · 17 Sep 2011

ok not much help to me as I am no coder but I belive that the

$this->sHomePath = $oMain->_oConfig->getHomePath();

gets its variable from the

$oAds

and looking at your error it says it cant find the homepath

Fatal error: Call to a member function getHomePath() on a non-object

If you can send zip files on the PM system zip up what you have so far and PM them to me I will install a test dolphin and see if I can work it out for you

 

Quote · 17 Sep 2011

Problem now resolved.

I have done this for mart and sent him the files

Quote · 28 Sep 2011
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.