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

Админка: не копируются дополнительные изображения товаров


 Share

Recommended Posts

Добрый день! Столкнулся с такой проблемой - при копировании товара через панель администрирования не копируются его дополнительные изображения, но их количество сохраняется, но они пустые (no_image.jpg)

Причём самое первое главное изображение копируется нормально.

Полазил в файлах, вроде всё чётко реализовано.

  if (isset($data['product_image'])) {
   foreach ($data['product_image'] as $product_image) {
    $this->db->query("INSERT INTO " . DB_PREFIX . "product_image SET product_id = '" . (int)$product_id . "', image = '" . $this->db->escape($product_image['image']) . "', sort_order = '" . (int)$product_image['sort_order'] . "'");
   }
  }
подозреваю, что функция escape не даёт скопировать?

Помогите решить проблему пожалуйста. Заранее, спасибо.

Link to comment
Share on other sites

public function copyProduct($product_id) {
  $query = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) WHERE p.product_id = '" . (int)$product_id . "' AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "'");

  if ($query->num_rows) {
   $data = array();
  
   $data = $query->row;
  
   $data['keyword'] = '';
   $data['status'] = '0';
	
   $data = array_merge($data, array('product_attribute' => $this->getProductAttributes($product_id)));
   $data = array_merge($data, array('product_description' => $this->getProductDescriptions($product_id)));  
   $data = array_merge($data, array('product_discount' => $this->getProductDiscounts($product_id)));
   $data = array_merge($data, array('product_image' => $this->getProductImages($product_id)));
  
   $data['product_image'] = array();
  
   $results = $this->getProductImages($product_id);
  
   foreach ($results as $result) {
	$data['product_image'][] = $result['image'];
   }
в этом коде видно, что таблица product_image не выбирается (((((

а вот в самой функции выбирается!!!

public function getProductImages($product_id) {
  $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_image WHERE product_id = '" . (int)$product_id . "'");
 
  return $query->rows;
}

но, почему-то, не работает :(

Link to comment
Share on other sites

ещё также заметил, что при копировании в таблице создаются значения поля изображений "d", т.е. видимо первая бука от пути файла, видимо почему-то срезается остальные символы почему-то ((((((

может у кого-то есть предположения, почему так?

Link to comment
Share on other sites

Тоже заметил такую неприятность, как поправить не знаю. В opencart копирует нормально. В ocstore 1.5.1.3 и 1.5.2.1 beta - не копирует. Если ни кто не поможет буду переходить на opencart 1.5.2.1. Help !!!

Link to comment
Share on other sites


  • 7 months later...
  • 4 months later...

Сравниваем оригинальный файл opencart и файл в ocstore admin/model/catalog/product.php

И видим, что в оригинале нет следующего:

$data['product_image'] = array();
  
   $results = $this->getProductImages($product_id);
  
   foreach ($results as $result) {
	$data['product_image'][] = $result['image'];
   }

Удаляем в ocstore, и вот оно, счастье!

По крайней мере я глюков от удаления этих строк не заметил.

Link to comment
Share on other sites


  • 1 year later...

Сравниваем оригинальный файл opencart и файл в ocstore admin/model/catalog/product.php

И видим, что в оригинале нет следующего:

$data['product_image'] = array();
  
   $results = $this->getProductImages($product_id);
  
   foreach ($results as $result) {
	$data['product_image'][] = $result['image'];
   }

Удаляем в ocstore, и вот оно, счастье!

По крайней мере я глюков от удаления этих строк не заметил.

Спасибо огромное, помогло. После установки модулей, типа редактируемого списка товаров, єта ошибка сплошь и рядом.

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.