Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- /* Корзина товарів початок*/
- $(document).ready(function() {
- function setWidhtTdTableCart() {
- var wid = 0, wid_ = 0;
- $(".cr_am").each(function(i){
- wid_ = $(this).width();
- if(wid_>wid) wid = wid_;
- });
- $(".cr_am").width(wid);
- $("#cr_am_all").width(wid);
- wid = 0; wid_ = 0;
- $(".cr_pr").each(function(i){
- wid_ = $(this).width();
- if(wid_>wid) wid = wid_;
- });
- $(".cr_pr").width(wid);
- $("#cr_number").width($(".number").width());
- }
- setWidhtTdTableCart();
- $(window).resize(function(e) {
- setWidhtTdTableCart();
- })
- });
- var productCart = {
- 'updCount' : function(component_id, product_id, el){
- var count = $(el).val();
- var tr = $(el).closest("tr"),
- price = parseFloat((tr.find(".price").text()).replace(/\s+/g, ''));
- var amount = price * count;
- // $("#shop_cart #preload div").show();
- tr.find(".amount").text(fn.number_format(amount, 2, ".", " "));
- addProductCart(component_id, product_id, count, 1, el, function(el, count){
- productCart.updAmount();
- });
- },
- 'addCount' : function (component_id, product_id, el){
- var tr = $(el).parents(".line");
- var count = +tr.find("input.count").val();
- var price = parseFloat((tr.find(".price").text()).replace(/\s+/g, ''));
- count += 1;
- var amount = price * count;
- // $("#shop_cart #preload div").show();
- tr.find("input.count").val(count);
- tr.find(".amount").text(fn.number_format(amount, 2, ".", " "));
- addProductCart(component_id, product_id, 1, 0, el, function(el, count){
- productCart.updAmount();
- });
- },
- 'delCount' : function (component_id, product_id, el){
- var tr = $(el).parents(".line"),
- price = parseFloat((tr.find(".price").text()).replace(/\s+/g, ''));
- var count = +tr.find("input.count").val();
- count -= 1;
- var amount = price * count;
- if(count == 0) tr.remove();
- // $("#shop_cart #preload div#p1").show();
- tr.find(".amount").text(fn.number_format(amount, 2, ".", " "));
- tr.find("input.count").val(count);
- delProductCart(component_id, product_id, 1, el, function(el){
- productCart.updAmount();
- });
- },
- 'delProduct' : function (component_id, product_id, el){
- delProductCart(component_id, product_id, "all", el, function(el){
- $(el).closest(".line").remove();
- productCart.updAmount();
- });
- },
- 'clear' : function(){
- if(confirm(DO_YOU_WANT_TO_EMPTY_THE_TRASH+"?")){
- clearProductCart();
- $("#shop_cart").html('<p class="cart_is_empty">'+CART_IS_EMPTY+'</p>');
- $(".line_1__in .cart_1").html('<p>'+CART_IS_EMPTY+'</p>');
- $(".line_1__in .count").text('0');
- }
- },
- 'add' : function(component_id, product_id, ev){
- ev.stopPropagation ? ev.stopPropagation() : (ev.cancelBubble=true)
- addProductCart(component_id, product_id, 1, 0, 0, function(el, count){
- var html = '<p>'+ITEM_SUCCESSFULLY_ADDED_TO_CART+'</p><div class="buttons"><button onclick="modal.hide()" class="one_click">'+CONTINUE_SHOPPING+'</button><a href="/'+LANG+'/cart/"><button class="in_cart">'+GO_TO_BASKET+'</button></a></div>';
- modal.show(html, "addToCart");
- });
- },
- 'updAmount' : function (){
- var cartCount = 0, cartAmount = 0, count;
- $("#shop_cart div.line").each(function(i){
- count = +$(this).find("input.count").val();
- cartCount += count;
- cartAmount += parseFloat(($(this).find(".price").text()).replace(/\s+/g, '')) * count;
- });
- $("#shop_cart #countProducts, .line_1__in .count").text(cartCount);
- $("#shop_cart #amountProducts, .line_1__in .amount").text(fn.number_format(cartAmount, 2, ".", " "));
- // $("#shop_cart #preload div#p1").hide();
- }
- }
- /* Корзина товарів кінець */
- </script>
- <style>
- /* Корзина товарів початок */
- .cart_wrap{
- margin-top: 80px;
- margin-left: 15px;
- margin-right: 15px;
- }
- .cart_wrap .line{
- border: 1px solid #ebebeb;
- background-color: #fff;
- width: 100%;
- padding: 5px;
- margin-bottom: 5px;
- }
- .cart_wrap .line:after{
- content: '';
- display: block;
- clear: both;
- }
- .cart_wrap .line .left{
- display: table;
- width: 50%;
- min-width: 278px;
- float: left;
- }
- .cart_wrap .number{
- max-width: 120px;
- }
- .cart_wrap .line .right{
- display: table;
- width: 50%;
- min-width: 278px;
- float: right;
- }
- .cart_wrap .line .left > div,
- .cart_wrap .line .right > div{
- display: table-cell;
- vertical-align: middle;
- }
- .cart_wrap .line .right table{
- width: 100%;
- }
- .cart_wrap .line .right table td{
- text-align: center;
- padding: 5px 0;
- }
- .cart_wrap .title_row{
- display: none;
- }
- .title_row td{
- border-bottom: 1px solid #a09d9d;
- }
- .cart_wrap .right_wr{
- width: calc(100% - 30px);
- }
- .cart_wrap .del{
- width: 24px;
- }
- .cart_wrap #del_1{
- display: none;
- }
- .cart_wrap .img{
- width: 80px;
- text-align: center;
- }
- .cart_wrap .img img{
- max-width: 80px;
- max-height: 80px;
- }
- .cart_wrap .name{
- width: calc(100% - 80px);
- padding: 5px;
- line-height: 1.3;
- }
- .num_w{
- display: table;
- margin: 0 auto;
- }
- .num_w div{
- display: table-cell;
- vertical-align: middle;
- }
- .num_w input{
- border: 1px solid #a09d9d;
- width: 40px;
- text-align: center;
- height: 36px;
- }
- .num_but{
- display: block;
- cursor: pointer;
- margin: 0 5px;
- font-size: 30px;
- color: #cdcdcd;
- transition: all 0.3s;
- }
- .num_but:hover{
- color: #00bff3;
- }
- .num_but.del:hover{
- color: #ff0000;
- }
- .cart_wrap__tit{
- padding: 6px;
- }
- .cart_wrap__tit .l{
- float: left;
- width: 50%;
- }
- .cart_wrap__tit .r{
- float: right;
- width: 50%;
- }
- .cart_wrap__tit:after{
- content: '';
- display: block;
- clear: both;
- }
- .cart_wrap__tit .r table{
- width: calc(100% - 34px);
- }
- .cart_wrap__tit .r table td{
- text-align: center;
- }
- .cart_butons{
- text-align: center;
- margin: 30px 0;
- }
- .cart_butons button{
- width: 240px;
- height: 36px;
- margin: 10px 20px;
- }
- .cart_butons button.one_click:hover{
- border-color: #ff0000;
- color: #ff0000;
- }
- .cart_wrap__tit.bott{
- padding-right: 25px;
- }
- .cart_wrap__tit.bott table{
- width: 100%;
- }
- .cart_wrap__tit.bott td{
- text-align: center;
- }
- .cart_wrap__tit.bott td:nth-child(1){
- text-align: right;
- }
- #line_cart{
- height: 60px;
- line-height: 60px;
- padding-left: 15px;
- }
- /***** Медіа */
- @media only screen and (max-width : 1050px) {
- .cart_wrap .line div.left{
- width: 40%;
- }
- .cart_wrap .line div.right{
- width: 60%;
- }
- .cart_wrap__tit .r{
- width: 60%;
- }
- .cart_wrap__tit .l {
- width: 40%;
- }
- }
- @media only screen and (max-width : 742px) {
- .cart_wrap .title_row{
- display: table-row;
- }
- .cart_wrap .line div.left, .cart_wrap .line div.right{
- width: 100%;
- }
- #cart_wrap__tit{
- display: none;
- }
- }
- @media only screen and (max-width : 400px) {
- .cart_wrap__tit.bott{
- font-size: 16px;
- }
- .cart_wrap{
- margin-left: 0;
- margin-right: 0;
- }
- }
- /* Корзина товарів кінець */
- </style>
- <!-- Корзина товарів початок -->
- <div class="cart_wrap">
- <div class="cart_wrap__tit" id="cart_wrap__tit">
- <div class="l">
- Найменування
- </div>
- <div class="r">
- <table id-"cart_tit_b">
- <tr>
- <td class="cr_pr">Ціна</td>
- <td>Кількість</td>
- <td class="cr_am">Сума</td>
- </tr>
- </table>
- </div>
- </div>
- <div class="line ">
- <div class="left">
- <div class="img">
- <img src="___1780.jpg" alt="">
- </div>
- <div class="name">
- Шина BRIDGESTONE, модель BLIZZAK DM-V1, 225/55R18
- </div>
- </div>
- <div class="right">
- <div class="right_wr">
- <table cellspacing="0" cellpadding="5">
- <tr class="title_row">
- <td class="cr_pr">
- Ціна
- </td>
- <td>
- Кількість
- </td>
- <td class="cr_am">
- Сума
- </td>
- </tr>
- <tr>
- <td class="cr_pr">
- 67858.55
- </td>
- <td class="number">
- <div class="num_w">
- <div class="b"><i class="fa fa-minus-square num_but"></i>
- </div>
- <div class="inp">
- <input type="text" value="3">
- </div>
- <div class="b"><i onclick="" class="fa fa-plus-square num_but"></i>
- </div>
- </div>
- </td>
- <td class="cr_am">
- 86758.55
- </td>
- </tr>
- </table>
- </div>
- <div class="del" id="del_2">
- <i class="fa fa-times num_but del"></i>
- </div>
- </div>
- </div>
- <div class="line ">
- <div class="left">
- <div class="img">
- <img src="___1780.jpg" alt="">
- </div>
- <div class="name">
- Шина BRIDGESTONE, модель BLIZZAK DM-V1, 225/55R18
- </div>
- </div>
- <div class="right">
- <div class="right_wr">
- <table cellspacing="0" cellpadding="5">
- <tr class="title_row">
- <td class="cr_pr">
- Ціна
- </td>
- <td>
- Кількість
- </td>
- <td class="cr_am">
- Сума
- </td>
- </tr>
- <tr>
- <td class="cr_pr">
- 67858.55
- </td>
- <td class="number">
- <div class="num_w">
- <div class="b"><i class="fa fa-minus-square num_but"></i>
- </div>
- <div class="inp">
- <input type="text" value="3">
- </div>
- <div class="b"><i onclick="" class="fa fa-plus-square num_but"></i>
- </div>
- </div>
- </td>
- <td class="cr_am">
- 58.55
- </td>
- </tr>
- </table>
- </div>
- <div class="del" id="del_2">
- <i class="fa fa-times num_but del"></i>
- </div>
- </div>
- </div>
- <div class="line ">
- <div class="left">
- <div class="img">
- <img src="___1780.jpg" alt="">
- </div>
- <div class="name">
- Шина BRIDGESTONE, модель BLIZZAK DM-V1, 225/55R18
- </div>
- </div>
- <div class="right">
- <div class="right_wr">
- <table cellspacing="0" cellpadding="5">
- <tr class="title_row">
- <td class="cr_pr">
- Ціна
- </td>
- <td>
- Кількість
- </td>
- <td class="cr_am">
- Сума
- </td>
- </tr>
- <tr>
- <td class="cr_pr">
- 858.55
- </td>
- <td class="number">
- <div class="num_w">
- <div class="b"><i class="fa fa-minus-square num_but"></i>
- </div>
- <div class="inp">
- <input type="text" value="3">
- </div>
- <div class="b"><i onclick="" class="fa fa-plus-square num_but"></i>
- </div>
- </div>
- </td>
- <td class="cr_am">
- 4586758.55
- </td>
- </tr>
- </table>
- </div>
- <div class="del" id="del_2">
- <i class="fa fa-times num_but del"></i>
- </div>
- </div>
- </div>
- <div class="cart_wrap__tit bott">
- <table id="cart_tit_b">
- <tr>
- <td>Всього:</td>
- <td id="cr_number">12</td>
- <td id="cr_am_all">269462.56</td>
- </tr>
- </table>
- </div>
- </div>
- <div class="cart_butons">
- <button class="one_click" onclick="productCart.clear()">Очистити корзину
- </button>
- <button class="in_cart">
- Оформити замовлення
- </button>
- <!--
- <a href="/cart/checkout/" class="in_cart">
- Оформити замовлення </a>
- -->
- </div>
- <!-- Корзина товарів кнець -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement