Why 404 error when calling module directly? Opencart

Please LogIn to Reply!

Post By: guest | 01-18-2013 07:57 Reply

Question

Just playing around the OC code and I am wondering why I am not able to access the module directly like http://www.xyz.com/index.php?route=module/manufacturer or any other module for that matter?

Answers

Anybody? Any help appreciated.

I figured out the issue. The Index() method on the module is protected so you cannot call them publically.

The solution is to change the method to "public".

but that just shows a blank page as there is no template render for that
You'd also have to change:
$this->render();
to
$this->response->setOutput($this->render(TRUE), $this->config->get('config_compression'));

Thanks Q. Yes I noticed the blank page but I didn't bother to look into deep.

Related to this, How I can display a module output in the product page?

If you look at my site http://www.sansdirect.com/acr-rcl-100d- ... ight-19303
YOu will see "More buying options" on the Right column. I would like to move this below the product image (center column)

You can add it to the controllers children array to make it a direct child:

1. EDIT: catalog/controller/product/product.php

2. FIND:

Code: Select all
$this->children = array(
                
'common/column_right',
                
'common/column_left',
                
'common/footer',
                
'common/header',
            ); 


3. REPLACE WITH:

Code: Select all
$this->children = array(
                
'common/column_right',
                
'common/column_left',
                
'common/footer',
                
'common/header',
                
'module/special'
            
); 


You will likely need to alter the css/tpl to make it look right.

Thanks Q. This works.

Reply Or Comment!
Please LogIn to Reply!