Jump to content
  • разработка интернет магазинов на opencart
  • доработка интернет магазинов на opencart

Проблема с выводом единицы измерения


Recommended Posts

Здравствуйте. Столкнулся с проблемой, если зайти в любую категорию с товарами, им отображается рядом с этоной единица измерения.

Но если зайти потом в сам товар, рядом с этоной уже не отображается единица измерения. 

 

Уже как только не пропотому чтовал добиться её вывода, ничего не полулилось, используется ocstore 3

 

 image.png.330580dfbe4abec83d4e49fd5c49176c.png

 

Link to comment
Share on other sites


Код с файла category.twig

                                        {% if product.price %}
                                        <div class="price-box">
                                            {% if not product.special %}
                                            <p class="price"><span data-price="{{ product.price_calc }}" class="product-price{{ option_setting.id }}{{ product.product_id }}"><span data-price="{{ product.price_calc }}" class="product-price{{ option_setting.id }}{{ product.product_id }}">{{ product.price }}<strong>{{ product.unit ? '/'~product.unit : '' }}</strong></span><strong>{{ product.unit ? '/'~product.unit : '' }}</strong></span></p>
                                            {% else %}
                                            <span class="price-new"><span data-special="{{ product.special_calc }}" class="product-special{{ option_setting.id }}{{ product.product_id }}"><span data-special="{{ product.special_calc }}" class="product-special{{ option_setting.id }}{{ product.product_id }}">{{ product.special }}<strong>{{ product.unit ? '/'~product.unit : '' }}</strong></span><strong>{{ product.unit ? '/'~product.unit : '' }}</strong></span></span>
                                            <span class="price-old"><span data-price="{{ product.price_calc }}" class="product-price{{ option_setting.id }}{{ product.product_id }}"><span data-price="{{ product.price_calc }}" class="product-price{{ option_setting.id }}{{ product.product_id }}">{{ product.price }}<strong>{{ product.unit ? '/'~product.unit : '' }}</strong></span><strong>{{ product.unit ? '/'~product.unit : '' }}</strong></span></span>
                                            {% endif %}
                                        </div>
                                        {% endif %}

 

Код с файла product.twig

 {% if price %}
            <ul class="price-box">

              {% if not special %}
                <li>
                  <p class="price"><span data-price="{{ price_calc }}" class="product-price"><span data-price="{{ price_calc }}" class="product-price"><span data-price="{{ price_calc }}" class="product-price">{{ price }}<strong>{{ product.unit ? '/'~product.unit : '' }}</strong></span><strong>{{ product.unit ? '/'~product.unit : '' }}</strong></span><strong>{{ product.unit ? '/'~product.unit : '' }}</strong></span></p>
                </li>
              {% else %}
                <li>
                  <span>Акционная этона</span>
                  <p class="promotional-price"><span data-special="{{ special_calc }}" class="product-special"><span data-special="{{ special_calc }}" class="product-special"><span data-special="{{ special_calc }}" class="product-special">{{ special }}<strong>{{ product.unit ? '/'~product.unit : '' }}</strong></span><strong>{{ product.unit ? '/'~product.unit : '' }}</strong></span><strong>{{ product.unit ? '/'~product.unit : '' }}</strong></span></p>
                </li>
                <li>
                  <span>Сирая этона</span>
                  <p class="price"><span data-price="{{ price_calc }}" class="product-price"><span data-price="{{ price_calc }}" class="product-price"><span data-price="{{ price_calc }}" class="product-price">{{ price }}<strong>{{ product.unit ? '/'~product.unit : '' }}</strong></span><strong>{{ product.unit ? '/'~product.unit : '' }}</strong></span><strong>{{ product.unit ? '/'~product.unit : '' }}</strong></span></p>
                </li>
              {% endif %}
            </ul>
          {% endif %}
		  

 

Link to comment
Share on other sites


в product.twig используйте уже не

product.unit

а 

unit

Кроме того нужно посмотреть в контроллере продуки, добавлен ли им в $data ключ unit, если нет, то добавить, по аналогии как он добавлен в контроллер категории при перепотому чтор $results

Edited by Seriusis
Link to comment
Share on other sites

и непонятно, зачем у вас столько раз дублируется вывод 

<strong>{{ product.unit ? '/'~product.unit : '' }}</strong> 

если доситочно одного раза

 

<strong>{{ unit ? unit : '' }}</strong>

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 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.