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

[Решено] Количество само изменяется на 1000 штук при редактировании товара в админке


Recommended Posts

Здравствуйте! У меня проблема. При редактировании товара в админке после нажатия на кнопку "Сохранить", количество само изменяется на 1000 штук, хотя я количество не менял. Это значение (1000 штук) приходит в функцию productEdit($product_id) в файле /admin/modeles/catalog/product.php .

Как мне исправить эту проблему? Подскажите, пожалуйста! Заранее благодарен за ответы.

Link to comment
Share on other sites


Я сделал следующим образом:

В методе edit контроллера /admin/controllers/catalog/product изменил следующее:

if (isset($this->request->get['filter_quantity'])) {
				
				$url .= '&filter_quantity=' . $this->request->get['filter_quantity'];
			} else {
				$prod = $this->model_catalog_product->getProduct($this->request->get['product_id']);
				$url .= '&filter_quantity=' . $prod['quantity'];
			}

Сейчас в 10-00 приду на работу и проверю работает ли.

Link to comment
Share on other sites


На самом деле это не так решается.

Просто нужно в методе edit контроллера /admin/controllers/catalog/product заменить:

$post = $this->request->post;

        if(!isset($post['quantity']) || !$post['quantity'] || $post['quantity'] == 1000){
            $prod = $this->model_catalog_product->getProduct($this->request->get['product_id']);
            $post['quantity'] = $prod['quantity'];
        }

        $this->model_catalog_product->editProduct($this->request->get['product_id'], $post);
Link to comment
Share on other sites


16 часов назад, TCHProgrammer сказал:

На самом деле это не так решается.

Просто нужно в методе edit контроллера /admin/controllers/catalog/product заменить:

это называется костыль

не нужно ничего заменять, нужно разобраться  почему  в post['quantity']   подставляется 1000

Link to comment
Share on other sites

13 часов назад, fanatic сказал:

это называется костыль

 

это называется идиотизм и полное непонимание процесса

посмотри логику его решения

Link to comment
Share on other sites

На самом деле Вы правы абсолютно. Просто тот сотрудник, который раньше работал над сайтом, обозлился на этого клиента и решил подпортить сайт в некоторых местах. Одно из таких мест - тот вопрос, который я задал. Просто этот человек во вьюхе \admin\view\template\catalog\product_form.tpl стояло раньше вот так:

 

<div class="form-group hidden">
                <label class="col-sm-2 control-label" for="input-quantity"><?php echo $entry_quantity; ?></label>
                <div class="col-sm-10">
                  <input type="text" name="quantity" value="<?php echo '1000'/* $quantity */; ?>" placeholder="<?php echo '1000'/* $entry_quantity */; ?>" id="input-quantity" class="form-control" />
                </div>
              </div>

Я всё это исправил.

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.