Magento - Fatal error(s) after installing module - magento

Just installed Product Accessories on Magento ver. 1.8.0.0
And my whole website went on fatal errors.
Fatal error: Call to a member function getCollection() on a non-object
Fatal error: Call to a member function setStoreId() on a non-object
Fatal error: Class 'Anais_Accessories_Model_Product'
What do I need to do to get the module running smooth? I can't find an other module that does the same like this one.

Your Model file name should be like this-->> AnaisAccessories.php. Rename all the classes in the Model folder start with the Uppercase and rest should be lowercase as AnaisAccessories. As you can see you've error in class 'Anais_Accessories_Model_Product'.
Make sure file ../Model/AnaisAccessories.php should contain below code. Make appropriate change according to your Module.
class Anais_Accessories_Model_Accessories extends Mage_Core_Model_Abstract
{
public function _construct()
{
parent::_construct();
$this->_init('accessories/accessories');
}
}

Related

How to create a new Category from Console Command

I'm trying to generate some categories programatically from a Console Command on Magento 2, but Magento responds with this error as soon as the command is executed:
[Magento\Framework\Exception\LocalizedException]
Class Magento\Catalog\Api\Data\CategoryExtensionInterface does not exist
The Interface referenced by the error exists on Magento.
The code to reproduce the error is pretty simple
class MyCommand extends Command {
[...initialization block...]
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->objectManager->create(\Magento\Catalog\Model\Category::class);
}
Has anyone seen this error before?
Please check file permissions for var/generation.

configure flexigrid helper, and customize variable $colModel

I try to start Flexigrid into Codeigniter.
I download demo files from here http://gembelzillonmendonk.wordpress.com/2010/06/28/flexigrid-and-codeigniter-with-advanced-searching-with-example/
but i wrong to set up something:
Instruction from site:
extract .rar to CI folder**
open your controller (ie: CI_Folder\system\application\controllers\flexigrid.php)**
configure flexigrid helper, and customize variable $colModel, example:**
code example
What I did:
I installed correctly CodeIgniter (copy and paste inside htdocs - xampp)
I created a database called 'country' and import sql file inside demo.
I copied correctly files an folders from demo files to my CI folder (called grocery-crud-demo).
But when I type on firefox http://localhost/grocery-crud-demo/index.php/flexigrid/index I have this error
Fatal error: Class 'Controller' not found in C:\xampp\htdocs\grocery-crud-demo\application\controllers\flexigrid.php on line 2
A PHP Error was encountered
Severity: Error
Message: Class 'Controller' not found
Filename: controllers/flexigrid.php
Line Number: 2
Backtrace:
I read instruction also from here: http://roadmyapps.toile-libre.org/index.php/flexigrid/examplebut I don't understand which code exactly I must have into flexigrid.php
I don't understand how configure flexigrid helper, and customize variable $colModel.
I need exact code into files. Have you idea?
I find CodeIgniter 1.7.3 -- I repeat steps -- new error:
A PHP Error was encountered
Severity: Notice
Message: Undefined property: Ajax_model::$db
Filename: models/ajax_model.php
Line Number: 34
Fatal error: Call to a member function query() on a non-object in C:\xampp\htdocs\grocery-crud-demo\system\application\models\ajax_model.php on line 34
Code of ajax_model.php is this: http://pastebin.com/P3KawC7S
Probably you are using newer version of CI than one on tutorial.
As I can see tutorial is written for 1.7.2 version.
Try to change
class Someclass extends Controller
{
public function someclass()
{
}
public function index()
{
//etc, etc
}
}
with
class Someclass extends Controller
{
public function __construct()
{
parent::__construct()
{
}
}
public function index()
{
//etc, etc
}
}
Also, for models too. Like
public function Ajax_model()
{
parent::Model();
$this->CI =& get_instance();
}
should be
public function __construct()
{
parent::__construct();
$this->CI =& get_instance();
}
Try that way.
Spot those differences. Those should change in every controller and model respectivelly. Follow this link for upgrading your app.
If fail again, see the CodeIgniter documentation about upgrading versions.

Fatal error: Cannot redeclare class JInput in JOOMLA

Today i just started my first joomla extension. I am using lendr sample joomla3.1 extnsion as a reference
$app = JFactory::getApplication()->input;
$controller = $app->input->get('controller','default');
i got following error on line execution of 2
Fatal error: Cannot redeclare class JInput in C:\Users\arslan\Desktop\xampp-win32-1.8.1-VC9\xampp\htdocs\COM\libraries\joomla\input\input.php on line 34
and line 34 of input.php is just implementation of interface
*/
class JInput implements Serializable, Countable
{
any idea about this error.

CodeIgniter class loading is not working

I have a class in application/library folder - filename = person_struc.php and the code is following..
class Person_struc {
var $person_id;
var $person_name;
public function set_info($person_id, $person_name) {
$this->person_id = $person_id;
$this->person_first_name = $person_name;
}
}
I have a view (person_list.php) and want to load the class by as follows -
$this->load->library('person_struc');
$this->person_struc->set_info(1,"xxx");
I have controller (person) and model (person_model). But it is generating error..
A PHP Error was encountered
Severity: Notice
Message: Undefined property: CI_Loader::$person_struc
Filename: person/person_list.php
Fatal error: Call to a member function set_info() on a non-object in
I tried to solve the problem but failed. Do you have any solution please...
Initial letter of your file name must be capital. In your case it would be filename = Person_struc.php instead of filename = person_struc.php
Try like
class Person_struc extends CI_Controller
your class must be locate in library.
your class name and file name are same.
and your person_list controller must be extends CI_CONTROLLER

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

When I try to placing an order, while selecting the shipping method an error is getting saying
Fatal error: Call to a member function setTitle() on a non-object in /home/exclus31/public_html/../../../app/code/core/Mage/Customer/Block/Form/Login.php on line 40
But there is no problem for placing the order and got the confirmation message for the particular order.
Any one know why this error is shown and a solution for this?
I had this error as well. It was because I was calling getLayout() in my IndexAction() before I had loaded the layout. Just call loadLayout() first, like so:
public function IndexAction() {
$this->loadLayout(); // do this first
$this->getLayout()->getBlock('head')->setTitle($this->__('My Title')); // then this works
$this->renderLayout(); // render as usual
}
I hope this helps

Resources