Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[Выполнено] Сделать сопутствующие товары (related) таблицей


Recommended Posts

Нужно сделать корректный вывод сопутствующих товаров (related) на странице товара таблицей с атрибутами этих товаров.

 

FjfRT1B.png

 

Ума мне хватило только на дописать 

'attribute_groups' => $this->model_catalog_product->getProductAttributes($result['product_id']),

 

в массив 

$this->data['products'][] = array(

 

в контролере карточки товара

 

Вывод в .tpl слепить так и не смог нормальный

 


  <?php if ($products) {  ?>
  <div  class="related">



    <div class="box-product">

        <table id="newspaper-c">
            <thead>
            <tr>
                <td>

                </td>
                <td>
                    Название
                </td>

                <td>
                    Цена
                </td>

                <?php foreach ($products as $product) { ?>
                    <?php foreach ($product['attribute_groups'] as $attribute_group) { ?>
                        <?php foreach ($attribute_group['attribute'] as $attribute) { ?>
                            <td><?php echo $attribute['name']; ?></td>
                        <?php } ?>
                    <?php } ?>
                <?php } ?>


            <?php foreach ($products as $product) { ?>
            <tr>
                <td>
                    <?php if ($product['thumb']) { ?>
                    <div class="image"><a href="<?php echo $product['href']; ?>"><img style="width: 36px; height: 36px;" id="img_<?php echo $product['product_id']; ?>" src="<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?>" /></a></div>
                    <?php } ?>
                </td>
                <td>
                    <div class="name"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></div>
                </td>

                <td>
                    <?php if ($product['price']) { ?>
                    <div class="price" style="padding-bottom: 0px;">
                        <?php if (!$product['special']) { ?>
                        <?php echo $product['price']; ?>
                        <?php } else { ?>
                        <span class="price-new"><?php echo $product['special']; ?></span>
                        <?php } ?>
                        <div class="rating">
                            <?php if ($product['rating']) { ?>
                            <img height="13" src="catalog/view/theme/theme_free/image/stars-<?php echo $product['rating']; ?>.png" alt="<?php echo $product['reviews']; ?>" />
                            <?php } ?>
                        </div>
                    </div>
                    <?php } ?>
                </td>
                <?php foreach ($product['attribute_groups'] as $attribute_group) { ?>
                    <?php foreach ($attribute_group['attribute'] as $attribute) { ?>
                        <td>
                            <?php echo $attribute['text']; ?>
                        </td>
                    <?php } ?>
                <?php } ?>
            </tr>

            <?php } ?>
        </table>
    </div>
  </div>
  <?php } ?> 

 

 

 

связь

ЛС

скайп pasha_qd

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.