Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Hiding Vendor Menu Items Rate Topic   - - - - -

 
  • shanower
  • Advanced Member
  • Members
  • Join Date: 27-Jul 19
  • 73 posts

Posted 19 May 2021 - 01:51 PM #81

Hi!

 

I made a small change in the last line (change true to false) and now it is working. How to remove pages from menu but not blog:

$schema['controllers']['pages'] = [
    'modes' => [
         'manage' => [
                   'param_permissions' => [
                        'page_type' => [
                            'B' => true,
                        ],
                        'default_permission' => false,
                    ]
        ],
    ],
    'permissions' => false
];


 
  • shanower
  • Advanced Member
  • Members
  • Join Date: 27-Jul 19
  • 73 posts

Posted 19 May 2021 - 02:23 PM #82

I checked the results better and the code solved a part of problem.

 

In fact it hide the page menu and allow to see blogs, but now vendors are unable to create blogs.

 

Using the following code make the add blog button appear again, but when you click on it, you receive a 403 error. Trying to figure out how to make it work again:

$schema['controllers']['pages'] = [
    'modes' => [
         'manage' => [
                   'param_permissions' => [
                        'page_type' => [
                            'B' => true,
                        ],
                        'default_permission' => false,
                    ],
        ],
    ],
    'permissions' => ['GET' => false, 'POST' => true]
];


 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 21984 posts

Posted 20 May 2021 - 07:00 AM #83

Try to play with permission for modes. For example, set permissions to true for the add and update mode


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      Multi-Vendor Ultimate       USD 7500 (6000)

 
  • shanower
  • Advanced Member
  • Members
  • Join Date: 27-Jul 19
  • 73 posts

Posted 20 May 2021 - 03:05 PM #84

I tried, but seems that is not possible to disable only pages without impact blog funcionality. Seems that in someway the "update" mode require that "get" is enabled and this is causing a 403 when trying to edit a blog. The same doesnt occur with the "add" mode. Here is the last code: 

$schema['controllers']['pages'] = [
    'modes' => [
         'manage' => [
                   'param_permissions' => [
                        'page_type' => [
                            'B' => true,
                        ],
                        'default_permission' => false,
                    ],
        ],
        'update' => [
                   'param_permissions' => [
                        'page_type' => [
                            'B' => true,
                        ],
                        'default_permission' => false,
                    ],
        ],
        'add' => [
                   'param_permissions' => [
                        'page_type' => [
                            'B' => true,
                        ],
                        'default_permission' => false,
                    ],
        ],
        'view' => [
                   'param_permissions' => [
                        'page_type' => [
                            'B' => true,
                        ],
                        'default_permission' => false,
                    ],
        ],
    ],
    'permissions' => ['GET' => false, 'POST' => true]
];


 
  • shanower
  • Advanced Member
  • Members
  • Join Date: 27-Jul 19
  • 73 posts

Posted 21 May 2021 - 02:33 AM #85

As I couldnt hide the pages menu using the permission file, I used another method.

 

I created a new menu_multivendor.post.php in app/addons/my_changes/schemas/menu then I used the following code:

<?php 

/* Hide Pages Menu From Vendor */

$schema['central']['website']['items']['pages'] = false;

return $schema;

Would be better find a way to block using permission, but for those just interested in to hide the menu this would work.