PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.8.0
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.8.0
1.8.0 1.7.1 1.7.0 1.6.6 1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 All 52 releases
← All changes | app/Helpers/AdminHelper.php +99 -56 1.3.22 → 1.8.0 View file →
@@ -14,9 +14,9 @@
14 14 {
15 15 public static function getProductMenu($product, $echo = false, $activeMenu = '')
16 16 {
17 17 // Skip rendering menu when custom editor modal is open
18 - if (isset($_GET['custom-editor']) && $_GET['custom-editor'] == 'true') {
18 + if (App::request()->get('custom-editor') === 'true') {
19 19 return '';
20 20 }
21 21
22 22 if (!$product instanceof Product) {
@@ -39,16 +39,8 @@
39 39 'product_integrations' => [
40 40 'label' => __('Integrations', 'fluent-cart'),
41 41 'link' => $baseUrl . 'products/' . $productId . '/integrations'
42 42 ],
43 - // 'product_pricing' => [
44 - // 'label' => __('Pricing', 'fluent-cart'),
45 - // 'link' => $baseUrl . 'products/' . $productId . '/pricing'
46 - // ],
47 -// 'product_integrations' => [
48 -// 'label' => __('Integrations', 'fluent-cart'),
49 -// 'link' => $baseUrl . 'products/' . $productId . '/integrations'
50 -// ]
51 43 ], [
52 44 'product_id' => $productId,
53 45 'base_url' => $baseUrl
54 46 ]);
@@ -53,9 +45,9 @@
53 45 'base_url' => $baseUrl
54 46 ]);
55 47
56 48 $request = App::request()->all();
57 - if (isset($request['action']) && $request['action'] == 'edit') {
49 + if (isset($request['action']) && $request['action'] === 'edit') {
58 50 $menuItems['product_details'] = [
59 51 'label' => __('Edit Pricing', 'fluent-cart'),
60 52 'link' => admin_url('admin.php?page=fluent-cart#/products/' . $productId)
61 53 ];
@@ -72,17 +64,89 @@
72 64 'status' => $product->post_status,
73 65 'product_id' => $productId
74 66 ];
75 67
76 - if ($echo) {
77 - App::make('view')->render('admin.admin_product_menu', $data);
78 - } else {
68 + if (!$echo) {
79 69 return (string)App::make('view')->make('admin.admin_product_menu', $data);
80 70 }
71 +
72 + App::make('view')->render('admin.admin_product_menu', $data);
81 73 }
82 74
75 + private static function getProductsMenu($baseUrl)
76 + {
77 + $menu = [
78 + 'label' => __('Products', 'fluent-cart'),
79 + 'link' => $baseUrl . 'products',
80 + // Any-of: a reviews-only role (reviews/manage without
81 + // products/view) must still see the parent, or its authorized
82 + // Reviews child could never render. Children gate individually —
83 + // including on the reviews module being switched on at all.
84 + 'permission' => ['products/view', 'reviews/manage']
85 + ];
86 +
87 + $children = [];
88 +
89 + // The parent link is not reachable on touch (the tap opens the dropdown),
90 + // and the off-canvas menu renders children only — so list it as a child too.
91 + $children['all_products'] = [
92 + 'label' => __('All Products', 'fluent-cart'),
93 + 'link' => $baseUrl . 'products',
94 + 'permission' => ['products/view']
95 + ];
96 +
97 + // Attributes power the advanced-variations feature.
98 + $children['product_attributes'] = [
99 + 'label' => __('Attributes', 'fluent-cart'),
100 + 'link' => $baseUrl . 'products/attributes',
101 + 'permission' => ['products/view']
102 + ];
103 +
104 + // Inventory only when the advanced-inventory toggle is on.
105 + if (ModuleSettings::isActive('stock_management') &&
106 + ModuleSettings::getSettings('stock_management.enable_advanced_inventory') === 'yes') {
107 + $children['product_inventory'] = [
108 + 'label' => __('Inventory', 'fluent-cart'),
109 + 'link' => $baseUrl . 'products/inventory',
110 + 'permission' => ['products/view']
111 + ];
112 + }
113 +
114 + // Only while the store has reviews switched on. The screen behind it
115 + // already redirects to the dashboard when the module is off, so an
116 + // entry here would be a menu item that bounces whoever clicks it.
117 + if (ModuleSettings::isActive('reviews')) {
118 + $children['reviews'] = [
119 + 'label' => __('Reviews', 'fluent-cart'),
120 + 'link' => $baseUrl . 'reviews',
121 + 'permission' => ['reviews/manage']
122 + ];
123 + }
124 +
125 + $menu['children'] = $children;
126 +
127 + return $menu;
128 + }
129 +
83 130 public static function getAdminMenu($echo = false, $activeNav = '')
84 131 {
132 + $menuItems = self::getMenuItems();
133 +
134 + if (!$echo) {
135 + return App::make('view')->make('admin.admin_menu', [
136 + 'menu_items' => $menuItems,
137 + 'active' => $activeNav
138 + ]);
139 + }
140 +
141 + App::make('view')->render('admin.admin_menu', [
142 + 'menu_items' => $menuItems,
143 + 'active' => $activeNav
144 + ]);
145 + }
146 +
147 + public static function getMenuItems($withSettings = false)
148 + {
85 149 $baseUrl = apply_filters('fluent_cart/admin_base_url', admin_url('admin.php?page=fluent-cart#/'), []);
86 150 $menuItems = apply_filters('fluent_cart/global_admin_menu_items', [
87 151 'dashboard' => [
88 152 'label' => __('Dashboard', 'fluent-cart'),
@@ -97,24 +161,9 @@
97 161 'label' => __('Customers', 'fluent-cart'),
98 162 'link' => $baseUrl . 'customers',
99 163 'permission' => ['customers/view', 'customers/manage']
100 164 ],
101 - 'products' => [
102 - 'label' => __('Products', 'fluent-cart'),
103 - 'link' => $baseUrl . 'products',
104 - 'permission' => ['products/view'],
105 - 'children' => [
106 - 'all_products' => [
107 - 'label' => __('All Products', 'fluent-cart'),
108 - 'link' => $baseUrl . 'products'
109 - ],
110 - 'product_inventory' => [
111 - 'label' => __('Inventory', 'fluent-cart'),
112 - 'link' => $baseUrl . 'products/inventory',
113 - 'permission' => ['products/view']
114 - ]
115 - ]
116 - ],
165 + 'products' => self::getProductsMenu($baseUrl),
117 166 'subscriptions' => [
118 167 'label' => __('Subscriptions', 'fluent-cart'),
119 168 'link' => $baseUrl . 'subscriptions',
120 169 'permission' => ['subscriptions/view']
@@ -125,15 +174,8 @@
125 174 'permission' => ['reports/view']
126 175 ],
127 176 ], ['base_url' => $baseUrl]);
128 177
129 - $menuItems['more'] = [
130 - 'label' => __('More', 'fluent-cart'),
131 - 'link' => '#',
132 - 'children' => []
133 - ];
134 -
135 -
136 178 $moreItems = apply_filters('fluent_cart/global_admin_menu_more_items', array_filter([
137 179 'integrations' => [
138 180 'label' => __('Integrations', 'fluent-cart'),
139 181 'link' => $baseUrl . 'integrations',
@@ -142,8 +184,13 @@
142 184 'order_bump' => App::isProActive() && ModuleSettings::isActive('order_bump') ? [
143 185 'label' => __('Order Bump', 'fluent-cart'),
144 186 'link' => $baseUrl . 'order_bump',
145 187 ] : false,
188 + 'dynamic_pricing' => App::isProActive() && ModuleSettings::isActive('dynamic_pricing') ? [
189 + 'label' => __('Dynamic Pricing', 'fluent-cart'),
190 + 'link' => $baseUrl . 'dynamic_pricing',
191 + 'permission' => ['dynamic_pricing/view'],
192 + ] : false,
146 193 'coupons' => [
147 194 'label' => __('Coupons', 'fluent-cart'),
148 195 'link' => $baseUrl . 'coupons',
149 196 ],
@@ -165,21 +212,25 @@
165 212 'link' => $baseUrl . 'logs',
166 213 ],
167 214 ]), ['base_url' => $baseUrl]);
168 215
169 - $menuItems['more']['children'] = $moreItems;
216 + if ($withSettings) {
217 + $menuItems['settings'] = [
218 + 'label' => __('Settings', 'fluent-cart'),
219 + 'link' => $baseUrl . 'settings/store-settings',
220 + 'permission' => ['store/settings', 'store/sensitive'],
221 + 'icon' => 'fluent-settings'
222 + ];
223 + }
170 224
171 - if ($echo) {
172 - App::make('view')->render('admin.admin_menu', [
173 - 'menu_items' => $menuItems,
174 - 'active' => $activeNav
175 - ]);
176 - } else {
177 - return App::make('view')->make('admin.admin_menu', [
178 - 'menu_items' => $menuItems,
179 - 'active' => $activeNav
180 - ]);
181 - }
225 + $menuItems['more'] = [
226 + 'label' => __('More', 'fluent-cart'),
227 + 'link' => '#',
228 + 'children' => $moreItems,
229 + ];
230 +
231 +
232 + return $menuItems;
182 233 }
183 234
184 235 public static function pushGlobalAdminAssets()
185 236 {
@@ -194,14 +245,6 @@
194 245 [],
195 246 FLUENTCART_VERSION,
196 247 );
197 248 }
198 -
199 -
200 249 }
201 -
202 -
203 -
204 -
205 -
206 -
207 250