A
A
Alexey2016-05-03 12:05:46
PHP
Alexey, 2016-05-03 12:05:46

How to change array value in joomshopping features?

Good day.
There is such a loop with an array

<?php if (is_array($this->product->extra_field)){?>
    
            <div class="extra_fields">
            <?php foreach($this->product->extra_field as $extra_field){?>
              
          <?php if ($extra_field['grshow']){?>
            <div class='block_efg'>
            <div class='extra_fields_group'><?php print $extra_field['groupname']?></div>
          <?php }?>
          <?php print_r ($extra_field);?>
          
          <div class="extra_fields_el extra_fields_<?php print $extra_field['id'];?>">
            <span class="extra_fields_name"><i class="ef_<?php print $extra_field['id'];?>"></i><?php print $extra_field['name'];?></span><?php if ($extra_field['description']){?> 
              <span class="extra_fields_description">
                <?php print $extra_field['description'];?>
              </span><?php } ?>:
            <span class="extra_fields_value">
            
              <?php print $extra_field['value'];?>
            </span>
          </div>
                  
          <?php if ($extra_field['grshowclose']){?>
            </div>
          <?php }?>
        
            <?php }?>
            </div>
      
        <?php }?>

As a result of its work, the following data is obtained
Array ( [id] => 11 [name] => CD changer [description] => [value] => Yes [groupname] => Audio equipment [field_value_ids] => Array ( [0] = > 61 ) [grshow] => 1 [grshowclose] => 0 )
You need to transform <?php print $extra_field['value'];?> so that the condition is fulfilled:
1 when [value] is => Have replace_value with
2 when value [value] => No replace_value with
3 otherwise don't replace anything.
How to implement this?
Thanks

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey, 2016-05-03
@AlexSF

I'll answer my own question.
Passing $extra_field['value'] to a variable

<?php foreach($this->product->extra_field as $extra_field){?>				
        <?php $valuess = $extra_field['value'];?>

And we write such a condition
<span class="extra_fields_value">
            
              <?php if ($valuess == 'Есть'){
                $fildval = '<i class="da"></i>';
              } elseif ($valuess == 'Нет'){
                $fildval = '<i class="net"></i>';
              } else {
                $fildval = $valuess;
              }
              
              ?>
              <?php print $fildval;?>
            </span>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question