[IMP] Shop Improvements

bzr revid: fp@openerp.com-20130922172727-9zvivms9w9v5hv2q
This commit is contained in:
Fabien Pinckaers 2013-09-22 19:27:27 +02:00
parent 9fae3fbba8
commit 512a9970df
17 changed files with 137 additions and 129 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 540 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

View File

@ -6,7 +6,7 @@
<field eval="[(4, ref('base.group_sale_salesman'))]" name="groups_id"/>
</record>
<!--
<!--
Resource: product.category
-->
@ -227,7 +227,7 @@ HDD SH-1</field>
</record>
<record id="product_product_4" model="product.product">
<field name="name">PC Assemble SC349</field>
<field name="name">iPad Retina Display</field>
<field name="default_code">PCSC349</field>
<field name="categ_id" ref="product_category_4"/>
<field name="public_categ_id" ref="Computer_all_in_one"/>
@ -236,14 +236,13 @@ HDD SH-1</field>
<field name="type">consu</field>
<field name="uom_id" ref="product_uom_unit"/>
<field name="uom_po_id" ref="product_uom_unit"/>
<field name="description_sale">19" LCD Monitor
Processor Core i5 2.70 Ghz
2GB RAM
HDD SH-1</field>
<field name="description_sale">7.9inch (diagonal) LED-backlit, 128Gb
Dual-core A5 with quad-core graphics
FaceTime HD Camera, 1.2 MP Photos</field>
</record>
<record id="product_product_5" model="product.product">
<field name="name">PC Assemble + Custom (PC on Demand)</field>
<field name="name">Bose Mini Bluetooth Speaker</field>
<field name="default_code">PC-DEM</field>
<field name="categ_id" ref="product_category_4"/>
<field name="public_categ_id" ref="services"/>
@ -253,9 +252,11 @@ HDD SH-1</field>
<field name="uom_id" ref="product_uom_unit"/>
<field name="uom_po_id" ref="product_uom_unit"/>
<field name="description">Custom computer assembled on order based on customer's requirement.</field>
<field name="description_sale">Bose's smallest portable Bluetooth speaker</field>
</record>
<record id="product_product_6" model="product.product">
<field name="name">iPad Mini</field>
<field name="name">15” LCD Monitor</field>
<field name="default_code">LCD15</field>
<field name="categ_id" ref="product_category_8"/>
@ -278,7 +279,7 @@ HDD SH-1</field>
<field name="uom_po_id" ref="product_uom_unit"/>
</record>
<record id="product_product_8" model="product.product">
<field name="name">USB Keyboard, QWERTY</field>
<field name="name">iPod Accessory</field>
<field name="default_code">KeyQ</field>
<field name="categ_id" ref="product_category_8"/>
<field name="public_categ_id" ref="Keyboard_Mouse"/>
@ -311,7 +312,7 @@ HDD SH-1</field>
<field name="uom_po_id" ref="product_uom_unit"/>
</record>
<record id="product_product_11" model="product.product">
<field name="name">Mouse, Laser</field>
<field name="name">iPod</field>
<field name="default_code">M-Las</field>
<field name="categ_id" ref="product_category_8"/>
<field name="public_categ_id" ref="Keyboard_Mouse"/>

File diff suppressed because one or more lines are too long

View File

@ -19,4 +19,7 @@ OpenERP Website CMS
'website_view.xml',
'security/ir.model.access.csv',
],
'demo': [
'website_demo.xml'
],
}

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="0">
<record id="product.product_product_consultant" model="product.product">
<field name="image" file="website/static/description/website_edit.png"/>
</record>
</data>
</openerp>

View File

@ -15,6 +15,8 @@ OpenERP E-Commerce
'views/website_sale.xml',
'security/ir.model.access.csv',
'security/website_sale.xml',
],
'demo': [
'website_sale_demo.xml',
],
'qweb': ['static/src/xml/*.xml'],

View File

