The breadcrumb can be manipulated from within a PHP file. Typically, this will either be on an existing Aero route such as the homepage or product page, or a new route that is custom to the project or module.
Adding to the breadcrumb
To add crumbs to the breadcrumb:
\Aero\Store\Facades\Breadcrumb::add(function ($breadcrumb) {
$breadcrumb->add(new \Aero\Store\Crumb('Name', '/url'));
});
Clearing the breadcrumb
To clear all crumbs from the breadcrumb:
\Aero\Store\Facades\Breadcrumb::clear();
Filtering the breadcrumb
A filter can be specified to control if certain crumbs should be removed from the breadcrumb. The function should return a boolean which indicates if the crumb should be kept:
\Aero\Store\Facades\Breadcrumb::setFilter(function ($crumb) {
if ($crumb->getName() === 'Foo') {
return false;
}
return true;
});
Disabling the request referer
By default, the product page breadcrumb is built based on the referer. For example, if a customer performs a search for "shirt" and then clicks on a listing result, the breadcrumb on the product page will be:
Home > Search for “shirt” > Casual Shirt
To disable this functionality:
\Aero\Store\Facades\Breadcrumb::dontUseReferer();
Disabling the request
There may be cases (such as an API) where the breadcrumb functionality should not use the request at all:
\Aero\Store\Facades\Breadcrumb::dontUseRequest();
Removing manufacturer from the product page breadcrumb
By default, the product page breadcrumb contains a crumb entry for the manufacturer. To disable this functionality:
\Aero\Catalog\Models\Product::$breadcrumbContainsManufacturer = false;