Jump to content

Remove seo tab from admin product section


deepa

Recommended Posts

I want to remove some tabs from product admin section for some level of users like for employees, for that i have modified the following code:

 

 

$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 have removed the suppliers, attachments, customisation, features,shipping successfully. Now they are not appearing in the backend. But when i try to remove the seo tab, my product section stops working. Please tell me what else i need to modify in order to remove this seo tab.

 

 

Thanks in advance.

Edited by deepa (see edit history)
Link to comment
Share on other sites

Hi Deepa,

What message/error do you get when doing this? If no error seen, can you turn on debug mode

(http://www.prestashop.com/forums/topic/224525-how-to-turn-on-error-reporting-for-debug-information/)

 

and see if you get any message? I can imagine it complains about the friendly URL, as this may be a required field (Maybe only when using Friendly URL mode?? Not sure about that), so then you have to fill this automatically in the background when saving the product.

 

 

My 2 cents,

pascal.

Link to comment
Share on other sites

Thanks for your reply :)

 

When i tried to remove the SEO tab from the above code, i did not get any error. But the textbox for the products name becomes disabled(could not enter anything in it). None of the fields in SEO tab is mandatory. Then what can be the problem?

However i am successfully able to remove other tabs from here like Shipping, suppliers, etc.

 

 

Regards

Link to comment
Share on other sites

  • 2 weeks later...

Think you have to do three things to make it possible:

 

in controllers/admin/AdminProductsController.php (make backup, just in case):

 

 

        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,*/                       <-- comment out this line, to remove the tab itself (think you did already)
                'Associations' => 3,
                'Images' => 9,
                'ImagesAlt' => 10,
                'Shipping' => 4,
                'Combinations' => 5,
                'Features' => 11,
                'Customization' => 12,
                'Attachments' => 13,
                'Suppliers' => 14,
            ));
 

 

then, in classes/Product.php: (make backup!)

 

    public static $definition = array(
        'table' => 'product',
        'primary' => 'id_product',
         ....

            'link_rewrite' =>  array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isLinkRewrite',

                                       'required' => false, 'size' => 128),              <-- change true to false, to make it non-required
 

 

 

finally, in:

<your ADMIN folder>/themes/default/template/controllers/products/informations.tpl (Make backup!!)

 

    {* global information *}
        <tr>
            <td class="col-left">
                {include file="controllers/products/multishop/checkbox.tpl" field="name" type="default" multilang="true"}
                <label>{l s='Name:'}</label>
            </td>
            <td style="padding-bottom:5px;" class="translatable">
            {foreach from=$languages item=language}
                <div class="lang_{$language.id_lang}" style="{if !$language.is_default}display: none;{/if} float: left;">
                        <input class="{$class_input_ajax}{if !$product->id}copy2friendlyUrl{/if} updateCurrentText" size="43" type="text" {*{if !$product->id}disabled="disabled"{/if}*}         <-- comment out this piece of code
                        id="name_{$language.id_lang}" name="name_{$language.id_lang}"
                        value="{$product->name[$language.id_lang]|htmlentitiesUTF8|default:''}"/><sup> *</sup>
                    <span class="hint" name="help_box">{l s='Invalid characters:'} <>;=#{}<span class="hint-pointer"> </span>
                    </span>
                </div>
            {/foreach}
            </td>
        </tr>
 

 

That should do the trick, give it a try :-)

 

pascal.

Link to comment
Share on other sites

Hi Pascal,

 

Thanks for your response.

 

I have made changes in the above files as you said. And yes now it is working fine.

 

But a confirmation, if i comment out the line in <your ADMIN folder>/themes/default/template/controllers/products/informations.tpl file, would it have some side effect in product edit mode or may be this should be commented only?

 

 

 

Thanks

Link to comment
Share on other sites

The change in informations.tpl makes the Name field editable, independent of anything (I believe it used to be shortly disabled, when it was a new product, when updating of the friendly URL. This seems unnecessary, as you took out the SEO tab.

 

I don't see any side effect, but to make sure, just play with it a little bit to see if you bump into something, when being an admininstratior AND when begin a limited user without SEO tab.

 

pascal.

Link to comment
Share on other sites

Hi Pascal,

 

Again i found a issue in the same thing.

 

As per your instructions i modified the code to enable the textbox of products name. But this is giving me a new problem, now the textbox is enabled but the save button in toolbar is not appearing and i am not able to save the products :(

You can also try this at your end. Please help.

 

 

 

Thanks

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...