1

I am using Magento 1.9.2.1 , I have faced problem on product details page(view.phtml file).

In this not show color attribute dropdown. Only empty dropdown show.

I have set up all setting in admin but not showing color dropdown. I have used another attribute like size than same problem showing.

Please help me this issue.

1 Answer 1

1

I have found solution this- Use this code we can get attribute option.

<?php 
              if ($_product->getData('type_id') == "configurable")
                {
                    //get the configurable data from the product
                    $config = $_product->getTypeInstance(true);
                    //loop through the attributes
                    foreach($config->getConfigurableAttributesAsArray($_product) as $attributes)
                    {
                        ?>
                        <div class="select_number">
                            <label class="required"><em>*</em><?php echo $attributes["label"]; ?></label>
                                <select name="super_attribute[<?php echo $attributes['attribute_id'] ?>]" id="attribute<?php echo $attributes['attribute_id'] ?>">
                                        <?php

                                        foreach($attributes["values"] as $values)
                                        {
                                            echo "<option value=".$values["value_index"].">".$values["label"]."</option>";
                                        }
                                        ?>
                                </select>
                        </div>
                        <?php
                    }
                }
                ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.