Перейти до вмісту
Пошук в
  • Детальніше...
Шукати результати, які ...
Шукати результати в ...

Notice : Undefined index:


Recommended Posts

Доброго дня.

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

В 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
Надіслати
Поділитися на інших сайтах


В 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 2
Надіслати
Поділитися на інших сайтах


Створіть аккаунт або увійдіть для коментування

Ви повинні бути користувачем, щоб залишити коментар

Створити обліковий запис

Зареєструйтеся для отримання облікового запису. Це просто!

Зареєструвати аккаунт

Вхід

Уже зареєстровані? Увійдіть тут.

Вхід зараз
  • Зараз на сторінці   0 користувачів

    • Ні користувачів, які переглядиють цю сторінку

×
×
  • Створити...

Important Information

На нашому сайті використовуються файли cookie і відбувається обробка деяких персональних даних користувачів, щоб поліпшити користувальницький інтерфейс. Щоб дізнатися для чого і які персональні дані ми обробляємо перейдіть за посиланням . Якщо Ви натиснете «Я даю згоду», це означає, що Ви розумієте і приймаєте всі умови, зазначені в цьому Повідомленні про конфіденційність.