Commit b7b446b7 by wd

Merge branch 'developer' of http://47.99.244.21:9999/root/joshine into developer

parents 854dcec4 5853904d
......@@ -66,6 +66,7 @@
<span><?= $block->escapeHtml(__('Clear Shopping Cart')) ?></span>
</button>
<?php endif ?>
<!--
<button type="submit"
name="update_cart_action"
data-cart-item-update=""
......@@ -74,6 +75,7 @@
class="action update">
<span><?= $block->escapeHtml(__('Update Shopping Cart')) ?></span>
</button>
-->
<input type="hidden" value="" id="update_cart_action_container" data-cart-item-update=""/>
</div>
</form>
......
......@@ -23,8 +23,8 @@ define([
* @returns void
*/
updateQty: function (item) {
if (item.qty < 0) {
$(".error-message[itemId = '" + item.item_id + "']").text($t('Please enter the number greater than or equal to 0!'));
if (item.qty <= 0) {
$(".error-message[itemId = '" + item.item_id + "']").text($t('Please enter the number greater than 0!'));
return;
}
if (parseFloat(item.qty) != item.qty) {
......@@ -83,7 +83,7 @@ define([
qtyInput.trigger('change');
}, 1000);
} else {
if (currentQty >= 100) {
if (currentQty > 100) {
var nextQty = (currentQty - 100)/100;
nextQty = +nextQty.toFixed(2);
qtyInput.val(nextQty);
......
......@@ -9,6 +9,16 @@
</strong>
<div class="details-qty">
<span class="label"><!-- ko i18n: 'Qty' --><!-- /ko --></span>
<!-- ko if: ($parent.qty > 1)-->
<span class="qty-button">
<span class="decrease" data-bind="attr: {action: 'decrease', itemId: $parent.item_id}, click: updateQtyButton">-</span>
</span>
<!-- /ko -->
<!-- ko ifnot: ($parent.qty > 1)-->
<span class="qty-button no-enabled">
<span class="decrease" data-bind="attr: {action: 'decrease', itemId: $parent.item_id}, click: updateQtyButton">-</span>
</span>
<!-- /ko -->
<input type="number" class="input-text qty" data-bind="
value: $parent.qty,
event: {
......@@ -16,10 +26,9 @@
},
attr: {
title: titleQtyBox
}"/>
}" readonly="readonly"/>
<span class="qty-button">
<span class="increase" data-bind="attr: {action: 'increase', itemId: $parent.item_id}, click: updateQtyButton">&nbsp;</span>
<span class="decrease" data-bind="attr: {action: 'decrease', itemId: $parent.item_id}, click: updateQtyButton">&nbsp;</span>
<span class="increase" data-bind="attr: {action: 'increase', itemId: $parent.item_id}, click: updateQtyButton">+</span>
</span>
<span class="error-message" data-bind="attr: {itemId: $parent.item_id}"></span>
</div>
......
......@@ -94,9 +94,16 @@ $canApplyMsrp = $helper->isShowBeforeOrderConfirm($product) && $helper->isMinima
</td>
<?php endif; ?>
<td class="col qty" data-th="<?= $block->escapeHtml(__('Qty')) ?>">
<div class="field qty">
<?php if ($block->escapeHtmlAttr($block->getQty()) > 1) :?>
<strong class="lower-qty qty-change">-</strong>
<?php else :?>
<strong class="lower-qty qty-change no-enabled">-</strong>
<?php endif; ?>
<div class="field qty new-qty">
<div class="control qty">
<label for="cart-<?= $block->escapeHtmlAttr($_item->getId()) ?>-qty">
<span class="label"><?= $block->escapeHtml(__('Qty')) ?></span>
<input id="cart-<?= $block->escapeHtmlAttr($_item->getId()) ?>-qty"
name="cart[<?= $block->escapeHtmlAttr($_item->getId()) ?>][qty]"
......@@ -108,10 +115,12 @@ $canApplyMsrp = $helper->isShowBeforeOrderConfirm($product) && $helper->isMinima
title="<?= $block->escapeHtmlAttr(__('Qty')) ?>"
class="input-text qty"
data-validate="{required:true,'validate-greater-than-zero':true}"
data-role="cart-item-qty"/>
data-role="cart-item-qty" readonly="readonly"/>
</label>
</div>
</div>
<strong class="add-qty qty-change">+</strong>
</td>
<td class="col subtotal" data-th="<?= $block->escapeHtml(__('Subtotal')) ?>">
......@@ -130,3 +139,30 @@ $canApplyMsrp = $helper->isShowBeforeOrderConfirm($product) && $helper->isMinima
</td>
</tr>
</tbody>
<script>
require(['jquery'], function ($) {
$('.add-qty').click(function(){
var input = $(this).prev().find('.input-text');
if (input.val()) {
var current = parseInt(input.val());
input.val(current + 1);
// submit
$("#form-validate").submit();
} else {
return false;
}
});
$('.lower-qty').click(function(){
var input = $(this).next().find('.input-text');
if (input.val() > 1) {
var current = parseInt(input.val());
input.val(current - 1);
// submit
$("#form-validate").submit();
} else {
return false;
}
});
});
</script>
......@@ -7,9 +7,11 @@
/** @var $block \Magento\Checkout\Block\Cart\Item\Renderer\Actions\Edit */
?>
<?php if ($block->isProductVisibleInSiteVisibility()) :?>
<!--
<a class="action action-edit"
href="<?= $block->escapeUrl($block->getConfigureUrl()) ?>"
title="<?= $block->escapeHtmlAttr(__('Edit item parameters')) ?>">
<span><?= $block->escapeHtml(__('Edit')) ?></span>
</a>
-->
<?php endif ?>
......@@ -711,6 +711,90 @@ p.shopbycate-title {
.baozhang_before_footer .last_font {color: inherit !important;}
.baozhang_before_footer img {opacity: 0.5;}
.checkout-cart-index input[type="number"]::-webkit-inner-spin-button,
.checkout-cart-index input[type="number"]::-webkit-outer-spin-button {
-webkit-appearance: none;
}
.checkout-cart-index input[type="number"]{-moz-appearance:textfield;}
.checkout-cart-index .new-qty{
display: inline-block;
}
.checkout-cart-index .new-qty .input-text{
text-align: center;
}
.checkout-cart-index .qty-change{
font-size: 18px;
font-weight: bold;
cursor:pointer;
color: #0000ff;
}
.checkout-cart-index .col.qty{
text-align: center;
}
@media (min-width: 1024px){
.cart.item .item-info td.col.item {
width: 50%;
}
}
.no-enabled{
color:#cacaca!important;
}
@media (max-width: 768px){
.checkout-cart-index .cart-container .cart-summary {
margin:0;
}
}
.checkout-index-index .details-qty,.checkout-cart-index .details-qty{
display: block;
}
.checkout-index-index input[type="number"]::-webkit-inner-spin-button,
.checkout-index-index input[type="number"]::-webkit-outer-spin-button {
-webkit-appearance: none;
}
.checkout-index-index .product-item-details .details-qty .input-text{
text-align: center;
border:none;
margin: 0 auto;
padding:0;
width:3rem;
}
.checkout-index-index span.qty-button {
font-size: 18px;
font-weight: bold;
cursor:pointer;
color: #0000ff;
}
.checkout-index-index .item-options dt.label {
width: 30% !important;
}
.checkout-index-index input[type="number"]{-moz-appearance:textfield;}
.checkout-index-index .product-item-details .product.options {
width: 70%;
margin-top: 0.5rem;
}
.checkout-index-index .product-item-details .product-item-inner .product-item-name-block .details-qty{
float:none;
}
.checkout-index-index .product-item-details .product-item-inner .product-item-name-block .details-qty .label {
margin-right:15%;
}
.checkout-index-index .product-item-details .product.options .content .item-options .label {
margin: 0 auto;
}
.checkout-index-index .product-item-details .product-item-inner .subtotal {
position: absolute;
right: 7%;
}
@media (max-width: 768px){
.checkout-index-index .product-item-details .product-item-inner .subtotal {
right: 13.5%;
}
}
@media(min-width: 790px){
.baozhang_before_footer{
margin-top: 30px;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment