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

Картинки товара в Alert


Recommended Posts

В файле catalog/controller/checkout/cart.php 

//найти строку:
$json['success'] = sprintf($this->language->get('text_success'), $this->url->link('product/product', 'product_id=' . $this->request->post['product_id']), $product_info['name'], $this->url->link('checkout/cart'));
//перед строкой добавить код:
$this->load->model('tool/image');
if ($product['image']) {
	$image = '<img src="'.$this->model_tool_image->resize($product_info['image'], $this->config->get($this->config->get('config_theme') . '_image_cart_width'), $this->config->get($this->config->get('config_theme') . '_image_cart_height')).'"> ';
} else {
	$image = '';
}
//добавить переменную $image в ответ:
$json['success'] = sprintf($this->language->get('text_success'), $image, $this->url->link('product/product', 'product_id=' . $this->request->post['product_id']), $product_info['name'], $this->url->link('checkout/cart'));

Дное в языковом файле (catalog/language/ru-ru/checkout/cart.php) добавляем вывод картинки: 

//заменяем строку:
$_['text_success']             = 'Товар <a href="%s">%s</a> добавлен в вашу <a href="%s">корзину</a>!';
//на эту:
$_['text_success']             = '%sТовар <a href="%s">%s</a> добавлен в вашу <a href="%s">корзину</a>!';

Как-то ик, но лучше в ocmod.

Если нужно добавить все фото товара, можно пройтись foreach по картинкам, подгрузив их из БД при помощи функции getProductImages! Лучше конечно для этого гдела еещё добавить массив product_images, отдавать его вместе с success и разметку html дописать уже в common.js. Пробуйте! 

Link to comment
Share on other sites

  • 3 months later...

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.