Jump to content

duplicate admin product images tab to new tab


aaront1

Recommended Posts

I am using prestashop 1.5.5.

in the admin, edit/add product area, is there a way to duplicate the images tab(want to add a new sub images tab), so that I can upload another set of images to a new table, and when display on the product page, it will display in a different section.

 

I know to add a new tab is to create a new module and hook it with hookDisplayAdminProductsExtra and hookActionProductUpdate,

but I want the exact same functions from that original images tab, that's why I want to see where I can copy the functions from and just modify it to link to the new table.

 

which files I should duplicate and modify? since I don't see there is an images module folder.

 

or is there another easy way to have this new tab which have the same functions like the default images tab?

 

Thanks,

 

Link to comment
Share on other sites

Have a look at /controllers/admin/AdminProductsController

 

function:

public function __construct()
{
$this->table = 'product';
$this->className = 'Product';
$this->lang = true;
$this->explicitSelect = true;
$this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?')));
 
if (!Tools::getValue('id_product'))
$this->multishop_context_group = false;
 
parent::__construct();
 
$this->imageType = 'jpg';
$this->_defaultOrderBy = 'position';
$this->max_file_size = (int)(Configuration::get('PS_LIMIT_UPLOAD_FILE_VALUE') * 1000000);
$this->max_image_size = (int)Configuration::get('PS_PRODUCT_PICTURE_MAX_SIZE');
$this->allow_export = true;
 
// @since 1.5 : translations for tabs
$this->available_tabs_lang = array(
'Informations' => $this->l('Information'),
'Pack' => $this->l('Pack'),
'VirtualProduct' => $this->l('Virtual Product'),
'Prices' => $this->l('Prices'),
'Seo' => $this->l('SEO'),
'Images' => $this->l('Images'),
'ImagesAlt' => $this->l('ImagesAlt'),
'Associations' => $this->l('Associations'),
'Shipping' => $this->l('Shipping'),
'Combinations' => $this->l('Combinations'),
'Features' => $this->l('Features'),
'Customization' => $this->l('Customization'),
'Attachments' => $this->l('Attachments'),
'Quantities' => $this->l('Quantities'),
'Suppliers' => $this->l('Suppliers'),
'Warehouses' => $this->l('Warehouses'),
);
 
$this->available_tabs = array('Quantities' => 6, 'Warehouses' => 14);
if ($this->context->shop->getContext() != Shop::CONTEXT_GROUP)
$this->available_tabs = array_merge($this->available_tabs, array(
'Informations' => 0,
'Pack' => 7,
'VirtualProduct' => 8,
'Prices' => 1,
'Seo' => 2,
'Associations' => 3,
'Images' => 9,
'ImagesAlt' => 10,
'Shipping' => 4,
'Combinations' => 5,
'Features' => 11,
'Customization' => 12,
'Attachments' => 13,
'Suppliers' => 14,
));
 
 
This will add a tab, but of course to fill it with the image info, you need to 'copy/modify' all 'image' as imageAlt. Search for image, and you will see JOINS with tables, fields etc. Didn't give it a deep look, but it's probably a good start.
 
My 2 cents,
pascal
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...