Monday, April 4, 2016

Create Custom Image Field in open cart

In this tutorial we are going to learn how to add custom Image field in opencart. Sometimes, due to specific requirement of the project, we need add new Image fields which can be – product Image, product information Image, Product Size Image etc., that we want to display. So lets create a new product field called "Size Chart".

Add Following Lines in

getForm() function

if (isset($this->request->post['size_chart']) && is_file(DIR_IMAGE . $this->request->post['size_chart'])) {
            $data['thumb_sizechart'] = $this->model_tool_image->resize($this->request->post['size_chart'], 100, 100);
        } elseif (!empty($product_info) && is_file(DIR_IMAGE . $product_info['size_chart'])) {
            $data['thumb_sizechart'] = $this->model_tool_image->resize($product_info['size_chart'], 100, 100);
        } else {
            $data['thumb_sizechart'] = $this->model_tool_image->resize('no_image.png', 100, 100);

in view

No comments:

Post a Comment