[MERGE] wip: ecommerce product list pager

bzr revid: fva@openerp.com-20130806123103-2iske1o6ckt7rjxf
This commit is contained in:
Frédéric van der Essen 2013-08-06 14:31:03 +02:00
commit 1e5794ac01
11 changed files with 380 additions and 465 deletions

View File

@ -45,3 +45,11 @@
.oe_editable:focus {
outline: #80b5f2 solid 5px !important;
}
.oe_carousel_options {
cursor: pointer;
position: absolute;
white-space: nowrap;
z-index: 1;
display: none;
}

View File

@ -40,3 +40,10 @@
.oe_editable:focus
outline: #80B5F2 solid 5px !important
.oe_carousel_options
cursor: pointer
position: absolute
white-space: nowrap
z-index: 1
display: none

View File

@ -1,3 +1,11 @@
/* THIS CSS FILE IS FOR WEBSITE THEMING CUSTOMIZATION ONLY
*
* css for editor buttons, openerp widget included in the website and other
* stuff must go to the editor.css
*
*/
/* ----- GENERIC LAYOUTING HELPERS ---- */
/* Vertical Spacing */
.mt128 {
margin-top: 128px !important;
}
@ -34,6 +42,88 @@
margin-top: 0px !important;
}
.mb128 {
margin-bottom: 128px !important;
}
.mb92 {
margin-bottom: 92px !important;
}
.mb64 {
margin-bottom: 64px !important;
}
.mb48 {
margin-bottom: 48px !important;
}
.mb32 {
margin-bottom: 32px !important;
}
.mb16 {
margin-bottom: 16px !important;
}
.mb8 {
margin-bottom: 8px !important;
}
.mb4 {
margin-bottom: 4px !important;
}
.mb0 {
margin-bottom: 0px !important;
}
/* Grid of unequally tall elements */
.grid > [class*="span"] {
display: inline-block;
float: none;
vertical-align: top;
margin-right: -4px;
box-sizing: border-box;
}
.grid > [class*="span"].grid-align-top > [class*="span"] {
vertical-align: top;
}
.grid > [class*="span"].grid-align-middle > [class*="span"] {
vertical-align: middle;
}
.grid > [class*="span"].grid-align-bottom > [class*="span"] {
vertical-align: bottom;
}
/* Table with two collumns aligned on the center */
.table-equalized {
width: 100%;
}
.table-equalized td:first-child {
width: 50%;
text-align: right;
padding-right: 1em;
vertical-align: bottom;
}
.table-equalized td:last-child {
width: 50%;
text-align: left;
vertical-align: bottom;
}
/* Theming pagination inside navbar */
.navbar-inner > .pagination {
margin: 6px 0;
}
.navbar-inner > .pagination ul {
position: relative;
top: 2px;
border: solid 2px rgba(0, 0, 0, 0.05);
border-radius: 8px;
}
/* ----- BOOTSTRAP HACK FOR STICKY FOOTER ----- */
html, body {
height: 100%;
box-sizing: border-box;
@ -57,6 +147,7 @@ footer {
padding-bottom: 64px;
}
/* ---- HOMEPAGE THEME CUSTOMIZATION ---- */
.subheader {
letter-spacing: 3px;
font-weight: 300;
@ -75,10 +166,20 @@ h5 {
font-weight: bold;
}
#myCarousel .item {
min-height: 300px;
color: white;
}
.nav > .pull-right {
float: right !important;
}
.thumbnail {
background: white;
}
/* ---- HACK FOR COVERING UP CK EDITOR BOGUS P INSERTION --- */
.navbar .nav > li > p {
margin-bottom: 0px;
}
@ -98,16 +199,3 @@ h5 {
.nav > li a {
display: block;
}
#myCarousel .item {
min-height: 300px;
color: white;
}
.carousel > .css_carousel_options {
cursor: pointer;
position: absolute;
white-space: nowrap;
z-index: 1;
display: none;
}

View File

@ -1,5 +1,16 @@
@charset "utf-8"
/*
* THIS CSS FILE IS FOR WEBSITE THEMING CUSTOMIZATION ONLY
*
* css for editor buttons, openerp widget included in the website and other
* stuff must go to the editor.css
*
*/
/* ----- GENERIC LAYOUTING HELPERS ---- */
/* Vertical Spacing */
.mt128
margin-top: 128px !important
.mt92
@ -19,6 +30,62 @@
.mt0
margin-top: 0px !important
.mb128
margin-bottom: 128px !important
.mb92
margin-bottom: 92px !important
.mb64
margin-bottom: 64px !important
.mb48
margin-bottom: 48px !important
.mb32
margin-bottom: 32px !important
.mb16
margin-bottom: 16px !important
.mb8
margin-bottom: 8px !important
.mb4
margin-bottom: 4px !important
.mb0
margin-bottom: 0px !important
/* Grid of unequally tall elements */
.grid > [class*="span"]
display: inline-block
float: none
vertical-align: top
margin-right: -4px
box-sizing: border-box
&.grid-align-top > [class*="span"]
vertical-align: top
&.grid-align-middle > [class*="span"]
vertical-align: middle
&.grid-align-bottom > [class*="span"]
vertical-align: bottom
/* Table with two collumns aligned on the center */
.table-equalized
width: 100%
td:first-child
width: 50%
text-align: right
padding-right: 1em
vertical-align: bottom
td:last-child
width: 50%
text-align: left
vertical-align: bottom
/* Theming pagination inside navbar */
.navbar-inner > .pagination
margin: 6px 0
ul
position: relative
top: 2px
border: solid 2px rgba(0,0,0,0.05)
border-radius: 8px
/* ----- BOOTSTRAP HACK FOR STICKY FOOTER ----- */
html,body
height: 100%
@ -39,8 +106,8 @@ footer
background: rgb(239, 248, 248) // rgb(221, 235, 227)
padding-top: 64px
padding-bottom: 64px
//*
color: #1abc9c !important
/* ---- HOMEPAGE THEME CUSTOMIZATION ---- */
.subheader
letter-spacing: 3px
@ -56,9 +123,19 @@ header.navbar-fixed-top
h5
font-weight: bold
#myCarousel .item
min-height: 300px
color: white
.nav > .pull-right
float: right !important //bugfix for flatly theme
.thumbnail
background: white
/* ---- HACK FOR COVERING UP CK EDITOR BOGUS P INSERTION --- */
.navbar .nav > li > p
margin-bottom: 0px
@ -75,13 +152,3 @@ h5
.nav > li a
display: block
#myCarousel .item
min-height: 300px
color: white
.carousel > .css_carousel_options
cursor: pointer
position: absolute
white-space: nowrap
z-index: 1
display: none

View File

@ -198,7 +198,7 @@
<section>
<div id="myCarousel" class="carousel slide" data-interval='1000000'>
<div class="css_carousel_options js_carousel_options" t-ignore="1">
<div class="oe_carousel_options js_carousel_options" t-ignore="1">
<span class="label js_add"><i class="icon-plus-sign"></i></span>
<span class="label js_remove"><i class="icon-minus-sign"></i></span>
</div>
@ -206,7 +206,7 @@
<div class="carousel-inner">
<div class="item active" style="background-image: url(/website/static/src/img/greenfields.jpg); background-size: cover;" >
<div class='container'>
<h1 class='mt64'>A Nice Banner</h1>
<h1 class='mt64'>A Nice Bidule</h1>
<h2>A convincing subtitle</h2>
<a href='#' class='btn btn-success btn-large mt16'>And a <em>Call To Action</em></a>
</div>
@ -318,13 +318,13 @@
<div class="row">
<div class="span12">
<h1>404: Page not found!</h1>
<p class="oe_grey">
<p>
The page you were looking for could not be
found; it is possible you have typed the
address incorrectly, but it has most
probably been removed due to the recent
website reorganisation.
</p><p class="oe_grey">
</p><p>
Maybe you were looking for one of these
popular pages ?
</p>
@ -335,8 +335,8 @@
</div>
</div>
<div class="row">
<div class="span12">
<a class="oe_button oe_big oe_tacky" t-att-href="'/pagenew/'+path" t-if="editable">Create Page</a>
<div class="span12 mt32">
<a class="btn btn-primary" t-att-href="'/pagenew/'+path" t-if="editable">Create Page</a>
</div>
</div>
</div>

View File

@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
import math
import openerp
import simplejson
from openerp.osv import osv
@ -49,6 +50,45 @@ class website(osv.osv):
class Ecommerce(http.Controller):
def get_categories(self):
category_obj = request.registry.get('pos.category')
category_ids = category_obj.search(request.cr, openerp.SUPERUSER_ID, [('parent_id', '=', False)])
categories = category_obj.browse(request.cr, openerp.SUPERUSER_ID, category_ids)
print categories
return categories
def get_current_order(self):
order = self.get_order(request.httprequest.session.get('ecommerce_order_id'))
request.httprequest.session['ecommerce_order_id'] = order.id
return order
def get_order(self, order_id=None):
order_obj = request.registry.get('sale.order')
# check if order allready exists
if order_id:
try:
order_obj.browse(request.cr, openerp.SUPERUSER_ID, order_id).pricelist_id
except:
order_id = None
if not order_id:
fields = [k for k, v in order_obj._columns.items()]
order_value = order_obj.default_get(request.cr, openerp.SUPERUSER_ID, fields)
order_value['partner_id'] = openerp.SUPERUSER_ID != request.public_uid and \
request.registry.get('res.users').browse(request.cr, openerp.SUPERUSER_ID, request.uid).partner_id.id or \
None
order_value.update(order_obj.onchange_partner_id(request.cr, openerp.SUPERUSER_ID, [], request.uid, context={})['value'])
order_id = order_obj.create(request.cr, openerp.SUPERUSER_ID, order_value)
return order_obj.browse(request.cr, openerp.SUPERUSER_ID, order_id)
def render(self, template, values={}):
_values = {
'order': self.get_current_order(),
'categories': self.get_categories(),
}
_values.update(values)
return website.render(template, _values)
def recommended_product(self, my_pids):
if not my_pids:
return []
@ -71,24 +111,47 @@ class Ecommerce(http.Controller):
product_ids.append(p[0])
return request.registry.get('product.product').browse(request.cr, request.uid, product_ids)
@http.route(['/shop', '/shop/category/<cat_id>'], type='http', auth="public")
def category(self, cat_id=0, offset=0, **post):
@http.route(['/shop', '/shop/category/<cat_id>', '/shop/category/<cat_id>/page/<page>', '/shop/page/<page>'], type='http', auth="public")
def category(self, cat_id=0, page=0, **post):
website = request.registry['website']
product_obj = request.registry.get('product.product')
domain = [("sale_ok", "=", True)]
if post.get("search"):
domain += ['|', '|', ('name', 'ilike', "%%%s%%" % post.get("search")), ('desrequest.cription', 'ilike', "%%%s%%" % post.get("search")), ('pos_categ_id.name', 'ilike', "%%%s%%" % post.get("search"))]
if cat_id:
cat_id = cat_id and int(cat_id) or 0
cat_id = int(cat_id)
domain = [('pos_categ_id.id', 'child_of', cat_id)] + domain
product_obj = request.registry.get('product.product')
product_count = len(product_obj.search(request.cr, request.uid, domain))
page_count = int(math.ceil(product_count / 20.0))
#if post.get("search"):
# domain += ['|', '|', ('name', 'ilike', "%%%s%%" % post.get("search")), ('description', 'ilike', "%%%s%%" % post.get("search")), ('pos_categ_id.name', 'ilike', "%%%s%%" % post.get("search"))]
page = max(1,min(int(page),page_count))
offset = (page-1) * 20
if page_count <= 5 or page <= 3:
pmin = 1
pmax = min(page_count,5)
elif page >= page_count - 2:
pmin = page_count - 4
pmax = page_count
else:
pmin = page - 2
pmax = page + 2
pages = range(pmin, pmax+1)
product_ids = product_obj.search(request.cr, request.uid, domain, limit=20, offset=offset)
values = website.get_rendering_context({
'current_category': cat_id,
'products': product_obj.browse(request.cr, request.uid, product_ids),
'search': post.get("search"),
'page_count': page_count,
'pages': pages,
'page': page,
})
return website.render("website_sale.products", values)

View File

@ -1,2 +1,2 @@
sass:
sass --compass --trace -t expanded ecommerce.sass ecommerce.css
sass --compass --trace -t expanded --watch ecommerce.sass:ecommerce.css

View File

@ -1,200 +0,0 @@
.oe_ecommerce .oe_total {
font-size: 13px;
margin-top: 10px;
}
.oe_ecommerce .oe_total td {
padding: 5px 10px;
}
.oe_ecommerce .oe_total table {
width: auto;
}
.oe_ecommerce .oe_total td:last-child {
text-align: right;
}
.oe_ecommerce .oe_total th:last-child {
text-align: center;
}
.oe_ecommerce .oe_products .oe_product {
text-align: center;
display: inline-block;
padding: 4px;
width: 180px;
height: 220px;
margin-right: 15px;
margin-left: 3px;
padding-top: 8px;
}
.oe_ecommerce .oe_products .oe_product .oe_hidden {
visibility: hidden;
}
.oe_ecommerce .oe_products .oe_product .pull-left {
margin: 0;
float: none;
}
.oe_ecommerce .oe_products .oe_product .oe_ecommerce_description {
display: none;
}
.oe_ecommerce .oe_products .oe_product h4 {
text-align: center;
text-shadow: 0px 1px 1px rgba(200, 200, 200, 0.2);
margin-bottom: 16px;
}
.oe_ecommerce .oe_products .oe_product img {
max-height: 110px;
max-width: 130px;
margin: 0 auto;
padding-bottom: 14px;
}
.oe_ecommerce .oe_products .oe_product:nth-child(3n) {
margin-right: 0;
}
.oe_ecommerce .oe_products .oe_product .oe_ecommerce_price {
width: 100%;
position: absolute;
bottom: 44px;
text-shadow: 0px 1px 3px rgba(255, 255, 255, 0.7);
text-align: center;
font-size: 25px;
}
.oe_ecommerce .oe_products .oe_product .oe_ecommerce_price span {
font-weight: bold;
}
.oe_ecommerce .oe_products .oe_product .oe_button_cart {
bottom: 5px;
left: 0;
}
.oe_ecommerce .oe_products .oe_product .oe_button_cart .btn-inverse {
display: none;
}
.oe_ecommerce .oe_mycart .oe_product {
display: inline-block;
width: 250px;
margin-left: 0px;
float: none;
margin-right: 16px;
padding: 8px 5px 6px 10px;
}
.oe_ecommerce .oe_mycart .oe_product > .pull-left {
width: 84px;
height: 64px;
}
.oe_ecommerce .oe_mycart .oe_product > .pull-left img {
max-width: 64px;
max-height: 64px;
margin: auto;
}
.oe_ecommerce .oe_mycart .oe_product .oe_button_cart {
position: static;
right: 6px;
top: 6px;
}
.oe_ecommerce .oe_mycart form input {
margin-bottom: 0;
}
.oe_ecommerce .oe_product {
vertical-align: top;
position: relative;
margin-top: 0;
margin-bottom: 15px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
-ms-border-radius: 5px;
-o-border-radius: 5px;
border-radius: 5px;
border: 1px solid rgba(0, 0, 0, 0.1);
-webkit-box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.1);
-moz-box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.1);
box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.1);
}
.oe_ecommerce .oe_button_cart {
width: 100%;
font-size: 11px;
position: absolute;
}
.oe_ecommerce .oe_button_cart button {
text-shadow: 0px 1px 1px rgba(0, 0, 0, 0.44);
overflow: hidden;
text-align: center;
font-size: 12px;
margin: 0 auto;
margin-bottom: 5px;
padding: 2px;
height: 22px;
position: relative;
}
.oe_ecommerce .oe_button_cart button.btn-inverse {
background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #aaaaaa), color-stop(100%, #999999));
background: -webkit-linear-gradient(#aaaaaa, #999999);
background: -moz-linear-gradient(#aaaaaa, #999999);
background: -o-linear-gradient(#aaaaaa, #999999);
background: linear-gradient(#aaaaaa, #999999);
}
.oe_ecommerce .oe_button_cart button.btn-primary {
background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #0088cc), color-stop(100%, #0076b1));
background: -webkit-linear-gradient(#0088cc, #0076b1);
background: -moz-linear-gradient(#0088cc, #0076b1);
background: -o-linear-gradient(#0088cc, #0076b1);
background: linear-gradient(#0088cc, #0076b1);
}
.oe_ecommerce .oe_button_cart button.btn-success {
background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #51a351), color-stop(100%, #418541));
background: -webkit-linear-gradient(#51a351, #418541);
background: -moz-linear-gradient(#51a351, #418541);
background: -o-linear-gradient(#51a351, #418541);
background: linear-gradient(#51a351, #418541);
}
.oe_ecommerce .oe_search form {
width: 100%;
margin: 24px;
text-align: center;
}
.oe_ecommerce .oe_product_detail .oe_button_cart {
position: relative;
text-align: right;
}
.oe_ecommerce .oe_recommended a {
margin: 0 3px;
}
.oe_ecommerce .oe_recommended img {
max-width: 64px;
max-height: 64px;
}
.oe_ecommerce .oe_checkout h4 {
border-bottom: 1px solid #dddddd;
margin-right: 30px;
}
.oe_ecommerce .oe_checkout input:not([type="radio"]):not([type="checkbox"]):not([type="image"]) {
height: 20px;
}
.oe_ecommerce .oe_checkout input[type="image"] {
height: 30px;
}
.oe_ecommerce .oe_checkout label > input:not([type="radio"]):not([type="checkbox"]), .oe_ecommerce .oe_checkout label > div, .oe_ecommerce .oe_checkout label > select {
display: block;
margin-top: 3px;
}
.oe_ecommerce .oe_checkout label select {
margin-top: 3px;
}
.oe_ecommerce .oe_checkout label > div > input {
margin-bottom: 0;
}
.oe_ecommerce .oe_checkout .css_payments {
clear: both;
}
.oe_ecommerce .oe_checkout .css_payments .css_payment {
position: relative;
width: 80px;
overflow: hidden;
height: 30px;
text-align: center;
padding: 10px 10px 0 0;
}
.oe_ecommerce .oe_checkout .css_payments .css_error_payment {
width: 100%;
height: 100%;
position: absolute;
top: +O;
left: 0;
cursor: pointer;
}

View File

@ -1,156 +0,0 @@
@import "compass/css3"
.oe_ecommerce
.oe_total
font-size: 13px
margin-top: 10px
td
padding: 5px 10px
table
width: auto
td:last-child
text-align: right
th:last-child
text-align: center
.oe_products
.oe_product
.oe_hidden
visibility: hidden
.pull-left
margin: 0
float: none
.oe_ecommerce_description
display: none
h4
text-align: center
+text-shadow(0px 1px 1px rgba(200, 200, 200,.2))
margin-bottom: 16px
img
max-height: 110px
max-width: 130px
margin: 0 auto
padding-bottom: 14px
text-align: center
display: inline-block
padding: 4px
width: 180px
height: 220px
margin-right: 15px
margin-left: 3px
padding-top: 8px
&:nth-child(3n)
margin-right: 0
.oe_ecommerce_price
width: 100%
position: absolute
bottom: 44px
+text-shadow(0px 1px 3px rgba(255, 255, 255, 0.7))
text-align: center
font-size: 25px
span
font-weight: bold
.oe_button_cart
bottom: 5px
left: 0
.btn-inverse
display: none
.oe_mycart
.oe_product
display: inline-block
width: 250px
margin-left: 0px
float: none
margin-right: 16px
padding: 8px 5px 6px 10px
> .pull-left
width: 84px
height: 64px
img
max-width: 64px
max-height: 64px
margin: auto
.oe_button_cart
position: static
right: 6px
top: 6px
form
input
margin-bottom: 0
.oe_product
vertical-align: top
position: relative
margin-top: 0
margin-bottom: 15px
+border-radius(5px)
border: 1px solid rgba(0,0,0,.1)
+box-shadow(0px 1px 3px rgba(0,0,0,.1))
.oe_button_cart
width: 100%
font-size: 11px
position: absolute
button
+text-shadow(0px 1px 1px rgba(0, 0, 0, 0.44))
overflow: hidden
text-align: center
font-size: 12px
margin: 0 auto
margin-bottom: 5px
padding: 2px
height: 22px
position: relative
&.btn-inverse
@include background(linear-gradient(#aaaaaa,#999999))
&.btn-primary
@include background(linear-gradient(#0088cc,#0076b1))
&.btn-success
@include background(linear-gradient(#51a351, #418541))
.oe_search
form
width: 100%
margin: 24px
text-align: center
.oe_product_detail
.oe_button_cart
position: relative
text-align: right
.oe_recommended
a
margin: 0 3px
img
max-width: 64px
max-height: 64px
.oe_checkout
.css_required
input, select
//background-color: #d2d2ff !important
h4
border-bottom: 1px solid #ddd
margin-right: 30px
input:not([type="radio"]):not([type="checkbox"]):not([type="image"])
height: 20px
input[type="image"]
height: 30px
label
> input:not([type="radio"]):not([type="checkbox"]), > div, > select
display: block
margin-top: 3px
select
margin-top: 3px
> div > input
margin-bottom: 0
.css_payments
clear: both
.css_payment
position: relative
width: 80px
overflow: hidden
height: 30px
text-align: center
padding: 10px 10px 0 0
.css_error_payment
width: 100%
height: 100%
position: absolute
top: +O
left: +0
cursor: pointer

View File

@ -30,7 +30,7 @@ $(document).ready(function () {
.html(quantity);
$add.toggleClass('btn-primary', !quantity)
.toggleClass('btn-success', !!quantity);
$remove.toggleClass('oe_hidden', !quantity);
$remove.toggleClass('hidden', !quantity);
if ($('.oe_mycart').size() && !quantity) {
$product.remove()
}
@ -65,4 +65,4 @@ $(document).ready(function () {
}
});
});
});
});

View File

@ -54,17 +54,8 @@
<t t-set="title">Shop - <t t-raw="title">Categories</t></t>
<div class="container mt48 oe_ecommerce">
<div class="row">
<div class="span4 css_noprint">
<ul class="nav nav-list">
<t t-foreach="website_sale_get_categories()" t-as="category">
<t t-call="website_sale.categories_recursive"/>
</t>
</ul>
</div>
<div class="span8">
<t t-raw="shop_content">
</t>
</div>
<t t-call='website_sale.categories' />
<t t-raw="shop_content" />
</div>
</div>
</t>
@ -72,9 +63,20 @@
<!-- List of categories -->
<template id="categories">
<div class="span4">
<ul class="nav nav-list">
<li t-att-class=" '' if current_category else 'active' " class='active'><a href='/shop/'>All Products</a></li>
<t t-foreach="website_sale_get_categories()" t-as="category">
<t t-call="website_sale.categories_recursive"/>
</t>
</ul>
</div>
</template>
<template id="categories_recursive">
<li t-att-class="category.id == current_category and 'active' or ''">
<a t-att-href="'/shop/category/%%s' %% category.id"><span t-field="category.name"><t t-esc="category.name"/></span></a>
<a t-att-href="'/shop/category/%%s' %% category.id" t-field="category.name"></a>
<ul t-if="category.child_id" class="nav nav-list">
<t t-foreach="category.child_id" t-as="category">
<t t-call="website_sale.categories_recursive"/>
@ -85,52 +87,84 @@
<!-- Product list -->
<template id="product_pager">
<t t-set="classname" t-value="classname or ''" />
<div t-if="page_count != 1" t-att-class="classname + ' pagination'">
<ul>
<li t-att-class=" 'disabled' if page == 1 else '' " ><a t-att-href=" '#' if page == 1 else ('/shop/category/%%s/page/%%s' %% (current_category, max(0,page-1))) ">Prev</a></li>
<t t-foreach="pages" t-as="p">
<li t-att-class=" 'active' if p == page else '' " ><a t-att-href=" '/shop/category/%%s/page/%%s' %% (current_category, p)" t-raw='p'></a></li>
</t>
<li t-att-class=" 'disabled' if page == page_count else '' "><a t-att-href=" '#' if page == page_count else ('/shop/category/%%s/page/%%s' %% (current_category, min(page_count,page+1))) ">Next</a></li>
</ul>
</div>
</template>
<template id="products">
<t t-call="website_sale.page">
<t t-set="title">Product</t>
<t t-set="shop_content">
<div class="oe_search clearfix">
<form action="/shop" method="get" class="navbar-search pull-right">
<input type="text" name="search" class="search-query span4" placeholder="Search" t-att-value="search or '' or ''"/>
<button type="submit" class="btn">Submit</button>
</form>
<div class='span8 navbar navbar-inverse'>
<div class='navbar-inner'>
<t t-call="website_sale.product_pager" >
<t t-set="classname">pull-left</t>
</t>
<form action="/shop" method="get" class="navbar-search pull-right">
<input type="text" name="search" class="search-query span2" placeholder="Search" t-att-value="search or '' or ''"/>
</form>
</div>
</div>
<div class="span8">
<div class='row grid grid-align-top'>
<t t-foreach="products" t-as="product">
<t t-set="quantity" t-value="([int(line.product_uom_qty) for line in (order.order_line or []) if line.product_id.id == product.id] + [0])[0]"/>
<t t-call="website_sale.product_card"/>
</t>
</div>
</div>
<div class="span8 offset4 text-center">
<t t-call="website_sale.product_pager" />
</div>
<span class="oe_products">
<t t-foreach="products" t-as="product">
<t t-set="quantity" t-value="([int(line.product_uom_qty) for line in (order.order_line or []) if line.product_id.id == product.id] + [0])[0]"/>
<t t-call="website_sale.product_card"/>
</t>
</span>
</t>
</t>
</template>
<template id="product_card">
<div class="media oe_product span3">
<a t-att-href="'/shop/product/%%s' %% product.id"><h4 class="media-heading"><span t-field="product.name"><t t-esc="product.name"/></span></h4></a>
<a class="pull-left" t-att-href="'/shop/product/%%s' %% product.id"><img class="media-object" t-att-src="'data:image/png;base64,' + product.image"/></a>
<div class="media-body">
<div class="oe_ecommerce_description" t-field="product.description_sale"><t t-esc="product.description_sale"/></div>
<div class="oe_ecommerce_price"><span><span t-field="product.list_price"><t t-esc="product.list_price"/></span></span></div>
<div class="oe_button_cart">
<div class="alert mb0" t-if="editable and not product.website_published">Product not published</div>
<t t-if="product.website_published">
<button t-att-class="'btn btn-small btn-inverse %%s' %% (not quantity and 'oe_hidden' or '')" t-att-data-id="product.id">Remove one</button>
<button t-att-class="'btn btn-small %%s' %% (quantity and 'btn-success' or 'btn-primary')" t-att-data-id="product.id">Add to cart
<span class="oe_txt">(<span class="oe_quantity"><t t-esc="quantity"/></span>)</span>
</button>
</t>
<div class="oe_product span2 mb16 thumbnail text-center">
<a t-att-href="'/shop/product/%%s' %% product.id">
<h5 t-field="product.name"> </h5>
</a>
<a t-att-href="'/shop/product/%%s' %% product.id">
<img class="img-rounded" t-att-src="'data:image/png;base64,' + product.image"/>
</a>
<div>
<div t-field="product.description_sale"></div>
<div><span t-field="product.list_price"></span></div>
<div class="mb8 mt8">
<button t-att-class="'btn mb8 btn-small btn-inverse %%s' %% (not quantity and 'hidden' or '')" t-att-data-id="product.id">Remove one</button>
<button t-att-class="'btn btn-small %%s' %% (quantity and 'btn-success' or 'btn-primary')" t-att-data-id="product.id">
Add to cart <t t-if="quantity">(<t t-esc="quantity"/>)</t>
</button>
</div>
</div>
</div>
</template>
<template id="product_recommended">
<div class="oe_recommended media well well-small" t-if="recommended_products">
<h6>Other customers have also take this products:</h6>
<div class="well mt32" t-if="recommended_products">
<h4>Customers who have bought this item also bought</h4>
<div class='row mt16'>
<t t-foreach="recommended_products or []" t-as="product">
<a t-att-href="'/shop/product/%%s' %% product.id"><img t-att-src="'data:image/png;base64,' + product.image"/></a>
<div class='span2 thumbnail'>
<a t-att-href="'/shop/product/%%s' %% product.id">
<div class='mt16 text-center'>
<img t-att-src="'data:image/png;base64,' + product.image"/>
<h5 t-field='product.name'></h5>
</div>
</a>
</div>
</t>
</div>
</div>
</template>
@ -140,21 +174,22 @@
<t t-call="website_sale.page">
<t t-set="title">Product</t>
<t t-set="shop_content">
<div class="oe_product_detail">
<div class="oe_product_detail span8">
<a href="#" t-att-data-id="product.id" class="pull-right" t-if="editable">
<span t-att-class="'label label-success js_unpublish %%s' %% (not product.website_published and 'hidden' or '')">Click to Unpublish</span>
<span t-att-class="'label label-important js_publish %%s' %% (product.website_published and 'hidden' or '')">Click to Publish</span>
</a>
<h1 t-field="product.name"></h1>
<h2 t-field="product.name"></h2>
<div class="oe_button_cart">
<button t-att-class="'btn btn-inverse %%s' %% (not quantity and 'oe_hidden' or '')" t-att-data-id="product.id">Remove one</button>
<button t-att-class="'btn %%s' %% (quantity and 'btn-success' or 'btn-primary')" t-att-data-id="product.id">Add to cart
<span class="oe_txt">(<span class="oe_quantity"><t t-esc="quantity"/></span>)</span>
<button t-att-class="'btn btn-small btn-inverse %%s' %% (not quantity and 'oe_hidden' or '')" t-att-data-id="product.id">Remove one</button>
<button t-att-class="'btn btn-small %%s' %% (quantity and 'btn-success' or 'btn-primary')" t-att-data-id="product.id">
Add to cart <t t-if="quantity" >(<t t-esc="quantity"/>)</t>
</button>
</div>
<img class="media-object" t-att-src="'data:image/png;base64,' + product.image"/>
<div t-field="product.description_website"></div>
<div class="oe_ecommerce_price" t-field="product.list_price"><t t-esc="product.list_price"/> </div>
<div class="oe_ecommerce_price"><t t-field="product.list_price" /></div>
<t t-call="website_sale.product_recommended"/>
</div>
</t>
@ -167,22 +202,24 @@
<t t-call="website_sale.page">
<t t-set="title">My cart</t>
<t t-set="shop_content">
<span class="oe_mycart">
<t t-foreach="order.order_line or []" t-as="line">
<t t-set="product" t-value="line.product_id"/>
<t t-set="quantity" t-value="int(line.product_uom_qty)"/>
<t t-call="website_sale.product_card"/>
</t>
<t t-call="website_sale.product_recommended"/>
<t t-call="website_sale.total"/>
<div class="media well well-small" t-if="order.order_line">
<form action="/shop/mycart" class="navbar-form">
<input name="code" type="text" placeholder="Reduction Code..."/>
<button class="btn">Submit your Reduction Code</button>
</form>
<div class="span8 oe_mycart">
<h2>My Shopping Cart</h2>
<h3 t-if="not order.order_line">Your cart is empty</h3>
<div class='row mt32 grid grid-align-top'>
<t t-foreach="order.order_line or []" t-as="line">
<t t-set="product" t-value="line.product_id"/>
<t t-set="quantity" t-value="int(line.product_uom_qty)"/>
<t t-call="website_sale.product_card"/>
</t>
</div>
<a t-if="order.order_line" href="/shop/checkout"><button class="btn btn-success">Next stage</button></a>
</span>
<t t-call="website_sale.total"/>
<form t-if="order.order_line" class="well form-search" action="/shop/mycart" >
<input name="code" class='input' type="text" placeholder="Reduction Code..."/>
<button class="btn">Apply Code</button>
</form>
<a t-if="order.order_line" href="/shop/checkout"><button class="btn btn-success">Proceed To Payment</button></a>
<t t-call="website_sale.product_recommended"/>
</div>
</t>
</t>
</template>
@ -190,14 +227,15 @@
<!-- Total Shop my cart -->
<template id="total">
<div class="oe_total">
<div class="media well well-small">
<table t-if="order.order_line">
<tr><td>Untaxed Amount</td><td><t t-esc="order.amount_untaxed"/></td></tr>
<tr><td>Taxes</td><td><t t-esc="order.amount_tax"/></td></tr>
<tr><td>Total</td><td><h3><t t-esc="order.amount_total"/></h3></td></tr>
</table>
<span t-if="not order.order_line">Your cart is empty</span>
<div class="row oe_total">
<div class="span4">
<div class="well">
<table class='table-equalized' t-if="order.order_line">
<tr> <td>Subtotal </td> <td><t t-esc="order.amount_untaxed"/></td></tr>
<tr> <td>Taxes </td> <td><t t-esc="order.amount_tax"/></td></tr>
<tr> <td><h4>Total</h4></td> <td><h4><t t-esc="order.amounttotal"/></h4></td></tr>
</table>
</div>
</div>
</div>
</template>