Jump to content
Sign in to follow this  
Bandicoot

Проблема с полем "Модель".

Recommended Posts

Доброе время суток, уважаемые форумчане.

Впервые столкнулся с работой OpenCart, и соответственно, куда же без проблем.

 

Итак, проблема вот в чем. По продаваемому товару поле "Модель" мне абсолютно не нужно, и я решил его удалить. Нашел в поиске вот такую вот полезную статью, по которой, в принципе, и действовал: https://opencartforum.com/topic/572-%D1%80%D0%B5%D1%88%D0%B5%D0%BD%D0%BE-%D1%83%D0%B1%D1%80%D0%B0%D1%82%D1%8C-%D0%BF%D0%BE%D0%BB%D0%B5-%D0%BC%D0%BE%D0%B4%D0%B5%D0%BB%D1%8C/

 

Получалось всё вроде-бы неплохо, поля, указанные в 4 посте удалял, некоторые нашел сам, НО! В данном пункте появилась проблема:

 

 

 

Убираем model со страницы редактирования товара в админке
admin/view/template/catalog/product_form.tpl - найти: (61-я строка)
<tr>
<td><span class="required">*</span> <?php echo $entry_model; ?></td>
<td><input type="text" name="model" value="<?php echo $model; ?>" />
<?php if ($error_model) { ?>
<span class="error"><?php echo $error_model; ?></span>
<?php } ?></td>
</tr>Удалить

 

Я закомментировал кусок:

<!-- <label class="col-sm-2 control-label" for="input-model"><?php echo $entry_model; ?></label>
                <div class="col-sm-10">
                  <input type="text" name="model" value="<?php echo $model; ?>" placeholder="<?php echo $entry_model; ?>" id="input-model" class="form-control" />
                  <?php if ($error_model) { ?>
                  <div class="text-danger"><?php echo $error_model; ?></div>
                  <?php } ?>
                </div> -->

И теперь при создании товара выскакивает такая ошибка:

 

 

Notice: Undefined index: model in Z:\home\PowerfulNutrition\www\admin\model\catalog\product.php on line 6Warning: Cannot modify header information - headers already sent by (output started at Z:\home\PowerfulNutrition\www\admin\index.php:80) inZ:\home\PowerfulNutrition\www\system\library\response.php on line 12

Товар, конечно, добавляется, но хотелось бы избавиться от этой заразы.

 

P.S. сайт на Денвере.

P.S.S. буду рад советам, в каких файлах поле модель можно удалить  еще.

Edited by Bandicoot

Share this post


Link to post
Share on other sites

admin/model/catalog/product.php в строке 6 пишет же,

Share this post


Link to post
Share on other sites

 Строка 6:

$this->db->query("INSERT INTO " . DB_PREFIX . /*"product SET model = '" . $this->db->escape($data['model']) .*/ "', sku = '" . $this->db->escape($data['sku']) . "', upc = '" . $this->db->escape($data['upc']) . "', ean = '" . $this->db->escape($data['ean']) . "', jan = '" . $this->db->escape($data['jan']) . "', isbn = '" . $this->db->escape($data['isbn']) . "', mpn = '" . $this->db->escape($data['mpn']) . "', location = '" . $this->db->escape($data['location']) . "', quantity = '" . (int)$data['quantity'] . "', minimum = '" . (int)$data['minimum'] . "', subtract = '" . (int)$data['subtract'] . "', stock_status_id = '" . (int)$data['stock_status_id'] . "', date_available = '" . $this->db->escape($data['date_available']) . "', manufacturer_id = '" . (int)$data['manufacturer_id'] . "', shipping = '" . (int)$data['shipping'] . "', price = '" . (float)$data['price'] . "', points = '" . (int)$data['points'] . "', weight = '" . (float)$data['weight'] . "', weight_class_id = '" . (int)$data['weight_class_id'] . "', length = '" . (float)$data['length'] . "', width = '" . (float)$data['width'] . "', height = '" . (float)$data['height'] . "', length_class_id = '" . (int)$data['length_class_id'] . "', status = '" . (int)$data['status'] . "', tax_class_id = '" . $this->db->escape($data['tax_class_id']) . "', sort_order = '" . (int)$data['sort_order'] . "', date_added = NOW()");

