How To Disable A Menu Item To The Vendors

Hi,

I have created a new Menu(Connections) in the Admin Panel. It was visible to all types of users {ie., Admin & Vendors}. But i want to disable this Menu(Connections) to the vendors.

Please check the attachment for more clarity.

Anybody please help me to solve my issue.

Regards,

Satya.

image.png

I have created a new Menu(Connections) in the Admin Panel. It was visible to all types of users {ie., Admin & Vendors}. But i want to disable this Menu(Connections) to the vendors.

you can set permission for vendor here : app/schemas/permissions/vendor_multivendor.php

use here controller which you want to block for vendor.

Add the following around the code you want to hide. I.e.

{if !$runtime.company_id} {** include only when company_id is 0 - all vendors **}
  • my list item
  • {/if}

    you can set permission for vendor here : app/schemas/permissions/vendor_multivendor.php

    use here controller which you want to block for vendor.

    Hi Vivek,

    As per your suggestion, I added the following code in app/schemas/permissions/vendor_multivendor.php , Under the 'controllers' array.

    'connections' => array (
    'permissions' => false,
    ),

    But still it is visible for vendors, Please check the attachment and help me to solve the issue.

    Regards,

    Satya.

    image2.png

    Add the following around the code you want to hide. I.e.

    {if !$runtime.company_id} {** include only when company_id is 0 - all vendors **}
    
  • my list item
  • {/if}

    Hi,

    I added the following code in app/schemas/menu/menu.php , But it is not working. Is there any mistake in my code. Please review it and help me to solve the issue.

    if (Registry::get('runtime.company_id')) {

    'connections' => array(
    'items' => array(
    'addons_divider' => array(
    'type' => 'divider',
    'position' => 110,
    ),
    'agents' => array(
    'href' => 'profiles.agts',
    'position' => 200,
    ),
    'manufacturers' => array(
    'href' => 'profiles.mnfs',
    'position' => 300,
    ),
    ),
    'position' => 600,
    );

    }

    Regards,

    Satya.

    I didn't mean for you to add that in the schema. That behaves differently and is cached by the system. My example was for the specific template to prevent the various standard list items from showing. However, you should be able to set this in the schema. I'm not familiar with a 'connections' controller. Suggest you do your settings in the DB like most addons in addition to using your own menu.post.php schema in the addon itself.

    Hi Vivek,

    As per your suggestion, I added the following code in app/schemas/permissions/vendor_multivendor.php , Under the 'controllers' array.

    'connections' => array (
    'permissions' => false,
    ),

    But still it is visible for vendors, Please check the attachment and help me to solve the issue.

    Regards,

    Satya.

    Did you clear cache after the changes were applied? CS-Cart stores all schemas in cache, so the cache should be regenerated in your case

    Did you clear cache after the changes were applied? CS-Cart stores all schemas in cache, so the cache should be regenerated in your case

    Hi eComLabs,

    I cleared the cache also, But still the menu is displaying to the vendors. Please help me to solve the issue.

    Regards,

    Satya.

    Hi eComLabs,

    I cleared the cache also, But still the menu is displaying to the vendors. Please help me to solve the issue.

    Regards,

    Satya.

    Please PM me temporary FTP access

    Please PM me temporary FTP access

    Hi eComLabs,

    I am working in Localhost, I don't have the access of FTP credentials. Please help me to resolve the issue.

    Regards,

    Satya.

    I am afraid, I am not able to help you in this case. The provided solution should work

    You can use css to hide that menu from the vendor console.

    You can use css to hide that menu from the vendor console.

    Hi Screenimages,

    How can i add the css hide property to the Schema file. If it happens, Please provide me the solution. Here is my schema code to generate the Menu in the Admin Panel.

    'connections' => array(
    'items' => array(
    'addons_divider' => array(
    'type' => 'divider',
    'position' => 110,
    ),
    'agents' => array(
    'href' => 'profiles.agts',
    'position' => 200,
    ),
    'manufacturers' => array(
    'href' => 'profiles.mnfs',
    'position' => 300,
    ),
    ),
    'position' => 600,
    );

    Regards,

    Satya.

    Hi,

    I added the following code in app/schemas/menu/menu.php , But it is not working. Is there any mistake in my code. Please review it and help me to solve the issue.

    if (Registry::get('runtime.company_id')) {

    'connections' => array(
    'items' => array(
    'addons_divider' => array(
    'type' => 'divider',
    'position' => 110,
    ),
    'agents' => array(
    'href' => 'profiles.agts',
    'position' => 200,
    ),
    'manufacturers' => array(
    'href' => 'profiles.mnfs',
    'position' => 300,
    ),
    ),
    'position' => 600,
    );

    }

    Regards,

    Satya.

    Hi Satya. I was just playing around with this myself and I think I have the solution if you're still having this issue. I think it will work if you change the following:

    if (Registry::get('runtime.company_id')) 

    to

    if (!Registry::get('runtime.company_id')) 

    If I am correct, the code effectively is saying "if vendor, show the following menu" and by adding the "!" it should now be "if not vendor, show the following menu". However, I'm not sure about the all the caching stuff, so not sure if that could still be an issue.

    Good luck.

    Hi Satya. I was just playing around with this myself and I think I have the solution if you're still having this issue. I think it will work if you change the following:

    if (Registry::get('runtime.company_id')) 

    to

    if (!Registry::get('runtime.company_id')) 

    If I am correct, the code effectively is saying "if vendor, show the following menu" and by adding the "!" it should now be "if not vendor, show the following menu". However, I'm not sure about the all the caching stuff, so not sure if that could still be an issue.

    Good luck.

    Hi Arteeni,

    Thanks for your help , Issue is resolved with a small modification in the code.

    Regards,

    Satya.