[website] [product] show currency symbol and show specifications below the image
This commit is contained in:
parent
ece3298159
commit
220ff30878
@ -4,10 +4,9 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import webnotes
|
import webnotes
|
||||||
from webnotes.utils import cstr
|
from webnotes.utils import cstr, cint
|
||||||
from webnotes.webutils import build_html, delete_page_cache
|
from webnotes.webutils import build_html, delete_page_cache
|
||||||
|
|
||||||
|
|
||||||
@webnotes.whitelist(allow_guest=True)
|
@webnotes.whitelist(allow_guest=True)
|
||||||
def get_product_info(item_code):
|
def get_product_info(item_code):
|
||||||
"""get product price / stock info"""
|
"""get product price / stock info"""
|
||||||
@ -20,10 +19,20 @@ def get_product_info(item_code):
|
|||||||
in_stock = in_stock[0][0] > 0 and 1 or 0
|
in_stock = in_stock[0][0] > 0 and 1 or 0
|
||||||
else:
|
else:
|
||||||
in_stock = -1
|
in_stock = -1
|
||||||
return {
|
|
||||||
"price": price_list and webnotes.conn.sql("""select ref_rate, ref_currency from
|
price = price_list and webnotes.conn.sql("""select ref_rate, ref_currency from
|
||||||
`tabItem Price` where parent=%s and price_list_name=%s""",
|
`tabItem Price` where parent=%s and price_list_name=%s""",
|
||||||
(item_code, price_list), as_dict=1) or [],
|
(item_code, price_list), as_dict=1) or []
|
||||||
|
|
||||||
|
price = price and price[0] or None
|
||||||
|
|
||||||
|
if price:
|
||||||
|
price["ref_currency"] = not cint(webnotes.conn.get_default("hide_currency_symbol")) \
|
||||||
|
and (webnotes.conn.get_value("Currency", price.ref_currency, "symbol") or price.ref_currency) \
|
||||||
|
or ""
|
||||||
|
|
||||||
|
return {
|
||||||
|
"price": price,
|
||||||
"stock": in_stock
|
"stock": in_stock
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,4 +7,7 @@
|
|||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
line-height: 200%;
|
line-height: 200%;
|
||||||
}
|
}
|
||||||
|
.item-price {
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
@ -35,23 +35,25 @@
|
|||||||
{{ web_long_description or web_short_description or
|
{{ web_long_description or web_short_description or
|
||||||
"[No description given]" }}
|
"[No description given]" }}
|
||||||
</div>
|
</div>
|
||||||
{% if obj.doclist.get({"doctype":"Item Website Specification"}) %}
|
<div class="item-price hide"></div>
|
||||||
|
<div class="item-stock"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% if obj.doclist.get({"doctype":"Item Website Specification"}) -%}
|
||||||
|
<div class="row" style="margin-top: 20px">
|
||||||
|
<div class="span12">
|
||||||
<h4>Specifications</h4>
|
<h4>Specifications</h4>
|
||||||
<table class="table table-bordered" style="width: 100%">
|
<table class="table table-bordered" style="width: 100%">
|
||||||
{% for d in obj.doclist.get(
|
{% for d in obj.doclist.get(
|
||||||
{"doctype":"Item Website Specification"}) %}
|
{"doctype":"Item Website Specification"}) -%}
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width: 30%;">{{ d.label }}</td>
|
<td style="width: 30%;">{{ d.label }}</td>
|
||||||
<td>{{ d.description }}</td>
|
<td>{{ d.description }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{%- endfor %}
|
||||||
</table>
|
</table>
|
||||||
{% endif %}
|
|
||||||
<div class="item-price hide">
|
|
||||||
<p>Price:</p>
|
|
||||||
</div>
|
|
||||||
<div class="item-stock"></div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{%- endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -26,8 +26,8 @@ $(document).ready(function() {
|
|||||||
success: function(data) {
|
success: function(data) {
|
||||||
if(data.message) {
|
if(data.message) {
|
||||||
if(data.message.price) {
|
if(data.message.price) {
|
||||||
$("<h4>").html(data.message.price[0].ref_currency + " "
|
$("<h4>").html(data.message.price.ref_currency + " "
|
||||||
+ data.message.price[0].ref_rate).appendTo(".item-price");
|
+ data.message.price.ref_rate).appendTo(".item-price");
|
||||||
$(".item-price").toggle(true);
|
$(".item-price").toggle(true);
|
||||||
}
|
}
|
||||||
if(data.message.stock==0) {
|
if(data.message.stock==0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user