Закомментировал запись модели в базу, и стало еще хуже:

 

 

 

Notice: Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '', sku = '', upc = '', ean = '', jan = '', isbn = '', mpn = '', location = '', q' at line 1
Error No: 1064
INSERT INTO oc_', sku = '', upc = '', ean = '', jan = '', isbn = '', mpn = '', location = '', quantity = '1', minimum = '1', subtract = '1', stock_status_id = '6', date_available = '2015-07-15', manufacturer_id = '0', shipping = '1', price = '0', points = '0', weight = '0', weight_class_id = '1', length = '0', width = '0', height = '0', length_class_id = '1', status = '1', tax_class_id = '0', sort_order = '1', date_added = NOW() inZ:\home\PowerfulNutrition\www\system\library\db\mysqli.php on line 40Notice: Error: Duplicate entry '0-2' for key 'PRIMARY'
Error No: 1062
INSERT INTO oc_product_description SET product_id = '0', language_id = '2', name = '312', description = '<p><br></p>', tag = '', meta_title = '312', meta_description = '', meta_keyword = '' in Z:\home\PowerfulNutrition\www\system\library\db\mysqli.php on line 40Notice: Error: Duplicate entry '0-0' for key 'PRIMARY'
Error No: 1062
INSERT INTO oc_product_to_store SET product_id = '0', store_id = '0' in Z:\home\PowerfulNutrition\www\system\library\db\mysqli.php on line40Notice: Error: Duplicate entry '0-0' for key 'PRIMARY'
Error No: 1062
INSERT INTO oc_product_to_layout SET product_id = '0', store_id = '0', layout_id = '0' inZ:\home\PowerfulNutrition\www\system\library\db\mysqli.php on line 40Warning: Cannot modify header information - headers already sent by (output started at Z:\home\PowerfulNutrition\www\admin\index.php:80) in Z:\home\PowerfulNutrition\www\system\library\response.php on line 12

Share this post


Link to post
Share on other sites

И да, еще:

 

admin/controller/catalog/product.php - найти: (1119-я строка)

if ((strlen(utf8_decode($this->request->post['model'])) < 1) || (strlen(utf8_decode($this->request->post['model'])) > 64)) {
        $this->error['model'] = $this->language->get('error_model');
    }Удалить или закомментировать

Закомментировал кусок:

		/*if ((utf8_strlen($this->request->post['model']) < 1) || (utf8_strlen($this->request->post['model']) > 64)) {
			$this->error['model'] = $this->language->get('error_model');
		}*/

Само поле осталось со звездочкой, но можно его не вводить. Товар добавляется. Тоже хотелось бы искоренить его (поле).

Share this post


Link to post
Share on other sites

Круто закомментировал, товарищ.

 

Не так.

