Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8554315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:51:15+00:00 2026-06-11T14:51:15+00:00

I have created a multi option attribute so that I show an image for

  • 0

I have created a multi option attribute so that I show an image for each option but i can not get it to work.

I have used this code from another post on here to get a list of the options to show.

The code I used is:

<?php if($_product->getResource()->getAttribute('suitable_for')->getFrontend()->getValue($_product)): ?>
        <h4>Suitable for:</h4>
        <ul><li><?php
            $_comma = ",";
            $_list = "</li><li>";
            echo str_replace($_comma,$_list,$_product->getResource()->getAttribute('suitable_for')->getFrontend()->getValue($_product))    ?>    
        </li></ul>
        <?php endif; ?>

So this now shows a list of the options, one of on top of each other.

As I said I would like an image to be shown for each option.

I thought the best way would be to have divs and assign an image to each div.

I was hoping that I could get the output to be:

<div class="option1"></div>
<div class="option2"></div>
<div class="option3"></div>
<div class="option3"></div>

instead of the output that the code above has:

<ul>
    <li>option1</li>
    <li>option2</li>
    <li>option3</li>
    <li>option4</li>
</ul>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T14:51:16+00:00Added an answer on June 11, 2026 at 2:51 pm

    Change your code to

    <?php if($_product->getResource()->getAttribute('suitable_for')->getFrontend()->getValue($_product)): ?>
        <h4>Suitable for:</h4>
        <div class="<?php
            $_comma = ",";
            $_list = "\"></div><div class=\"";
            echo str_replace($_comma,$_list,$_product->getResource()->getAttribute('suitable_for')->getFrontend()->getValue($_product))    ?>    
        </div>
        <?php endif; ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a multi-step form (a wizard) that I created using this railscast: http://railscasts.com/episodes/217-multistep-forms
I have created a multi-instance performance counter and I pass it mixed case instance
I have created an multi thread application on IIS (ASP.NET MVC), When the threading
I have created a multi module maven project. Now I have shared the project
I have a multi dimensional array, like this: array('name' => array('title'=>'Title','date'=>'Created')) I store it
I have created some JQuery that will expand a div 'popup' on hover and
I have created a simple list of images that are to be reloaded every
I'm working on a multi-user, multi-account App where 1 account can have n users.
I have a requirement to create a multi level treeview in ASP.Net (with VB)
I am using soapUI maven plugin to create a multi-module maven-soapUi project. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.