Opencart Product Option Images set automatically to 50x50

Great! But my image is REALLY SMALL! What's going on??
By default, OpenCart passes you an image that is 50x50. If you would like it in a different size (say 228x228, the typical size of the product image) you will need to make these changes below.

Catalog/Controller/Product/Product.php
Find this bit of code
Code: 
foreach ($option['option_value'] as $option_value) {
                  if (!$option_value['subtract'] || ($option_value['quantity'] > 0)) {
                     $option_value_data[] = array(
                        'product_option_value_id' => $option_value['product_option_value_id'],
                        'option_value_id'         => $option_value['option_value_id'],
                        'name'                    => $option_value['name'],
                        'image'                   => $this->model_tool_image->resize($option_value['image'], 50, 50),
                        'price'                   => (float)$option_value['price'] ? $this->currency->format($this->tax->calculate($option_value['price'], $product_info['tax_class_id'], $this->config->get('config_tax'))) : false,
                        'price_prefix'            => $option_value['price_prefix']
                     );
                  }
               }


See the section that says
Code: 
$this->model_tool_image->resize($option_value['image'], 50, 50),

That's where our image is being resized! Simply change the integer values to the desired size (in my case 228, 228)!

Comments

Popular posts from this blog

Script For Login, Logout and View Using PHP, MySQL and Bootstrap

Real-Time Web Interface to MQTT using Socket.io and Node.js

Customize radio buttons and checkboxes with CSS sprites