Jump to content

My Product controller override doesn't work.


xlynx

Recommended Posts

Hello,
 
I want to override a part of code of the AdminProductsController.php to change some tabs :

This is the original part :

$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,
'Shipping' => 4,
'Combinations' => 5,
'Features' => 10,
'Customization' => 11,
'Attachments' => 12,
'Suppliers' => 13,
));

I created a file called AdminProductsController.php and saved in /override/controllers/admin and made this code :

<?php

class AdminProductsController extends AdminProductsControllerCore {

public function __construct() {
parent::__construct();
$this->available_tabs = array('Quantities' => 6, 'Warehouses' => 14);
if ($this->context->shop->getContext() != Shop::CONTEXT_GROUP && $this->context->shop->getContext() != Shop::CONTEXT_SHOP )
$this->available_tabs = array_merge($this->available_tabs, array(
'Informations' => 0,
'Pack' => 7,
'VirtualProduct' => 8,
'Prices' => 1,
'Seo' => 2,
'Associations' => 3,
'Images' => 9,
'Shipping' => 4,
'Combinations' => 5,
'Features' => 10,
'Customization' => 11,
'Attachments' => 12,
'Suppliers' => 13,
));
}
}

If i put this code in the original file, it works but i want an override to get a clean install.

i don't know where i am wrong.

 

Thanks for any help

Best !

 

Edited by xlynx (see edit history)
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...