Notes

Hide Menu Item/Link If User does not have Permission - OpenCart 2.1.0.2

Edit on GitHub

OpenCart
18 minutes

Right now, if you edit a User Group and take away permissions for some areas, it still shows the areas in the menu. Meaning, the person can see all the areas, knows he wasn’t allowed access and get’s a not allowed message when he clicks on the menu link.

Ideally, if a user has no access to a menu, he should not see it to begin with. OpenCart should hide the menu item automatically if user doesn’t have permission to View it.

The solution for OpenCart 2.1.0.2 is editing the admin/view/template/common/menu.tpl file via OCMOD and adding checks to every single menu item to see if the user has access to view it. If yes, show the item. If not, hide it.

There are plenty of OCMOD files are available for this in the OpenCart marketplace. I tried one but it still left out some areas (Extensions > Captcha, Extensions > Analytics etc.)

Another issue is hiding 3rd-party modules from menu (e.g. Abandoned Carts, POS etc.). You’ll have to edit their accompanying OCMOD files to edit the part where they add a menu link and add a user access check to it as well. (Maybe you can have one OCMOD file deditcated to menu links?)

The code to check for access is

1<?php
2global $registry; $userac = $registry->get('user');
3
4// if ($userac -> hasPermission('access', 'link')) { ?>
5if($userac->hasPermission('access','catalog/category')) {  ?> // e.g. look for access to Catalog > Category
6	// do something
7<?php } ?>

To hide/show a menu item, you’ll do:

1global $registry; $userac = $registry->get('user');
2if($userac->hasPermission('access','catalog/category')) {  ?>
3  <li><a href="<?php echo $category; ?>"><?php echo $text_category; ?></a></li>
4<?php } ?>

And as far as OpenCart 2.1.0.2 goes, you gotta do this for ALL THE MENU ITEMS. Things in 2.3.0.2 seems to have changed a bit. The file containing the code for menu is admin/view/template/common/column_left.tpl and it uses a loop for displaying menu, so you should not have to repeat your code much.