@ -63,8 +63,7 @@ class Ecommerce(http.Controller):
product_obj = request.registry.get('product.template')
domain = [("sale_ok", "=", True)]
if SUPERUSER_ID != request.uid:
domain += [('website_published', '=', True)]
domain += [('website_published', '=', True)]
if post.get("search"):
domain += ['|', '|', '|',

View File

@ -4,7 +4,8 @@
position: absolute;
left: 15px;
right: 15px;
top: 5px;
top: 15px;
bottom: 50px;
}
.oe_product_description {
@ -21,8 +22,8 @@
border-top-style: none;
}
.oe_shop_top .oe_product_image {
top: auto;
bottom: 5px;
top: 15px;
bottom: 50px;
}
.oe_shop_center .oe_product_description {
@ -30,13 +31,13 @@
border-top-style: none;
}
/* Products Options */
.oe_product.oe_image_full .oe_product_image {
left: 0;
right: 0;
top: 0;
bottom: 0;
}
.oe_product.oe_image_full .oe_product_image img {
max-height: 100%;
}
/* ---- Default Styles ---- */
.oe_product {
@ -45,7 +46,7 @@
.oe_product .oe_product_image img {
max-width: 100%;
max-height: 65%;
max-height: 100%;
z-index: 4;
}
@ -71,25 +72,17 @@
/* ---- Product Sizes ---- */
.oe-height-1 {
height: 60px;
height: 170px;
}
.oe-height-2 {
height: 180px;
height: 255px;
}
.oe-height-3 {
height: 210px;
height: 340px;
}
.oe-height-4 {
height: 420px;
}
.oe-height-5 {
height: 540px;
}
.oe-height-6 {
height: 620px;
height: 510px;
}

View File

@ -6,7 +6,8 @@
position: absolute
left: 15px
right: 15px
top: 5px
top: 15px
bottom: 50px
.oe_product_description
bottom: 0
@ -22,20 +23,22 @@
bottom: auto
border-top-style: none
.oe_product_image
top: auto
bottom: 5px
top: 15px
bottom: 50px
.oe_shop_center /* Option 2 */
.oe_product_description
text-align: center
border-top-style: none
.oe_product.oe_image_full /* Option 3 */
/* Products Options */
.oe_product.oe_image_full
.oe_product_image
left: 0
right: 0
top: 0
bottom: 0
img
max-height: 100%
/* ---- Default Styles ---- */
@ -44,7 +47,7 @@
.oe_product .oe_product_image img
max-width: 100%
max-height: 65%
max-height: 100%
z-index: 4
.oe_product_description
@ -70,20 +73,14 @@
/* ---- Product Sizes ---- */
.oe-height-1
height: 60px
height: 170px
.oe-height-2
height: 180px
height: 255px
.oe-height-3
height: 210px
height: 340px
.oe-height-4
height: 420px
.oe-height-5
height: 540px
.oe-height-6
height: 620px
height: 510px

View File

@ -64,44 +64,6 @@
</li>
</xpath>
</template>
<!-- Page Shop -->
<template id="layout" name="Products Layout">
<t t-call="website.layout">
<t t-set="head">
<script type="text/javascript" src="/website_sale/static/src/js/website_sale.js"></script>
<t t-raw="head or ''"/>
</t>
<t t-set="title">Shop - <t t-raw="title">Categories</t></t>
<div id="wrap">
<div class="oe_structure"/>
<div class="container oe_website_sale">
<div class="row">
<div class="col-md-12" id="shop_content">
<t t-raw="shop_content" />
</div>
</div>
</div>
</div>
</t>
</template>
<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 mt16">
<li t-att-class=" '' if category_id else 'active' " class='active'><a href="/shop/">All Products</a></li>
<t t-foreach="categories" t-as="category">
<t t-call="website_sale.categories_recursive"/>
</t>
</ul>
</div>
</xpath>
<xpath expr="//div[@id='shop_content']" position="attributes">
<attribute name="class">col-md-9</attribute>
</xpath>
</template>
<!-- List of categories -->
<template id="categories_recursive">
@ -118,13 +80,16 @@
<!-- Product list -->
<template id="products" page="True">
<t t-call="website_sale.layout">
<t t-call="website.layout">
<t t-set="head">
<script type="text/javascript" src="/website_sale/static/src/js/website_sale.js"></script>
<link rel='stylesheet' href='/website_sale/static/src/css/website_sale.css'/>
<t t-raw="head or ''"/>
</t>
<t t-set="title">Product</t>
<t t-set="shop_content">
<t t-set="title">Our Products</t>
<div id="wrap">
<div class="oe_structure"/>
<div class="container oe_website_sale">
<div class="row">
<div class="col-sm-4">
<t t-call="website.pager">
@ -136,16 +101,17 @@
<form t-attf-action="/shop/#{ category_id and ('category/%s/' % category_id) or ''}" method="get" class="pull-right pagination">
<div class="input-group">
<span class="input-group-addon"><span class="glyphicon glyphicon-search"/></span>
<input type="text" name="search" class="search-query form-control" placeholder="Search" t-att-value="search or '' or ''"/>
<input type="text" name="search" class="search-query form-control" placeholder="Search..." t-att-value="search or '' or ''"/>
</div>
</form>
</div>
</div>
<div class='style_default'>
<div class='row style_default'>
<div class="col-md-12" id="products_grid">
<t t-foreach="products" t-as="product">
<div t-attf-class="col-md-#{ product.website_sizex } oe_product oe-height-#{ product.website_sizey }" t-att-data-publish="product.website_published" data-snippet-id="colmd">
<div t-attf-class="col-md-#{ product.website_sizex } oe_product oe-height-#{ product.website_sizey } #{ product.website_product_class}" t-att-data-publish="product.website_published" data-snippet-id="colmd">
<div class="oe_product_description">
<a t-attf-href="/shop/product/#{ product.id }/?#{ search and ('search=%s' % search) or ''}#{ category_id and ('&amp;category_id=%s' % category_id) or ''}">
@ -153,15 +119,19 @@
</a>
<!-- This should be an option -->
<div t-if="product.description_sale" class="text-muted oe_subdescription">
<small t-field="product.description_sale"/>
<!-- TODO: replace by a smart t-field on field.text: description_sale -->
<small t-raw="product.description_sale.replace('\n','&lt;br/&gt;') "/>
</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>
<b>
<t t-if="product.product_variant_ids[0].lst_price != product.product_variant_ids[0].price">
<span class="text-danger" style="text-decoration: line-through;">
<t t-esc="product.product_variant_ids[0].lst_price" />
</span>&amp;nbsp;
</t>
<t t-esc="product.product_variant_ids[0].price" />
</b>
<a t-attf-href="./add_cart/?product_id=#{ product.id }">
<span class="icon-shopping-cart"/>
</a>
@ -176,22 +146,28 @@
</div>
</t>
</div>
</div>
<div class="text-center">
<t t-call="website.pager" />
</div>
</t>
</div>
<div class="oe_structure mb32"/>
</div>
</t>
</template>
<!-- product -->
<template id="product" name="Product">
<t t-call="website_sale.layout">
<t t-set="title">Product</t>
<t t-set="shop_content">
<t t-call="website.layout">
<t t-set="head">
<script type="text/javascript" src="/website_sale/static/src/js/website_sale.js"></script>
<t t-raw="head or ''"/>
</t>
<t t-set="title" t-raw="product.name"/>
<div id="wrap">
<div class="container oe_website_sale">
<form t-attf-action="/shop/#{ category_id and ('category/%s/' % category_id) or ''}" method="get" class="pull-right">
<input type="text" name="search" class="search-query col-md-2 form-control" placeholder="Search..." t-att-value="search or '' or ''"/>
</form>
@ -218,7 +194,9 @@
<img class="media-object img-responsive" t-att-src="product.img('image_medium')"/>
<div t-field="product.website_description"></div>
</div>
</t>
</div>
<div class="oe_structure"/>
</div>
</t>
</template>
<template id="recommended_products" inherit_id="website_sale.product" inherit_option_id="website_sale.product" name="Recommended Products">
@ -244,9 +222,14 @@
<!-- Page Shop my cart -->
<template id="mycart" name="My cart" page="True">
<t t-call="website_sale.layout">
<t t-set="title">My cart</t>
<t t-set="shop_content">
<t t-call="website.layout">
<t t-set="head">
<script type="text/javascript" src="/website_sale/static/src/js/website_sale.js"></script>
<t t-raw="head or ''"/>
</t>
<t t-set="title">Your Cart</t>
<div id="wrap">
<div class="container oe_website_sale">
<div class="col-md-12 oe_mycart">
<h1>My Shopping Cart</h1>
<table class='table' id="mycart_products">
@ -309,9 +292,31 @@
</table>
<a t-if="website_sale_order and website_sale_order.order_line" href="/shop/checkout/" class="btn btn-success">Proceed To Payment</a>
</div>
</t>
</div>
<div class="oe_structure"/>
</div>
</t>
</template>
<!-- Page Shop -->
<template id="products_categories" inherit_option_id="website_sale.products" name="Product Categories">
<xpath expr="//div[@id='products_grid']" position="before">
<div class="col-md-3">
<ul class="nav nav-pills nav-stacked mt16">
<li t-att-class=" '' if category_id else 'active' "><a href="/shop/">All Products</a></li>
<t t-foreach="categories" t-as="category">
<t t-call="website_sale.categories_recursive"/>
</t>
</ul>
</div>
</xpath>
<xpath expr="//div[@id='products_grid']" position="attributes">
<attribute name="class">col-md-9</attribute>
</xpath>
</template>
<template id="suggested_products_list" inherit_id="website_sale.mycart" inherit_option_id="website_sale.mycart" name="Suggested Products in list view">
<xpath expr="//table[@id='mycart_products']" position="after">
<table t-if="suggested_products" class='table table-hover table-condensed'>

View File

@ -36,12 +36,14 @@ 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'),
'website_sizex': fields.selection(map(lambda x: (str(x+1),str(x+1)), range(12)), 'Size X'),
'website_sizey': fields.selection(map(lambda x: (str(x+1),str(x+1)), range(6)), 'Size Y'),
'website_product_class': fields.selection([('','Default'), ('oe_image_full','Image Full')], 'Size Y'),
}
_defaults = {
'website_sizex': 3,
'website_sizey': 3,
'website_sizey': 2,
'website_product_class': '',
}
def recommended_products(self, cr, uid, ids, context=None):

View File

@ -1,24 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<data noupdate="0">
<record id="product.product_product_consultant" model="product.product">
<field name="website_published" eval="True"/>
</record>
<record id="product.product_product_1" model="product.product">
<field name="website_published" eval="True"/>
</record>
<record id="product.product_product_2" model="product.product">
<field name="website_published" eval="True"/>
</record>
<record id="product.product_product_4" model="product.product">
<field name="website_published" eval="True"/>
<field name="website_product_class">oe_image_full</field>
<field name="website_sizex">6</field>
<field name="website_sizey">4</field>
</record>
<record id="product.product_product_5" model="product.product">
<field name="website_published" eval="True"/>
<field name="website_sizex">6</field>
</record>
<record id="product.product_product_6" model="product.product">
<field name="website_published" eval="True"/>
<field name="website_product_class">oe_image_full</field>
</record>
<record id="product.product_product_7" model="product.product">
<field name="website_published" eval="True"/>