Usar atributos de productos
Guía para usar atributos (tallas - colores, etc) de productos
Uso de atributos
Paso 1
Obtener atributos de producto (en /inc/catalog/product.php)
<?php while($_attribute->getNext()): ?>
<label>
<?=$_attribute->get('name')?>
<select name="attributes[<?=$_attribute->get('id')?>]" class="attribute" data-id="<?=$_attribute->get('id')?>">
<?php foreach($_product->getAvailableAttributeValues($_attribute->get('id')) as $value): ?>
<option value="<?=$value?>"><?=$value?></option>
<?php endforeach; ?>
</select>
</label>
<?php endwhile; ?><?php while($_attribute->getNext()): ?>
<label>
<?=$_attribute->get('name')?>
<select name="attributes[<?=$_attribute->get('id')?>]" class="attribute" data-id="<?=$_attribute->get('id')?>">
<?php foreach($_product->getAvailableAttributeValuesWithColors($_attribute->get('id')) as $data): ?>
<option value="<?=$data['value']?>"><?=$data['value']?> (Color: <?=$data['color']?>)</option>
<?php endforeach; ?>
</select>
</label>
<?php endwhile; ?>Paso 2
Obtener ID de versión
Paso 3
Enviar ID versión a métodos de $_product
Last updated
Was this helpful?