Jump to content

Вывод бренда и его картинку в карточке товара


Recommended Posts

Доброй ночи, не как не могу додумать, как взять мне бренд? Вызвать его в products.tpl, ну или для отдельного товара. Вывести бренд, к которому товар относится.
В таблице продукта есть поле brand_id и у бренда есть ид, не как не могу ими воспользоватся. Кто ни будь встречался с этим уже?

Link to post
Share on other sites
  • Replies 55
  • Created
  • Last Reply

Top Posters In This Topic

  • 2 months later...
  • 2 weeks later...

А как вывести в описании товара, в product.tpl изображение категории, где этот товар находиться и чтоб это изображение было ссылкой на эту категорию?
Выручайте =)

Link to post
Share on other sites
  • 4 months later...

 

в api/Products.php

что-то в районе 160-х строк идет запрос в базу, добавляем в него новую строчку

b.image as brandimage,

в product.tpl вызываем так

<img src="{$config->brands_images_dir}{$product->brandimage}" alt="" />

в api добавил, в produkt.tpl не понял куда прописать, 

Link to post
Share on other sites

Ребята, что вы велосипед изобретаете?

А не проще будет так вывести в product.tpl

<img src="{$config->brands_images_dir}{$brand->image}" alt="" />
 

и не надо в API править

Link to post
Share on other sites
 {get_brands var=all_brands}

        

        {if $category->brands}

        <select class="selects" name="brand">

        <img src="{$config->brands_images_dir}{$brand->image}" alt="" />

            <option value="">Производитель</option>

            {foreach name=brands item=b from=$category->brands}

                <option value="{$b->url}"{if $b->id == $brand->id} selected="selected"{/if}>{$b->name|escape}</option>

            {/foreach}

        </select>

        {elseif $all_brands}

        <select class="selects" name="brand">

            <option value="">Производитель</option>

            {foreach $all_brands as $b}

                <option value="{$b->url}"{if $brand->id == $b->id} selected="selected"{/if}>{$b->name}</option>

            {/foreach}

        </select>

        {/if}

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...