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

Поиск заказа по товару в списке заказов


Recommended Posts

Здравствуйте. Помогите разобраться с модификатором. Пытаюсь адаптировать его с 2.3 на 3х. Само поле появилось в фильтре заказов но не фильтрует, обновляется страница и все. Делаю все на чистом OcStore где нету вообще ничего кроме то что с коробки.

Спасибо.

 

Скрытый текст
<?xml version="1.0" encoding="UTF-8"?>
<modification>
   <name>Filter Name</name>
   <code>filter_wfm</code>
   <version>1.0</version>
   <author></author>
   <link />
   <file path="admin/view/template/sale/order_list.twig">
      <operation>
         <search index="0"><![CDATA[<div class="form-group">]]></search>
         <add position="before"><![CDATA[<div class="form-group">
                <label class="control-label" for="input-filter-name">Наименование товара</label>
                <input type="text" name="filter_name" value="{{ filter_name }}" placeholder="Наименование товара" id="input-filter-name" class="form-control" />
            </div>]]></add>
      </operation>
      <operation>
         <search><![CDATA[var filter_order_id = $('input[name=\'filter_order_id\']').val();]]></search>
         <add position="after"><![CDATA[var filter_name = $('input[name=\'filter_name\']').val();
if (filter_name) {
    url += '&filter_name=' + encodeURIComponent(filter_name);
}]]></add>
      </operation>
   </file>
   <file path="admin/controller/sale/order.php">
      <operation>
         <search><![CDATA[protected function getList() {]]></search>
         <add position="after"><![CDATA[if (isset($this->request->get['filter_name'])) {
    $filter_name = $this->request->get['filter_name'];
} else {
    $filter_name = null;
}]]></add>
      </operation>
      <operation>
         <search><![CDATA['filter_order_id'      => $filter_order_id,]]></search>
         <add position="before"><![CDATA['filter_name'          => $filter_name,]]></add>
      </operation>
      <operation>
         <search index="3"><![CDATA[$url = '';]]></search>
         <add position="after"><![CDATA[if (isset($this->request->get['filter_name'])) {
    $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
}]]></add>
      </operation>
      <operation>
         <search><![CDATA[$data['filter_order_id'] = $filter_order_id;]]></search>
         <add position="before"><![CDATA[$data['filter_name'] = $filter_name;]]></add>
      </operation>
   </file>
   <file path="admin/model/sale/order.php">
      <operation>
         <search index="0"><![CDATA[if (!empty($data['filter_order_id'])) {]]></search>
         <add position="before"><![CDATA[if (!empty($data['filter_name'])) {
            $sql .= " AND o.order_id IN (SELECT " . DB_PREFIX . "order_product.order_id FROM " . DB_PREFIX . "order_product WHERE " . DB_PREFIX . "order_product.name LIKE '%" . $this->db->escape($data['filter_name']) . "%')";
        }]]></add>
      </operation>
      <operation>
         <search index="1"><![CDATA[if (!empty($data['filter_order_id'])) {]]></search>
         <add position="before"><![CDATA[if (!empty($data['filter_name'])) {
            $sql .= " AND order_id IN (SELECT " . DB_PREFIX . "order_product.order_id FROM " . DB_PREFIX . "order_product WHERE " . DB_PREFIX . "order_product.name LIKE '%" . $this->db->escape($data['filter_name']) . "%')";
        }]]></add>
      </operation>
   </file>
</modification>

 

 

Edited by Malhaz
Link to comment
Share on other sites


17.03.2023 в 14:24, spectre сказал:

Проверьте каждую операцию в модификаторе

Проверил уже 100раз, не могу понять в чем причина, именно по этому написал пост

Link to comment
Share on other sites


Скрытый текст
<?xml version="1.0" encoding="UTF-8"?>
<modification>
   <name>Filter Name</name>
   <code>Filter Name</code>
   <version>1.0</version>
   <author>Filter Name</author>
   <link>Filter Name</link>
   <file path="admin/view/template/sale/order_list.twig">
      <operation>
         <search index="0"><![CDATA[<div class="form-group">]]></search>
         <add position="before"><![CDATA[<div class="form-group">
                <label class="control-label" for="input-filter-name">Наименование товара</label>
                <input type="text" name="filter_name" value="{{ filter_name }}" placeholder="Наименование товара" id="input-filter-name" class="form-control" />
            </div>]]></add>
      </operation>
      <operation>
         <search><![CDATA[var filter_order_id = $('input[name=\'filter_order_id\']').val();]]></search>
         <add position="after"><![CDATA[var filter_name = $('input[name=\'filter_name\']').val();
if (filter_name) {
    url += '&filter_name=' + encodeURIComponent(filter_name);
}]]></add>
      </operation>
   </file>
   <file path="admin/controller/sale/order.php">
      <operation>
         <search><![CDATA[protected function getList() {]]></search>
         <add position="after"><![CDATA[if (isset($this->request->get['filter_name'])) {
    $filter_name = $this->request->get['filter_name'];
} else {
    $filter_name = null;
}]]></add>
      </operation>
      <operation>
         <search index="0"><![CDATA[$filter_data = array(]]></search>
         <add position="after"><![CDATA['filter_name'          => $filter_name,]]></add>
      </operation>
      <operation>
         <search index="3"><![CDATA[$url = '';]]></search>
         <add position="after"><![CDATA[if (isset($this->request->get['filter_name'])) {
    $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
}]]></add>
      </operation>
      <operation>
         <search><![CDATA[$data['filter_order_id'] = $filter_order_id;]]></search>
         <add position="before"><![CDATA[$data['filter_name'] = $filter_name;]]></add>
      </operation>
   </file>
   <file path="admin/model/sale/order.php">
      <operation>
         <search index="0"><![CDATA[if (!empty($data['filter_order_id'])) {]]></search>
         <add position="before"><![CDATA[if (!empty($data['filter_name'])) {
            $sql .= " AND o.order_id IN (SELECT " . DB_PREFIX . "order_product.order_id FROM " . DB_PREFIX . "order_product WHERE " . DB_PREFIX . "order_product.name LIKE '%" . $this->db->escape($data['filter_name']) . "%')";
        }]]></add>
      </operation>
      <operation>
         <search index="1"><![CDATA[if (!empty($data['filter_order_id'])) {]]></search>
         <add position="before"><![CDATA[if (!empty($data['filter_name'])) {
            $sql .= " AND order_id IN (SELECT " . DB_PREFIX . "order_product.order_id FROM " . DB_PREFIX . "order_product WHERE " . DB_PREFIX . "order_product.name LIKE '%" . $this->db->escape($data['filter_name']) . "%')";
        }]]></add>
      </operation>
   </file>
</modification>

 

 

  • +1 1
Link to comment
Share on other sites

17.03.2023 в 14:52, Tom сказал:
<?xml version="1.0" encoding="UTF-8"?>
<modification>
   <name>Filter Name</name>
   <code>Filter Name</code>
   <version>1.0</version>
   <author>Filter Name</author>
   <link>Filter Name</link>
   <file path="admin/view/template/sale/order_list.twig">
      <operation>
         <search index="0"><![CDATA[<div class="form-group">]]></search>
         <add position="before"><![CDATA[<div class="form-group">
                <label class="control-label" for="input-filter-name">Наименование товара</label>
                <input type="text" name="filter_name" value="{{ filter_name }}" placeholder="Наименование товара" id="input-filter-name" class="form-control" />
            </div>]]></add>
      </operation>
      <operation>
         <search><![CDATA[var filter_order_id = $('input[name=\'filter_order_id\']').val();]]></search>
         <add position="after"><![CDATA[var filter_name = $('input[name=\'filter_name\']').val();
if (filter_name) {
    url += '&filter_name=' + encodeURIComponent(filter_name);
}]]></add>
      </operation>
   </file>
   <file path="admin/controller/sale/order.php">
      <operation>
         <search><![CDATA[protected function getList() {]]></search>
         <add position="after"><![CDATA[if (isset($this->request->get['filter_name'])) {
    $filter_name = $this->request->get['filter_name'];
} else {
    $filter_name = null;
}]]></add>
      </operation>
      <operation>
         <search><![CDATA['filter_order_id'        => $filter_order_id,]]></search>
         <add position="before"><![CDATA['filter_name'          => $filter_name,]]></add>
      </operation>
      <operation>
         <search index="3"><![CDATA[$url = '';]]></search>
         <add position="after"><![CDATA[if (isset($this->request->get['filter_name'])) {
    $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
}]]></add>
      </operation>
      <operation>
         <search><![CDATA[$data['filter_order_id'] = $filter_order_id;]]></search>
         <add position="before"><![CDATA[$data['filter_name'] = $filter_name;]]></add>
      </operation>
   </file>
   <file path="admin/model/sale/order.php">
      <operation>
         <search index="0"><![CDATA[if (!empty($data['filter_order_id'])) {]]></search>
         <add position="before"><![CDATA[if (!empty($data['filter_name'])) {
            $sql .= " AND o.order_id IN (SELECT " . DB_PREFIX . "order_product.order_id FROM " . DB_PREFIX . "order_product WHERE " . DB_PREFIX . "order_product.name LIKE '%" . $this->db->escape($data['filter_name']) . "%')";
        }]]></add>
      </operation>
      <operation>
         <search index="1"><![CDATA[if (!empty($data['filter_order_id'])) {]]></search>
         <add position="before"><![CDATA[if (!empty($data['filter_name'])) {
            $sql .= " AND order_id IN (SELECT " . DB_PREFIX . "order_product.order_id FROM " . DB_PREFIX . "order_product WHERE " . DB_PREFIX . "order_product.name LIKE '%" . $this->db->escape($data['filter_name']) . "%')";
        }]]></add>
      </operation>
   </file>
</modification>

 

 

Капец, даже представить не смог что и за 2 пробела такое. Спасибо Том!
П.С. Кому нужно берите, модификатор рабочий.

  • +1 1
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.