fixed latest products
This commit is contained in:
parent
7cc8056af9
commit
cb484688d2
|
|
@ -1,62 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* bootstrap.php
|
||||
*
|
||||
* @copyright 2022 opencart.cn - All Rights Reserved
|
||||
* @link http://www.guangdawangluo.com
|
||||
* @author Edward Yang <yangjin@opencart.cn>
|
||||
* @created 2022-07-20 15:35:59
|
||||
* @modified 2022-07-20 15:35:59
|
||||
*/
|
||||
|
||||
namespace Plugin\HeaderMenu;
|
||||
|
||||
class Bootstrap
|
||||
{
|
||||
public function boot()
|
||||
{
|
||||
$this->addAdminSideBarMenu();
|
||||
$this->addHeaderMenu();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 在网站管理后台添加菜单链接
|
||||
*/
|
||||
private function addAdminSideBarMenu()
|
||||
{
|
||||
add_filter('sidebar.order_routes', function ($data) {
|
||||
$data[] = [
|
||||
"route" => "currencies.index",
|
||||
"icon" => "fa fa-tachometer-alt"
|
||||
];
|
||||
return $data;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 在前台网页头部添加二级菜单链接
|
||||
*/
|
||||
private function addHeaderMenu()
|
||||
{
|
||||
add_filter('header.categories', function ($data) {
|
||||
$data[] = [
|
||||
'name' => trans('HeaderMenu::header.plugin_link'),
|
||||
'url' => shop_route('home.index'),
|
||||
'children' => [
|
||||
[
|
||||
"name" => trans('HeaderMenu::header.latest_products'),
|
||||
"url" => plugin_route('latest_products'),
|
||||
"new_window" => false,
|
||||
], [
|
||||
"name" => trans('HeaderMenu::header.baidu'),
|
||||
"url" => "https://www.baidu.com",
|
||||
"new_window" => true,
|
||||
]
|
||||
],
|
||||
];
|
||||
return $data;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
@extends('admin::layouts.master')
|
||||
|
||||
@section('title', '插件自定义页面测试')
|
||||
|
||||
@section('content')
|
||||
{{ $method }}
|
||||
@endsection
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
/**
|
||||
* bootstrap.php
|
||||
*
|
||||
* @copyright 2022 opencart.cn - All Rights Reserved
|
||||
* @link http://www.guangdawangluo.com
|
||||
* @author Edward Yang <yangjin@opencart.cn>
|
||||
* @created 2022-07-20 15:35:59
|
||||
* @modified 2022-07-20 15:35:59
|
||||
*/
|
||||
|
||||
namespace Plugin\LatestProducts;
|
||||
|
||||
class Bootstrap
|
||||
{
|
||||
public function boot()
|
||||
{
|
||||
$this->addLatestProducts();
|
||||
}
|
||||
|
||||
/**
|
||||
* 在前台网页头部添加二级菜单链接
|
||||
*/
|
||||
private function addLatestProducts()
|
||||
{
|
||||
add_filter('header.categories', function ($data) {
|
||||
$data[] = [
|
||||
'name' => trans('LatestProducts::header.latest_products'),
|
||||
"url" => plugin_route('latest_products'),
|
||||
];
|
||||
return $data;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
* @modified 2022-07-21 10:00:25
|
||||
*/
|
||||
|
||||
namespace Plugin\HeaderMenu\Controllers;
|
||||
namespace Plugin\LatestProducts\Controllers;
|
||||
|
||||
use Beike\Repositories\ProductRepo;
|
||||
use Beike\Shop\Http\Resources\ProductList;
|
||||
|
|
@ -23,7 +23,7 @@ class MenusController extends Controller
|
|||
'method' => __METHOD__,
|
||||
'route_list' => []
|
||||
];
|
||||
return view("HeaderMenu::route_list", $data);
|
||||
return view("LatestProducts::route_list", $data);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -34,6 +34,6 @@ class MenusController extends Controller
|
|||
'products' => $products,
|
||||
'items' => ProductList::collection($products)->jsonSerialize(),
|
||||
];
|
||||
return view("HeaderMenu::latest_products", $data);
|
||||
return view("LatestProducts::latest_products", $data);
|
||||
}
|
||||
}
|
||||
|
|
@ -10,7 +10,5 @@
|
|||
*/
|
||||
|
||||
return [
|
||||
'plugin_link' => 'Plugin Link',
|
||||
'latest_products' => 'Latest Products',
|
||||
'baidu' => 'Baidu',
|
||||
];
|
||||
|
|
@ -10,7 +10,5 @@
|
|||
*/
|
||||
|
||||
return [
|
||||
'plugin_link' => '插件链接',
|
||||
'latest_products' => '最新商品',
|
||||
'baidu' => '百度',
|
||||
];
|
||||
|
|
@ -10,6 +10,6 @@
|
|||
*/
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Plugin\HeaderMenu\Controllers\MenusController;
|
||||
use Plugin\LatestProducts\Controllers\MenusController;
|
||||
|
||||
Route::get('/routes', [MenusController::class, 'getRoutes'])->name('routes');
|
||||
|
|
@ -10,6 +10,6 @@
|
|||
*/
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Plugin\HeaderMenu\Controllers\MenusController;
|
||||
use Plugin\LatestProducts\Controllers\MenusController;
|
||||
|
||||
Route::get('/latest_products', [MenusController::class, 'latestProducts'])->name('plugin.latest_products');
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
<nav aria-label="breadcrumb">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="/">Home</a></li>
|
||||
<li class="breadcrumb-item active" aria-current="page">{{ trans('HeaderMenu::header.latest_products') }}</li>
|
||||
<li class="breadcrumb-item active" aria-current="page">{{ trans('LatestProducts::header.latest_products') }}</li>
|
||||
</ol>
|
||||
</nav>
|
||||
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"code": "header_menu",
|
||||
"name": "首页菜单Demo",
|
||||
"description": "修改首页菜单插件",
|
||||
"code": "latest_products",
|
||||
"name": "最新商品列表",
|
||||
"description": "首页菜单添加最新商品列表功能",
|
||||
"type": "view",
|
||||
"version": "v1.0.0",
|
||||
"icon": "https://via.placeholder.com/100x100.png/aabbcc?text=MENU",
|
||||
Loading…
Reference in New Issue