Au lieu de la valeur d'attribute, son affichage de la matrice d'identifiants dans la page de vue
-
28-09-2020 - |
Question
S'il vous plaît visitez lien
Utiliser
Il est
Y a-t-il quelque chose qui manque dans la base de données, car elle n'affiche pas la valeur présente dans le backend.
app/design/frontend/default/em0113/template/catalog/product/view/Attributes.phtml
<?php
$_helper = $this->helper('catalog/output');
$_product = $this->getProduct();
?>
<?php if($_additional = $this->getAdditionalData()): ?>
<div class="fp1"><?php $Pro_name = $_product->getName();?>
<h2><?php echo $this->__('Specifications Of '."$Pro_name") ?></h2><br/><br/>
<table class="data-table" id="product-attribute-specs-table">
<col width="25%" />
<col />
<tbody>
<?php foreach ($_additional as $_data): ?>
<?php $_attribute = $_product->getResource()->getAttribute($_data['code']);
/* hide abc */
if($_attribute->getFrontend()->getValue($_product) == 'no') {
continue;
}
/* hide no abd*/
if (!is_null($_product->getData($_attribute->getAttributeCode())) && (trim((string)$_attribute->getFrontend()->getValue($_product)) != ''))
{
if ($_data['code'] == 'gendernew'):
?>
<tr><th colspan="3"><?php echo $this->__('') ?></th></tr>
<th class = "tablehead" colspan="3" > GENERAL </th>
<?php elseif ($_data['code'] == 'productweight'): ?>
<tr><th class = "tablehead" id="prod_dim" colspan="3"><p style="background: rgb(255, 255, 255) none repeat scroll 0% 0% ! important; color: rgb(255, 255, 255); width: 100%; padding-top: 10px; padding-right: 10px; padding-left: 10px; padding-bottom: 0px ! important;" class="Product_dim">Product Dimension</p><?php echo $this->__('PRODUCT DIMENSION') ?></th></tr>
<?php endif; ?>
<tr>
<th class="label"><?php echo $this->escapeHtml($this->__($_data['label'])) ?></th>
<?php
if (/*stripos($_data['code'],',') === true &&*/ $_data['code'] == 'age')
{ ?>
<td class="data">
<?php
$_ageValues = $_product->getAttributeText($_data['code']);
$count = 1;
?>
<?php if(is_array($_ageValues)): foreach($_ageValues as $_ageValue): ?>
<?php if($count > 1) { echo ","; } ?>
<?php echo $_ageValue; ?>
<?php $count++; ?>
<?php endforeach;
else: echo $_product->getAttributeText($_data['code']);
endif; ?>
</td>
<?php } else { ?>
<td class="data"><?php echo $_helper->productAttribute($_product, $_product->getData($_data['code']), $_data['code']); ?></td>
<?php
}
?>
</tr>
<!-- mobile -->
<tr>
<?php echo $_product->getResource()->getAttribute('mobile_design')->getFrontend()->getValue($_product); ?>
</tr>
<!-- mobile -->
<?php
}
?>
<?php endforeach; ?>
</tbody>
</table>
</div>
<script type="text/javascript">decorateTable('product-attribute-specs-table')</script>
<?php endif;?>
La solution
Essayez ceci:
<?php
if($_product->getMobileDesign()) {
foreach($_product->getAttributeText('mobile_design') as $type) {
echo $type;
}
}
?>
ou
<?php
if($_product->getMobileDesign()) {
$mobileDesigns = explode(",",$_product->getResource()->getAttribute('mobile_design')->getFrontend()
->getValue($_product));
foreach($mobileDesigns as $key => $value){
echo $value;
}
}
?>
Licencié sous: CC-BY-SA avec attribution
Non affilié à magento.stackexchange