D
D
DeniSidorenko2018-06-04 15:43:21
opencart
DeniSidorenko, 2018-06-04 15:43:21

How to display opencart attributes in data for recommended?

Good afternoon, I export goods through the recommended ones. I need to set data-$attribute for them. There are already attributes in opencart, how can I display them as recommended + get them in the format data-attributename='true'

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vasyl Vandych, 2018-06-24
@DeniSidorenko

featured.php
'attribute_groups' => $this->model_catalog_product->getProductAttributes($product_info['product_id']),
and in the template

<?php if($product['attribute_groups']) { ?>
  <div>         
    <table class="table table-bordered table-condensed table-striped">
    <thead>
    </thead>
    <tbody>
     <?php foreach($product['attribute_groups'] as $attribute_group) { ?>
     <?php foreach($attribute_group['attribute'] as $attribute) { ?>
      <tr>
      <td><b><?php echo $attribute['name']; ?></b></td>
      <td><?php echo $attribute['text']; ?></td>
      </tr>
      <?php } ?>
      <?php } ?>
    </tbody>
    </table>
  </div>
  <?php } ?>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question