web2works wrote:Right if you make the changes below you should get the image browse button back. I normally dont like to make changes to the functionality of opencart to allow for easy of upgrade further down the line. Here I have added the original browse button to the image (Data Tab). Reason for this is that on the Data tab you only want to upload one image so what is the point in browsing through 1000s of images and waiting for them all to load. Although I have left the Image File Manage in the Image tab to allow for multiple images to be selected/uploaded.
The new image manager is all done through AJAX so there is I am not going to remove any code just simple add the original code.
STEP1 get the physical button back
In - /admin/view/template/catalog/product_form.tpl
If you replace:With:Code: Select all
<tr> <td><?php echo $entry_image; ?></td> <td><input type="hidden" name="image" value="<?php echo $image; ?>" id="image" /> <img src="<?php echo $preview; ?>" alt="" id="preview" style="border: 1px solid #EEEEEE;"/> <img src="view/image/image.png" alt="" style="cursor: pointer;" align="top" onclick="image_upload('image', 'preview');" /> </td> </tr>
Now open: /admin/controller/catalog/product.phpCode: Select all
<tr> <td><?php echo $entry_image; ?></td> <td><input type="file" name="image" /></td> </tr> <tr> <td></td> <td><img src="<?php echo $preview; ?>" alt="" style="margin: 4px 0px; border: 1px solid #EEEEEE;" /></td> </tr>
STEP2
Inside public function insert() around line 24.
Find: if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
Add below:STEP3Code: Select all
if (is_uploaded_file($this->request->files['image']['tmp_name']) && is_writable(DIR_IMAGE) && is_writable(DIR_IMAGE . 'cache/')) { move_uploaded_file($this->request->files['image']['tmp_name'], DIR_IMAGE . $this->request->files['image']['name']); if (file_exists(DIR_IMAGE . $this->request->files['image']['name'])) { $data['image'] = $this->request->files['image']['name']; } } if (isset($this->request->files['product_image'])) { foreach (array_keys($this->request->files['product_image']['name']) as $key) { if (is_uploaded_file($this->request->files['product_image']['tmp_name'][$key]) && is_writable(DIR_IMAGE) && is_writable(DIR_IMAGE . 'cache/')) { move_uploaded_file($this->request->files['product_image']['tmp_name'][$key], DIR_IMAGE . $this->request->files['product_image']['name'][$key]); if (file_exists(DIR_IMAGE . $this->request->files['product_image']['name'][$key])) { $data['product_image'][] = $this->request->files['product_image']['name'][$key]; } } } }
Inside public function update() around line 85.
Find: if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
$data = array();
Add below:Code: Select all
if (is_uploaded_file($this->request->files['image']['tmp_name']) && is_writable(DIR_IMAGE) && is_writable(DIR_IMAGE . 'cache/')) { move_uploaded_file($this->request->files['image']['tmp_name'], DIR_IMAGE . $this->request->files['image']['name']); if (file_exists(DIR_IMAGE . $this->request->files['image']['name'])) { $data['image'] = $this->request->files['image']['name']; } } if (isset($this->request->files['product_image'])) { foreach (array_keys($this->request->files['product_image']['name']) as $key) { if (is_uploaded_file($this->request->files['product_image']['tmp_name'][$key]) && is_writable(DIR_IMAGE) && is_writable(DIR_IMAGE . 'cache/')) { move_uploaded_file($this->request->files['product_image']['tmp_name'][$key], DIR_IMAGE . $this->request->files['product_image']['name'][$key]); if (file_exists(DIR_IMAGE . $this->request->files['product_image']['name'][$key])) { $data['product_image'][] = $this->request->files['product_image']['name'][$key]; } unset($this->request->post['product_image'][$key]); } } } if (isset($this->request->post['product_image'])) { foreach (array_keys($this->request->post['product_image']) as $key) { $data['product_image'][] = $this->request->post['product_image'][$key]; unset($this->request->post['product_image'][$key]); } }
It is don't work.

Maybe someone knows how to fix?