odoo/addons/website_sale/views/ecommerce.xml

267 lines
15 KiB
XML
Raw Normal View History

<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- Layout add nav and footer -->
<record id="layout_ecommerce" model="ir.ui.view">
<field name="name">layout_ecommerce</field>
<field name="inherit_id" ref="website.layout"/>
<field name="arch" type="xml">
<data>
<xpath expr="(//header//li)[last()]" position="after">
<li class="pull-right"><a href="/shop/my_cart"><i class="icon-shopping-cart icon-large"></i> My cart</a></li>
<li class="pull-right"><a href="/shop">Shop</a></li>
</xpath>
<xpath expr="//footer/div/div/div[3]" position="inside">
SHOP Footer
</xpath>
</data>
</field>
</record>
<!-- Page Shop -->
<record id="page" model="ir.ui.view">
<field name="name">page</field>
<field name="type">qweb</field>
<field name="arch" type="xml">
<t t-call="website.layout">
<t t-set="title">Shop - <t t-raw="title">Categories</t></t>
<div class="container oe_ecommerce">
<div class="row">
<div class="span4">
<ul class="nav nav-list">
<t t-foreach="categories" t-as="category">
<t t-call="website_sale.categories_recursive"/>
</t>
</ul>
</div>
<div class="span8">
<t t-raw="shop_content">
</t>
</div>
</div>
</div>
</t>
</field>
</record>
<!-- List of categories -->
<record id="categories_recursive" model="ir.ui.view">
<field name="name">categories_recursive</field>
<field name="type">qweb</field>
<field name="arch" type="xml">
<li t-att-class="category.id == current_category and 'active' or ''">
<a t-att-href="'/shop/category/%%s' %% category.id"><span t-record="category" t-field="name"><t t-esc="category.name"/></span></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"/>
</t>
</ul>
</li>
</field>
</record>
<!-- Product list -->
<record id="products" model="ir.ui.view">
<field name="name">products</field>
<field name="type">qweb</field>
<field name="arch" type="xml">
<t t-call="website_sale.page">
<t t-set="title">Product</t>
<t t-set="shop_content">
<div class="oe_search">
<form action="/shop" method="get" class="navbar-search">
<input type="text" name="search" class="search-query span4" placeholder="Search" t-att-value="search or ''"/>
<button type="submit" class="btn">Submit</button>
</form>
</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>
</field>
</record>
<record id="product_card" model="ir.ui.view">
<field name="name">product_card</field>
<field name="type">qweb</field>
<field name="arch" type="xml">
<div class="media oe_product">
<a t-att-href="'/shop/product/%%s' %% product.id"><h4 class="media-heading"><span t-record="product" t-field="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-record="product" t-field="description_sale"><t t-esc="product.description_sale"/></div>
<div class="oe_ecommerce_price"><span><span t-record="product" t-field="list_price"><t t-esc="product.list_price"/></span></span></div>
<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"><span>X</span><i class="icon-shopping-cart icon-large"></i> </button>
<button t-att-class="'btn %%s' %% (quantity and 'btn-success' or 'btn-primary')" t-att-data-id="product.id">
<i class="icon-shopping-cart icon-large"></i>
<span class="oe_txt">(<span class="oe_quantity"><t t-esc="quantity"/></span>)</span>
</button>
</div>
</div>
</div>
</field>
</record>
<!-- product -->
<record id="product" model="ir.ui.view">
<field name="name">product</field>
<field name="type">qweb</field>
<field name="arch" type="xml">
<t t-call="website_sale.page">
<t t-set="title">Product</t>
<t t-set="shop_content">
<div clas="oe_commerce_product_display">
<h1><span t-record="product" t-field="name"><t t-esc="product.name"/></span></h1>
<img class="media-object" t-att-src="'data:image/png;base64,' + product.image"/>
<div t-record="product" t-field="description_sale"><t t-esc="product.description_sale"/></div>
<div class="oe_ecommerce_price" t-record="product" t-field="list_price"><t t-esc="product.list_price"/></div>
</div>
</t>
</t>
</field>
</record>
<!-- Page Shop my cart -->
<record id="my_cart" model="ir.ui.view">
<field name="name">my_cart</field>
<field name="type">qweb</field>
<field name="arch" type="xml">
<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.total"/>
<a t-if="order.order_line" href="/shop/customer"><button class="btn btn-success">Next stage</button></a>
</span>
</t>
</t>
</field>
</record>
<!-- Total Shop my cart -->
<record id="total" model="ir.ui.view">
<field name="name">total</field>
<field name="type">qweb</field>
<field name="arch" type="xml">
<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>
</div>
</field>
</record>
<!-- Page confirm my cart -->
<record id="customer" model="ir.ui.view">
<field name="name">customer</field>
<field name="type">qweb</field>
<field name="arch" type="xml">
<t t-call="website_sale.page">
<t t-set="title">Your informations</t>
<t t-set="shop_content">
<form action="/shop/customer" class="oe_signin" method="post" t-if="not partner">
<h5>Please Sign in or enter your informations</h5>
<input name="login" type="text" placeholder="Login..."/><br/>
<input name="password" type="password" placeholder="Password..."/><br/>
<button type="submit" class="btn btn-success">Next stage</button> or <button type="reset" class="btn btn-primary oe_toggleform">Complete your address</button>
</form>
<form action="/shop/confirm_cart" class="oe_signup" method="post" t-att-style="partner and 'display:block' or ''">
<h5 t-if="partner">Please confirm your informations</h5>
<h5 t-if="not partner">Please enter your informations</h5>
<input name="name" type="text" required="True" placeholder="Name..." t-att-value="partner and partner.name or ''"/><br/>
<input name="phone" type="tel"
required="True" placeholder="Phone number..." t-att-value="partner and partner.phone or ''"/>
<input name="email" type="email" required="True" placeholder="Email..." t-att-value="partner and partner.email or ''"/>
<h5 t-if="partner">Please confirm your address</h5>
<h5 t-if="not partner">Please enter your address</h5>
<address>
<input name="street" type="text" required="True" placeholder="Street..." t-att-value="partner and partner.street or ''"/><br/>
<input name="street2" type="text" placeholder="Street..." t-att-value="partner and partner.street2 or ''"/><br/>
<input name="zip" type="text" required="True" placeholder="Zip-code..." t-att-value="partner and partner.zip or ''"/>
<input name="city" type="text" required="True" placeholder="City..." t-att-value="partner and partner.city or ''"/><br/>
<input name="country" type="text" required="True" placeholder="Country..." t-att-value="partner and partner.country_id and partner.country_id.name_get()[0][1] or ''"/>
<input name="state" type="text" placeholder="State..." t-att-value="partner and partner.state_id and partner.state_id.name_get()[0][1] or ''"/>
</address>
<button type="submit" class="btn btn-success">Next stage</button><t t-if="not partner"> or <button type="reset" class="btn btn-primary oe_toggleform">Sign in</button></t>
</form>
<t t-call="website_sale.total"/>
</t>
</t>
</field>
</record>
<record id="order" model="ir.ui.view">
<field name="name">order</field>
<field name="type">qweb</field>
<field name="arch" type="xml">
<t t-call="website_sale.page">
<t t-set="title">Order</t>
<t t-set="shop_content">
<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)"/>
<div class="media oe_product">
<div class="pull-left" style="width:64px; height:64px;">
<img style="max-width:64px; max-height:64px; margin:auto;" class="media-object" t-att-src="'data:image/png;base64,' + product.image"/>
</div>
<div class="media-body">
<a t-att-href="'/shop/product/%%s' %% product.id"><h4 class="media-heading"><t t-esc="product.name"/></h4></a>
<t t-esc="product.description_sale"/>
<div><t t-esc="product.list_price"/></div>
</div>
</div>
</t>
<div class="media well">
<t t-esc="partner.name"/><br/>
<t t-esc="partner.phone"/><br/>
<t t-esc="partner.email"/><br/>
<address>
<t t-esc="partner.street"/><br/>
<t t-esc="partner.zip"/>,
<t t-esc="partner.city"/><br/>
<t t-esc="partner.country_id and partner.country_id.name_get()[0][1] or ''"/>,
<t t-esc="partner.state_id and partner.state_id.name_get()[0][1] or ''"/><br/>
</address>
</div>
<t t-call="website_sale.total"/>
<a t-if="order.order_line" href="/shop/confirm_order"><button class="btn btn-success">Confirm order</button></a>
</t>
</t>
</field>
</record>
<record id="thanks" model="ir.ui.view">
<field name="name">thanks</field>
<field name="type">qweb</field>
<field name="arch" type="xml">
<t t-call="website_sale.page">
<t t-set="title">Order</t>
<t t-set="shop_content">
Thanks for your sale order
</t>
</t>
</field>
</record>
</data>
</openerp>