mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-31 10:49:09 +00:00
Website Product Image
This commit is contained in:
@@ -105,8 +105,7 @@ $.extend(shopping_cart, {
|
||||
|
||||
render_item_row: function($cart_items, doc) {
|
||||
doc.image_html = doc.website_image ?
|
||||
'<div style="height: 120px; overflow: hidden;"><img src="' + doc.website_image + '" /></div>' :
|
||||
'{% include "templates/includes/product_missing_image.html" %}';
|
||||
'<div style="height: 120px; overflow: hidden;"><img src="' + doc.website_image + '" /></div>': "";
|
||||
|
||||
if(doc.description === doc.item_name) doc.description = "";
|
||||
|
||||
@@ -265,7 +264,7 @@ $.extend(shopping_cart, {
|
||||
.html(msg || frappe._("Something went wrong!"))
|
||||
.toggle(true);
|
||||
} else {
|
||||
window.location.href = "order?name=" + encodeURIComponent(r.message);
|
||||
window.location.href = "/orders/" + encodeURIComponent(r.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
17
erpnext/templates/includes/macros.html
Normal file
17
erpnext/templates/includes/macros.html
Normal file
@@ -0,0 +1,17 @@
|
||||
{% macro product_image_square(website_image, css_class="") %}
|
||||
<div class="product-image product-image-square {% if not website_image -%} missing-image {%- endif %} {{ css_class }}"
|
||||
{% if website_image -%} style="background-image: url({{ website_image }});" {%- endif %}>
|
||||
{% if not website_image -%}<i class="centered octicon octicon-device-camera"></i>{%- endif %}
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro product_image(website_image, css_class="") %}
|
||||
<div class="product-image {% if not website_image -%} missing-image {%- endif %} {{ css_class }}">
|
||||
{% if website_image -%}
|
||||
<img src="{{ website_image }}" class="img-responsive">
|
||||
{%- else -%}
|
||||
<i class="centered octicon octicon-device-camera"></i>
|
||||
{%- endif %}
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{% from "erpnext/templates/includes/macros.html" import product_image_square %}
|
||||
|
||||
<a class="product-link" href="{{ route or page_name }}">
|
||||
<div class="col-sm-2 product-image-wrapper">
|
||||
<div class="product-image {% if not website_image -%}missing-image{%- endif %}"
|
||||
{% if website_image -%} style="background-image: url({{ website_image }});" {%- endif %}>
|
||||
</div>
|
||||
<div class="col-sm-2 col-xs-4 product-image-wrapper">
|
||||
{{ product_image_square(website_image) }}
|
||||
<div class="product-text small">{{ item_name }}</div>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
<div class="missing-image"><i class="icon-camera"></i></div>
|
||||
Reference in New Issue
Block a user