[fix] view shopping cart dropdown (#6928)
diff --git a/erpnext/public/css/website.css b/erpnext/public/css/website.css
index 2bfcd3e..6a1d311 100644
--- a/erpnext/public/css/website.css
+++ b/erpnext/public/css/website.css
@@ -181,7 +181,6 @@
}
.cart-dropdown-container .cart-items-dropdown {
max-height: 350px;
- overflow: auto;
}
.cart-dropdown-container .cart-items-dropdown .cart-dropdown {
display: block;
diff --git a/erpnext/public/js/shopping_cart.js b/erpnext/public/js/shopping_cart.js
index ace7fd8..1617283 100644
--- a/erpnext/public/js/shopping_cart.js
+++ b/erpnext/public/js/shopping_cart.js
@@ -65,7 +65,7 @@
var cart_count = getCookie("cart_count");
if(cart_count) {
- $(".shopping-cart").toggleClass('hidden', true);
+ $(".shopping-cart").toggleClass('hidden', false);
}
var $cart = $('.cart-icon');
diff --git a/erpnext/public/less/website.less b/erpnext/public/less/website.less
index ce36e5f..b270b8b 100644
--- a/erpnext/public/less/website.less
+++ b/erpnext/public/less/website.less
@@ -233,7 +233,6 @@
.cart-items-dropdown {
max-height: 350px;
- overflow: auto;
}
.cart-items-dropdown .cart-dropdown {
diff --git a/erpnext/templates/generators/item.html b/erpnext/templates/generators/item.html
index 5a8116c..c0399a7 100644
--- a/erpnext/templates/generators/item.html
+++ b/erpnext/templates/generators/item.html
@@ -3,7 +3,7 @@
{% block title %} {{ title }} {% endblock %}
{% block breadcrumbs %}
- {% include "templates/includes/breadcrumbs.html" %}
+ {% include "templates/includes/breadcrumbs.html" %}
{% endblock %}
{% block page_content %}
@@ -25,17 +25,17 @@
{{ _("Item Code") }}: <span itemprop="productID">{{ variant and variant.name or name }}</span></p>
<br>
<div class="item-attribute-selectors">
- {% if has_variants %}
- {% for d in attributes %}
+ {% if has_variants %}
+ {% for d in attributes %}
{% if attribute_values[d.attribute] -%}
- <div class="item-view-attribute {% if (attribute_values[d.attribute] | len)==1 -%} hidden {%- endif %}"
- style="margin-bottom: 10px;">
- <h6 class="text-muted">{{ _(d.attribute) }}</h6>
- <select class="form-control"
- style="max-width: 140px"
- data-attribute="{{ d.attribute }}">
+ <div class="item-view-attribute {% if (attribute_values[d.attribute] | len)==1 -%} hidden {%- endif %}"
+ style="margin-bottom: 10px;">
+ <h6 class="text-muted">{{ _(d.attribute) }}</h6>
+ <select class="form-control"
+ style="max-width: 140px"
+ data-attribute="{{ d.attribute }}">
{% for value in attribute_values[d.attribute] %}
- <option value="{{ value }}"
+ <option value="{{ value }}"
{% if selected_attributes and selected_attributes[d.attribute]==value -%}
selected
{%- elif disabled_attributes and value in disabled_attributes.get(d.attribute, []) -%}
@@ -43,12 +43,12 @@
{%- endif %}>
{{ _(value) }}
</option>
- {% endfor %}
- </select>
- </div>
+ {% endfor %}
+ </select>
+ </div>
{%- endif %}
- {% endfor %}
- {% endif %}
+ {% endfor %}
+ {% endif %}
</div>
<br>
<div style="min-height: 100px; margin: 10px 0;">
@@ -56,18 +56,17 @@
<h4 class="item-price" itemprop="price"></h4>
<div class="item-stock" itemprop="availability"></div>
</div>
- <div class="item-cart hide">
- <div id="item-add-to-cart">
- <button class="btn btn-primary btn-sm">
- {{ _("Add to Cart") }}</button>
- </div>
- <div id="item-update-cart"
- style="display: none;
- padding-left: 0px; padding-right: 0px;
- padding-top: 10px;">
- <a href="/cart">{{ _("Goto Cart") }}</a>
- </div>
- </div>
+ <div class="item-cart hide">
+ <div id="item-add-to-cart">
+ <button class="btn btn-primary btn-sm">
+ {{ _("Add to Cart") }}</button>
+ </div>
+ <div id="item-update-cart" style="display: none;">
+ <a href="/cart" class='btn btn-sm btn-default'>
+ <i class='octicon octicon-check'></i>
+ {{ _("View in Cart") }}</a>
+ </div>
+ </div>
</div>
</div>
</div>
@@ -101,10 +100,10 @@
<script>
{% include "templates/includes/product_page.js" %}
- {% if variant_info %}
- window.variant_info = {{ variant_info }};
- {% else %}
- window.variant_info = null;
- {% endif %}
+ {% if variant_info %}
+ window.variant_info = {{ variant_info }};
+ {% else %}
+ window.variant_info = null;
+ {% endif %}
</script>
{% endblock %}
diff --git a/erpnext/templates/includes/cart/cart_dropdown.html b/erpnext/templates/includes/cart/cart_dropdown.html
index 071b281..de29b56 100644
--- a/erpnext/templates/includes/cart/cart_dropdown.html
+++ b/erpnext/templates/includes/cart/cart_dropdown.html
@@ -1,6 +1,6 @@
<div class="cart-dropdown-container">
<div id="cart-error" class="alert alert-danger"
- style="display: none;"></div>
+ style="display: none;"></div>
<div class="row cart-items-dropdown cart-item-header text-muted">
<div class="col-sm-6 col-xs-6 h6 text-uppercase">
{{ _("Item") }}
@@ -9,13 +9,13 @@
{{ _("Price") }}
</div>
</div>
-
+
{% if doc.items %}
<div class="cart-items-dropdown">
{% include "templates/includes/cart/cart_items_dropdown.html" %}
</div>
<div class="checkout-btn">
- <a href="/cart" class="btn btn-block btn-primary">{{ _("Checkout") }}</a>
+ <a href="/cart" class="btn btn-block btn-primary">{{ _("Checkout") }}</a>
</div>
{% else %}
<p>{{ _("Cart is Empty") }}</p>
diff --git a/erpnext/templates/includes/cart/cart_items_dropdown.html b/erpnext/templates/includes/cart/cart_items_dropdown.html
index 9a3dbf8..b2ba431 100644
--- a/erpnext/templates/includes/cart/cart_items_dropdown.html
+++ b/erpnext/templates/includes/cart/cart_items_dropdown.html
@@ -7,7 +7,6 @@
</div>
<div class="col-sm-4 col-xs-4 text-right col-amount">
{{ d.get_formatted("amount") }}
-
</div>
</div>
{% endfor %}
\ No newline at end of file
diff --git a/erpnext/templates/includes/macros.html b/erpnext/templates/includes/macros.html
index da21748..a25f313 100644
--- a/erpnext/templates/includes/macros.html
+++ b/erpnext/templates/includes/macros.html
@@ -1,7 +1,12 @@
{% macro product_image_square(website_image, css_class="") %}
-{% if website_image -%} <meta itemprop="image" content="{{ frappe.utils.quoted(website_image) | abs_url }}"></meta>{%- endif %}
-<div class="product-image product-image-square {% if not website_image -%} missing-image {%- endif %} {{ css_class }}"
- {% if website_image -%} style="background-image: url('{{ frappe.utils.quoted(website_image) | abs_url }}');" {%- endif %}>
+{% if website_image -%}
+ <meta itemprop="image" content="{{ frappe.utils.quoted(website_image) | abs_url }}"></meta>
+{%- endif %}
+<div class="product-image product-image-square
+ {% if not website_image -%} missing-image {%- endif %} {{ css_class }}"
+ {% if website_image -%}
+ style="background-image: url('{{ frappe.utils.quoted(website_image) | abs_url }}');"
+ {%- endif %}>
</div>
{% endmacro %}
diff --git a/erpnext/templates/includes/navbar/navbar_items.html b/erpnext/templates/includes/navbar/navbar_items.html
index f0c780d..87dea8f 100644
--- a/erpnext/templates/includes/navbar/navbar_items.html
+++ b/erpnext/templates/includes/navbar/navbar_items.html
@@ -2,7 +2,7 @@
{% block navbar_right_extension %}
<li class="shopping-cart hidden">
- <div class="cart-icon small">
+ <div class="cart-icon">
<a class="dropdown-toggle" href="#" data-toggle="dropdown" id="navLogin">
Cart <span class="badge-wrapper" id="cart-count"></span>
</a>
diff --git a/erpnext/templates/includes/order/order_macros.html b/erpnext/templates/includes/order/order_macros.html
index 41be449..70a1fd8 100644
--- a/erpnext/templates/includes/order/order_macros.html
+++ b/erpnext/templates/includes/order/order_macros.html
@@ -13,6 +13,7 @@
</div>
</div>
{% endmacro %}
+
{% macro item_name_and_description_cart(d) %}
<div class="row item_name_dropdown">
<div class="col-xs-4 col-sm-4 order-image-col">
@@ -21,15 +22,15 @@
</div>
</div>
<div class="col-xs-8 col-sm-8">
- {{ d.item_code|truncate(25) }}
+ {{ d.item_code|truncate(25) }}
<div class="input-group number-spinner">
<span class="input-group-btn">
<button class="btn btn-default cart-btn" data-dir="dwn">
–</button>
</span>
- <input class="form-control text-right cart-qty"
- value = "{{ d.get_formatted('qty') }}"
- data-item-code="{{ d.item_code }}">
+ <input class="form-control text-right cart-qty"
+ value = "{{ d.get_formatted('qty') }}"
+ data-item-code="{{ d.item_code }}">
<span class="input-group-btn">
<button class="btn btn-default cart-btn" data-dir="up">
+</button>