GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Dancer2::Plugin::Interchange6::Routes(3) User Contributed Perl Documentation Dancer2::Plugin::Interchange6::Routes(3)

Dancer2::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:

cart ("/cart")
Route for displaying and updating the cart.
checkout ("/checkout")
Route for the checkout process (not active and not recommended).
login ("/login")
Login route.
logout ("/logout")
Logout route.
navigation
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:

  plugins:
    Interchange6::Routes:
      navigation:
        records: 20
    
product
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:
before_product_display
The hook sub receives a hash reference, where the Product object is the value of the "product" key.
before_cart_display
before_checkout_display
before_navigation_search
This hook is called if a navigation uri is requested and before product search queries are generated.

The hook sub receives the navigation data as hash reference:

navigation
Navigation object.
page
Page number found at end of URI or 1 if no page number found.
template
Name of template.

The navigation hash reference can be modified inside the hook and all changes will be visible to the navigation route (and also the template) after the hook returns.

before_navigation_display
The hook sub receives the navigation data as hash reference:
navigation
Navigation object.
products
Product listing for this navigation item. The product listing is generated using "listing" in Interchange6::Schema::Result::Product.
pager
Data::Page object for "products".

To get the full count of products call "total_entries" on the Data::Page object.

template
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';
        }
    };
    
before_login_display

EXAMPLES

Disable parts of layout on the login view:

    hook 'before_login_display' => sub {
        my $tokens = shift;

        $tokens->{layout_noleft} = 1;
        $tokens->{layout_noright} = 1;
    };

The following standard Dancer2 hooks are used:

Set "current_user" in Interchange6::Schema for the default schema to "logged_in_user" in Dancer2::Plugin::Auth::Extensible or "undef".
2017-10-21 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.