SuperKingTurban
SuperKingTurban

Reputation: 27

Trying to create new product type in magento, getting fatal error

I'm trying to create new product type in magento and it is showing up in admin panel create new product page's product type options, but when I select it and continue, i get fatal error:

Fatal error: Call to a member function setConfig() on a non-object in /home/shop/public_html/shop/app/code/core/Mage/Catalog/Model/Product/Type.php on line 82

Line 82 is:

$typeModel->setConfig($types[$typeId]);

Module config file (app/code/local/Pood/Toodep6hi/etc/config.xml):

<?xml version="1.0"?>
    <config>

        <modules>
            <Pood_Toodep6hi>
                <version>0.1.0</version>
            </Pood_Toodep6hi>
        </modules>
        <adminhtml>
            <translate>
                <modules>
                    <Pood_Toodep6hi>
                    <files>
                        <default>Pood_Toodep6hi.csv</default>
                    </files>
                    </Pood_Toodep6hi>
                </modules>
            </translate>
        </adminhtml>


        <global>

            <models>
                <Toodep6hi>
                    <class>Pood_Toodep6hi_Model</class>
                </Toodep6hi>
            </models>

            <catalog>
                <product>
                    <type>
                        <p6hitoode translate="label" module="Toodep6hi">
                            <label>Pohitoode</label>
                            <model>Toodep6hi/Product_Type_P6hitoode</model>
                            <price_model>Toodep6hi/Product_Price</price_model>
                            <index_data_retreiver>Toodep6hi/catalogIndex_Data_P6hitoode</index_data_retreiver>
                            <is_qty>1</is_qty>
                        </p6hitoode>
                    </type>
                </product>
            </catalog>



            <helpers>
                <Toodep6hi>
                    <class>Pood_Toodep6hi_Helper</class>
                </Toodep6hi>
            </helpers>
        </global>
    </config>

app/code/local/Pood/Model/Product/Type/P6hitoode.php:

<?php
class Pood_Toodep6hi_Model_Product_Type_P6hitoode extends Mage_Catalog_Model_Toodep6hi_Type_Abstract
{
        const TYPE_P6HITOODE = "p6hitoode";
    public function isVirtual()
    {
        return true;
    }
}

I found a sililar problem: http://www.magentocommerce.com/boards/viewthread/196886/#t248371, but it did not help.

Every bit of help would be very appreciated. Thank you!

Upvotes: 0

Views: 1580

Answers (4)

Cameron
Cameron

Reputation: 36

Try this

                <type>
                    <p6hitoode translate="label" module="Toodep6hi">
                        <label>Pohitoode</label>
                        <model>Toodep6hi/product_type_p6hitoode</model>
                        <price_model>Toodep6hi/product_price</price_model>
                        <index_data_retreiver>Toodep6hi/catalogIndex_data_p6hitoode</index_data_retreiver>
                        <is_qty>1</is_qty>
                    </p6hitoode>
                </type>   

Upvotes: 0

Sunel
Sunel

Reputation: 51

the problem is case sensititve

<model>Toodep6hi/product_type_p6hitoode</model>

it should be

<model>toodep6hi/product_type_p6hitoode</model>

Upvotes: 2

freento
freento

Reputation: 2949

Use lower case here:

<model>Toodep6hi/Product_Type_P6hitoode</model>

so it will be:

<model>Toodep6hi/product_type_p6hitoode</model>

If will not help, try to use lower case for model:

<models>
    <toodep6hi>
        <class>Pood_Toodep6hi_Model</class>
    </toodep6hi>
</models>

and lower case here then

<model>toodep6hi/product_type_p6hitoode</model>

Upvotes: 0

freento
freento

Reputation: 2949

Try to extend Mage_Catalog_Model_Toodep6hi_Type_Abstract from Mage_Catalog_Model_Product_Type_Virtual

Upvotes: 0

Related Questions