View Single Post
  #1  
Old 06-05-2018, 04:26 AM
 
Soptareanu @Alex Soptareanu @Alex is offline
 

Advanced Member
  
Join Date: Apr 2018
Posts: 39
 

Default Changes in View Cart

Hello, i do some changes in my view-cart layout in order to looks like in capture. For that i replace quantity_box.twig with my new implementation.
This is my own quantity_box.twig file
HTML Code:
{## # Main element (input) # # @ListChild (list="product.quantity-box", weight="20") #} <div class="fdmteam_quantity"> <input type="hidden" class="{{ this.getClass() }}" id="{{ this.getBoxId() }}" value="{{ this.getBoxValue() }}" name="{{ this.getBoxName() }}" > <span class="fdmteam_quantity_value" id="count-{{ this.getBoxId() }}"> {{ this.getBoxValue() }} </span> <span class="fdmteam_quantity_label"> {{ t(this.getBoxTitle()) }} </span> </div> <div class="fdmteam_quantity_plus" id="plus-{{ this.getBoxId() }}"></div> <div class="fdmteam_quantity_minus" id="minus-{{ this.getBoxId() }}"></div> <script> document.body.addEventListener('click', function(event){ var _target_p = "plus-{{ this.getBoxId() }}" ; var _target_m = "minus-{{ this.getBoxId() }}" ; var _input = "{{ this.getBoxId() }}"; var _span = "count-{{ this.getBoxId() }}"; if(event.target.id == _target_p){ var i = parseInt(document.getElementById(_input).value) ; i++; document.getElementById(_span).innerHTML = i; document.getElementById(_input).value = i; // do update cart !! }else if(event.target.id == _target_m){ var i = parseInt(document.getElementById(_input).value) ; i--; if(!i){ return false; }else{ document.getElementById(_span).innerHTML = i; document.getElementById(_input).value = i; // do update cart !! } } }); </script>
The question is how to put updateCart trigger in order to work properly as default implementation. I want to update quantity of item when i press + - button.
Attached Thumbnails
Click image for larger version

Name:	cartViw.PNG
Views:	91
Size:	26.6 KB
ID:	5161  
__________________
Soptareanu Alex
Reply With Quote