简体   繁体   English

在Magento中扩展产品类型

[英]Extending product type in Magento

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. 问题是没有使用应该处理逻辑的模型(从Mage_Catalog_Model_Product_Type_Grouped扩展),但使用了核心模型。

My config.xml configuration: 我的config.xml配置:

<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.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. 我自己的示例是promoset / product / type / promoset.php,另一个是newproducttype / product / type / newproducttype.php。

Anyone who can point out my mistake? 谁能指出我的错误? I'm running on Magento 1.6 我在Magento 1.6上运行

UPDATE: On Magento 1.4 this works like a charm. 更新:在Magento 1.4上,这就像一个魅力。 On Magento 1.5 and up it does not. 在Magento 1.5及更高版本上则不行。 I'm investigating this. 我正在对此进行调查。 If anyone would know why this might be, do tell. 如果有人知道为什么会这样,请告诉。

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 ) 添加了指向下面注释中的屏幕截图的链接( 后端配置前端

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM