[FIX] website_sale: update total when the user change a product quantity
[odoo/odoo.git] / addons / website_sale / views / website_sale.xml
1 <?xml version="1.0" encoding="utf-8"?>
2 <openerp>
3 <data>
4
5     <!-- Layout add nav and footer -->
6
7     <template id="header" inherit_id="website.layout" name="Custom Header">
8         <xpath expr="//header//ul[@id='top_menu']/li" position="before">
9             <li t-att-class="(not website_sale_order or not website_sale_order.get_total_quantity()) and 'hidden' or ''">
10                 <a t-href="/shop/mycart/">
11                     <i class="icon-shopping-cart"></i>
12                     My cart <sup t-attf-class="my_cart_quantity label label-primary"
13                                   t-esc="website_sale_order and website_sale_order.get_total_quantity() or ''"/>
14                 </a>
15             </li>
16         </xpath>
17     </template>
18
19     <!-- List of categories -->
20
21     <template id="categories_recursive" name="Category list">
22         <li t-att-class="category.id == search.get('category') and 'active' or ''">
23             <a t-att-class="category.id not in categ[1] and 'unpublish' or ''" t-href="/shop/?category=#{ category.id }" t-field="category.name" t-keep-query="search,facettes"></a>
24             <ul t-if="category.child_id" class="nav nav-pills nav-stacked nav-hierarchy">
25                 <t t-foreach="category.child_id" t-as="category">
26                     <t t-if="category.id in categ[1] or editable">
27                         <t t-call="website_sale.categories_recursive"/>
28                     </t>
29                 </t>
30             </ul>
31         </li>
32     </template>
33
34     <!-- Product list -->
35
36     <template id="products_cart" name="Shopping cart">
37       <div class="ribbon-wrapper">
38         <div class="ribbon">Promo</div>
39       </div>
40       <div class="oe_product_description">
41           <a t-href="/shop/product/#{ product.id }/" t-keep-query="category,search,facettes">
42               <b t-field="product.name"/>
43           </a>
44       </div>
45       <div class="product_price" t-if="product.product_variant_ids">
46           <b>
47               <t t-if="product.product_variant_ids[0].lst_price != product.product_variant_ids[0].price">
48                 <del class="text-danger"
49                   t-field="product.product_variant_ids[0].lst_price" t-field-options='{
50                        "widget": "monetary",
51                        "display_currency": "website.pricelist_id.currency_id"
52                   }'/>&amp;nbsp;
53               </t>
54               <span t-field="product.product_variant_ids[0].price"  t-field-options='{
55                    "widget": "monetary",
56                    "display_currency": "website.pricelist_id.currency_id"
57                }'/>
58           </b>
59       </div>
60       <div class="oe_product_image text-center">
61           <a t-href="/shop/product/#{ product.id }/" t-keep-query="category,search,facettes">
62               <span t-field="product.image" t-field-options='{"widget": "image"}'/>
63           </a>
64       </div>
65     </template>
66
67     <template id="products" name="Products" page="True">
68         <t t-call="website.layout">
69             <t t-set="head">
70                 <script type="text/javascript" src="/website_sale/static/src/js/website_sale.js"></script>
71                 <link rel='stylesheet' href='/website_sale/static/src/css/website_sale.css'/>
72                 <t t-raw="head or ''"/>
73             </t>
74             <t t-set="additional_title">Shop</t>
75             <div id="wrap">
76               <div class="oe_structure"/>
77               <div class="container oe_website_sale">
78                 <div class="row">
79                     <div class="col-sm-6 pagination" style="padding-left: 15px;">
80                         <form t-if="editable" t-keep-query="category,search,facettes"
81                               method="POST" t-action="/shop/add_product">
82                             <button class="btn btn-primary">New Product</button>
83                         </form>
84                     </div>
85                     <div class="col-sm-6">
86                         <t t-call="website.pager">
87                             <t t-set="classname">pull-right</t>
88                         </t>
89                         <form t-action="/shop/" method="get" class="pull-right pagination form-inline" style="padding-right: 5px;" t-keep-query="category,search,facettes">
90                             <div class="form-group">
91                                 <input type="text" name="search" class="search-query form-control" placeholder="Search..." t-att-value="search.get('search') or ''"/>
92                             </div>
93                         </form>
94                     </div>
95                 </div>
96
97                 <div class='style_default row'>
98                   <div class="col-md-12" id="products_grid">
99                     <table width="100%">
100                       <tbody>
101                         <t t-set="table_products" t-value="Ecommerce.get_bin_packing_products(product_ids, product_ids_for_holes, 4)"/>
102                         <tr t-foreach="table_products" t-as="tr_product">
103                           <t t-foreach="tr_product" t-as="td_product">
104                             <t t-if="td_product">
105                             <t t-set="product" t-value="td_product['product']"/>
106                             <td t-att-colspan="td_product['x']"
107                                 t-attf-width="#{td_product['x']*25}%"
108                                 t-att-rowspan="td_product['y']"
109                                 t-attf-class="oe_product oe-height-#{td_product['y']*2} #{ td_product['class'] }">
110
111                                 <div class="oe_product_cart" t-att-data-publish="product.website_published and 'on' or 'off'">
112
113                                   <div class="css_options" t-ignore="true" t-if="editable">
114                                     <div t-attf-class="dropdown js_options" t-att-data-id="product.id">
115                                       <a class="btn btn-default" t-att-id="'dopprod-%s' % product.id" role="button" data-toggle="dropdown">Options <span class="caret"></span></a>
116                                       <ul class="dropdown-menu" role="menu" t-att-aria-labelledby="'dopprod-%s' % product.id">
117                                         <li class='dropdown-submenu'>
118                                           <a tabindex="-1" href="#">Size</a>
119                                           <ul class="dropdown-menu" name="size">
120                                             <li><a href="#">
121                                               <table>
122                                                 <tr>
123                                                   <td class="selected"></td>
124                                                   <td t-att-class="product.website_size_x > 1 and 'selected'"></td>
125                                                   <td t-att-class="product.website_size_x > 2 and 'selected'"></td>
126                                                   <td t-att-class="product.website_size_x > 3 and 'selected'"></td>
127                                                 </tr>
128                                                 <tr>
129                                                   <td t-att-class="product.website_size_y > 1 and 'selected'"></td>
130                                                   <td t-att-class="product.website_size_y > 1 and product.website_size_x > 1 and 'selected'"></td>
131                                                   <td t-att-class="product.website_size_y > 1 and product.website_size_x > 2 and 'selected'"></td>
132                                                   <td t-att-class="product.website_size_y > 1 and product.website_size_x > 3 and 'selected'"></td>
133                                                 </tr>
134                                                 <tr>
135                                                   <td t-att-class="product.website_size_y > 2 and 'selected'"></td>
136                                                   <td t-att-class="product.website_size_y > 2 and product.website_size_x > 1 and 'selected'"></td>
137                                                   <td t-att-class="product.website_size_y > 2 and product.website_size_x > 2 and 'selected'"></td>
138                                                   <td t-att-class="product.website_size_y > 2 and product.website_size_x > 3 and 'selected'"></td>
139                                                 </tr>
140                                                 <tr>
141                                                   <td t-att-class="product.website_size_y > 3 and 'selected'"></td>
142                                                   <td t-att-class="product.website_size_y > 3 and product.website_size_x > 1 and 'selected'"></td>
143                                                   <td t-att-class="product.website_size_y > 3 and product.website_size_x > 2 and 'selected'"></td>
144                                                   <td t-att-class="product.website_size_y > 3 and product.website_size_x > 3 and 'selected'"></td>
145                                                 </tr>
146                                               </table>
147                                             </a></li>
148                                           </ul>
149                                         </li>
150                                         <li class='dropdown-submenu'>
151                                           <a tabindex="-1" href="#">Styles</a>
152                                           <ul class="dropdown-menu" name="style">
153                                             <t t-foreach="styles" t-as="style">
154                                               <li t-att-class="style_in_product(style, product) and 'active' or ''"><a href="#" t-att-data-id="style.id" t-att-data-class="style.html_class"><t t-esc="style.name"/></a></li>
155                                             </t>
156                                           </ul>
157                                         </li>
158                                       </ul>
159                                     </div>
160                                   </div>
161
162                                   <t t-call="website_sale.products_cart"/>
163                                 </div>
164
165                             </td>
166                             </t>
167                             <td t-if="td_product == None"/>
168                           </t>
169                         </tr>
170                       </tbody>
171                     </table>
172                   </div>
173                 </div>
174                 <div>
175                     <t t-call="website.pager">
176                         <t t-set="classname">pull-right</t>
177                     </t>
178                 </div>
179               </div>
180               <div class="oe_structure mb32"/>
181             </div>
182         </t>
183     </template>
184
185     <!-- Product Description-->
186
187     <template id="product_description" inherit_option_id="website_sale.products_cart" name="Product Description">
188         <xpath expr="//div[@class='oe_product_description']" position="inside">
189             <p class="text-muted oe_subdescription">
190                 <span t-field="product.description_sale"/>
191             </p>
192         </xpath>
193     </template>
194
195     <!-- Add to cart button-->
196
197     <template id="add_to_basket" inherit_option_id="website_sale.products_cart" name="Add to Cart">
198         <xpath expr="//div[@class='product_price']" position="inside">
199             <a t-href="./add_cart/?product_id=#{ product.id }" class="js_add_cart_json">
200                 <span class="icon-shopping-cart"/>
201             </a>
202         </xpath>
203     </template>
204
205     <!-- List view of products -->
206
207     <template id="list_view" inherit_option_id="website_sale.products" name="List View">
208         <xpath expr="//div[@id='products_grid']/table" position="replace">
209           <div class="row">
210             <t t-set="products" t-value="Ecommerce.get_products(product_ids)"/>
211             <t t-foreach="products" t-as="product">
212               <div class="col-md-12 oe_list_products oe-height-1">
213                 <t t-call="website_sale.products_cart"/>
214               </div>
215             </t>
216           </div>
217         </xpath>
218     </template>
219
220
221     <!-- product -->
222
223     <template id="product" name="Product">
224         <t t-call="website.layout">
225             <t t-set="head">
226                 <script type="text/javascript" src="/website_sale/static/src/js/website_sale.js"></script>
227             </t>
228             <t t-set="additional_title" t-value="product.name"/>
229             <div id="wrap">
230
231               <section class="container mt8">
232                 <div class="row">
233                   <div class="col-sm-5">
234                       <ol class="breadcrumb">
235                           <li><a t-href="/shop">Products</a></li>
236                           <li t-if="search.get('category')"><a t-att-href="'/shop/" t-keep-query="category,search,facettes"><span t-field="category.name"/></a></li>
237                           <li class="active"><span t-field="product.name"></span></li>
238                       </ol>
239                   </div><div class="col-sm-3">
240                       <t t-call="website.publish_management">
241                         <t t-set="object" t-value="product"/>
242                         <t t-set="publish_edit" t-value="True"/>
243                         <li class='dropdown-submenu'>
244                             <a tabindex="-1" href="#">Promote</a>
245                             <ul class="dropdown-menu" name="sequence">
246                                 <li><a href="#" class="js_go_to_top">Push to top</a></li>
247                                 <li><a href="#" class="js_go_to_bottom">Push to bottom</a></li>
248                             </ul>
249                         </li>
250                       </t>
251                   </div><div class="col-sm-3 col-sm-offset-1">
252                       <form t-action="/shop/" method="get" class="pull-right" t-keep-query="category,facettes">
253                           <div class="input-group">
254                               <t t-if="search">
255                               <t t-foreach="search.items()" t-as="key">
256                                   <input t-att-name="key[0]" t-att-value="key[1]"/>
257                               </t>
258                               </t>
259                               <span class="input-group-addon"><span class="glyphicon glyphicon-search"/></span>
260                               <input type="text" name="search" class="search-query form-control" placeholder="Search..." t-att-value="search or ''"/>
261                           </div>
262                       </form>
263                   </div>
264                 </div>
265               </section>
266
267               <section class="container oe_website_sale mb16" id="product_detail">
268                 <div class="row">
269                   <div class="col-sm-7 col-md-7 col-lg-7">
270                       <span t-field="product.image" style="max-height: 500px" t-field-options='{"widget": "image"}'/>
271                   </div><div class="col-sm-5 col-md-5 col-lg-4 col-lg-offset-1">
272                       <h1 t-field="product.name">Product Name</h1>
273
274                       <form t-action="./add_cart/" class="js_add_cart_json">
275                           <input type="hidden" t-if="len(product.product_variant_ids) &lt;= 1" name="product_id" t-att-value="product.id"/>
276                           <t t-if="len(product.product_variant_ids) &gt; 1">
277                               <label label-default="label-default" class="radio" t-foreach="product.product_variant_ids" t-as="product">
278                                   <input type="radio" name="product_id" t-att-value="product.id" t-att-checked="product == product.product_variant_ids[0] or None"/>
279                                   <t t-esc="product.variants or ''">Standard</t>
280                                   <span class="badge" t-if="product.price_extra">
281                                       <t t-esc="product.price_extra > 0 and '+' or ''"/><span t-field="product.price_extra" t-field-options='{
282                                                    "widget": "monetary",
283                                                    "display_currency": "website.pricelist_id.currency_id"
284                                                }'/>
285                                   </span>
286                               </label>
287                               <br/>
288                           </t>
289
290                           <div class="product_price mt16" t-if="product.product_variant_ids">
291                               <h4>
292                                   <b><span class="oe_price" t-esc="product.product_variant_ids[0].price" /> â‚¬</b>
293
294                                   <t t-if="product.product_variant_ids[0].lst_price != product.product_variant_ids[0].price">
295                                     <span class="text-danger" style="text-decoration: line-through;">
296                                         <t t-esc="product.product_variant_ids[0].lst_price" /> â‚¬
297                                     </span>&amp;nbsp;
298                                   </t>
299                               </h4>
300                           </div>
301                           <button class="btn btn-primary btn-lg mt8">Add to Cart</button>
302                           <hr t-if="product.description_sale"/>
303                           <p t-field="product.description_sale" class="text-muted"/>
304                           <hr/>
305                           <p class="text-muted">
306                               30-day money-back guarantee<br/>
307                               Free Shipping in U.S.<br/>
308                               Buy now, get in 2 days
309                           </p>
310                       </form>
311                   </div>
312                 </div>
313               </section>
314               <div t-field="product.website_description" class="oe_structure" id="product_full_description"/>
315             </div>
316         </t>
317     </template>
318
319     <template id="recommended_products" inherit_id="website_sale.product" inherit_option_id="website_sale.product" name="Recommended Products">
320         <xpath expr="//div[@id='product_full_description']" position="after">
321             <div class="container mt32" t-if="product.recommended_products()">
322                 <h3>Customers who have bought this product also bought:</h3>
323                 <div class='row mt16' style="margin-left: 15px !important;">
324                 <t t-foreach="product.recommended_products()" t-as="product">
325                     <div class='col-md-2 thumbnail' style='width: 170px; margin-right: 16px;'>
326                         <div class='mt16 text-center'>
327                             <span t-field="product.image_small"/>
328                             <h5>
329                                 <a t-href="/shop/product/#{ product.id }/"
330                                    style="display: block">
331                                     <span t-field='product.name'
332                                           style="display: block"/>
333                                 </a>
334                             </h5>
335                         </div>
336                     </div>
337                 </t>
338                 </div>
339             </div>
340         </xpath>
341     </template>
342
343     <!-- Page Shop my cart -->
344
345     <template id="mycart" name="Your Cart" page="True">
346         <t t-call="website.layout">
347             <t t-set="head">
348                 <script type="text/javascript" src="/website_sale/static/src/js/website_sale.js"></script>
349                 <link rel='stylesheet' href='/website_sale/static/src/css/website_sale.css'/>
350                 <t t-raw="head or ''"/>
351             </t>
352             <div id="wrap">
353               <div class="container oe_website_sale">
354
355                 <ul class="wizard pull-right">
356                     <li class="text-primary">Review Order<span class="chevron"></span></li>
357                     <li class="text-muted">Shipping &amp; Billing<span class="chevron"></span></li>
358                     <li class="text-muted">Payment<span class="chevron"></span></li>
359                     <li class="text-muted">Confirmation<span class="chevron"></span></li>
360                 </ul>
361                 <h1 class="mb32">Shopping Cart</h1>
362                 <div class="row">
363                     <div class="col-md-3 text-muted" id="right_column">
364                         <h4>Policies</h4>
365                         <ul class="list-unstyled mb32">
366                             <li>&#9745; 30-days money-back guarantee</li>
367                             <li>&#9745; Invoice sent by e-Mail</li>
368                         </ul>
369                         <h4>Secure Payment</h4>
370                         <ul class="list-unstyled mb32">
371                             <li>&#9745; 256 bit encryption</li>
372                             <li>&#9745; Processed by Ogone</li>
373                         </ul>
374                     </div>
375                     <div class="col-md-8 col-md-offset-1 oe_mycart">
376                         <div t-if="not website_sale_order or not website_sale_order.order_line" class="well well-lg">
377                             Your cart is empty!
378                         </div>
379                         <table class='table table-striped table-condensed' id="mycart_products" t-if="website_sale_order and website_sale_order.order_line">
380                             <colgroup>
381                                 <col width="80"/>
382                                 <col/>
383                                 <col width="100"/>
384                                 <col width="120"/>
385                             </colgroup>
386                             <thead>
387                                 <tr>
388                                     <th colspan="2">Product</th>
389                                     <th>Price</th>
390                                     <th>Quantity</th>
391                                 </tr>
392                             </thead>
393                             <tbody>
394                                 <tr t-foreach="website_sale_order.order_line" t-as="line">
395                                     <td colspan="2" t-if="not line.product_id.product_tmpl_id"></td>
396                                     <td t-if="line.product_id.product_tmpl_id">
397                                         <span t-field="line.product_id.image_small"
398                                               t-field-options='{"widget": "image", "class": "img-rounded"}'/>
399                                     </td>
400                                     <td t-if="line.product_id.product_tmpl_id">
401                                         <div>
402                                             <a t-href="/shop/product/#{ line.product_id.product_tmpl_id.id }/">
403                                                 <strong t-field="line.product_id.name"/>
404                                             </a>
405                                         </div>
406                                         <div class="text-muted" t-field="line.product_id.description_sale"/>
407                                     </td>
408                                     <td class="text-center">
409                                        <del class="text-danger" t-if="line.product_id.lst_price &gt; line.price_unit">
410                                            <span t-field="line.product_id.lst_price" t-field-options='{
411                                                "widget": "monetary",
412                                                "display_currency": "website.pricelist_id.currency_id"
413                                            }'/>
414                                        </del>
415                                        <span t-field="line.price_unit" t-field-options='{
416                                            "widget": "monetary",
417                                            "display_currency": "website.pricelist_id.currency_id"
418                                        }'/>
419                                     </td>
420                                     <td>
421                                         <div class="input-group">
422                                             <span class="input-group-addon">
423                                                 <a t-href="./add_cart/?remove=True&amp;order_line_id=#{ line.id }" class="mb8 js_add_cart_json">  
424                                                     <span class="icon-minus"/>
425                                                 </a>
426                                             </span>
427                                             <input type="text" class="js_quantity form-control"
428                                                 t-att-data-id="line.id" t-att-value="int(line.product_uom_qty)"/>
429                                             <span class="input-group-addon">
430                                                 <a t-href="./add_cart/?order_line_id=#{ line.id }" class="mb8 float_left js_add_cart_json">
431                                                     <span class="icon-plus"/>
432                                                 </a>
433                                             </span>
434                                         </div>
435
436                                     </td>
437                                 </tr>
438                             </tbody>
439                         </table>
440                         <table class='pull-right mb16' id="mycart_total">
441                             <colgroup>
442                                 <col width="100"/>
443                                 <col width="120"/>
444                             </colgroup>
445                             <thead>
446                                 <tr style="border-top: 1px solid #000">
447                                     <th><h3>Total:</h3></th>
448                                     <th class="text-right">
449                                       <h3><t t-call="website_sale.total"/></h3>
450                                     </th>
451                                 </tr>
452                                 <tr class="text-muted">
453                                     <td><abbr title="Taxes may be updated after providing shipping address">Incl. Taxes:</abbr></td>
454                                     <td class="text-right">
455                                         <span t-field="website_sale_order.amount_tax" t-field-options='{
456                                             "widget": "monetary",
457                                             "display_currency": "website.pricelist_id.currency_id"
458                                         }'/>
459                                     </td>
460                                 </tr>
461                             </thead>
462                         </table>
463                         <div class="clearfix"/>
464                         <a t-href="/shop" class="btn btn-default mb32"><span class="icon-long-arrow-left"/> Continue Shopping</a>
465                         <a t-if="website_sale_order and website_sale_order.order_line" t-href="/shop/checkout/" class="btn btn-primary pull-right mb32">Process Checkout <span class="icon-long-arrow-right"/></a>
466                         <div class="oe_structure"/>
467                     </div>
468                 </div>
469
470               </div>
471               <div class="oe_structure"/>
472             </div>
473         </t>
474     </template>
475
476     <!-- Page Shop -->
477
478     <template id="products_categories" inherit_option_id="website_sale.products" name="Product Categories">
479         <xpath expr="//div[@id='products_grid']" position="before">
480             <div id="categories" class="col-md-3">
481                 <ul class="nav nav-pills nav-stacked mt16">
482                     <li t-att-class=" '' if search.get('category') else 'active' "><a t-href="/shop/">All Products</a></li>
483                     <t t-set="categ" t-value="Ecommerce.get_categories()"/>
484                     <t t-foreach="categ[0]" t-as="category">
485                         <t t-call="website_sale.categories_recursive"/>
486                     </t>
487                 </ul>
488             </div>
489         </xpath>
490         <xpath expr="//div[@id='products_grid']" position="attributes">
491             <attribute name="class">col-md-9</attribute>
492         </xpath>
493     </template>
494
495     <template id="products_attributes" inherit_option_id="website_sale.products_categories" name="Product Attributes">
496         <xpath expr="//div[@id='categories']" position="inside">
497             <form t-action="/shop/attributes/" method="post" t-keep-query="category,search">
498                 <ul class="nav nav-pills nav-stacked mt16">
499                     <t t-set="attribute_ids" t-value="Ecommerce.get_attribute_ids()"/>
500                     <t t-foreach="attribute_ids" t-as="attribute_id">
501                         <li t-if="attribute_id.value_ids and attribute_id.type == 'distinct'">
502                             <div t-field="attribute_id.name"/>
503                             <ul class="nav nav-pills nav-stacked">
504                                 <t t-foreach="attribute_id.value_ids" t-as="value_id">
505                                     <li t-att-class="Ecommerce.has_search_attributes(attribute_id.id, value_id.id) and 'active' or ''">
506                                         <label style="margin: 0 20px;">
507                                             <input type="checkbox" t-att-name="'att-%s-%s' % (attribute_id.id, value_id.id)"
508                                                 t-att-checked="Ecommerce.has_search_attributes(attribute_id.id, value_id.id) and 'checked' or ''"/>
509                                             <span style="font-weight: normal" t-field="value_id.name"/>
510                                         </label>
511                                     </li>
512                                 </t>
513                             </ul>
514                         </li>
515                         <li t-if="attribute_id.type == 'float' and attribute_id.float_min != attribute_id.float_max">
516                             <div t-field="attribute_id.name"/>
517                             <t t-set="attribute" t-value="Ecommerce.has_search_attributes(attribute_id.id)"/>
518                             <div style="margin: 0 20px;" class="js_slider"
519                               t-att-data-id="attribute_id.id"
520                               t-att-data-value-min="attribute and attribute[1][0] or attribute_id.float_min"
521                               t-att-data-value-max="attribute and attribute[1][1] or attribute_id.float_max"
522                               t-att-data-min="attribute_id.float_min"
523                               t-att-data-max="attribute_id.float_max"></div>
524                         </li>
525                     </t>
526                 </ul>
527                 <button class="btn btn-xs btn-primary mt16">Apply filter</button>
528             </form>
529         </xpath>
530     </template>
531
532     <template id="suggested_products_list" inherit_id="website_sale.mycart" inherit_option_id="website_sale.mycart" name="Suggested Products in list view">
533         <xpath expr="//table[@id='mycart_products']" position="after">
534             <table t-if="suggested_products" class='table table-striped table-condensed'>
535                 <colgroup>
536                     <col width="80"/>
537                     <col/>
538                     <col width="100"/>
539                     <col width="120"/>
540                 </colgroup>
541                 <thead>
542                     <tr>
543                         <th colspan="2">Suggested products</th>
544                     </tr>
545                 </thead>
546                 <tbody>
547                     <tr t-foreach="suggested_products" t-as="product">
548
549                         <td>
550                             <a t-href="/shop/product/#{ product.product_tmpl_id.id }/">
551                                 <span t-field="product.image_small"
552                                       t-field-options='{"widget": "image", "class": "img-rounded"}'/>
553                             </a>
554                         </td>
555                         <td>
556                             <div>
557                                 <a t-href="/shop/product/#{ product.product_tmpl_id.id }/">
558                                     <strong t-field="product.name"/>
559                                 </a>
560                             </div>
561                             <div class="text-muted" t-field="product.description_sale"/>
562                         </td>
563                         <td>
564                             <span t-field="product.lst_price" t-field-options='{
565                                 "widget": "monetary",
566                                 "display_currency": "website.pricelist_id.currency_id"
567                             }'/>
568                         </td>
569                         <td class="text-center">
570                             <a t-href="./add_cart/?product_id=#{ product.id }"><strong>Add to Cart</strong></a>
571                         </td>
572                     </tr>
573                 </tbody>
574             </table>
575         </xpath>
576     </template>
577
578     <template id="reduction_code" inherit_option_id="website_sale.mycart" name="Reduction Code">
579         <xpath expr="//div[@id='right_column']" position="inside">
580             <h4>Coupon Code</h4>
581             <p>
582                 Have a coupon code? Fill in this field and apply.
583             </p>
584             <form t-if="website_sale_order and website_sale_order.order_line" t-action="/shop/mycart/" method="post" class="mb32">
585                 <div class="input-group">
586                     <input name="promo" class='form-control' type="text" placeholder="code..." t-att-value="website_sale_order.pricelist_id.code or ''"/>
587                     <div class="input-group-btn">
588                         <button class="btn btn-default">Apply</button>
589                     </div>
590                 </div>
591             </form>
592         </xpath>
593     </template>
594
595
596     <!-- Page confirm my cart -->
597
598     <template id="checkout">
599         <t t-call="website.layout">
600           <t t-set="head">
601               <script type="text/javascript" src="/website_sale/static/src/js/website_sale.js"></script>
602               <link rel='stylesheet' href='/website_sale/static/src/css/website_sale.css'/>
603               <t t-raw="head or ''"/>
604           </t>
605           <t t-set="additional_title">Shop - Checkout</t>
606           <div id="wrap">
607             <div class="container oe_website_sale">
608                 <ul class="wizard pull-right">
609                     <li><a href="/shop/mycart" class="text-success">Review Order<span class="chevron"></span></a></li>
610                     <li class="text-primary">Shipping &amp; Billing<span class="chevron"></span></li>
611                     <li class="text-muted">Payment<span class="chevron"></span></li>
612                     <li class="text-muted">Confirmation<span class="chevron"></span></li>
613                 </ul>
614                 <h1>Your Address</h1>
615                 <form t-action="/shop/confirm_order/" method="post">
616
617                 <div class="row">
618                 <div class="col-md-8 oe_mycart">
619                     <h3 class="page-header mt16">Billing Information
620                         <small t-if="user_id.id == website.public_user.id"> or
621                             <a t-if="not partner" t-attf-href="/web#action=redirect&amp;url=#{ request.httprequest.host_url }/shop/checkout/">sign in</a>
622                         </small>
623                     </h3>
624                         <div class="row">
625                             <div t-attf-class="form-group #{error.get('name') and 'has-error' or ''} col-lg-6">
626                                 <label class="control-label" for="contact_name">Your Name</label>
627                                 <input type="text" name="name" class="form-control" t-att-value="checkout.get('name')"/>
628                             </div>
629                             <div t-attf-class="form-group #{error.get('company') and 'has-error' or ''} col-lg-6">
630                                 <label class="control-label" for="company" style="font-weight: normal">Your Company</label>
631                                 <input type="text" name="company" class="form-control" t-att-value="checkout.get('company')"/>
632                             </div>
633                             <div t-attf-class="form-group #{error.get('email') and 'has-error' or ''} col-lg-6">
634                                 <label class="control-label" for="contact_name">Email</label>
635                                 <input type="email" name="email" class="form-control" t-att-value="checkout.get('email')"/>
636                             </div>
637                             <div t-attf-class="form-group #{ error.get('phone') and 'has-error' or ''} col-lg-6">
638                                 <label class="control-label" for="phone">Telephone</label>
639                                 <input type="tel" name="phone" class="form-control" t-att-value="checkout.get('phone')"/>
640                             </div>
641
642                             <div t-attf-class="form-group #{error.get('street') and 'has-error' or ''} col-lg-6">
643                                 <label class="control-label" for="street">Street</label>
644                                 <input type="text" name="street" class="form-control" t-att-value="checkout.get('street')"/>
645                             </div>
646                             <div class="clearfix"/>
647
648                             <div t-attf-class="form-group #{error.get('city') and 'has-error' or ''} col-lg-6">
649                                 <label class="control-label" for="city">City</label>
650                                 <input type="text" name="city" class="form-control" t-att-value="checkout.get('city')"/>
651                             </div>
652                             <div t-attf-class="form-group #{error.get('zip') and 'has-error' or ''} col-lg-6">
653                                 <label class="control-label" for="zip">Zip / Postal Code</label>
654                                 <input type="text" name="zip" class="form-control" t-att-value="checkout.get('zip')"/>
655                             </div>
656                             <div t-attf-class="form-group #{error.get('state_id') and 'has-error' or ''} col-lg-6">
657                                 <label class="control-label" for="state_id" style="font-weight: normal">State / Province</label>
658                                 <select name="state_id" class="form-control">
659                                     <option value="">select...</option>
660                                     <t t-foreach="states or []" t-as="state">
661                                         <option t-att-value="state.id" t-att-selected="state.id == checkout.get('state_id')"><t t-esc="state.name"/></option>
662                                     </t>
663                                 </select>
664                             </div>
665                             <div t-attf-class="form-group #{error.get('country_id') and 'has-error' or ''} col-lg-6">
666                                 <label class="control-label" for="contact_name">Country</label>
667                                 <select name="country_id" class="form-control">
668                                     <option value="">Country...</option>
669                                     <t t-foreach="countries or []" t-as="country">
670                                         <option t-att-value="country.id" t-att-selected="country.id == checkout.get('country_id')"><t t-esc="country.name"/></option>
671                                     </t>
672                                 </select>
673                             </div>
674
675                             <div class="clearfix"/>
676
677                             <div class="form-group col-lg-6">
678                                 <label>
679                                     <input t-if="not shipping" type="checkbox" name="shipping_different"/>
680                                     <input t-if="shipping" type="checkbox" name="shipping_different" checked="1"/>
681                                     Ship to a different address
682                                 </label>
683                             </div>
684                         </div>
685
686                         <div class="js_shipping row mb16" t-att-style="not shipping and 'display:none' or ''">
687                             <h3 class="oe_shipping col-lg-12 mt16">Shipping Information</h3>
688
689                             <div t-attf-class="form-group #{error.get('shipping_name') and 'has-error' or ''} col-lg-6">
690                                 <label class="control-label" for="contact_name">Name (Shipping)</label>
691                                 <input type="text" name="shipping_name" class="form-control" t-att-value="checkout.get('shipping_name', '')"/>
692                             </div>
693                             <div t-attf-class="form-group #{error.get('shipping_phone') and 'has-error' or ''} col-lg-6">
694                                 <label class="control-label" for="contact_name">Telephone</label>
695                                 <input type="tel" name="shipping_phone" class="form-control" t-att-value="checkout.get('shipping_phone', '')"/>
696                             </div>
697                             <div t-attf-class="form-group #{error.get('shipping_street') and 'has-error' or ''} col-lg-6">
698                                 <label class="control-label" for="contact_name">Street</label>
699                                 <input type="text" name="shipping_street" class="form-control" t-att-value="checkout.get('shipping_street', '')"/>
700                             </div>
701                             <div class="clearfix"/>
702                             <div t-attf-class="form-group #{error.get('shipping_city') and 'has-error' or ''} col-lg-6">
703                                 <label class="control-label" for="contact_name">City</label>
704                                 <input type="text" name="shipping_city" class="form-control" t-att-value="checkout.get('shipping_city', '')"/>
705                             </div>
706                             <div t-attf-class="form-group #{error.get('shipping_zip') and 'has-error' or ''} col-lg-6">
707                                 <label class="control-label" for="contact_name">Zip / Postal Code</label>
708                                 <input type="text" name="shipping_zip" class="form-control" t-att-value="checkout.get('shipping_zip', '')"/>
709                             </div>
710                             <div t-attf-class="form-group #{error.get('shipping_state_id') and 'has-error' or ''} col-lg-6">
711                                 <label class="control-label" for="contact_name" style="font-weight: normal">State / Province</label>
712                                 <select name="shipping_state_id" class="form-control">
713                                     <option value="">State / Province...</option>
714                                     <t t-foreach="states or []" t-as="state">
715                                         <option t-att-value="state.id" t-att-selected="state.id == checkout.get('shipping_state_id')"><t t-esc="state.name"/></option>
716                                     </t>
717                                 </select>
718                             </div>
719                             <div t-attf-class="form-group #{error.get('shipping_country_id') and 'has-error' or ''} col-lg-6">
720                                 <label class="control-label" for="contact_name">Country</label>
721                                 <select name="shipping_country_id" class="form-control">
722                                     <option value="">Country...</option>
723                                     <t t-foreach="countries or []" t-as="country">
724                                         <option t-att-value="country.id" t-att-selected="country.id == checkout.get('shipping_country_id')"><t t-esc="country.name"/></option>
725                                     </t>
726                                 </select>
727                             </div>
728                         </div>
729                         <button type="submit" class="btn btn-default btn-primary pull-right mb32">Confirm <span class="icon-long-arrow-right"/></button>
730                 </div>
731                 <div class="col-lg-offset-1 col-lg-3 text-muted">
732                     <h3 class="page-header mt16">Your Order <small><a href="/shop/mycart"><span class="icon-arrow-right"/> change</a></small></h3>
733                     <div class="row">
734                         <div class="col-sm-6 text-right">Subtotal:</div>
735                         <div class="col-sm-6"><span t-esc="website_sale_order.amount_untaxed" t-field-options='{
736                             "widget": "monetary",
737                             "display_currency": "website.pricelist_id.currency_id"
738                         }'/></div>
739                         <div class="col-sm-6 text-right">Taxes:</div>
740                         <div class="col-sm-6"><span t-field="website_sale_order.amount_tax" t-field-options='{
741                             "widget": "monetary",
742                             "display_currency": "website.pricelist_id.currency_id"
743                         }'/></div>
744                         <div class="col-sm-6 text-right"><h4>Total To Pay:</h4></div>
745                         <div class="col-sm-6"><h4><span t-field="website_sale_order.amount_total" t-field-options='{
746                             "widget": "monetary",
747                             "display_currency": "website.pricelist_id.currency_id"
748                         }'/></h4></div>
749                     </div>
750                 </div>
751             </div>
752             </form>
753           </div>
754           </div>
755         </t>
756     </template>
757
758     <template id="payment">
759         <t t-call="website.layout">
760             <t t-set="head">
761                 <script type="text/javascript" src="/website_sale/static/src/js/website_sale.js"></script>
762                 <link rel='stylesheet' href='/website_sale/static/src/css/website_sale.css'/>
763                 <t t-raw="head or ''"/>
764             </t>
765             <t t-set="additional_title">Shop - Select Payment Mode</t>
766             <div id="wrap">
767               <div class="container oe_website_sale">
768
769                 <ul class="wizard pull-right">
770                     <li><a href="/shop/mycart" class="text-success">Review Order<span class="chevron"></span></a></li>
771                     <li><a href="/shop/checkout" class="text-success">Shipping &amp; Billing<span class="chevron"></span></a></li>
772                     <li class="text-primary">Payment<span class="chevron"></span></li>
773                     <li class="text-muted">Confirmation<span class="chevron"></span></li>
774                 </ul>
775                 <h1 class="mb32">Validate Order</h1>
776                 <div class="row">
777                 <div class="col-md-8 oe_mycart">
778                     <table class='table table-striped table-condensed' id="mycart_products" t-if="website_sale_order and website_sale_order.order_line">
779                         <colgroup>
780                             <col width="80"/>
781                             <col/>
782                             <col width="100"/>
783                             <col width="120"/>
784                         </colgroup>
785                         <thead>
786                             <tr>
787                                 <th colspan="2">Product</th>
788                                 <th>Price</th>
789                                 <th>Quantity</th>
790                             </tr>
791                         </thead>
792                         <tbody>
793                             <tr t-foreach="website_sale_order.order_line" t-as="line">
794                                 <td colspan="2" t-if="not line.product_id.product_tmpl_id"></td>
795                                 <td t-if="line.product_id.product_tmpl_id">
796                                     <a t-href="/shop/product/#{ line.product_id.product_tmpl_id.id }/">
797                                         <span t-field="line.product_id.image_small"
798                                               t-field-options='{"widget": "image", "class": "img-rounded"}'/>
799                                     </a>
800                                 </td>
801                                 <td t-if="line.product_id.product_tmpl_id">
802                                    <strong t-field="line.product_id.name"/>
803                                 </td>
804                                 <td class="text-center">
805                                    <span t-field="line.price_unit" t-field-options='{
806                                        "widget": "monetary",
807                                        "display_currency": "website.pricelist_id.currency_id"
808                                    }'/>
809                                 </td>
810                                 <td>
811                                    <div t-esc="line.product_uom_qty"/>
812                                 </td>
813                             </tr>
814                         </tbody>
815                     </table>
816                     <table class='pull-right mb16' id="mycart_total">
817                         <colgroup>
818                             <col width="100"/>
819                             <col width="120"/>
820                         </colgroup>
821                         <thead>
822                             <tr style="border-top: 1px solid #000">
823                                 <th><h3>Total:</h3></th>
824                                 <th class="text-right"><h3><span t-field="website_sale_order.amount_total" t-field-options='{
825                                     "widget": "monetary",
826                                     "display_currency": "website.pricelist_id.currency_id"
827                                 }'/></h3></th>
828                             </tr>
829                             <tr class="text-muted">
830                                 <td><abbr title="Taxes may be updated after providing shipping address">Incl. Taxes:</abbr></td>
831                                 <td class="text-right"><span t-field="website_sale_order.amount_tax" t-field-options='{
832                                     "widget": "monetary",
833                                     "display_currency": "website.pricelist_id.currency_id"
834                                 }'/></td>
835                             </tr>
836                         </thead>
837                     </table>
838                     <div class="clearfix"/>
839                     <div class="oe_structure"/>
840                   </div>
841                   <div class="col-md-3 col-md-offset-1 text-muted" id="right_column">
842                       <h4>Bill To:</h4>
843                       <div t-field="website_sale_order.partner_invoice_id"/>
844                       <div>
845                         <a href="/shop/checkout"><span class="icon-arrow-right"/> Change Address</a>
846                       </div>
847
848                       <h4 class="mt32">Ship To:</h4>
849                       <div t-field="website_sale_order.partner_shipping_id"/>
850                       <div>
851                         <a href="/shop/checkout"><span class="icon-arrow-right"/> Change Address</a>
852                       </div>
853
854                   </div>
855                 </div>
856
857                 <div class="js_payment mb64">
858                     <p>Select your payment method:</p>
859                     <div>
860                         <t t-foreach="payments or []" t-as="payment">
861                             <label>
862                                 <input t-att-value="payment.id" type="radio" name="payment_type"/> <t t-esc="payment.name"/>
863                             </label>
864                         </t>
865                     </div>
866                     <t t-foreach="payments or []" t-as="payment">
867                         <div t-att-data-id="payment.id" t-raw="payment._content" class="hidden"/>
868                     </t>
869                     <a t-href="/shop/payment_validate/" class="btn btn-primary mt16">Validate &amp; Pay <span class="icon-long-arrow-right"/></a>
870                 </div>
871
872               </div>
873               <div class="oe_structure"/>
874             </div>
875
876         </t>
877     </template>
878
879     <template id="total">
880       <span t-field="website_sale_order.amount_total" t-field-options='{
881           "widget": "monetary",
882           "display_currency": "website.pricelist_id.currency_id"
883         }'/>
884     </template>
885  </data>
886 </openerp>