php $option['label'] 错误 ===
php error with $option['label'] ===
我将这段代码放在 view.phtml 文件中,以检索所有产品页面中具有特定 css 样式的特定值的属性值列表。但是我没有找到 php 个错误。
有人可以帮忙解决或分享任何事情吗?谢谢
<?php $attribute_code = "my_attribute_code" ?>
<?php $attribute_details = Mage::getSingleton("eav/config")->getAttribute("catalog_product", $attribute_code) ?>
<?php $options = $attribute_details->getSource()->getAllOptions(false) ?>
<ul>
<?php foreach($options as $option): ?>
<li>
<?php if ($_product->getResource()->getAttribute('my_attribute_code')->getFrontend()->getValue($_product);?>) === $option['label']): ?>
<p style="font-weight:bold;"><?php echo $option['label']; ?></p>
<?php else: ?>
<p><?php echo $option['label']; ?></p>
<?php endif; ?>
</li>
<?php endforeach; ?>
语法错误:
我从第一个条件语句中删除了这个字符串:;?>)
,一切看起来都很好。
<?php if ($_product->getResource()->getAttribute('my_attribute_code')->getFrontend()->getValue($_product) === $option['label']): ?>
我将这段代码放在 view.phtml 文件中,以检索所有产品页面中具有特定 css 样式的特定值的属性值列表。但是我没有找到 php 个错误。
有人可以帮忙解决或分享任何事情吗?谢谢
<?php $attribute_code = "my_attribute_code" ?>
<?php $attribute_details = Mage::getSingleton("eav/config")->getAttribute("catalog_product", $attribute_code) ?>
<?php $options = $attribute_details->getSource()->getAllOptions(false) ?>
<ul>
<?php foreach($options as $option): ?>
<li>
<?php if ($_product->getResource()->getAttribute('my_attribute_code')->getFrontend()->getValue($_product);?>) === $option['label']): ?>
<p style="font-weight:bold;"><?php echo $option['label']; ?></p>
<?php else: ?>
<p><?php echo $option['label']; ?></p>
<?php endif; ?>
</li>
<?php endforeach; ?>
语法错误:
我从第一个条件语句中删除了这个字符串:;?>)
,一切看起来都很好。
<?php if ($_product->getResource()->getAttribute('my_attribute_code')->getFrontend()->getValue($_product) === $option['label']): ?>