Dancer::Plugin::Interchange6::Routes - Routes for Interchange6 Shop Machine
The following routes are provided by this plugin.
Active routes are automatically installed by the shop_setup_routes keyword:
shop_setup_routes
/cart
Route for displaying and updating the cart.
/checkout
Route for the checkout process (not active and not recommended).
/login
Login route.
/logout
Logout route.
Route for displaying navigation pages, for example categories and menus.
The number of products shown on the navigation page can be configured with the records option:
records
plugins: Interchange6::Routes: navigation: records: 20
Route for displaying products.
The template for each route type can be configured:
plugins: Interchange6::Routes: account: login: template: login uri: login success_uri: logout: template: logout uri: logout cart: template: cart uri: cart active: 1 checkout: template: checkout uri: checkout active: 0 navigation: template: listing records: 0 product: template: product
This sample configuration shows the current defaults.
The following hooks are available to manipulate the values passed to the templates:
The hook sub receives a hash reference, where the Product object is the value of the product key.
product
The hook sub receives the navigation data as hash reference:
Navigation object.
Products for this navigation item.
Number of products.
Page for products.
Name of template. In order to use another template, change the value in the hashref.
hook 'before_navigation_display' => sub { my $navigation_data = shift; if ($navigation_data->{navigation}->uri =~ /^admin/) { $navigation_data->{template} = 'admin_listing'; } };
Disable parts of layout on the login view:
hook 'before_login_display' => sub { my $tokens = shift; $tokens->{layout_noleft} = 1; $tokens->{layout_noright} = 1; };
To install Dancer::Plugin::Interchange6, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Dancer::Plugin::Interchange6
CPAN shell
perl -MCPAN -e shell install Dancer::Plugin::Interchange6
For more information on module installation, please visit the detailed CPAN module installation guide.