-
Notifications
You must be signed in to change notification settings - Fork 1
/
README
196 lines (136 loc) · 5.4 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
NAME
Dancer::Plugin::Interchange6 - Interchange6 Shop Plugin for Dancer
VERSION
Version 0.121
DESCRIPTION
This Dancer plugin is now DEPRECATED since all new development has moved
to the Dancer2 plugin Dancer2::Plugin::Interchange6.
REQUIREMENTS
All Interchange6 Dancer applications need to use the
Dancer::Session::DBIC engine.
The easiest way to configure this is in your main module, just after all
the "use" statements:
set session => 'DBIC';
set session_options => {schema => schema};
CONFIGURATION
Available configuration options:
plugins:
Interchange6:
cart_class: MyApp::Cart
carts_var_name: some_other_var
* cart_class
If you wish to subclass the cart you can have "shop_cart" return
your subclassed cart instead. You set the cart class via
"cart_class". Defaults to Dancer::Plugin::Interchange6::Cart.
* carts_var_name
The plugin caches carts in a "var" in Dancer and the name of the var
used can be set via "carts_var_name". Defaults to "ic6_carts".
ROUTES
You can use the Dancer::Plugin::Interchange6::Routes plugin bundled with
this plugin to setup standard routes for:
product listing
product display
cart display
checkout form
To enable these routes, you put the "shop_setup_routes" keyword at the
end of your main module:
package MyShop;
use Dancer ':syntax';
use Dancer::Plugin::Interchange6;
use Dancer::Plugin::Interchange6::Routes;
get '/shop' => sub {
...
};
...
shop_setup_routes;
true;
Please refer to Dancer::Plugin::Interchange6::Routes for configuration
options and further information.
KEYWORDS
shop_cart
Returns Dancer::Plugin::Interchange6::Cart object.
shop_charge
Creates payment order and authorizes amount.
shop_redirect
Calls "redirect" in Interchange6::Schema::ResultSet::UriRedirect with
given args.
shop_schema
Returns Interchange6::Schema object.
shop_...
Accessors for Interchange6::Schema result classes. You can use it to
retrieve a single object or the corresponding result set.
shop_product('F0001')->uri;
shop_navigation->search({type => 'manufacturer',
active => 1});
Available accessors are "shop_address", "shop_attribute",
"shop_country", "shop_message", "shop_navigation", "shop_order",
"shop_product", "shop_state" and "shop_user".
HOOKS
This plugin installs the following hooks:
Add to cart
The functions registered for these hooks receive the cart object and the
item to be added as parameters.
before_cart_add_validate
Triggered before item is validated for adding to the cart.
before_cart_add
Triggered before item is added to the cart.
after_cart_add
Triggered after item is added to the cart. Used by DBI backend to
save item to the database.
Update cart
The functions registered for these hooks receive the cart object, the
current item in the cart and the updated item.
before_cart_update
Triggered before cart item is updated (changing quantity).
after_cart_update
Triggered after cart item is updated (changing quantity). Used by
DBI backend to update item to the database.
Remove from cart
The functions registered for these hooks receive the cart object and the
item to be added as parameters.
before_cart_remove_validate
Triggered before item is validated for removal. Receives cart object
and item SKU.
before_cart_remove
Triggered before item is removed from the cart. Receives cart object
and item.
after_cart_remove
Triggered after item is removed from the cart. Used by DBI backend
to delete item from the database. Receives cart object and item.
Clear cart
before_cart_clear
Triggered before cart is cleared.
after_cart_clear
Triggered after cart is cleared.
Rename cart
The functions registered for these hooks receive the cart object, the
old name and the new name.
before_cart_rename
Triggered before cart is renamed.
after_cart_rename
Triggered after cart is renamed.
before_cart_set_users_id
Triggered before users_id is set for the cart.
after_cart_set_users_id
Triggered after users_id is set for the cart.
before_cart_set_sessions_id
Triggered before sessions_id is set for the cart.
after_cart_set_sessions_id
Triggered after sessions_id is set for the cart.
EXPIRE DBIC SESSIONS
This command expires/manages DBIC sessions and carts. NOTE: For proper
functionality please copy/link to Dancer App/bin directory.
interchange6-expire-sessions
ACKNOWLEDGEMENTS
The Dancer developers and community for their great application
framework and for their quick and competent support.
Peter Mottram for his patches.
LICENSE AND COPYRIGHT
Copyright 2010-2016 Stefan Hornburg (Racke).
This program is free software; you can redistribute it and/or modify it
under the terms of either: the GNU General Public License as published
by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
SEE ALSO
Dancer2::Plugin::Interchange6
Interchange6, Interchange6::Schema