2
votes

We are building a module which allows you to group several products into a set for a specified price. Seeing as this is not too different from the grouped product, we extended it so we wouldn't have to rewrite too much.

The problem is that the model which is supposed to handle the logic (extended from Mage_Catalog_Model_Product_Type_Grouped) is not used, but the core model is.

My config.xml configuration:

<models>
    <promoset>
        <rewrite>
            <product_type>Phpro_PromoSet_Model_Product_Type_Promoset</product_type>
        </rewrite>
    </promoset>
</models>
<catalog>
    <product>
        <type>
            <promoset translate="label" module="promoset">
                <label>Promoset bundle</label>
                <model>promoset/product_type_promoset</model>
                <price_model>promoset/product_price</price_model
                <index_data_retreiver>promoset/catalogindex_data_promoset</index_data_retreiver>
                <allow_product_types>
                    <simple/>
                    <virtual/>
                </allow_product_types>
                <composite>1</composite>
            </promoset>
        </type>
    </product>
</catalog>

I have also tried some articles, which provide this config.xml:

<config>
    <global>
        <models>
            <newproducttype>
                <class>SeventhSense_NewProductType_Model</class>
            </newproducttype>
        </models>
        <helpers>
            <newproducttype>
                <class>Mage_Catalog_Helper</class>
            </newproducttype>
        </helpers>
        <catalog>
            <product>
                <type>
                    <newproducttype translate="label" module="newproducttype">
                        <label>New Product Type</label>
                        <model>newproducttype/product_type_newproducttype</model>
                        <composite>0</composite>
                        <index_priority>15</index_priority>
                    </newproducttype>
                </type>
            </product>
        </catalog>
    </global>
</config>

But also have thesame result.

I have checked and double checked that my model is in the right place. promoset/product/type/promoset.php for my own example, and newproducttype/product/type/newproducttype.php for the other.

Anyone who can point out my mistake? I'm running on Magento 1.6

UPDATE: On Magento 1.4 this works like a charm. On Magento 1.5 and up it does not. I'm investigating this. If anyone would know why this might be, do tell.

1
Why are you performing a <rewrite /> on the promoset model group? Should be creating it, not rewriting it. What do you get when you run <?php echo get_class(Mage::getModel('promoset/product_type_promoset')); ?>?Nick
I get the correct model, being Phpro_PromoSet_Model_Product_Type_PromosetJeroen
It sounds like Nick is on the right track, I would expect catalog/product_type_grouped to be rewritten, not promoset/product_type.clockworkgeek
Yes indeed. Removing the rewrite doesn't change anything though... And the product type doesn't need to be rewritten. They need to co-exist.Jeroen
Can you dump for product of your type get_class($product->getTypeInstance())?Dmytro Zavalkin

1 Answers

0
votes

I know you mentioned "grouped product", but the bundled product type allows you to build a "kit" of items, and you can specify a price specifically for the bundle. Is there a reason why you aren't using the bundle product type?

For bundle products, you can configure them in such a way that the customer can choose from a list of available items, or they can be locked in to a certain collection of items that you define.

Updated

Added links to screenshots from comments below (Backend Configuration, Frontend)