odoo/addons/website_sale_options/views/templates.xml

159 lines
8.0 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="assets_frontend" inherit_id="website.assets_frontend" name="Shop Product Options">
<xpath expr="." position="inside">
<script type="text/javascript" src="/website_sale_options/static/src/js/website_sale.test.js"></script>
<script type="text/javascript" src="/website_sale_options/static/src/js/website_sale.js"></script>
<link rel='stylesheet' href='/website_sale_options/static/src/css/website_sale.css'/>
</xpath>
</template>
<template id="optional_products" inherit_id="website_sale.cart" name="Optional products">
<xpath expr="//table[@id='cart_products']/tbody//td[last()]/div" position="attributes">
<attribute name="t-if">not line.linked_line_id</attribute>
</xpath>
<xpath expr="//table[@id='cart_products']/tbody//tr" position="attributes">
<attribute name="t-att-class">'optional_product info' if line.linked_line_id else ''</attribute>
</xpath>
<xpath expr="//table[@id='cart_products']/tbody//td[last()]" position="inside">
<t t-if="line.linked_line_id">
<span class="js_quantity text-muted" t-att-data-line-id="line.id" t-att-data-product-id="line.product_id.id" t-esc="int(line.product_uom_qty)"/>
</t>
</xpath>
</template>
<template id="modal" name="Optional Products">
<div id="modal_optional_products" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
<h4 class="modal-title" id="myModalLabel">Product to add in your shopping cart</h4>
</div>
<div class="modal-body">
<table class="table table-striped table-condensed">
<thead>
<tr>
<th colspan="2">Product</th>
<th style="min-width: 140px;"> </th>
<th width="100">Price</th>
<th width="120">Quantity</th>
</tr>
</thead>
<tbody>
<tr id="product_confirmation">
<td width="100">
<span t-field="product.image_medium" t-field-options='{"widget": "image" }'/>
</td>
<td colspan="2">
<strong t-field="product.display_name"/>
<div class="text-muted">
<div t-field="product.description_sale"/>
<div class="js_attributes"/>
</div>
</td>
<td>
<span t-attf-class="text-danger oe_default_price" t-att-style="'' if (compute_currency(product.lst_price) - product.price) &gt; 0.1 else 'display: none;'" style="text-decoration: line-through; white-space: nowrap;"
t-field="product.lst_price"
t-field-options='{
"widget": "monetary",
"from_currency": "website.currency_id",
"display_currency": "user_id.partner_id.property_product_pricelist.currency_id"
}'/>
<span class="oe_price" style="white-space: nowrap;"
t-att-data-product-id="product.id"
t-field="product.price"
t-field-options='{
"widget": "monetary",
"from_currency": "website.currency_id",
"display_currency": "user_id.partner_id.property_product_pricelist.currency_id"
}'/>
</td>
<td>
<div class="input-group oe_website_spinner">
<span class="input-group-addon">
<a t-attf-href="#" class="mb8 js_add_cart_json">
<i class="fa fa-minus"></i>
</a>
</span>
<input type="text" class="js_quantity form-control" data-min="1" name="add_qty" value="1"/>
<span class="input-group-addon">
<a t-attf-href="#" class="mb8 float_left js_add_cart_json">
<i class="fa fa-plus"></i>
</a>
</span>
</div>
</td>
</tr>
<tr t-if="product.optional_product_ids"><td colspan="5"><h4>Select Your Options:</h4></td></tr>
<t t-set="option_inc" t-value="0"/>
<tr class="js_product" t-foreach="product.optional_product_ids" t-as="product">
<td width="100">
<input type="hidden" class="product_id" t-attf-name="optional-product-#{option_inc}" t-att-value="int(product.product_variant_ids[0]) if len(product.product_variant_ids) == 1 else '0'"/>
<span t-field="product.image_small" t-field-options='{"widget": "image"}'/>
</td>
<td>
<div class="pull-left">
<strong class="media-heading" t-field="product.name"/>
<div class="text-muted" t-field="product.description_sale"/>
</div>
</td>
<td>
<div class="pull-right">
<t t-call="website_sale.variants"/>
</div>
</td>
<td>
<span class="text-danger oe_optional" t-att-style="'' if (compute_currency(product.lst_price) - product.price) &gt; 0.1 else 'display: none;'" style="text-decoration: line-through; white-space: nowrap;"
t-field="product.lst_price"
t-field-options='{
"widget": "monetary",
"from_currency": "website.currency_id",
"display_currency": "user_id.partner_id.property_product_pricelist.currency_id"
}'/><br/>
<span class="oe_price" style="white-space: nowrap;"
t-field="product.price"
t-field-options='{
"widget": "monetary",
"display_currency": "user_id.partner_id.property_product_pricelist.currency_id"
}'/>
<p class="css_not_available_msg bg-danger" style="position:absolute; padding: 15px;">Product not available</p>
</td>
<td>
<input type="hidden" class="js_optional_same_quantity" t-attf-name="optional-add-#{option_inc}" value="0"/>
<a href="#" class="js_add"><strong>Add to Cart</strong></a>
<span class="js_remove hidden">
<span class="js_item">1 Item</span><span class="js_items hidden">5 Items</span><br/>
<a href="#" class="js_remove"><small>Remove from cart</small></a>
</span>
</td>
<t t-set="option_inc" t-value="option_inc+1"/>
</tr>
</tbody>
</table>
</div>
<div class="modal-footer">
<a class="btn btn-default a-submit js_goto_shop"><i class="fa fa-chevron-left"></i> <span class="hidden-xs">Continue Shopping</span><span class="visible-xs-inline">Continue</span></a>
<a class="btn btn-primary pull-right a-submit"><i class="fa fa-shopping-cart fa-fw"></i> <span class="hidden-xs">Proceed to checkout</span><span class="visible-xs-inline">Checkout</span></a>
</div>
</div>
</div>
</div>
</template>
<template id="products_add_to_cart" inherit_id="website_sale.products_add_to_cart">
<xpath expr="//div[@class='product_price']/t[1]" position="attributes">
<attribute name="t-if">len(product.product_variant_ids) == 1 and not len(product.optional_product_ids) &gt;= 1</attribute>
</xpath>
<xpath expr="//div[@class='product_price']/t[2]" position="attributes">
<attribute name="t-if">len(product.product_variant_ids) &gt; 1 or len(product.optional_product_ids) &gt;= 1</attribute>
</xpath>
</template>
</data>
</openerp>