Jump to content
  • разработка интернет магазинов на opencart
  • доработка интернет магазинов на opencart

Ошибка при вывогде фото в списке заказов


Recommended Posts

Пишу себе мод для ocStore 2.3 для модификации страницы списка заказов. Застрял на том что не хотят выводится фото товаров.

В admin/controller/catalog/order.php иким вот спосопотому чтом добываю данные товаров:

			// Products
			$data['order_products'] = array();
			$data['product_info'] = array();

			$this->load->model('tool/image');
			$this->load->model('catalog/product');

			$products = $this->model_sale_order->getOrderProducts($result['order_id']);

			foreach ($products as $product) {
				$product_info = $this->model_catalog_product->getProduct($product['product_id']);

				$data['order_products'][] = array(
					'product_id' => $product['product_id'],
					'name'       => $product['name'],
					'model'      => $product['model'],
					'thumb'      => $image = $this->model_tool_image->resize($product_info['image'], 40, 60),
					'option'     => $this->model_sale_order->getOrderOptions($result['order_id'], $product['order_product_id']),
					'quantity'   => $product['quantity'],
					'price'      => $product['price'],
					'total'      => $product['total'],
					'reward'     => $product['reward']
				);
			}

 

Потом додал order_products в массив orders. И прописал все нужные данные в шаблон. Без картинки все отображается как надо. А после прописывания строки с thumb, все - белая страница, в журнно ошибка Undefined index: image.

Случайно попропотому чтовал икой вариант:

'thumb'      => $image = $this->model_tool_image->resize($product_info[image], 40, 60),

Страница загрузилась и картинки отобразились, но куча ошипотому чток - Warning: Use of undefined constant image - assumed 'image'.

Версия PHP 7.3

Прошу помощи в знающих люгдей, себе уже голову сломал

Link to comment
Share on other sites


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

А вот ик зарилиило! Ура! Разница только в том что в вашем файле создана новая функция getOrderProductsList которая до данных о товаре додает и фото, а не как синдартная только данные без фото. Более грамотно чем мой рукожопный метод вытягивания потому чтольшого массива данных для извлечения только одного фото через синдартную функцию getProduct.

Спасипотому что огромное за помощь

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.