Перейти к публикации
  • разработка интернет магазинов на opencart
  • доработка интернет магазинов на opencart

Notice : Undefined index:


 Поделиться

Рекомендованные сообщения

Доброго дня.

Хочу вивести на сайт ще одну ціну. Розумію, що можна через знижки чи акції... але хочу саме так.

В oc_product добавив 'price_m_opt'

Далі зробив:

 <file path="admin/view/template/catalog/product_form.twig">
    <operation>
      <search><![CDATA[<label class="col-sm-2 control-label" for="input-price">{{ entry_price }}</label>]]></search>
      <add position="before" offset="1"><![CDATA[<div class="form-group">
                <label class="col-sm-2 control-label" for="input-price">{{ entry_price }}</label>
                <div class="col-sm-10">
                  <input type="text" name="price" value="{{ price_m_opt }}" placeholder="{{ entry_price_m_opt }}" id="input-price" class="form-control"/>
                </div>
              </div>
              ]]></add>
    </operation>
  </file>
  <file path="admin/controller/catalog/product.php">
    <operation>
      <search><![CDATA[$this->currency->format($result['price'], $this->config->get('config_currency')),]]></search>
      <add position="after"><![CDATA['price_m_opt'      => $this->currency->format($result['price_m_opt'], $this->config->get('config_currency')),
				]]></add>
    </operation>
    <operation>
      <search><![CDATA[if (isset($this->request->post['price'])) {]]></search>
      <add position="before"><![CDATA[if (isset($this->request->post['price_m_opt'])) {
			$data['price_m_opt'] = $this->request->post['price_m_opt'];
		} elseif (!empty($product_info)) {
			$data['price_m_opt'] = $product_info['price_m_opt'];
		} else {
			$data['price_m_opt'] = '';
		}
		]]></add>
    </operation>
  </file>
  <file path="catalog/controller/product/category.php">
    <operation>
      <search><![CDATA[if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) {]]></search>
      <add position="before"><![CDATA[
        if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) {
          $price_m_opt = $this->currency->format($this->tax->calculate($result['price_m_opt'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']);
        } else {
          $price_m_opt = false;
        }]]></add>
    </operation>
    <operation>
      <search><![CDATA[=> $price,]]></search>
      <add position="before"><![CDATA['price_m_opt'       => $price_m_opt,]]></add>
    </operation>
  </file>
  <file path="catalog/view/theme/oct_remarket/template/product/category.twig">
    <operation>
      <search><![CDATA[<span class="rm-module-price">{{ product.price }}</span>]]></search>
      <add position="before"><![CDATA[<span class="rm-module-price">{{ product.price_m_opt }}</span>]]></add>
    </operation>
  </file>

В адмінці працює

Отримую Notice: Undefined index: price_m_opt in /storage/modification/catalog/controller/product/category.php

 

Я розумію, що багато не розумію...

Стукніть мене, будь ласка... тільки не сильно :)

Спасибі.

Изменено пользователем NoName_13
Ссылка на комментарий
Поделиться на других сайтах


смотреть в модель

catalog\model\catalog\product.php
метод getProduct

  • +1 1
Ссылка на комментарий
Поделиться на других сайтах

В 06.12.2022 в 14:02, chukcha сказав:

смотреть в модель

catalog\model\catalog\product.php
метод getProduct

Спасибі.

Залишу тут, для наступних поколінь.

<file path="catalog/model/catalog/product.php">
    <operation>
      <search><![CDATA[=> ($query->row['discount'] ? $query->row['discount'] : $query->row['price']),]]></search>
      <add position="after"><![CDATA['price_m_opt'            => ($query->row['discount'] ? $query->row['discount'] : $query->row['price_m_opt']),]]></add>
    </operation>
  </file>

Ціни виводяться.

  • +1 1
Ссылка на комментарий
Поделиться на других сайтах


Создайте аккаунт или войдите в него для комментирования

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

Создать аккаунт

Зарегистрируйтесь для получения аккаунта. Это просто!

Зарегистрировать аккаунт

Войти

Уже зарегистрированы? Войдите здесь.

Войти сейчас
 Поделиться

×
×
  • Создать...

Важная информация

На нашем сайте используются файлы cookie и происходит обработка некоторых персональных данных пользователей, чтобы улучшить пользовательский интерфейс. Чтобы узнать для чего и какие персональные данные мы обрабатываем перейдите по ссылке. Если Вы нажмете «Я даю согласие», это означает, что Вы понимаете и принимаете все условия, указанные в этом Уведомлении о Конфиденциальности.