You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

114 lines
6.6 KiB

<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<!--Product Template is inherited to add
the table that let users choose its variants-->
<template id="multi_variant_product" inherit_id="website_sale.product">
<xpath expr="//div[@id='product_details']/div[@id='o_product_terms_and_share']"
position="before">
<div class="multi_variant_list"
t-if="len(product.product_variant_ids) > 1"
style="margin-left:-28px;">
<form method="post" action="/shop/cart/multi">
<input type="hidden" name="csrf_token"
t-att-value="request.csrf_token()"/>
<t t-set="products" t-value="product"/>
<table class="table table-striped table-condensed"
id="product_variants">
<thead>
<tr>
<th width="130">Attributes</th>
<th width="130">Price</th>
<th width="130">Quantity</th>
</tr>
</thead>
<tbody>
<tr t-foreach="product.product_variant_ids"
t-as="variant_ids">
<td>
<div style="display: flex; justify-content: space-between;">
<div>
<img class="variant_image"
style="width: 66%; border-radius: 10%;"
t-att-src="'/web/image/product.product/%s/image_128' % variant_ids.id"/>
</div>
<div style="display:block; width:111%;">
<div t-foreach="variant_ids.product_template_attribute_value_ids"
t-as="attribute">
<div>
<span t-field="attribute.attribute_id"/>
:
<span t-esc="attribute.name"/>
</div>
</div>
</div>
</div>
</td>
<td id="td-price" name="product_price">
<span t-field="variant_ids.lst_price"
style="white-space: nowrap;"
t-options="{ 'widget': 'monetary', 'display_currency': website.currency_id }"/>
</td>
<td>
<div class="css_quantity input-group"
contenteditable="false">
<a t-attf-href="#"
class="btn btn-secondary js_add_cart_json"
aria-label="Remove one"
title="Remove one">
<i class="fa fa-minus"/>
</a>
<input type="text"
class="form-control quantity"
data-min="0"
t-att-name="'quantity-%s' % (variant_ids.id)"
value="0"
style="width:31px;text-align:center;"/>
<a t-attf-href="#"
class="btn btn-secondary float_left js_add_cart_json"
aria-label="Add one"
title="Add one">
<i class="fa fa-plus"/>
</a>
</div>
</td>
</tr>
</tbody>
</table>
<input name="product_tmpl_id" t-att-value="products.id"
type="hidden"/>
<div style="display: flex;align-items: center; margin-bottom: 2%">
<a role='button'
type="submit" id="m_add_to_cart"
class="btn btn-primary btn-lg mt8 js_check_product a-submit"
style="padding-bottom: 0.10000000000000142rem;width: 28%; font-size: 91%;height: 38px; padding-top: 9px;"
>
<i class="fa fa-shopping-cart"/>
<span style="font-weight:bold">Add to Cart</span>
</a>
<div style="position: relative; display: inline-block; margin-left: 2%;">
<input t-if="buy_now" role="button"
type="submit" name="buy_now" value="Buy Now"
class="btn btn-outline-primary btn-lg mt16 d-block d-sm-inline-block buy_now_variant"
style="margin-top: 1.3%; transform: translateY(-3px); padding: 6px 32px; padding-right: 30px; font-size: 16px"
/>
<i t-if="buy_now" class="fa fa-bolt me-2"
style="position: absolute;top: 20%;right: 90px; transform: translateY(-30%);"/>
</div>
</div>
</form>
</div>
</xpath>
</template>
<!--Hides the add to cart and color selection
option from the screen if it has variants-->
<template id="quantity_hide" inherit_id="website_sale.product_quantity">
<xpath expr="//div[@id='add_to_cart_wrap']" position="attributes">
<attribute name="t-if">len(product.product_variant_ids) &lt;= 1
</attribute>
</xpath>
<xpath expr="//div[hasclass('js_main_product')]" position="attributes">
<attribute name="t-if">len(product.product_variant_ids) &lt;= 1
</attribute>
</xpath>
</template>
</odoo>