Magento 製品タイプでは、シンプル製品とグループ製品のみが必要です。新しい製品を追加するときに、製品タイプのオプションから非表示にしたり、削除したりするにはどうすればよいですか?
どうもありがとう
Mage_Catalog_Model_Product_Type
Model クラスをオーバーライドする必要があります。
この呼び出しには function があります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>
モデル関数をオーバーライドする最後のファイル。app\code\local\Namespace\Producttype\Model\Product\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;
}
}
?>
これが役立つことを願っています!
この問題を解決するには 2 つの方法があります。
方法 1: 管理者アカウントにログインします。
そこでオプション「モジュール」を検索します。
不要なモジュールをアンインストールします。
ここで見つからない場合は、「テンプレート」オプションを検索してください。その中で「テンプレートの編集」に移動し、独自の選択に従って編集します。
方法 2: cpanel アカウントに移動します。「テーマ/テンプレート」フォルダーに移動します。
独自の選択に従ってテンプレートを編集します。
更新に問題があるため、magento から何も削除しないでください。最善の解決策は、必要なオプションのみを使用することです。
「ハードな」変更なしで、いくつかを非アクティブ化できるはずです。
シンプル、構成可能、グループ化された、仮想製品のみがコア Magento カタログ モジュールの一部であり、残りは独自のモジュールであり、app/etc/modules/Mage_Bundle.xml app/etc/modules/Mage_Downloadable.xml に移動することで完全に非アクティブ化できます。
「アクティブ」を 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>