1

I have a fresh install of EE2.8.1

I want to use the Geofinder plugin and do a location search. On my result page, I am getting serious errors.

Fatal error: Call to undefined method EE_Template::assign_relationship_data() in /vagrant/xxx.dev/system99/expressionengine/third_party/geofinder/mod.geofinder.php 
Call Stack: 0.0000 644616 1. {main}() /vagrant/xxx.dev/index.php:0 0.0023 648744
 2. require_once('/vagrant/xxx.dev/system99/codeigniter/system/core/CodeIgniter.php') /vagrant/xxx.dev/index.php:188 0.1334 2785712 
 3. call_user_func_array() /vagrant/xxx.dev/system99/codeigniter/system/core/CodeIgniter.php:319 0.1334 2785848 
 4. EE->index() /vagrant/xxx.dev/system99/codeigniter/system/core/CodeIgniter.php:0 0.1334 2785928 
 5. EE_Core->generate_page() /vagrant/xxx.dev/system99/expressionengine/controllers/ee.php:68 0.1346 2966928 
 6. EE_Template->run_template_engine() /vagrant/xxx.dev/system99/expressionengine/libraries/Core.php:703 0.1363 2994440 7. EE_Template->fetch_and_parse() /vagrant/xxx.dev/system99/expressionengine/libraries/Template.php:157 0.1534 3191400 
 8. EE_Template->parse() /vagrant/xxx.dev/system99/expressionengine/libraries/Template.php:209 0.1542 3199400 
 9. EE_Template->tags() /vagrant/xxx.dev/system99/expressionengine/libraries/Template.php:466 0.1621 3217496 
 10. EE_Template->process_tags() /vagrant/xxx.dev/system99/expressionengine/libraries/Template.php:1178 0.1707 4095136
 11. Geofinder->location_results() /vagrant/xxx.dev/system99/expressionengine/libraries/Template.php:1559

Have anyone went around it

Thanks

Developer - Rob

2

I have gotten this to work with a little massaging. I am trying to contact big robot and send them the patch currently. But you can change the plugin in two places to get it working.

In the mod.geofinder.php file around line 169 you can change

$this->EE->TMPL->tagdata = $this->EE->TMPL->assign_relationship_data($this->EE->TMPL->tagdata);
$this->EE->TMPL->var_single = array_merge($this->EE->TMPL->var_single, $this->EE->TMPL->related_markers);

to

if (version_compare(APP_VER, '2.6.0', '<')) {
    $this->EE->TMPL->tagdata = $this->EE->TMPL->assign_relationship_data($this->EE->TMPL->tagdata);
    $this->EE->TMPL->var_single = array_merge($this->EE->TMPL->var_single, $this->EE->TMPL->related_markers);
}

and you need to change the function render_with_page_fix($channel, $limit, $offset) to a completely different function

function render_with_page_fix($channel, $limit, $offset) {
        if ($channel->enable['pagination'] == TRUE)
        {

            if (version_compare(APP_VER, '2.8', '>=')) {
        $this->EE->load->library('pagination');
        $pagination = $this->EE->pagination->create();
        $this->EE->TMPL->tagdata = $pagination->prepare($this->EE->TMPL->tagdata);
        $total_items = $channel->total_rows;
        $per_page = $this->EE->TMPL->fetch_param('limit');
        $pagination->build($total_items, $per_page);
        if ($pagination->paginate === TRUE)
        {
          $pagination->build($total_items, $per_page);
        }

        return $pagination->render($channel->return_data);
      } else {
                $channel->pagination->EE->pagination->total_rows = $channel->total_rows;
                $channel->pagination->get_template();
                $channel->return_data = preg_replace(
                    "/".LD."paginate".RD.".+?".LD.'\/'."paginate".RD."/s",
                    "",
                    $channel->return_data
                );
                $channel->pagination->build($channel->total_pages);

                $config = array();
                $config['first_url']    = rtrim($channel->pagination->basepath, '/');
                $config['base_url']     = $channel->pagination->basepath;
                $config['prefix']       = 'P';
                $config['total_rows']   = $channel->total_rows;
                $config['per_page'] = $limit;
                // cur_page uses the offset because P45 (or similar) is a page
                $config['cur_page'] = $offset;
                $config['first_link']   = lang('pag_first_link');
                $config['last_link']    = lang('pag_last_link');
                $config['uri_segment']  = 0; // Allows $config['cur_page'] to override

                $channel->pagination->EE->pagination->initialize($config);
                $channel->pagination->page_links = $channel->pagination->EE->pagination->create_links();
                $channel->pagination->EE->pagination->initialize($config); // Re-initialize to reset config
                $channel->pagination->page_array = $channel->pagination->EE->pagination->create_link_array();

                $channel->pagination->current_page = floor(($offset / $limit) + 1);
                $channel->pagination->total_pages = $channel->total_pages;

                return $channel->pagination->render($channel->return_data);
            }
        } else {
            return $channel->return_data;
        }
    }

That should get it working.

Cory

1
  • Thanks Cory - upgrading a site to 2.8.1 now and it's having loads of issues with Fieldtypes & Module upgrades. This has sorted the Geofinder errors! – John Cowen Apr 30 '14 at 14:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.