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.
 
 
 
 
 

277 lines
17 KiB

<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<template id="website_product_view" inherit_id="website_sale.product">
<xpath expr="//div[@id='product_details']" position="replace">
<t t-if="product.is_auction"> <!-- Conditionally render elements based on the "is_auction" attribute of the product object -->
<!-- Create hidden input fields with values from the product and auction objects -->
<t t-if="request.env.user.is_public">
<div t-attf-class="col-lg-#{image_cols[1]} mt-md-4"
id="product_details">
<h1 itemprop="name" t-field="product.name">
Product
Name
</h1>
Please <a href="/web/login">sign in</a> to participate
</div>
</t>
<t t-else="">
<input type="hidden" class="product_id"
name="product_product_id"
t-att-value="product_variant.id"/>
<input type="hidden" name="auction_product_id"
t-att-value="product.id"/>
<!-- Iterate over the auction objects -->
<t t-foreach="auction" t-as="bid">
<!-- Check if the auction is running, matches the current product, and matches the current website -->
<t t-if="(bid['state']=='running') and (bid['product_id'][0]==product.id) and (website.id == bid['website_id'][0])">
<input type="hidden" class="auction"
name="auction_id" t-att-value="bid['id']"/>
<!-- Create a div to display details about the product and auction -->
<div t-attf-class="col-lg-#{image_cols[1]} mt-md-4"
id="product_details">
<h1 itemprop="name" t-field="product.name">
Product
Name
</h1>
<span id="auction_messages"
class="alert alert-info"/>
<div class="auction_timer">
Auction will end in
<h3 id="timer">---</h3>
Till
<!-- Display either the extended time or the end time of the auction -->
<t t-if="bid['extend_time']">
<t t-esc="bid['extend_time']"/>
</t>
<t t-else="">
<t t-esc="bid['end_time']"/>
</t>
</div>
<div class="auction_min_amount">
Min bid amount
<t t-esc="bid['currency_id'][1] "/>
<strong id="min_amount"
t-esc="bid['initial_price']"/>
</div>
<input type="number" id="bid_amount" step="any"
required="1"/>
<button type="button" class="btn btn-primary"
id="place_bid_button">Place bid
</button>
<p class="subscribe">
<i class="fa fa-bell-o o_notification_icon"
id="subscribe_bid">Subscribe
</i>
<i class="fa fa-users" id="auction_bidders">
<a t-attf-href="/bidders/{{ slug(product) }}">
Bidders
</a>
</i>
</p>
<!-- Create a modal to display warnings or messages about the auction -->
<div class="modal fade"
id="modal_product_warning"
tableindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title"
id="modal_title"/>
</div>
<div class="modal-body">
<p class="message"
id="modal_message"/>
</div>
<div class="modal-footer">
<button type="button"
id="hide_modal"
class="btn btn-default"
data-dismiss="modal">
Close
</button>
</div>
</div>
</div>
</div>
<!-- Display a "buy now" option if the auction allows it -->
<t t-if="bid['is_buy_now']">
<div>
or
<br/>
<a class="btn btn-primary js_add_cart"
data-productiid="1">Buy Now
</a>
For just
<t t-esc="bid['currency_id'][1]"/>
<t t-esc="bid['price_buy_now']"/>
</div>
</t>
</div>
<div id="o_product_terms_and_share"
class="d-flex justify-content-between flex-column flex-md-row align-items-md-end mb-3">
</div>
</t>
</t>
</t>
</t>
<t t-else=""> <!-- start of else block -->
<div t-attf-class="col-lg-#{image_cols[1]} mt-md-4"
id="product_details">
<t t-set="base_url"
t-value="product.get_base_url()"/> <!-- set base URL -->
<h1 itemprop="name" t-field="product.name">Product Name
</h1> <!-- display product name -->
<span itemprop="url" style="display:none;"
t-esc="base_url + product.website_url"/> <!-- set URL for product -->
<span itemprop="image" style="display:none;"
t-esc="base_url + website.image_url(product, 'image_1920')"/> <!-- set image for product -->
<t t-if="is_view_active('website_sale.product_comment')"> <!-- check if product comments are active -->
<a href="#o_product_page_reviews"
class="o_product_page_reviews_link text-decoration-none"> <!-- link to product reviews section -->
<t t-call="portal_rating.rating_widget_stars_static"> <!-- display product rating -->
<t t-set="rating_avg"
t-value="product.rating_avg"/> <!-- set product rating average -->
<t t-set="trans_text_plural">%s reviews</t>
<t t-set="trans_text_singular">%s review</t>
<t t-set="rating_count"
t-value="(trans_text_plural if product.rating_count > 1 else trans_text_singular) % product.rating_count"/> <!-- set product rating count -->
</t>
</a>
</t>
<p t-field="product.description_sale"
class="text-muted my-2"
placeholder="A short description that will also appear on documents."/> <!-- display product description -->
<form t-if="product._is_add_to_cart_possible()"
action="/shop/cart/update"
method="POST"> <!-- add to a cart form -->
<input type="hidden" name="csrf_token"
t-att-value="request.csrf_token()"/> <!-- add CSRF token for security -->
<div class="js_product js_main_product mb-3">
<div>
<t t-call="website_sale.product_price"/> <!-- display product price -->
<small t-if="combination_info['base_unit_price']"
class="ms-1 text-muted o_base_unit_price_wrapper d-none"
groups="website_sale.group_show_uom_price">
<t t-call='website_sale.base_unit_price'/> <!-- display product unit price -->
</small>
</div>
<t t-placeholder="select">
<input type="hidden" class="product_id"
name="product_id"
t-att-value="product_variant.id"/>
<input type="hidden"
class="product_template_id"
name="product_template_id"
t-att-value="product.id"/>
<input t-if="product.public_categ_ids.ids"
type="hidden"
class="product_category_id"
name="product_category_id"
t-att-value="product.public_categ_ids.ids[0]"/>
<input t-if="product.product_tag_ids.ids"
type="hidden"
class="product_tag_id"
name="product_tag_id"
t-att-value="product.product_tag_ids.ids[0]"/>
<t t-if="combination"
t-call="sale.variants"> <!-- display product variants -->
<t t-set="ul_class"
t-valuef="flex-column"/>
<t t-set="parent_combination"
t-value="None"/>
</t>
<t t-else="">
<ul class="d-none js_add_cart_variants mb-0"
t-att-data-attribute_exclusions="{'exclusions: []'}"/>
</t>
</t>
<p t-if="True"
class="css_not_available_msg alert alert-warning">
This
combination does not exist.
</p>
<!-- Define a div element with an id of "o_wsale_cta_wrapper" and some classes -->
<div id="o_wsale_cta_wrapper"
class="d-flex flex-wrap align-items-center">
<!-- Define some variables in the template -->
<t t-set="hasQuantities" t-value="false"/>
<t t-set="hasBuyNow" t-value="false"/>
<t t-set="ctaSizeBig"
t-value="not hasQuantities or not hasBuyNow"/>
<!-- Define a div element with an id of "add_to_cart_wrap" and some classes -->
<div id="add_to_cart_wrap"
t-attf-class="{{'d-none' if combination_info['prevent_zero_price_sale'] else 'd-inline-flex'}} align-items-center mb-2 me-auto">
<!-- Define an anchor element with an id of "add_to_cart" and some classes -->
<a role="button" id="add_to_cart"
t-attf-class="btn btn-primary js_check_product a-submit flex-grow-1 #{'btn-lg' if ctaSizeBig else ''}"
href="#">
<!-- Define an icon element with the FontAwesome class "fa fa-shopping-cart" -->
<i class="fa fa-shopping-cart me-2"/>
<!-- Define a span element with bold text -->
<span style="font-weight: bold">ADD TO
CART
</span>
</a>
</div>
<!-- Define a div element with an id of "product_option_block" and some classes -->
<div id="product_option_block"
class="d-flex flex-wrap w-100"/>
</div>
<div id="contact_us_wrapper"
t-attf-class="{{'d-flex' if combination_info['prevent_zero_price_sale'] else 'd-none'}} oe_structure oe_structure_solo #{_div_classes}">
<section class="s_text_block"
data-snippet="s_text_block"
data-name="Text">
<div class="container">
<a t-att-href="website.contact_us_button_url"
class="btn btn-primary btn_cta">
Contact Us
</a>
</div>
</section>
</div>
</div>
</form>
<!-- If the product is not active, show a warning message -->
<p t-elif="not product.active" class="alert alert-warning">
This product is no longer available.
</p>
<!-- If the product has no valid combination, show a warning message -->
<p t-else="" class="alert alert-warning">
This product has no valid combination.
</p>
<!-- Display the single value attributes of the product -->
<div id="product_attributes_simple">
<!-- Prepare single value attributes for display -->
<t t-set="single_value_attributes"
t-value="product.valid_product_template_attribute_line_ids._prepare_single_value_for_display()"/>
<!-- Display the attributes in a table format -->
<table t-attf-class="table table-sm text-muted {{'' if single_value_attributes else 'd-none'}}">
<t t-foreach="single_value_attributes"
t-as="attribute">
<tr>
<td>
<span t-field="attribute.name"/>:
<!-- Display the attribute values -->
<t t-foreach="single_value_attributes[attribute]"
t-as="ptal">
<span t-field="ptal.product_template_value_ids._only_active().name"/>
<t t-if="not ptal_last">,</t>
</t>
</td>
</tr>
</t>
</table>
</div>
<!-- Display the product terms and share section -->
<div id="o_product_terms_and_share"
class="d-flex justify-content-between flex-column flex-md-row align-items-md-end mb-3">
</div>
</div>
</t>
</xpath>
</template>
</odoo>