Merged lp:~openerp-dev/openobject-addons/trunk-website-shop-fp

bzr revid: psa@tinyerp.com-20130919100105-kcl6ia2bwe5acjv0
This commit is contained in:
Paramjit Singh Sahota
2013-09-19 15:31:05 +05:30
4 changed files with 137 additions and 31 deletions
+56
View File
@@ -168,6 +168,62 @@
vertical-align: bottom;
}
.oe_product {
border-bottom: 1px solid grey;
border-right: 1px solid grey;
padding: 0;
.oe_product_image-width: 100%;
.oe_product_image-height: auto;
}
.oe-height-1 {
height: 60px;
}
.oe-height-2 {
height: 120px;
}
.oe-height-3 {
height: 180px;
}
.oe-height-4 {
height: 240px;
}
.oe-height-5 {
height: 300px;
}
.oe-height-6 {
height: 360px;
}
.oe-height-7 {
height: 420px;
}
.oe-height-8 {
height: 480px;
}
.oe-height-9 {
height: 540px;
}
.oe-height-10 {
height: 600px;
}
.oe-height-11 {
height: 620px;
}
.oe-height-12 {
height: 680px;
}
/* Extra Styles */
img.shadow {
-webkit-border-radius: 3px;
@@ -100,6 +100,39 @@
&.grid-align-bottom > [class*="col-md"]
vertical-align: bottom
.oe_product
border-bottom: 1px solid grey
border-right: 1px solid grey
padding: 0
.oe_product_image:
width: 100%
height: auto
.oe-height-1
height: 60px
.oe-height-2
height: 120px
.oe-height-3
height: 180px
.oe-height-4
height: 240px
.oe-height-5
height: 300px
.oe-height-6
height: 360px
.oe-height-7
height: 420px
.oe-height-8
height: 480px
.oe-height-9
height: 540px
.oe-height-10
height: 600px
.oe-height-11
height: 620px
.oe-height-12
height: 680px
/* Extra Styles */
img.shadow
+42 -31
View File
@@ -86,7 +86,7 @@
</div>
</t>
</template>
<template id="products_categories" inherit_id="website_sale.layout" inherit_option_id="website_sale.layout" name="Left Product Categories">
<template id="products_categories" inherit_option_id="website_sale.layout" name="Product Categories">
<xpath expr="//div[@id='shop_content']" position="before">
<div class="col-md-3">
<ul class="nav nav-pills nav-stacked">
@@ -125,39 +125,50 @@
</t>
<t t-set="title">Product</t>
<t t-set="shop_content">
<a t-if="editable" t-attf-href="/shop/#{ category_id and ('category/%s/' % category_id) or ''}add_product/" class="btn btn-default pull-right">Create New Product</a>
<div t-if="editable" class="clearfix"/>
<t t-call="website.pager">
<t t-set="classname">pull-left</t>
</t>
<form t-attf-action="/shop/#{ category_id and ('category/%s/' % category_id) or ''}" method="get" class="pull-right pagination">
<input type="text" name="search" class="search-query col-md-2 form-control" placeholder="Search" t-att-value="search or '' or ''"/>
</form>
<div class="clearfix"/>
<div class='row grid grid-align-top'>
<t t-foreach="products" t-as="product">
<div class="css_product col-md-2 mb16 thumbnail text-center" data-publish="">
<t t-call="website.publish"><t t-set="object" t-value="product"/></t>
<div class="ellipsis css_content">
<a t-attf-href="/shop/product/#{ product.id }/?#{ search and ('search=%s' % search) or ''}#{ category_id and ('&amp;category_id=%s' % category_id) or ''}" style="text-decoration: none; display: block;">
<h5 t-field="product.name"> </h5>
<img class="img-rounded" t-att-src="product.img('image_small')"/>
</a>
<small t-field="product.description_sale"></small>
<span class="end">&amp;#133;</span><span class="fill"></span>
</div>
<div>
<t t-if="product.product_variant_ids[0].lst_price != product.product_variant_ids[0].price">
<small class="text-error" style="text-decoration: line-through;"><t t-esc="product.product_variant_ids[0].lst_price" /> €</small>
</t>
<b><t t-esc="product.product_variant_ids[0].price" /> €</b>
</div>
<div class="mb8 mt8">
<a t-attf-href="./add_cart/?product_id=#{ product.id }" class="btn btn-default btn-sm btn-success">Add to basket</a>
</div>
<div class="row">
<div class="col-sm-4">
<t t-call="website.pager">
<t t-set="classname">pull-left</t>
</t>
</div><div class="col-sm-4 pagination text-center">
<a t-if="editable" t-attf-href="/shop/#{ category_id and ('category/%s/' % category_id) or ''}add_product/" class="btn btn-default pull-left">New Product</a>
</div><div class="col-sm-4">
<form t-attf-action="/shop/#{ category_id and ('category/%s/' % category_id) or ''}" method="get" class="pull-right pagination">
<input type="text" name="search" class="search-query col-md-2 form-control" placeholder="Search" t-att-value="search or '' or ''"/>
</form>
</div>
</div>
<div class='row'>
<t t-foreach="products" t-as="product">
<div t-attf-class="col-md-#{ product.website_sizex } oe_product text-center oe-height-#{ product.website_sizey }" t-att-data-publish="product.website_published">
<div class="oe_product_name">
<a t-attf-href="/shop/product/#{ product.id }/?#{ search and ('search=%s' % search) or ''}#{ category_id and ('&amp;category_id=%s' % category_id) or ''}" style="text-decoration: none; display: block;">
<h5 t-field="product.name"> </h5>
</a>
<!-- This should be an option -->
<small t-field="product.description_sale"></small>
</div>
<img class="img oe_product_image" t-att-src="product.img('image')"/>
<div class="oe_product_price">
<t t-if="product.product_variant_ids[0].lst_price != product.product_variant_ids[0].price">
<small class="text-error" style="text-decoration: line-through;">
<t t-esc="product.product_variant_ids[0].lst_price" /> €
</small>
</t>
<b><t t-esc="product.product_variant_ids[0].price" /> €</b>
<!-- Put this in a separate view -->
<a t-attf-href="./add_cart/?product_id=#{ product.id }" class="btn btn-default btn-sm btn-success">Add to basket</a>
</div>
</div>
</t>
</div>
<div class="text-center">
<t t-call="website.pager" />
</div>
+6
View File
@@ -36,6 +36,12 @@ class product_template(osv.osv):
'website_description': fields.html('Description for the website'),
'suggested_product_id': fields.many2one('product.template', 'Suggested For Product'),
'suggested_product_ids': fields.one2many('product.template', 'suggested_product_id', 'Suggested Products'),
'website_sizex': fields.selection([map(lambda x: (str(x),str(x)), range(12))], 'Size X'),
'website_sizey': fields.selection([map(lambda x: (str(x),str(x)), range(12))], 'Size Y'),
}
_defaults = {
'website_sizex': 3,
'website_sizey': 3,
}
def recommended_products(self, cr, uid, ids, context=None):