odoo/addons/website_sale/views/ecommerce.xml

326 lines
19 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- Layout add nav and footer -->
<record id="header_ecommerce" model="ir.ui.view">
<field name="name">header_ecommerce</field>
<field name="inherit_id" ref="website.header"/>
<field name="arch" type="xml">
<data>
<xpath expr="(//li)[last()]" position="after">
<li class="pull-right"><a href="/shop/mycart"><i class="icon-shopping-cart icon-large" style="position: absolute;"></i>&amp;nbsp; &amp;nbsp; &amp;nbsp; My cart</a></li>
<li class="pull-right"><a href="/shop">Shop</a></li>
</xpath>
</data>
</field>
</record>
<record id="header_ecommerce" model="ir.ui.view">
<field name="name">header_ecommerce</field>
<field name="inherit_id" ref="website.header"/>
<field name="arch" type="xml">
<data>
<xpath expr="(//li)[last()]" position="after">
<li class="pull-right"><a href="/shop/mycart"><i class="icon-shopping-cart icon-large" style="position: absolute;"></i>&amp;nbsp; &amp;nbsp; &amp;nbsp; My cart</a></li>
<li class="pull-right"><a href="/shop">Shop</a></li>
</xpath>
</data>
</field>
</record>
<record id="product_normal_form_view" model="ir.ui.view">
<field name="name">product.normal.form.inherit</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="stock.view_normal_procurement_locations_form"/>
<field name="arch" type="xml">
<group name="sale" position="before">
<group name="pos" string="Website">
<field name="website_published"/>
</group>
</group>
</field>
</record>
<!-- Page Shop -->
<template id="page">
<t t-call="website.layout">
<t t-set="head">
<script type="text/javascript" src="/website_sale/static/src/js/ecommerce.js"></script>
<link rel='stylesheet' href='/website_sale/static/src/css/ecommerce.css'/>
<t t-raw="head"/>
</t>
<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>
</div>
</div>
</t>
</template>
<!-- List of categories -->
<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>
<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>
</template>
<!-- Product list -->
<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>
<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>
</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>
<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>
</t>
</div>
</template>
<!-- product -->
<template id="product">
<t t-call="website_sale.page">
<t t-set="title">Product</t>
<t t-set="shop_content">
<div class="oe_product_detail">
<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>
<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>
</div>
<img class="media-object" t-att-src="'data:image/png;base64,' + product.image"/>
<div t-field="product.description_sale"></div>
<div class="oe_ecommerce_price" t-field="product.list_price"><t t-esc="product.list_price"/></div>
<t t-call="website_sale.product_recommended"/>
</div>
</t>
</t>
</template>
<!-- Page Shop my cart -->
<template id="mycart">
<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>
<a t-if="order.order_line" href="/shop/checkout"><button class="btn btn-success">Next stage</button></a>
</span>
</t>
</t>
</template>
<!-- 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>
</div>
</template>
<!-- Page confirm my cart -->
<template id="checkout">
<t t-call="website.layout">
<t t-set="head">
<script type="text/javascript" src="/website_sale/static/src/js/ecommerce.js"></script>
<link rel='stylesheet' href='/website_sale/static/src/css/ecommerce.css'/>
<t t-raw="head"/>
</t>
<t t-set="title">Shop - Checkout</t>
<div class="container mt48 oe_ecommerce">
<div class="row">
<div class="span4 oe_total">
<table class="table table-condensed" t-if="order.order_line">
<thead>
<tr><th>Product</th><th>Qty.</th><th>Price</th></tr>
</thead>
<tbody>
<t t-foreach="order.order_line or []" t-as="line">
<tr>
<td><t t-esc="line.product_id.name"/></td>
<td><t t-esc="int(line.product_uom_qty)"/></td>
<td class="css_alignright"><t t-esc="line.product_id.list_price"/></td>
</tr>
</t>
<tr><td colspan="3" style="visibility: hidden; border: 0">-</td></tr>
<tr><th>Untaxed Amount</th><td></td><td><t t-esc="order.amount_untaxed"/></td></tr>
<tr><th>Taxes</th><td></td><td><t t-esc="order.amount_tax"/></td></tr>
<tr><th>Total</th><td></td><td><t t-esc="order.amount_total"/></td></tr>
</tbody>
</table>
</div>
<div class="span8 oe_checkout">
<div class="js_inputs row">
<a t-if="not partner" t-att-href="'/admin#action=redirect&amp;url=%%s/shop/checkout' %% host_url" class="btn btn-primary">Log me, I have an account</a>
<h3 class="span8">Billing Information</h3>
<label class="span8 css_required">Name and firstname<input class="span7" type="text" name="name" placeholder="Name and firstname" t-att-value="partner.name or ''"/></label>
<label class="span4 css_required">Telephone<input type="tel" name="phone" placeholder="Telephone" t-att-value="partner.phone or ''"/></label>
<label class="span4">Fax<input type="tel" name="fax" placeholder="Fax" t-att-value="partner.fax or ''"/></label>
<label class="span4">Company<input type="text" name="company" placeholder="Company" t-att-value="partner.parent_id and partner.parent_id.name or ''"/></label>
<label class="span4 css_required">Email address<input type="email" name="email" placeholder="Email address" t-att-value="partner.email or ''"/></label>
<label class="span8 css_required">Street<input class="span7" type="text" name="street" placeholder="Street address" t-att-value="partner.street or ''"/></label>
<label class="span4 css_required">City<input type="text" name="city" placeholder="City" t-att-value="partner.city or ''"/></label>
<label class="span4">State / Province <select name="state_id">
<option value="">State / Province...</option>
<t t-foreach="states or []" t-as="state">
<option t-att-value="state.id" t-att-selected="partner and partner.state_id and state.id == partner.state_id.id or None"><t t-esc="state.name"/></option>
</t>
</select></label>
<label class="span4 css_required">Zip / Postal Code<input type="text" name="zip" placeholder="Zip/Postal Code" t-att-value="partner.zip or ''"/></label>
<label class="span4 css_required">Country <select name="country_id">
<option value="">Country...</option>
<t t-foreach="countries or []" t-as="country">
<option t-att-value="country.id" t-att-selected="partner and partner.country_id and country.id == partner.country_id.id or None"><t t-esc="country.name"/></option>
</t>
</select></label>
<label class="span8 checkbox">Ship to different address<input type="checkbox" name="shipping_different"/></label>
</div>
<div class="js_inputs js_shipping row" style="display:none">
<h3 class="span8 oe_shipping" style="display:none">Shipping Information</h3>
<label class="span8 css_required">Name and firstname<input class="span7" type="text" name="shipping_name" placeholder="Name and firstname" t-att-value="shipping.name or ''"/></label>
<label class="span4 css_required">Telephone<input type="tel" name="shipping_phone" placeholder="Telephone" t-att-value="shipping.phone or ''"/></label>
<label class="span4">Fax<input type="tel" name="shipping_fax" placeholder="Fax" t-att-value="shipping.fax or ''"/></label>
<label class="span8 css_required">Street<input class="span7" type="text" name="shipping_street" placeholder="Street address" t-att-value="shipping.street or ''"/></label>
<label class="span4 css_required">City<input type="text" name="shipping_city" placeholder="City" t-att-value="shipping.city or ''"/></label>
<label class="span4">State / Province <select name="shipping_state_id">
<option value="">State / Province...</option>
<t t-foreach="states or []" t-as="state">
<option t-att-value="state.id" t-att-selected="shipping and shipping.state_id and state.id == shipping.state_id.id or None"><t t-esc="state.name"/></option>
</t>
</select></label>
<label class="span4 css_required">Zip / Postal Code<input type="text" name="shipping_zip" placeholder="Zip/Postal Code" t-att-value="shipping.zip or ''"/></label>
<label class="span4 css_required">Country <select name="shipping_country_id">
<option value="">Country...</option>
<t t-foreach="countries or []" t-as="country">
<option t-att-value="country.id" t-att-selected="shipping and shipping.country_id and country.id == shipping.country_id.id or None"><t t-esc="country.name"/></option>
</t>
</select></label>
</div>
<div class="js_payments css_payments row">
<h3 class="span8">Click on your payment method</h3>
<t t-foreach="payments or []" t-as="payment">
<div class="css_payment" t-att-title="payment.name">
<div class="js_error_payment css_error_payment"> </div>
<t t-raw="payment._content"/>
</div>
</t>
</div>
</div>
</div>
</div>
</t>
</template>
<template id="confirmed">
<t t-call="website_sale.page">
<t t-set="title">Order</t>
<t t-set="shop_content">
<table class="table table-condensed" t-if="order.order_line">
<thead>
<tr><th>Product</th><th>Qty.</th><th>Price</th></tr>
</thead>
<tbody>
<t t-foreach="order.order_line or []" t-as="line">
<tr>
<td><t t-esc="line.product_id.name"/></td>
<td><t t-esc="int(line.product_uom_qty)"/></td>
<td class="css_alignright"><t t-esc="line.product_id.list_price"/></td>
</tr>
</t>
<tr><td colspan="3" style="visibility: hidden; border: 0">-</td></tr>
<tr><th>Untaxed Amount</th><td></td><td><t t-esc="order.amount_untaxed"/></td></tr>
<tr><th>Taxes</th><td></td><td><t t-esc="order.amount_tax"/></td></tr>
<tr><th>Total</th><td></td><td><t t-esc="order.amount_total"/></td></tr>
</tbody>
</table>
</t>
</t>
</template>
</data>
</openerp>