1

Magento で製品を保存中に問題が発生しました。

私は製品を持っていて、複数のストア (複数のグループとビュー) を持っています。

  • サンプルウェブサイト
    • 店舗グループ1
      • 英語
      • フランス語
      • ドイツ人
    • 店舗グループ 2
      • バングラ
      • ヒンディー語

ストア用に商品を編集していて、French保存をクリックしたとします。ただし、新しく保存/入力されたストアの値は、すべてのストア ( 、など)にFrenchコピーされます。EnglishGerman

指定された店舗のみの値を (価格の値であっても) 保存する必要があります。全店舗ではありません。

解決策がプログラムによる方法である場合、私はそれに同意します。

ありがとう

新しく追加された:

節約についても知りたいprice, cost, special price, grouped price, tier price

4

3 に答える 3

1

私はprice, cost, special price, grouped price, tier price節約の問題を自分で解決しました。

Google で検索して、 Store View Pricingという拡張機能を無料で入手しました。これで、問題の 80% が解決しました。店舗ごとに価格を節約する機会を与えるだけです。

ただし、他のフィールド (コスト、特別価格、グループ価格、ティア価格) も価格フィールド/属性のように動作させるには、Scope (is_global: DB の列名) をStore View(0: DB に設定) に変更する必要がありました。 . DBで次のクエリを実行しました:

SELECT ea.attribute_id, ea.entity_type_id, ea.attribute_code, ea.frontend_label, cea.is_global 
FROM `eav_attribute` AS ea 
INNER JOIN `catalog_eav_attribute` AS cea ON ea.attribute_id = cea.attribute_id
WHERE `attribute_code` LIKE  '%price%'
ORDER BY ea.`attribute_id` ASC 

必要な属性が見つかりました。そしてis_global、それらの値を に変更しました0

その後、必要に応じてすべて正常に機能しています。私はこの種の手動プロセスを知っています。私はプログラムによる解決策を得ようとしています。

于 2013-06-21T18:02:31.757 に答える
1

保存する前に、製品を保存するストアの storeId を設定します。製品のロードも同様です。

$product->setStoreId('2')->setName('Name for Store 2')->save();

$product->setStoreId('2')->load(17)->getName()

幸運を!

于 2013-06-18T15:22:48.467 に答える
0

1.5でこの問題が発生しました

app\code\core\Mage\Catalog\Model\Resource\Eav\Mysql4\Abstract.php をオーバーライドします

protected function _insertAttribute($object, $attribute, $value) {
        /**
         * save required attributes in global scope every time if store id different from default
         */
        $storeId = Mage::app()->getStore($object->getStoreId())->getId();
        if ($attribute->getIsRequired() && $this->getDefaultStoreId() != $storeId) {

                $bind = array(
                    'entity_type_id' => $attribute->getEntityTypeId(),
                    'attribute_id' => $attribute->getAttributeId(),
                    'store_id' => $this->getDefaultStoreId(),
                    'entity_id' => $object->getEntityId(),
                    'value' => $this->_prepareValueForSave($value, $attribute)
                );
                $this->_getWriteAdapter()->insertOnDuplicate($attribute->getBackend()->getTable(), $bind, array('value'));
            }

protected function _insertAttribute($object, $attribute, $value) {
        /**
         * save required attributes in global scope every time if store id different from default
         */
        $storeId = Mage::app()->getStore($object->getStoreId())->getId();
        if ($attribute->getIsRequired() && $this->getDefaultStoreId() != $storeId) {

            $table = $attribute->getBackend()->getTable();
            $select = $this->_getReadAdapter()->select()
                    ->from($table)
                    ->where('entity_type_id = ?', $attribute->getEntityTypeId())
                    ->where('attribute_id = ?', $attribute->getAttributeId())
                    ->where('store_id = ?', $this->getDefaultStoreId())
                    ->where('entity_id = ?', $object->getEntityId());
            $row = $this->_getReadAdapter()->fetchOne($select);

            if (!$row) {
                $bind = array(
                    'entity_type_id' => $attribute->getEntityTypeId(),
                    'attribute_id' => $attribute->getAttributeId(),
                    'store_id' => $this->getDefaultStoreId(),
                    'entity_id' => $object->getEntityId(),
                    'value' => $this->_prepareValueForSave($value, $attribute)
                );
                $this->_getWriteAdapter()->insertOnDuplicate($attribute->getBackend()->getTable(), $bind, array('value'));
            }
        }
于 2013-11-18T11:56:35.727 に答える