0

I've created a custom banner module for Magento and I've tested it locally on my Vagrant/VirtualBox setup running an instance of precise32 and everything is working great.

When I pulled the code from GitHub on to a staging server the extension is not working and I'm getting the following error:

PHP Fatal error: Call to a member function getCollection() on a non-object in /var/colourbox/app/code/local/AffinityCloud/ACBanners/Block/Slider.php on line 7, referer: http://colourbox.affinitycloud.co.uk/tub-storage.html

This is while viewing the home page, so I'm not sure why it's referencing http://colourbox.affinitycloud.co.uk/tub-storage.html as the referer as this is a category page.

I've cleared the cache (is disabled anyway) and reindexed. Stil no joy. I've also tried to rename the model classes using lowercase characters and the first character uppercase with no result.

I've added the module code to GitHub below so you can see the code:

https://github.com/affinitycloud/acbanners

Any ideas why this would be working locally and not on the staging server? It's as if it can't find the model classes but has no problem fining the Slider.php class.

I'm at a loss as to what to do here.

NOTE: For brevity, I would like to add that I have logged out and back in to the admin, while also deleting the module tables and the reference in core_resource to no avail. It creates the tables fine but I still get the same issues and the module is showing as enabled in the advanced config.

1

Its probably due to the capitals you are using. Please try AffinityCloud/Acbanners as directory path and check if usage of uppercase and lowercase is correct in your config.xml.

Depending on server configuration uppercase can de handled differently.

|improve this answer|||||
0

The line which fails is:

$bannersCollection = Mage::getModel('acbanners/acbanners')->getCollection();

and in your config you have:

    <acbanners>
        <class>AffinityCloud_ACBanners_Model</class>
        <resourceModel>acbanners_mysql4</resourceModel>
    </acbanners>

Thus, the model will be AffinityCloud_ACBanners_Model_Acbanners.

Your folder structure however is AffinityCloud_ACBanners_Model_ACBanners

So the correct way for your structure would be:

$bannersCollection = Mage::getModel('acbanners/aCBanners')->getCollection();

You will also need to adjust appropriately for your resource model / collection.

|improve this answer|||||

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.