$this->db->query("INSERT INTO " . DB_PREFIX . /*"product SET model

А хотя-бы так

$this->db->query("INSERT INTO " . DB_PREFIX . "product SET " ./* "model = '" . $this->db->escape($data['model']) . "','". */"sku = '" .
Edited by kotahinus

Share this post


Link to post
Share on other sites

Я закомментировал кусок:

неверный путь

лучше скройте стилями display:none

Share this post


Link to post
Share on other sites

Увы...

		$this->db->query("INSERT INTO " . DB_PREFIX . "product SET". /*model = ' . $this->db->escape($data['model']) .*/

 

 

Notice: Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '', sku = '', upc = '', ean = '', jan = '', isbn = '', mpn = '', location = '', q' at line 1
Error No: 1064
INSERT INTO oc_product SET', sku = '', upc = '', ean = '', jan = '', isbn = '', mpn = '', location = '', quantity = '1', minimum = '1', subtract = '1', stock_status_id = '6', date_available = '2015-07-15', manufacturer_id = '0', shipping = '1', price = '0', points = '0', weight = '0', weight_class_id = '1', length = '0', width = '0', height = '0', length_class_id = '1', status = '1', tax_class_id = '0', sort_order = '1', date_added = NOW() inZ:\home\PowerfulNutrition\www\system\library\db\mysqli.php on line 40Notice: Error: Duplicate entry '0-2' for key 'PRIMARY'
Error No: 1062
INSERT INTO oc_product_description SET product_id = '0', language_id = '2', name = '123', description = '<p><br></p>', tag = '', meta_title = '123', meta_description = '', meta_keyword = '' in Z:\home\PowerfulNutrition\www\system\library\db\mysqli.php on line 40Notice: Error: Duplicate entry '0-0' for key 'PRIMARY'
Error No: 1062
INSERT INTO oc_product_to_store SET product_id = '0', store_id = '0' in Z:\home\PowerfulNutrition\www\system\library\db\mysqli.php on line40Notice: Error: Duplicate entry '0-59' for key 'PRIMARY'
Error No: 1062
INSERT INTO oc_product_to_category SET product_id = '0', category_id = '59' in Z:\home\PowerfulNutrition\www\system\library\db\mysqli.php on line 40Notice: Error: Duplicate entry '0-0' for key 'PRIMARY'
Error No: 1062
INSERT INTO oc_product_to_layout SET product_id = '0', store_id = '0', layout_id = '0' inZ:\home\PowerfulNutrition\www\system\library\db\mysqli.php on line 40Warning: Cannot modify header information - headers already sent by (output started at Z:\home\PowerfulNutrition\www\admin\index.php:80) in Z:\home\PowerfulNutrition\www\system\library\response.php on line 12

Share this post


Link to post
Share on other sites

Извиняй. Я там опечатался, уже поправил в сообщении.

Share this post


Link to post
Share on other sites

На всякий случай, напиши тут параметры ftp доступа.

Добрые люди помогут.

 

p.s. ну не знаю, в прошлый раз проканало

Share this post


Link to post
Share on other sites

 

$this->db->query("INSERT INTO " . DB_PREFIX . "product SET". /* "model = '" . $this->db->escape($data['model']) . "','"*/ "sku = '" . $this->db->escape($data['sku']) . "', upc = '" . $this->db->escape($data['upc']) . "', ean = '" . $this->db->escape($data['ean']) . "', jan = '" . $this->db->escape($data['jan']) . "', isbn = '" . $this->db->escape($data['isbn']) . "', mpn = '" . $this->db->escape($data['mpn']) . "', location = '" . $this->db->escape($data['location']) . "', quantity = '" . (int)$data['quantity'] . "', minimum = '" . (int)$data['minimum'] . "', subtract = '" . (int)$data['subtract'] . "', stock_status_id = '" . (int)$data['stock_status_id'] . "', date_available = '" . $this->db->escape($data['date_available']) . "', manufacturer_id = '" . (int)$data['manufacturer_id'] . "', shipping = '" . (int)$data['shipping'] . "', price = '" . (float)$data['price'] . "', points = '" . (int)$data['points'] . "', weight = '" . (float)$data['weight'] . "', weight_class_id = '" . (int)$data['weight_class_id'] . "', length = '" . (float)$data['length'] . "', width = '" . (float)$data['width'] . "', height = '" . (float)$data['height'] . "', length_class_id = '" . (int)$data['length_class_id'] . "', status = '" . (int)$data['status'] . "', tax_class_id = '" . $this->db->escape($data['tax_class_id']) . "', sort_order = '" . (int)$data['sort_order'] . "', date_added = NOW()");

 

 

Notice: Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SETsku = '', upc = '', ean = '', jan = '', isbn = '', mpn = '', location = '', q' at line 1

Error No: 1064

INSERT INTO oc_product SETsku = '', upc = '', ean = '', jan = '', isbn = '', mpn = '', location = '', quantity = '1', minimum = '1', subtract = '1', stock_status_id = '6', date_available = '2015-07-15', manufacturer_id = '0', shipping = '1', price = '0', points = '0', weight = '0', weight_class_id = '1', length = '0', width = '0', height = '0', length_class_id = '1', status = '1', tax_class_id = '0', sort_order = '1', date_added = NOW() inZ:\home\PowerfulNutrition\www\system\library\db\mysqli.php on line 40Notice: Error: Duplicate entry '0-2' for key 'PRIMARY'

Error No: 1062

INSERT INTO oc_product_description SET product_id = '0', language_id = '2', name = '123', description = '<p><br></p>', tag = '', meta_title = '123', meta_description = '', meta_keyword = '' in Z:\home\PowerfulNutrition\www\system\library\db\mysqli.php on line 40Notice: Error: Duplicate entry '0-0' for key 'PRIMARY'

Error No: 1062

INSERT INTO oc_product_to_store SET product_id = '0', store_id = '0' in Z:\home\PowerfulNutrition\www\system\library\db\mysqli.php on line40Notice: Error: Duplicate entry '0-59' for key 'PRIMARY'

Error No: 1062

INSERT INTO oc_product_to_category SET product_id = '0', category_id = '59' in Z:\home\PowerfulNutrition\www\system\library\db\mysqli.php on line 40Notice: Error: Duplicate entry '0-0' for key 'PRIMARY'

Error No: 1062

INSERT INTO oc_product_to_layout SET product_id = '0', store_id = '0', layout_id = '0' inZ:\home\PowerfulNutrition\www\system\library\db\mysqli.php on line 40Warning: Cannot modify header information - headers already sent by (output started at Z:\home\PowerfulNutrition\www\admin\index.php:80) in Z:\home\PowerfulNutrition\www\system\library\response.php on line 12

Делаю всё точь в точь.

 

 

неверный путь

лучше скройте стилями display:none

А точнее?

 

На всякий случай, напиши тут параметры ftp доступа.

Добрые люди помогут.

 

p.s. ну не знаю, в прошлый раз проканало

На локалке сайт, на Денвере.

Share this post


Link to post
Share on other sites

Не точь в точь. Забыл пробел. У тебя:

"product SET". /*

У меня:

"product SET ". /*

О чем и вещает ошибка:

Notice: Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SETsku = '', upc = '', ean = '', jan = '', isbn = '', mpn = '', location = '', q' at line 1 //SETsku склеено

В прочем после того как закомментировал кусок:

/*if ((utf8_strlen($this->request->post['model']) < 1) || (utf8_strlen($this->request->post['model']) > 64)) {
$this->error['model'] = $this->language->get('error_model');
}*/

Это уже и не должно быть нужно по идее.

 

По поводу скрыть стилями, точнее было бы не так.

<!-- <label class="col-sm-2 control-label" for="input-model"><?php echo $entry_model; ?></label>
<div class="col-sm-10">
<input type="text" name="model" value="<?php echo $model; ?>" placeholder="<?php echo $entry_model; ?>" id="input-model" class="form-control" />
<?php if ($error_model) { ?>
<div class="text-danger"><?php echo $error_model; ?></div>
<?php } ?>
</div> -->

А так.

<label style="display:none" class="col-sm-2 control-label" for="input-model"><?php echo $entry_model; ?></label>
<div style="display:none" class="col-sm-10">
<input type="text" name="model" value="<?php echo $model; ?>" placeholder="<?php echo $entry_model; ?>" id="input-model" class="form-control" />
<?php if ($error_model) { ?>
<div class="text-danger"><?php echo $error_model; ?></div>
<?php } ?>
</div>
Но если само поле после этого не исчезло значит не там закомментировал.
Edited by kotahinus

Share this post


Link to post
Share on other sites

Отлично, проблемы решены, всем спасибо огромное)

Осталась просьба: я удалил поле "Модель":

а) при создании товара;

б) при редактировании товара;

в) со страницы продукта;

г) со страницы корзины;

д) со страницы подтверждения заказа;

е) со страницы в истории заказов пользователя;

ё) с письма, которое приходит пользователю после заказа (не тестил);

ж) со страницы избранного;

з) со страницы избранного;

и) с формы возврата;

й) с информации о возврате.

 

Может кто навскидку знает, где еще поле "Модель" может отображаться?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×

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.