Magento - 删除产品类型选项

时间:2013-09-21 18:33:11

标签: magento types product

在Magento产品类型中,我只需要简单的产品和集团产品。当我添加新产品时,如何隐藏它或从产品类型选项中删除它?

非常感谢

4 个答案:

答案 0 :(得分:3)

您需要覆盖Mage_Catalog_Model_Product_Type模型类。

在此调用中有函数static public function getOptionArray()。只需更新此功能。

按照以下说明操作:

在app \ etc \ modules \ Namespace_producttype.xml

下创建新文件
<Namespace_Producttype>
        <active>true</active>
        <codePool>local</codePool>
    </Namespace_Producttype>

在app \ code \ local \ Namespace \ Producttype \ etc \ config.xml

下创建新文件
<?xml version="1.0"?>
<config>
    <modules>
        <Namespace_Producttype>
            <version>1.6.1.1</version>
        </Namespace_Producttype>
    </modules>
    <global>
       <models>
            <catalog>
                <rewrite>
                    <product_type>Namespace_Producttype_Model_Product_Type</product_type>
                </rewrite>
            </catalog>            
       </models>
    </global>       
</config>

要覆盖模型功能的最后一个文件。 应用\代码\本地\命名空间\ Producttype \模型\产品\ Type.php

<<?php
class Namespace_Producttype_Model_Product_Type extends Mage_Catalog_Model_Product_Type
{
    static public function getOptionArray()
    {
        $options = array();
        foreach(self::getTypes() as $typeId=>$type) {

            if($typeId == 'simple' || $typeId == 'grouped'):
                $options[$typeId] = Mage::helper('catalog')->__($type['label']);
            endif;

        }

        return $options;
    }
}
?>   

希望这会有所帮助!

答案 1 :(得分:0)

有两种方法可以解决这个问题 方式1: 登录您的管理员帐户。
在那里搜索选项'Module' 卸载您不需要的模块。
如果您在这里找不到,请搜索“模板”选项。在那里转到“编辑模板”并根据您自己的选择进行编辑。

方式2:转到您的cpanel帐户。 转到“主题/模板”文件夹。
根据您自己的选择编辑模板。

答案 2 :(得分:0)

请勿删除magento中的任何内容,因为您的更新有问题。 最好的解决方案是只使用您需要的选项。

答案 3 :(得分:0)

你应该能够在没有任何“硬”改变的情况下停用一些。

只有 simples, 配置属性, 分组, 虚拟产品是核心magento目录模块的一部分,其余的是 自己的模块可以通过进入完全停用 应用程序的/ etc /模块/ Mage_Bundle.xml 应用程序的/ etc /模块/ Mage_Downloadable.xml

并将“active”从true设置为false。 不要忘记在这些更改后清理缓存

如果您使用的是企业版,则有一个 礼品卡产品类型

其他产品类型: 因为无法删除配置节点或以您需要的方式覆盖它们,最简单的方法是转到/app/code/core/Mage/Catalog/etc/config.xml并注释其他产品类型,如这个,magento的升级怎么可能会恢复这些变化

   <catalog>
        <product>
            <type>
                <simple translate="label" module="catalog">
                    <label>Simple Product</label>
                    <model>catalog/product_type_simple</model>
                    <composite>0</composite>
                    <index_priority>10</index_priority>
                </simple>
                <grouped translate="label" module="catalog">
                    <label>Grouped Product</label>
                    <model>catalog/product_type_grouped</model>
                    <price_model>catalog/product_type_grouped_price</price_model>
                    <composite>1</composite>
                    <allow_product_types>
                        <simple/>
                        <virtual/>
                    </allow_product_types>
                    <index_priority>50</index_priority>
                    <price_indexer>catalog/product_indexer_price_grouped</price_indexer>
                </grouped>
                <!-- 
                <configurable translate="label" module="catalog">
                    <label>Configurable Product</label>
                    <model>catalog/product_type_configurable</model>
                    <price_model>catalog/product_type_configurable_price</price_model>
                    <composite>1</composite>
                    <allow_product_types>
                        <simple/>
                        <virtual/>
                    </allow_product_types>
                    <index_priority>30</index_priority>
                    <price_indexer>catalog/product_indexer_price_configurable</price_indexer>
                </configurable>
                <virtual translate="label" module="catalog">
                    <label>Virtual Product</label>
                    <model>catalog/product_type_virtual</model>
                    <composite>0</composite>
                    <index_priority>20</index_priority>
                </virtual>
                -->
            </type>