Jump to content

[1.6]problem with HelperOptions, input type file & image display


Recommended Posts

Hello everyone :)

I'm doing a module for PrestaShop 1.6 that allows me to upload images. So far everything works well with my module created from the generator Presta but I have a problem with the formatting of my configuration form in the back office module. The problem is with the type "file" input.

Here's what I did in mymodule.php:

/**
 * Create the structure of your form.
 */
protected function getConfigForm()
{
    $xl_labels_img = ($this->xl_labels != null)
        ? '<img src="'.$this->_path.'views/img/upload/'.$this->xl_labels->uploadedFileName
            . '" alt="'.$this->l("Preview of the extra large label picture")
            . '" title="'.$this->l("Extra large label picture")
            . '" width="210" height="300" />'
        : '';

    return array(
        'form' => array(
            'legend' => array(
                'title' => $this->l('Module settings'),
                'icon' => 'icon-cogs',
            ),
            'input' => array(
                array(
                    'col' => 9,
                    'type' => 'file',
                    'image' => $xl_labels_img,
                    'size' => $this->xl_labels->size,
                    'delete_url' => "#",
//                    'file' => 'http://www.nabalsy-dev'.$this->_path.'/views/img/upload/SEBASTIENDESCHAMPSEH_XL_LABELS',
//                    'download_url' => true,
                    'prefix' => '<i class="icon icon-upload"></i>',
                    'desc' => $this->l('Upload a picture for the extra large screen size label. Extra large screen size label picture size is 210 x 300px.'),
                    'name' => 'SEBASTIENDESCHAMPSEH_XL_LABELS',
                    'label' => $this->l('Extra large label picture'),
                    'hint' => 'Vertical label picture size is 210 x 300px. It used for the extra large screen size.'
                ),
            'buttons' => array(
                'cancel' => array(
                    'title' => $this->l('Cancel'),
                    'href' => '#',
                    'js' => 'window.history.back();',
                    'icon' => 'process-icon-cancel'
                )
            ),
            'submit' => array(
                'title' => $this->l('Save'),
                'name' => 'submitForm'
            ),
        ),
    );
}

Here's what I get when uploading an image:

http://pasteall.org/pic/show.php?id=106619

Here is my problem is that I do with the two lines commented out :

http://pasteall.org/pic/show.php?id=106755

Here is what I am doing:

http://pasteall.org/pic/show.php?id=106620

If someone an idea ;)

Thank you in advance.

 

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
×
×
  • Create New...