Here’s the complete ocmod file

  1<?xml version="1.0" encoding="UTF-8"?>
  2<modification>
  3	<name>Hide Menu if Not Permitted</name>
  4	<code>not_permitted_menu_hide_in_admin</code>
  5	<version>1.2</version>
  6	<author><![CDATA[Sparx & Aamnah]]></author>
  7	<link><![CDATA[https://www.opencart.com/index.php?route=marketplace/extension/info&extension_id=23615]]></link>
  8	<file path="admin/view/template/common/menu.tpl">
  9		<operation>
 10			<search ><![CDATA[
 11                        <li><a href="<?php echo $category; ?>"><?php echo $text_category; ?></a></li>
 12			]]></search>
 13			<add position="replace"><![CDATA[
 14                        <?php 
 15						global $registry; $userac = $registry->get('user');
 16						if($userac->hasPermission('access','catalog/category')) {  ?>
 17                        <li><a href="<?php echo $category; ?>"><?php echo $text_category; ?></a></li>
 18                        <?php } ?>
 19			]]></add>
 20		</operation>
 21		<operation>
 22			<search><![CDATA[
 23                        <li><a href="<?php echo $attribute; ?>"><?php echo $text_attribute; ?></a></li>                        
 24			]]></search>
 25			<add position="replace"><![CDATA[
 26                        <?php if($userac->hasPermission('access','catalog/attribute')) { ?>
 27                        <li><a href="<?php echo $attribute; ?>"><?php echo $text_attribute; ?></a></li>
 28                        <?php } ?>
 29			]]></add>
 30		</operation>
 31		<operation>
 32			<search ><![CDATA[
 33                        <li><a href="<?php echo $product; ?>"><?php echo $text_product; ?></a></li>
 34			]]></search>
 35			<add position="replace"><![CDATA[
 36                        <?php if($userac->hasPermission('access','catalog/product')) {  ?>
 37                        <li><a href="<?php echo $product; ?>"><?php echo $text_product; ?></a></li>
 38                        <?php } ?>
 39			]]></add>
 40		</operation>
 41                <operation>
 42			<search ><![CDATA[
 43                        <li><a href="<?php echo $recurring; ?>"><?php echo $text_recurring; ?></a></li>
 44			]]></search>
 45			<add position="replace"><![CDATA[
 46                        <?php if($userac->hasPermission('access','catalog/recurring')) {  ?>
 47                        <li><a href="<?php echo $recurring; ?>"><?php echo $text_recurring; ?></a></li>
 48                        <?php } ?>
 49			]]></add>
 50		</operation>
 51		<operation>
 52			<search><![CDATA[
 53                        <li><a href="<?php echo $attribute_group; ?>"><?php echo $text_attribute_group; ?></a></li>
 54			]]></search>
 55			<add position="replace"><![CDATA[
 56                        <?php if($userac->hasPermission('access','catalog/attribute_group')) { ?>
 57                        <li><a href="<?php echo $attribute_group; ?>"><?php echo $text_attribute_group; ?></a></li>
 58                        <?php } ?>
 59			]]></add>
 60		</operation>
 61		<operation>
 62			<search><![CDATA[
 63                        <li><a href="<?php echo $option; ?>"><?php echo $text_option; ?></a></li>
 64			]]></search>
 65			<add position="replace"><![CDATA[
 66                        <?php if($userac->hasPermission('access','catalog/option')) {  ?>
 67                        <li><a href="<?php echo $option; ?>"><?php echo $text_option; ?></a></li>
 68                        <?php } ?>
 69			]]></add>
 70		</operation>
 71		<operation>
 72			<search><![CDATA[
 73                        <li><a href="<?php echo $manufacturer; ?>"><?php echo $text_manufacturer; ?></a></li>
 74			]]></search>
 75			<add position="replace"><![CDATA[
 76                        <?php if($userac->hasPermission('access','catalog/manufacturer')) {  ?>
 77                        <li><a href="<?php echo $manufacturer; ?>"><?php echo $text_manufacturer; ?></a></li>
 78                        <?php } ?>
 79			]]></add>
 80		</operation>
 81		<operation>
 82			<search><![CDATA[
 83                        <li><a href="<?php echo $download; ?>"><?php echo $text_download; ?></a></li>
 84			]]></search>
 85			<add position="replace"><![CDATA[
 86                        <?php if($userac->hasPermission('access','catalog/download')) {  ?>
 87                        <li><a href="<?php echo $download; ?>"><?php echo $text_download; ?></a></li>
 88                        <?php } ?>
 89			]]></add>
 90		</operation>
 91		<operation>
 92			<search><![CDATA[
 93                        <li><a href="<?php echo $review; ?>"><?php echo $text_review; ?></a></li>
 94			]]></search>
 95			<add position="replace"><![CDATA[
 96                        <?php if($userac->hasPermission('access','catalog/review')) {  ?>
 97                        <li><a href="<?php echo $review; ?>"><?php echo $text_review; ?></a></li>
 98                        <?php } ?>
 99			]]></add>
100		</operation>
101		<operation>
102			<search><![CDATA[
103                        <li><a href="<?php echo $information; ?>"><?php echo $text_information; ?></a></li>
104			]]></search>
105			<add position="replace"><![CDATA[
106                        <?php if($userac->hasPermission('access','catalog/information')) {  ?>
107                        <li><a href="<?php echo $information; ?>"><?php echo $text_information; ?></a></li>
108                        <?php } ?>
109			]]></add>
110		</operation>
111		<operation>
112			<search><![CDATA[
113                        <li><a href="<?php echo $filter; ?>"><?php echo $text_filter; ?></a></li>
114			]]></search>
115			<add position="replace"><![CDATA[
116                        <?php if($userac->hasPermission('access','catalog/filter')) {  ?>
117                        <li><a href="<?php echo $filter; ?>"><?php echo $text_filter; ?></a></li>
118                        <?php } ?>
119			]]></add>
120		</operation>
121		<operation>
122			<search><![CDATA[
123                         <li><a href="<?php echo $installer; ?>"><?php echo $text_installer; ?></a></li>
124			]]></search>
125			<add position="replace"><![CDATA[
126                        <?php if($userac->hasPermission('access','extension/installer')) {  ?>
127                         <li><a href="<?php echo $installer; ?>"><?php echo $text_installer; ?></a></li>
128                        <?php } ?>
129			]]></add>
130		</operation>
131		<operation>
132			<search><![CDATA[
133                         <li><a href="<?php echo $modification; ?>"><?php echo $text_modification; ?></a></li>
134			]]></search>
135			<add position="replace"><![CDATA[
136                        <?php if($userac->hasPermission('access','extension/modification')) {  ?>
137                         <li><a href="<?php echo $modification; ?>"><?php echo $text_modification; ?></a></li>
138                        <?php } ?>
139			]]></add>
140		</operation>
141		<operation>
142			<search><![CDATA[
143                         <li><a href="<?php echo $analytics; ?>"><?php echo $text_analytics; ?></a></li>
144			]]></search>
145			<add position="replace"><![CDATA[
146                        <?php if($userac->hasPermission('access','extension/analytics')) {  ?>
147                         <li><a href="<?php echo $analytics; ?>"><?php echo $text_analytics; ?></a></li>
148                        <?php } ?>
149			]]></add>
150		</operation>
151		<operation>
152			<search><![CDATA[
153                         <li><a href="<?php echo $captcha; ?>"><?php echo $text_captcha; ?></a></li>
154			]]></search>
155			<add position="replace"><![CDATA[
156                        <?php if($userac->hasPermission('access','extension/captcha')) {  ?>
157                         <li><a href="<?php echo $captcha; ?>"><?php echo $text_captcha; ?></a></li>
158                        <?php } ?>
159			]]></add>
160		</operation>
161		<operation>
162			<search><![CDATA[
163                        <li><a href="<?php echo $module; ?>"><?php echo $text_module; ?></a></li>
164			]]></search>
165			<add position="replace"><![CDATA[
166                        <?php if($userac->hasPermission('access','extension/module')) {  ?>
167                        <li><a href="<?php echo $module; ?>"><?php echo $text_module; ?></a></li>
168                        <?php } ?>
169			]]></add>
170		</operation>
171		<operation>
172			<search><![CDATA[
173                        <li><a href="<?php echo $shipping; ?>"><?php echo $text_shipping; ?></a></li>
174			]]></search>
175			<add position="replace"><![CDATA[
176                        <?php if($userac->hasPermission('access','extension/shipping')) {  ?>
177                        <li><a href="<?php echo $shipping; ?>"><?php echo $text_shipping; ?></a></li>
178                        <?php } ?>
179			]]></add>
180		</operation>
181		<operation>
182			<search><![CDATA[
183                        <li><a href="<?php echo $payment; ?>"><?php echo $text_payment; ?></a></li>
184			]]></search>
185			<add position="replace"><![CDATA[
186                        <?php if($userac->hasPermission('access','extension/payment')) {  ?>
187                        <li><a href="<?php echo $payment; ?>"><?php echo $text_payment; ?></a></li>
188                        <?php } ?>
189			]]></add>
190		</operation>
191		<operation>
192			<search><![CDATA[
193                        <li><a href="<?php echo $total; ?>"><?php echo $text_total; ?></a></li>
194			]]></search>
195			<add position="replace"><![CDATA[
196                        <?php if($userac->hasPermission('access','extension/total')) {  ?>
197                        <li><a href="<?php echo $total; ?>"><?php echo $text_total; ?></a></li>
198                        <?php } ?>
199			]]></add>
200		</operation>
201		<operation>
202			<search><![CDATA[
203                        <li><a href="<?php echo $feed; ?>"><?php echo $text_feed; ?></a></li>
204			]]></search>
205			<add position="replace"><![CDATA[
206                        <?php if($userac->hasPermission('access','extension/feed')) {  ?>
207                        <li><a href="<?php echo $feed; ?>"><?php echo $text_feed; ?></a></li>
208                        <?php } ?>
209			]]></add>
210		</operation>
211		<operation>
212			<search><![CDATA[
213                        <li><a href="<?php echo $fraud; ?>"><?php echo $text_fraud; ?></a></li>
214			]]></search>
215			<add position="replace"><![CDATA[
216                        <?php if($userac->hasPermission('access','extension/fraud')) {  ?>
217                        <li><a href="<?php echo $fraud; ?>"><?php echo $text_fraud; ?></a></li>
218                        <?php } ?>
219			]]></add>
220		</operation>
221		<operation>
222			<search><![CDATA[
223                        <li><a href="<?php echo $order; ?>"><?php echo $text_order; ?></a></li>
224			]]></search>
225			<add position="replace"><![CDATA[
226                        <?php if($userac->hasPermission('access','sale/order')) {  ?>
227                        <li><a href="<?php echo $order; ?>"><?php echo $text_order; ?></a></li>
228                        <?php } ?>
229			]]></add>
230		</operation>
231		<operation>
232			<search><![CDATA[
233                        <li><a href="<?php echo $order_recurring; ?>"><?php echo $text_order_recurring; ?></a></li>
234			]]></search>
235			<add position="replace"><![CDATA[
236                        <?php if($userac->hasPermission('access','sale/recurring')) {  ?>
237                        <li><a href="<?php echo $order_recurring; ?>"><?php echo $text_order_recurring; ?></a></li>
238                        <?php } ?>
239			]]></add>
240		</operation>
241		<operation>
242			<search><![CDATA[
243                        <li><a href="<?php echo $return; ?>"><?php echo $text_return; ?></a></li>
244			]]></search>
245			<add position="replace"><![CDATA[
246                        <?php if($userac->hasPermission('access','sale/return')) {  ?>
247                        <li><a href="<?php echo $return; ?>"><?php echo $text_return; ?></a></li>
248                        <?php } ?>
249			]]></add>
250		</operation>
251		<operation>
252			<search><![CDATA[
253                        <li><a href="<?php echo $customer; ?>"><?php echo $text_customer; ?></a></li>
254			]]></search>
255			<add position="replace"><![CDATA[
256                        <?php if($userac->hasPermission('access','sale/customer')) { ?>
257                        <li><a href="<?php echo $customer; ?>"><?php echo $text_customer; ?></a></li>
258                        <?php } ?>
259			]]></add>
260		</operation>
261		<operation>
262			<search><![CDATA[
263                        <li><a href="<?php echo $customer_group; ?>"><?php echo $text_customer_group; ?></a></li>
264			]]></search>
265			<add position="replace"><![CDATA[
266                        <?php if($userac->hasPermission('access','sale/customer_group')) { ?>
267                        <li><a href="<?php echo $customer_group; ?>"><?php echo $text_customer_group; ?></a></li>
268                        <?php } ?>
269			]]></add>
270		</operation>
271		<operation>
272			<search><![CDATA[
273			<li><a href="<?php echo $customer_ban_ip; ?>"><?php echo $text_customer_ban_ip; ?></a></li>
274			]]></search>
275			<add position="replace"><![CDATA[
276                        <?php if($userac->hasPermission('access','sale/customer_ban_ip')) { ?>
277			<li><a href="<?php echo $customer_ban_ip; ?>"><?php echo $text_customer_ban_ip; ?></a></li>
278                        <?php } ?>
279			]]></add>
280		</operation>
281		<operation>
282			<search><![CDATA[
283			<li><a href="<?php echo $custom_field; ?>"><?php echo $text_custom_field; ?></a></li>
284			]]></search>
285			<add position="replace"><![CDATA[
286                        <?php if($userac->hasPermission('access','sale/custom_field')) { ?>
287			<li><a href="<?php echo $custom_field; ?>"><?php echo $text_custom_field; ?></a></li>
288                        <?php } ?>
289			]]></add>
290		</operation>
291		<operation>
292			<search><![CDATA[
293                        <li><a href="<?php echo $affiliate; ?>"><?php echo $text_affiliate; ?></a></li>
294			]]></search>
295			<add position="replace"><![CDATA[
296                        <?php if($userac->hasPermission('access','marketing/affiliate')) {  ?>
297                        <li><a href="<?php echo $affiliate; ?>"><?php echo $text_affiliate; ?></a></li>
298                        <?php } ?>
299			]]></add>
300		</operation>
301		<operation>
302			<search><![CDATA[
303                        <li><a href="<?php echo $coupon; ?>"><?php echo $text_coupon; ?></a></li>
304			]]></search>
305			<add position="replace"><![CDATA[
306                        <?php if($userac->hasPermission('access','marketing/coupon')) {  ?>
307                        <li><a href="<?php echo $coupon; ?>"><?php echo $text_coupon; ?></a></li>
308                        <?php } ?>
309			]]></add>
310		</operation>
311		<operation>
312			<search><![CDATA[
313                        <li><a href="<?php echo $voucher; ?>"><?php echo $text_voucher; ?></a></li>
314			]]></search>
315			<add position="replace"><![CDATA[
316                        <?php if($userac->hasPermission('access','sale/voucher')) { ?>
317                        <li><a href="<?php echo $voucher; ?>"><?php echo $text_voucher; ?></a></li>
318                        <?php } ?>
319			]]></add>
320		</operation>
321		<operation>
322			<search><![CDATA[
323                        <li><a href="<?php echo $voucher_theme; ?>"><?php echo $text_voucher_theme; ?></a></li>
324			]]></search>
325			<add position="replace"><![CDATA[
326                        <?php if($userac->hasPermission('access','sale/voucher_theme')) { ?>
327                        <li><a href="<?php echo $voucher_theme; ?>"><?php echo $text_voucher_theme; ?></a></li>
328                        <?php } ?>
329			]]></add>
330		</operation>
331		<operation>
332			<search><![CDATA[
333                        <li><a class="parent"><?php echo $text_paypal ?></a>
334			]]></search>
335			<add position="replace" offset="4"><![CDATA[
336                        <?php if($userac->hasPermission('access','payment/pp_express')) { ?>
337                         <li><a class="parent"><?php echo $text_paypal ?></a>
338                            <ul>
339                              <li><a href="<?php echo $paypal_search ?>"><?php echo $text_paypal_search ?></a></li>
340                            </ul>
341                          </li>
342                        <?php } ?>
343			]]></add>
344		</operation>
345		<operation>
346			<search><![CDATA[
347                        <li><a href="<?php echo $marketing; ?>"><?php echo $text_marketing; ?></a></li>
348			]]></search>
349			<add position="replace"><![CDATA[
350                        <?php if($userac->hasPermission('access','marketing/marketing')) {  ?>
351                        <li><a href="<?php echo $marketing; ?>"><?php echo $text_marketing; ?></a></li>
352                        <?php } ?>
353			]]></add>
354		</operation>
355		<operation>
356			<search><![CDATA[
357                        <li><a href="<?php echo $contact; ?>"><?php echo $text_contact; ?></a></li>
358			]]></search>
359			<add position="replace"><![CDATA[
360                        <?php if($userac->hasPermission('access','marketing/contact')) {  ?>
361                        <li><a href="<?php echo $contact; ?>"><?php echo $text_contact; ?></a></li>
362                        <?php } ?>
363			]]></add>
364		</operation>
365		<operation>
366			<search><![CDATA[
367                        <li><a href="<?php echo $setting; ?>"><?php echo $text_setting; ?></a></li>
368			]]></search>
369			<add position="replace"><![CDATA[
370                        <?php if($userac->hasPermission('access','setting/setting')) { ?>
371                        <li><a href="<?php echo $setting; ?>"><?php echo $text_setting; ?></a></li>
372                        <?php } ?>
373			]]></add>
374		</operation>
375		<operation>
376			<search><![CDATA[
377                        <li><a href="<?php echo $layout; ?>"><?php echo $text_layout; ?></a></li>
378			]]></search>
379			<add position="replace"><![CDATA[
380                        <?php if($userac->hasPermission('access','design/layout')) { ?>
381                        <li><a href="<?php echo $layout; ?>"><?php echo $text_layout; ?></a></li>
382                        <?php } ?>
383			]]></add>
384		</operation>
385		<operation>
386			<search><![CDATA[
387                        <li><a href="<?php echo $banner; ?>"><?php echo $text_banner; ?></a></li>
388			]]></search>
389			<add position="replace"><![CDATA[
390                        <?php if($userac->hasPermission('access','design/banner')) { ?>
391                        <li><a href="<?php echo $banner; ?>"><?php echo $text_banner; ?></a></li>
392                        <?php } ?>
393			]]></add>
394		</operation>
395		<operation>
396			<search><![CDATA[
397                        <li><a href="<?php echo $user; ?>"><?php echo $text_user; ?></a></li>
398			]]></search>
399			<add position="replace"><![CDATA[
400                        <?php if($userac->hasPermission('access','user/user')) { ?>
401                        <li><a href="<?php echo $user; ?>"><?php echo $text_user; ?></a></li>
402                        <?php } ?>
403			]]></add>
404		</operation>
405		<operation>
406			<search><![CDATA[
407                        <li><a href="<?php echo $api; ?>"><?php echo $text_api; ?></a></li>
408			]]></search>
409			<add position="replace"><![CDATA[
410                        <?php if($userac->hasPermission('access','user/api')) { ?>
411                        <li><a href="<?php echo $api; ?>"><?php echo $text_api; ?></a></li>
412                        <?php } ?>
413			]]></add>
414		</operation>
415		<operation>
416			<search><![CDATA[
417                        <li><a href="<?php echo $user_group; ?>"><?php echo $text_user_group; ?></a></li>
418			]]></search>
419			<add position="replace"><![CDATA[
420                        <?php if($userac->hasPermission('access','user/user_permission')) { ?>
421                        <li><a href="<?php echo $user_group; ?>"><?php echo $text_user_group; ?></a></li>
422                        <?php } ?>
423			]]></add>
424		</operation>
425		<operation>
426			<search><![CDATA[
427                        <li><a href="<?php echo $location; ?>"><?php echo $text_location; ?></a></li>
428			]]></search>
429			<add position="replace"><![CDATA[
430                        <?php if($userac->hasPermission('access','localisation/location')) { ?>
431                        <li><a href="<?php echo $location; ?>"><?php echo $text_location; ?></a></li>
432                        <?php } ?>
433			]]></add>
434		</operation>
435		<operation>
436			<search><![CDATA[
437                        <li><a href="<?php echo $language; ?>"><?php echo $text_language; ?></a></li>
438			]]></search>
439			<add position="replace"><![CDATA[
440                        <?php if($userac->hasPermission('access','localisation/language')) { ?>
441                        <li><a href="<?php echo $language; ?>"><?php echo $text_language; ?></a></li>
442                        <?php } ?>
443			]]></add>
444		</operation>
445		<operation>
446			<search><![CDATA[
447                        <li><a href="<?php echo $currency; ?>"><?php echo $text_currency; ?></a></li>
448			]]></search>
449			<add position="replace"><![CDATA[
450                        <?php if($userac->hasPermission('access','localisation/currency')) { ?>
451                        <li><a href="<?php echo $currency; ?>"><?php echo $text_currency; ?></a></li>
452                        <?php } ?>
453			]]></add>
454		</operation>
455		<operation>
456			<search><![CDATA[
457                        <li><a href="<?php echo $stock_status; ?>"><?php echo $text_stock_status; ?></a></li>
458			]]></search>
459			<add position="replace"><![CDATA[
460                        <?php if($userac->hasPermission('access','localisation/stock_status')) { ?>
461                        <li><a href="<?php echo $stock_status; ?>"><?php echo $text_stock_status; ?></a></li>
462                        <?php } ?>
463			]]></add>
464		</operation>
465		<operation>
466			<search><![CDATA[
467                        <li><a href="<?php echo $order_status; ?>"><?php echo $text_order_status; ?></a></li>
468			]]></search>
469			<add position="replace"><![CDATA[
470                        <?php if($userac->hasPermission('access','localisation/order_status')) { ?>
471                        <li><a href="<?php echo $order_status; ?>"><?php echo $text_order_status; ?></a></li>
472                        <?php } ?>
473			]]></add>
474		</operation>
475		<operation>
476			<search><![CDATA[
477                        <li><a href="<?php echo $return_status; ?>"><?php echo $text_return_status; ?></a></li>
478			]]></search>
479			<add position="replace"><![CDATA[
480                        <?php if($userac->hasPermission('access','localisation/return_status')) { ?>
481                        <li><a href="<?php echo $return_status; ?>"><?php echo $text_return_status; ?></a></li>
482                        <?php } ?>
483			]]></add>
484		</operation>
485		<operation>
486			<search><![CDATA[
487                        <li><a href="<?php echo $return_action; ?>"><?php echo $text_return_action; ?></a></li>
488			]]></search>
489			<add position="replace"><![CDATA[
490                        <?php if($userac->hasPermission('access','localisation/return_action')) { ?>
491                        <li><a href="<?php echo $return_action; ?>"><?php echo $text_return_action; ?></a></li>
492                        <?php } ?>
493			]]></add>
494		</operation>
495		<operation>
496			<search><![CDATA[
497                        <li><a href="<?php echo $return_reason; ?>"><?php echo $text_return_reason; ?></a></li>
498			]]></search>
499			<add position="replace"><![CDATA[
500                        <?php if($userac->hasPermission('access','localisation/return_reason')) { ?>
501                        <li><a href="<?php echo $return_reason; ?>"><?php echo $text_return_reason; ?></a></li>
502                        <?php } ?>
503			]]></add>
504		</operation>
505		<operation>
506			<search><![CDATA[
507                        <li><a href="<?php echo $country; ?>"><?php echo $text_country; ?></a></li>
508			]]></search>
509			<add position="replace"><![CDATA[
510                        <?php if($userac->hasPermission('access','localisation/country')) { ?>
511                        <li><a href="<?php echo $country; ?>"><?php echo $text_country; ?></a></li>
512                        <?php } ?>
513			]]></add>
514		</operation>
515		<operation>
516			<search><![CDATA[
517                        <li><a href="<?php echo $zone; ?>"><?php echo $text_zone; ?></a></li>
518			]]></search>
519			<add position="replace"><![CDATA[
520                        <?php if($userac->hasPermission('access','localisation/zone')) { ?>
521                        <li><a href="<?php echo $zone; ?>"><?php echo $text_zone; ?></a></li>
522                        <?php } ?>
523			]]></add>
524		</operation>
525		<operation>
526			<search><![CDATA[
527                        <li><a href="<?php echo $geo_zone; ?>"><?php echo $text_geo_zone; ?></a></li>
528			]]></search>
529			<add position="replace"><![CDATA[
530                        <?php if($userac->hasPermission('access','localisation/geo_zone')) { ?>
531                        <li><a href="<?php echo $geo_zone; ?>"><?php echo $text_geo_zone; ?></a></li>
532                        <?php } ?>
533			]]></add>
534		</operation>
535		<operation>
536			<search><![CDATA[
537                        <li><a href="<?php echo $tax_class; ?>"><?php echo $text_tax_class; ?></a></li>
538			]]></search>
539			<add position="replace"><![CDATA[
540                        <?php if($userac->hasPermission('access','localisation/tax_class')) { ?>
541                        <li><a href="<?php echo $tax_class; ?>"><?php echo $text_tax_class; ?></a></li>
542                        <?php } ?>
543			]]></add>
544		</operation>
545		<operation>
546			<search><![CDATA[
547                        <li><a href="<?php echo $tax_rate; ?>"><?php echo $text_tax_rate; ?></a></li>
548			]]></search>
549			<add position="replace"><![CDATA[
550                        <?php if($userac->hasPermission('access','localisation/tax_rate')) { ?>
551                        <li><a href="<?php echo $tax_rate; ?>"><?php echo $text_tax_rate; ?></a></li>
552                        <?php } ?>
553			]]></add>
554		</operation>
555		<operation>
556			<search><![CDATA[
557                        <li><a href="<?php echo $length_class; ?>"><?php echo $text_length_class; ?></a></li>
558			]]></search>
559			<add position="replace"><![CDATA[
560                        <?php if($userac->hasPermission('access','localisation/length_class')) { ?>
561                        <li><a href="<?php echo $length_class; ?>"><?php echo $text_length_class; ?></a></li>
562                        <?php } ?>
563			]]></add>
564		</operation>
565		<operation>
566			<search><![CDATA[
567                        <li><a href="<?php echo $weight_class; ?>"><?php echo $text_weight_class; ?></a></li>
568			]]></search>
569			<add position="replace"><![CDATA[
570                        <?php if($userac->hasPermission('access','localisation/weight_class')) { ?>
571                        <li><a href="<?php echo $weight_class; ?>"><?php echo $text_weight_class; ?></a></li>
572                        <?php } ?>
573			]]></add>
574		</operation>
575		<operation>
576			<search><![CDATA[
577                        <li><a href="<?php echo $upload; ?>"><?php echo $text_upload; ?></a></li>
578			]]></search>
579			<add position="replace"><![CDATA[
580                        <?php if($userac->hasPermission('access','tool/upload')) {?>
581                        <li><a href="<?php echo $upload; ?>"><?php echo $text_upload; ?></a></li>
582                        <?php } ?>
583			]]></add>
584		</operation>
585		<operation>
586			<search><![CDATA[
587                        <li><a href="<?php echo $error_log; ?>"><?php echo $text_error_log; ?></a></li>
588			]]></search>
589			<add position="replace"><![CDATA[
590                        <?php if($userac->hasPermission('access','tool/error_log')) {?>
591                        <li><a href="<?php echo $error_log; ?>"><?php echo $text_error_log; ?></a></li>
592                        <?php } ?>
593			]]></add>
594		</operation>
595		<operation>
596			<search><![CDATA[
597                        <li><a href="<?php echo $backup; ?>"><?php echo $text_backup; ?></a></li>
598			]]></search>
599			<add position="replace"><![CDATA[
600                        <?php if($userac->hasPermission('access','tool/backup')) {?>
601                        <li><a href="<?php echo $backup; ?>"><?php echo $text_backup; ?></a></li>
602                        <?php } ?>
603			]]></add>
604		</operation>
605		<operation>
606			<search><![CDATA[
607                        <li><a href="<?php echo $report_sale_order; ?>"><?php echo $text_report_sale_order; ?></a></li>
608			]]></search>
609			<add position="replace"><![CDATA[
610                        <?php if($userac->hasPermission('access','report/sale_order')) {?>
611                        <li><a href="<?php echo $report_sale_order; ?>"><?php echo $text_report_sale_order; ?></a></li>
612                        <?php } ?>
613			]]></add>
614		</operation>
615		<operation>
616			<search><![CDATA[
617                        <li><a href="<?php echo $report_sale_tax; ?>"><?php echo $text_report_sale_tax; ?></a></li>
618			]]></search>
619			<add position="replace"><![CDATA[
620                        <?php if($userac->hasPermission('access','report/sale_tax')) {?>
621                        <li><a href="<?php echo $report_sale_tax; ?>"><?php echo $text_report_sale_tax; ?></a></li>
622                        <?php } ?>
623			]]></add>
624		</operation>
625		<operation>
626			<search><![CDATA[
627                        <li><a href="<?php echo $report_sale_shipping; ?>"><?php echo $text_report_sale_shipping; ?></a></li>
628			]]></search>
629			<add position="replace"><![CDATA[
630                        <?php if($userac->hasPermission('access','report/sale_shipping')) {?>
631                        <li><a href="<?php echo $report_sale_shipping; ?>"><?php echo $text_report_sale_shipping; ?></a></li>
632                        <?php } ?>
633			]]></add>
634		</operation>
635		<operation>
636			<search><![CDATA[
637                        <li><a href="<?php echo $report_sale_return; ?>"><?php echo $text_report_sale_return; ?></a></li>
638			]]></search>
639			<add position="replace"><![CDATA[
640                        <?php if($userac->hasPermission('access','report/sale_return')) {?>
641                        <li><a href="<?php echo $report_sale_return; ?>"><?php echo $text_report_sale_return; ?></a></li>
642                        <?php } ?>
643			]]></add>
644		</operation>
645		<operation>
646			<search><![CDATA[
647                        <li><a href="<?php echo $report_sale_coupon; ?>"><?php echo $text_report_sale_coupon; ?></a></li>
648			]]></search>
649			<add position="replace"><![CDATA[
650                        <?php if($userac->hasPermission('access','report/sale_coupon')) {?>
651                        <li><a href="<?php echo $report_sale_coupon; ?>"><?php echo $text_report_sale_coupon; ?></a></li>
652                        <?php } ?>
653			]]></add>
654		</operation>
655		<operation>
656			<search><![CDATA[
657                        <li><a href="<?php echo $report_product_viewed; ?>"><?php echo $text_report_product_viewed; ?></a></li>
658			]]></search>
659			<add position="replace"><![CDATA[
660                        <?php if($userac->hasPermission('access','report/product_viewed')) {?>
661                        <li><a href="<?php echo $report_product_viewed; ?>"><?php echo $text_report_product_viewed; ?></a></li>
662                        <?php } ?>
663			]]></add>
664		</operation>
665		<operation>
666			<search><![CDATA[
667                        <li><a href="<?php echo $report_product_purchased; ?>"><?php echo $text_report_product_purchased; ?></a></li>
668			]]></search>
669			<add position="replace"><![CDATA[
670                        <?php if($userac->hasPermission('access','report/product_purchased')) {?>
671                        <li><a href="<?php echo $report_product_purchased; ?>"><?php echo $text_report_product_purchased; ?></a></li>
672                        <?php } ?>
673			]]></add>
674		</operation>
675		<operation>
676			<search><![CDATA[
677                        <li><a href="<?php echo $report_customer_order; ?>"><?php echo $text_report_customer_order; ?></a></li>
678			]]></search>
679			<add position="replace"><![CDATA[
680                        <?php if($userac->hasPermission('access','report/customer_order')) {?>
681                        <li><a href="<?php echo $report_customer_order; ?>"><?php echo $text_report_customer_order; ?></a></li>
682                        <?php } ?>
683			]]></add>
684		</operation>
685		<operation>
686			<search><![CDATA[
687                        <li><a href="<?php echo $report_customer_online; ?>"><?php echo $text_report_customer_online; ?></a></li>
688			]]></search>
689			<add position="replace"><![CDATA[
690                        <?php if($userac->hasPermission('access','report/customer_online')) {?>
691                        <li><a href="<?php echo $report_customer_online; ?>"><?php echo $text_report_customer_online; ?></a></li>
692                        <?php } ?>
693			]]></add>
694		</operation>
695		<operation>
696			<search><![CDATA[
697                        <li><a href="<?php echo $report_customer_activity; ?>"><?php echo $text_report_customer_activity; ?></a></li>
698			]]></search>
699			<add position="replace"><![CDATA[
700                        <?php if($userac->hasPermission('access','report/customer_activity')) {?>
701                        <li><a href="<?php echo $report_customer_activity; ?>"><?php echo $text_report_customer_activity; ?></a></li>
702                        <?php } ?>
703			]]></add>
704		</operation>
705		<operation>
706			<search><![CDATA[
707                        <li><a href="<?php echo $report_customer_reward; ?>"><?php echo $text_report_customer_reward; ?></a></li>
708			]]></search>
709			<add position="replace"><![CDATA[
710                        <?php if($userac->hasPermission('access','report/customer_reward')) {?>
711                        <li><a href="<?php echo $report_customer_reward; ?>"><?php echo $text_report_customer_reward; ?></a></li>
712                        <?php } ?>
713			]]></add>
714		</operation>
715		<operation>
716			<search><![CDATA[
717                        <li><a href="<?php echo $report_customer_credit; ?>"><?php echo $text_report_customer_credit; ?></a></li>
718			]]></search>
719			<add position="replace"><![CDATA[
720                        <?php if($userac->hasPermission('access','report/customer_credit')) {?>
721                        <li><a href="<?php echo $report_customer_credit; ?>"><?php echo $text_report_customer_credit; ?></a></li>
722                        <?php } ?>
723			]]></add>
724		</operation>
725		<operation>
726			<search><![CDATA[
727                        <li><a href="<?php echo $report_marketing; ?>"><?php echo $text_marketing; ?></a></li>
728			]]></search>
729			<add position="replace"><![CDATA[
730                        <?php if($userac->hasPermission('access','report/marketing')) {?>
731                        <li><a href="<?php echo $report_marketing; ?>"><?php echo $text_marketing; ?></a></li>
732                        <?php } ?>
733			]]></add>
734		</operation>
735		<operation>
736			<search><![CDATA[
737                        <li><a href="<?php echo $report_affiliate; ?>"><?php echo $text_report_affiliate; ?></a></li>
738			]]></search>
739			<add position="replace"><![CDATA[
740                        <?php if($userac->hasPermission('access','report/affiliate')) {?>
741                        <li><a href="<?php echo $report_affiliate; ?>"><?php echo $text_report_affiliate; ?></a></li>
742                        <?php } ?>
743			]]></add>
744		</operation>
745		<operation>
746			<search><![CDATA[
747                        <li><a href="<?php echo $vqmod_manager; ?>"><?php echo $text_vqmod_manager; ?></a></li>
748			]]></search>
749			<add position="replace"><![CDATA[
750                        <?php if($userac->hasPermission('access','module/vqmod_manager')) {?>
751                        <li><a href="<?php echo $vqmod_manager; ?>"><?php echo $text_vqmod_manager; ?></a></li>
752                        <?php } ?>
753			]]></add>
754		</operation>
755		<operation>
756			<search><![CDATA[
757                        <li><a href="<?php echo $customer_blacklist; ?>"><?php echo $text_customer_blacklist; ?></a></li>
758			]]></search>
759			<add position="replace"><![CDATA[
760                        <?php if($userac->hasPermission('access','sale/customer_blacklist')) { ?>
761                        <li><a href="<?php echo $customer_blacklist; ?>"><?php echo $text_customer_blacklist; ?></a></li>
762                        <?php } ?>
763			]]></add>
764		</operation>
765		<operation>
766			<search><![CDATA[
767                        <li><a href="<?php echo $pavo_link; ?>">Theme Control</a></li>
768			]]></search>
769			<add position="replace"><![CDATA[
770                        <?php if($userac->hasPermission('access','module/themecontrol')) { ?>
771                        <li><a href="<?php echo $pavo_link; ?>">Theme Control</a></li>
772                        <?php } ?>
773			]]></add>
774		</operation>
775		<operation>
776			<search><![CDATA[
777                        <li><a href="<?php echo $megamenu_link; ?>">MegaMenu</a></li>
778			]]></search>
779			<add position="replace"><![CDATA[
780                        <?php if($userac->hasPermission('access','module/pavmegamenu')) { ?>
781                        <li><a href="<?php echo $megamenu_link; ?>">MegaMenu</a></li>
782                        <?php } ?>
783			]]></add>
784		</operation>
785		<operation>
786			<search><![CDATA[
787                        <li><a href="<?php echo $report_affiliate_activity; ?>"><?php echo $text_report_affiliate_activity; ?></a></li>
788			]]></search>
789			<add position="replace"><![CDATA[
790                        <?php if($userac->hasPermission('access','report/affiliate_activity')) {?>
791                        <li><a href="<?php echo $report_affiliate_activity; ?>"><?php echo $text_report_affiliate_activity; ?></a></li>
792                        <?php } ?>
793						
794						<script type="text/javascript"><!--
795						$('li a.parent').each(function(index) { 
796                           if($(this).next('ul').children('li').size() == 0) {
797                              $(this).parent('li').css('display', 'none');
798                           }
799                        })
800
801                        if($('#catalog ul li:not(:has(a.parent))').size() == 0) $('#catalog').css('display', 'none');
802                        if($('#extension ul li:not(:has(a.parent))').size() == 0) $('#extension').css('display', 'none');
803                        if($('#sale ul li:not(:has(a.parent))').size() == 0) $('#sale').css('display', 'none');
804                        if($('#system ul li:not(:has(a.parent))').size() == 0) $('#system').css('display', 'none');
805                        if($('#reports ul li:not(:has(a.parent))').size() == 0) $('#reports').css('display', 'none');
806                            
807                            //--></script> 
808			]]></add>
809		</operation>
810	</file>
811</modification>

For Abandoned Carts link

 1   <file path="admin/view/template/common/menu.tpl">  
 2  		<operation>
 3			<search><![CDATA[<li id="reports"><a class="parent"><i class="fa fa-bar-chart-o fa-fw"></i> <span><?php echo $text_reports; ?></span></a>]]></search>
 4			<add position="before"><![CDATA[			
 5            <?php if (isset($text_abandonedCarts)) { ?>
 6				<li id="abandoned_carts"><a href="<?php echo $link_abandonedCarts; ?>"><i class="fa fa-shopping-cart"></i> <span><?php echo $text_abandonedCarts; ?></span></a></li>
 7			<?php } ?>
 8			]]></add>
 9		</operation>
10	</file>
 1   <file path="admin/view/template/common/menu.tpl">  
 2  		<operation>
 3			<search><![CDATA[<li id="reports"><a class="parent"><i class="fa fa-bar-chart-o fa-fw"></i> <span><?php echo $text_reports; ?></span></a>]]></search>
 4			<add position="before"><![CDATA[			
 5            <?php if (isset($text_abandonedCarts)) { 
 6                if($userac->hasPermission('access','module/abandonedcarts')) {  ?>
 7				    <li id="abandoned_carts"><a href="<?php echo $link_abandonedCarts; ?>"><i class="fa fa-shopping-cart"></i> <span><?php echo $text_abandonedCarts; ?></span></a></li>
 8			    <?php } ?>
 9			<?php } ?>
10			]]></add>
11		</operation>
12	</file>

ADV Sales & Profit Report

 1	<file path="admin/view/template/common/menu.tpl">
 2        <operation>
 3            <search><![CDATA[
 4<li><a class="parent"><?php echo $text_sale; ?></a>
 5            ]]></search>
 6            <add position="after" offset="1"><![CDATA[
 7<li><a href="<?php echo $report_adv_sales_profit; ?>"><?php echo $text_report_adv_sales_profit; ?></a></li>
 8            ]]></add>
 9        </operation>
10        <operation error="skip">
11            <search><![CDATA[
12<li><a href="<?php echo $report_sale_order; ?>"><?php echo $text_report_sale_order; ?></a></li>
13            ]]></search>
14            <add position="replace"><![CDATA[
15<li style="border-top:1px dashed #888;"><a href="<?php echo $report_sale_order; ?>"><?php echo $text_report_sale_order; ?></a></li>
16            ]]></add>
17        </operation>		
18	</file>
 1	<file path="admin/view/template/common/menu.tpl">
 2        <operation>
 3            <search><![CDATA[
 4<li><a class="parent"><?php echo $text_sale; ?></a>
 5            ]]></search>
 6            <add position="after" offset="1"><![CDATA[
 7<?php if($userac->hasPermission('access','module/abandonedcarts')) {  ?>
 8	<li><a href="<?php echo $report_adv_sales_profit; ?>"><?php echo $text_report_adv_sales_profit; ?></a></li>
 9 <?php } ?>
10            ]]></add>
11        </operation>	
12	</file>

Courier Shipment Tracker / Courier Partners

1<file path="admin/view/template/common/menu.tpl">
2    <operation error="log">
3      <search><![CDATA[<li><a href="<?php echo $feed; ?>"><?php echo $text_feed; ?></a></li>]]>
4      </search>
5      <add position="after"><![CDATA[<li><a href="<?php echo $courier_link; ?>"><?php echo $text_courier; ?></a></li>]]>
6      </add>
7    </operation>
8  </file>
 1  <file path="admin/view/template/common/menu.tpl">
 2    <operation error="log">
 3      <search><![CDATA[<li><a href="<?php echo $feed; ?>"><?php echo $text_feed; ?></a></li>]]>
 4      </search>
 5      <add position="after"><![CDATA[
 6      <?php if($userac->hasPermission('access','module/abandonedcarts')) {  ?>
 7        <li><a href="<?php echo $courier_link; ?>"><?php echo $text_courier; ?></a></li>
 8      <?php } ?>
 9      ]]></add>
10    </operation>
11  </file>