助けてください...誰か
いくつかの構成可能な属性を非表示にすることに問題があります。
これらは、バックエンドで構成可能な属性です。
- 形状・種類
- グリット&カラー
- シャンク
- アイテムパック
- 直径
- サプライヤー
私のクライアントは、フロントエンドで「メーカー」属性を非表示にしたいのですが、バックエンドでサプライヤーをインポートしたいと考えています。
私が働いているウェブサイトを見てください:
http://ridental.com.au/newsite/polishers.html/
次のようなifステートメントをいくつか追加するだけで、フロントエンドからそれを隠すことができました:app\design\frontend\default\MYTEMPLATE\template\catalog\product\view\type\options\configurable.phtml
<?php
$_product = $this->getProduct();
$_attributes = Mage::helper('core')->decorateArray($this->getAllowAttributes());
?>
<?php if ($_product->isSaleable() && count($_attributes)):?>
<dl class="outer">
<dl class="inner">
<?php foreach($_attributes as $_attribute): ?>
<?php $attCode = $_attribute->getProductAttribute()->getFrontend()->getAttribute()->getAttributeCode(); ?>
<?php if($attCode != "manufacturer"):?>
<div class="dtdd-wrapper<?php if ($_attribute->decoratedIsLast){echo " last";}?>">
<dt><label class="required"><em>*</em><?php echo $_attribute->getLabel() ?></label></dt>
<dd<?php if ($_attribute->decoratedIsLast){?> class="last"<?php }?>>
<div class="input-box">
<select name="super_attribute[<?php echo $_attribute->getAttributeId() ?>]" id="attribute<?php echo $_attribute->getAttributeId() ?>" class="required-entry super-attribute-select">
<option><?php echo $this->__('Choose an Option...') ?></option>
</select>
</div>
</dd>
</div>
<?php endif; ?>
<?php endforeach; ?>
</dl>
</dl>
<script type="text/javascript">
[b]var spConfig = new Product.Config(<?php echo $this->getJsonConfig() ?>);[/b]
</script>
メーカーはフロントエンドに表示されません。
しかし、[カートに追加] ボタンをクリックすると、次のエラーが表示されました。
製品のオプションを指定してください。
私はそれに気づきました:
var spConfig = new Product.Config(<?php echo $this->getJsonConfig()
まだ属性「サプライヤー」を参照しており、ユーザーの応答がドロップダウンでメーカーを選択するのを待っています。
そのため、次のエラーが表示されます: 製品のオプションを指定してください。
私の質問:
関数をフィルタリングすることは可能getJsonConfig()
ですか? 以下を含めないようにしましょう:
if ($attributecode != 'manufacturer'){ do some stuff..... }
この関数のローカル バージョンをコピーしたところ、次の場所にあります。app\code\local\Mage\Catalog\Block\Product\View\Type\Configurable.php
助けてください...誰かがこの種の問題を達成した場合。getJsonConfig()
「サプライヤー」などの属性をフィルタリングするように拡張しようとしましたが、役に立ちませんでした。
私は正しいことをしていますか?