Hiding Product tabs in Admin

Hello,



I would like to hide some of the Product tabs within Admin. I am setting up a downloadable media store and it makes no sense to have a Quantity Discount tabs. I found this is tabsbox.tbl:







So it would seem there is a “tab.hidden” flag somewhere.



Any clues?



Appreciate the help.

Nobody knows how to turn off the Tabs in “Editing product”?



I am setting up a Multi-vendor downloadable media store and have no need for some of the Tabs like “Quantity Discounts” and “Shipping Properties”

You can comment out or delete these lines of code ( in $DIR_ROOT/controllers/admin/products.php file):


'shippings' => array (
'title' => fn_get_lang_var('shipping_properties'),
'js' => true
),
'qty_discounts' => array (
'title' => fn_get_lang_var('qty_discounts'),
'js' => true
),


to turn off the “[color=#282828][font=arial, verdana, tahoma, sans-serif]Quantity Discount[/font][/color]” and [color=#282828][font=arial, verdana, tahoma, sans-serif]“Shipping Properties” [/font][/color]tabs [color=#282828][font=arial, verdana, tahoma, sans-serif] in “Editing product”[/font][/color].

[color=#282828][font=arial, verdana, tahoma, sans-serif]Hi,[/font][/color]



[color=#282828][font=arial, verdana, tahoma, sans-serif]I tried the logic from this post here:[/font][/color]

[color=#000088]if[/color][color=#000000] [/color]color=#666600{[/color]



[color=#282828][font=arial, verdana, tahoma, sans-serif]in the following file to reduce the product tabs displayed for vendors…[/font][/color]



[color=#282828][font=arial, verdana, tahoma, sans-serif]/app/controllers/backend/products.php[/font][/color]



[color=#282828][font=arial, verdana, tahoma, sans-serif]Unfortunately it did not work…anybody an idea why?[/font][/color]



[color=#282828][font=arial, verdana, tahoma, sans-serif]I implemented the following logic:[/font][/color]



[color=#000088]if[/color][color=#000000] [/color]color=#666600{[/color]

[color=#000000]$tabs [/color][color=#666600]=[/color][color=#000000] array [/color][color=#666600]([/color]

[color=#000000] [/color][color=#008800]'detailed'[/color][color=#000000] [/color][color=#666600]=>[/color][color=#000000] array [/color][color=#666600]([/color]

[color=#000000] [/color][color=#008800]'title'[/color][color=#000000] [/color][color=#666600]=>[/color][color=#000000] __[/color]color=#666600,[/color]

[color=#000000] [/color][color=#008800]'js'[/color][color=#000000] [/color][color=#666600]=>[/color][color=#000000] [/color][color=#000088]true[/color]

[color=#000000] [/color][color=#666600]),[/color]

[color=#000000] [/color][color=#008800]'images'[/color][color=#000000] [/color][color=#666600]=>[/color][color=#000000] array [/color][color=#666600]([/color]

[color=#000000] [/color][color=#008800]'title'[/color][color=#000000] [/color][color=#666600]=>[/color][color=#000000] __[/color]color=#666600,[/color]

[color=#000000] [/color][color=#008800]'js'[/color][color=#000000] [/color][color=#666600]=>[/color][color=#000000] [/color][color=#000088]true[/color]

[color=#666600]…[/color]

[color=#666600]}[/color]

[color=#000088]else[/color][color=#000000] [/color][color=#880000]//do not show all tabs[/color]

[color=#666600]{[/color]

[color=#666600]}[/color]

hi,



For limitation of number of tabs in admin panel, please add the code in the “app/controllers/backend/products.php”:



if ($auth['user_type'] =="A"){
$tabs = array (
'detailed' => array (
'title' => __('general'),
'js' => true
),
'images' => array (
'title' => __('images'),
'js' => true
)
);
}


before lines:


// [/Product tabs]
Registry::set('navigation.tabs', $tabs);
// [/Page sections]




Also in the file “design/backend/templates/views/products/update.tpl” replace line:

```php


```
with:
```php

```

NOTE: After that don't forget to clean up the template cache.

NOTE: After this fix major part of tabs will disappear (e.g. "Options" or "Shipping Properties" ), however some other tabs might stay (mainly it is about tabs added by modules, e.g. "Attachments" - these tabs are added in POST controllers, e.g. "app/addons/attachments/controllers/backend/products.post.php").

For hiding other tabs you should find and modify all these POST controllers.
If you need our assistance in it, please don't hesitate to [url="http://hd.webshopaddons.com/open.php"]contact us[/url].

Best regards,
WSA team

[quote name='hipe' timestamp='1430390432' post='213050']

[color=#282828][font=arial, verdana, tahoma, sans-serif]Unfortunately it did not work…anybody an idea why?[/font][/color]

[/quote]



As we said in that post, additional template modifications are required to complete the modification. The thread was updated yesterday. Please check.

Hello, this thread was very helpful. I did everything and had success in hiding all the tabs when editing a product, but when I add a new product the tabs appear again. It seems this only works when updating or after creation.

Is there a way to hide the tabs on creation of the product?

I would like to hide tabs like SEO, Product Discounts and more...which still appear when I add a new product, but are hidden after creation.

Hello, this thread was very helpful. I did everything and had success in hiding all the tabs when editing a product, but when I add a new product the tabs appear again. It seems this only works when updating or after creation.

Is there a way to hide the tabs on creation of the product?

I would like to hide tabs like SEO, Product Discounts and more...which still appear when I add a new product, but are hidden after creation.

Bump, I would like to find out the same!!

Hello, this thread was very helpful. I did everything and had success in hiding all the tabs when editing a product, but when I add a new product the tabs appear again. It seems this only works when updating or after creation.

Is there a way to hide the tabs on creation of the product?

I would like to hide tabs like SEO, Product Discounts and more...which still appear when I add a new product, but are hidden after creation.

For adding products another part of code is used in the same file:

    // [Page sections]
    Registry::set('navigation.tabs', array (
        'detailed' => array (
            'title' => __('general'),
            'js' => true
        ),
        'images' => array (
            'title' => __('images'),
            'js' => true
        ),
        'seo' => array(
            'title' => __('seo'),
            'js' => true
        ),
        'qty_discounts' => array (
            'title' => __('qty_discounts'),
            'js' => true
        ),
        'addons' => array (
            'title' => __('addons'),
            'js' => true
        ),
        'shippings' => array (
            'title' => __('shipping_properties'),
            'js' => true
        ),
    ));
    // [/Page sections]

Just remove unnecessary sections

I am running MV 4.3.10 and amended products.php like before....this means

if ($auth.user_type=="A"){ //tabs for admin
tabs for admin
}
else //do not show all tabs
{

tabs for vendors
}

Now I am getting the warning....

Notice: Use of undefined constant user_type - assumed 'user_type' in app/controllers/backend/products.php on line 502

Anyone an idea how to solve this?

Please try

if ($auth['user_type'] == "A") {

Perfect, thanks it works like that :grin:

We are glad to help you.

So i copied this file:

app/controllers/backend/products.php

Put it in

app/addon/my_changes/controllers/backend/products.php

Modified the copied file, cleared the cache , but cart is not picking up the changes. To be sure I purposely put a syntax error to find out which file cart is picking up and it is picking up original file at app/controllers/backend/products.php

Any ideas on how to force cart to use new copied file?

So i copied this file:

app/controllers/backend/products.php

Put it in

app/addon/my_changes/controllers/backend/products.php

Modified the copied file, cleared the cache , but cart is not picking up the changes. To be sure I purposely put a syntax error to find out which file cart is picking up and it is picking up original file at app/controllers/backend/products.php

Any ideas on how to force cart to use new copied file?

Hello!

You shouldn't copy the file, just create app/addon/my_changes/controllers/backend/products.post.php with the following code:

use Tygh\Registry;

if ($_SERVER[‘REQUEST_METHOD’] == ‘POST’) {
return array(CONTROLLER_STATUS_OK);
}

if ($mode == ‘add’ && Tygh::$app[‘session’][‘auth’][‘user_type’] == ‘V’) {
Registry::del(‘navigation.tabs.qty_discounts’);
} elseif ($mode == ‘update’ && Tygh::$app[‘session’][‘auth’][‘user_type’] == ‘V’) {
Registry::del(‘navigation.tabs.qty_discounts’);
}

You can delete any tab with Registry::del('navigation.tabs.tab_name');

Hello!

You shouldn't copy the file, just create app/addon/my_changes/controllers/backend/products.post.php with the following code:

use Tygh\Registry;

if ($_SERVER[‘REQUEST_METHOD’] == ‘POST’) {
return array(CONTROLLER_STATUS_OK);
}

if ($mode == ‘add’ && Tygh::$app[‘session’][‘auth’][‘user_type’] == ‘V’) {
Registry::del(‘navigation.tabs.qty_discounts’);
} elseif ($mode == ‘update’ && Tygh::$app[‘session’][‘auth’][‘user_type’] == ‘V’) {
Registry::del(‘navigation.tabs.qty_discounts’);
}

You can delete any tab with Registry::del('navigation.tabs.tab_name');

Thank you for your response, did you mean products.php? or products.post.php?

products.post.php is under app/controller/common

products.php is under app/controller/backend

Thank you for your response, did you mean products.php? or products.post.php?

products.post.php is under app/controller/common

products.php is under app/controller/backend

No, you need to remove your app/addon/my_changes/controllers/backend/products.php file and create app/addon/my_changes/controllers/backend/products.post.php file with the code I mentioned.

No, you need to remove your app/addon/my_changes/controllers/backend/products.php file and create app/addon/my_changes/controllers/backend/products.post.php file with the code I mentioned.

Thank you again for the response, I copied exact code in the backend directory with same file name, cleared the cache, but it is still showing qty_discount tab on edit and add product screens.

Thank you again for the response, I copied exact code in the backend directory with same file name, cleared the cache, but it is still showing qty_discount tab on edit and add product screens.

There is a condition for vendors in my code above. So now the tab is removed only for vendors. If you want to remove it for all admins, remove the

 && Tygh::$app['session']['auth']['user_type'] == 'V'

code from both places.

Thank you again for the response, I copied exact code in the backend directory with same file name, cleared the cache, but it is still showing qty_discount tab on edit and add product screens.

Did you check it in the vendor area, not in the admin panel?