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

Добавление формы в Админку каталога над списком товаров


BAM
 Share

Recommended Posts

Добрый день.

Есть задача, в Админке, в разделе Товары, в верхней части, слева от кнопки "добавить товар" (обозначена как +),  разместить форму (поле input и кнопку выполнить), по нажатию на которую запустится функция MyFunc(), которая увеличит или уменьшит цену каждого товара на указанную в поле input величину;

image.png.36b48e9d77a12994c2c936d57f0a0396.png

Что удалось сделать:

в /admin/model/catalog/product.php прописал тело функции MyFunc();

 

в /admin/controller/catalog/product.php прописал тело контроллера (могу ошибаться в терминологии) runMyFunc(); в которой идет вызов

$this->model_catalog_product->MyFunc($this->request->post);

 

в /admin/view/template/catalog/edit_product_list.tpl прописал форму 

<INPUT TYPE="number" style="width:70px;" data-toggle="tooltip" ID="myVal" value="20"><-<input formaction="<?php echo $runMyFunc;?>" type="button" form="form-product" data-toggle="tooltip" class="btn btn-primary" value="Выполнить">
        

в итоге форма отображается, но ошибка в том что  $runMyFunc не определена, соответственно вызов MyFunc() не происходит.

 

Подскажите, что делаю не так и куда смотреть?

Версия ocStore 2.3

Edited by BAM
Link to comment
Share on other sites


29 минут назад, BAM сказал:

Добрый день.

Есть задача, в Админке, в разделе Товары, в верхней части, слева от кнопки "добавить товар" (обозначена как +),  разместить форму (поле input и кнопку выполнить), по нажатию на которую запустится функция MyFunc(), которая увеличит или уменьшит цену каждого товара на указанную в поле input величину;

image.png.36b48e9d77a12994c2c936d57f0a0396.png

Что удалось сделать:

в /admin/model/catalog/product.php прописал тело функции MyFunc();

 

в /admin/controller/catalog/product.php прописал тело контроллера (могу ошибаться в терминологии) runMyFunc(); в которой идет вызов

$this->model_catalog_product->MyFunc($this->request->post);

 

в /admin/view/template/catalog/edit_product_list.tpl прописал форму 

<INPUT TYPE="number" style="width:70px;" data-toggle="tooltip" ID="myVal" value="20"><-<input formaction="<?php echo $runMyFunc;?>" type="button" form="form-product" data-toggle="tooltip" class="btn btn-primary" value="Выполнить">
        

в итоге форма отображается, но ошибка в том что  $runMyFunc не определена, соответственно вызов MyFunc() не происходит.

 

Подскажите, что делаю не так и куда смотреть?

Версия ocStore 2.3

в /admin/controller/catalog/product.php - $data['runMyFunc'] = ????? чему равно? Ответ на : "$runMyFunc не определена"

Link to comment
Share on other sites

public function runMyFunc() {
      $this->load->language('catalog/product');
      $this->load->model('catalog/product');
     $data['runMyFunc'] = $this->url->link('common/product', 'token=' . $this->session->data['token'], true);
       if (($this->request->server['REQUEST_METHOD'] == 'POST')) {
            $this->model_catalog_product->MyFunc($this->request->post);
    }
  }

Link to comment
Share on other sites


1 час назад, BAM сказал:

public function runMyFunc() {
      $this->load->language('catalog/product');
      $this->load->model('catalog/product');
     $data['runMyFunc'] = $this->url->link('common/product', 'token=' . $this->session->data['token'], true);
       if (($this->request->server['REQUEST_METHOD'] == 'POST')) {
            $this->model_catalog_product->MyFunc($this->request->post);
    }
  }

 

при этом пробовал прописать    $data['runMyFunc'] = $this->url->link('common/product', 'token=' . $this->session->data['token'], true);

в public function index(){ ... } , результат без изменений

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

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.