diff --git a/common/modules/comment/models/CommentModel.php b/common/modules/comment/models/CommentModel.php index 1d10f13..576bbb8 100755 --- a/common/modules/comment/models/CommentModel.php +++ b/common/modules/comment/models/CommentModel.php @@ -166,17 +166,17 @@ ]; } - function setEntity(string $entity) + function setEntity( $entity) { $this->entity = $entity; } - function getEntity(): string + function getEntity() { return $this->entity; } - static function getTree(string $entity, int $entityId): ActiveDataProvider + static function getTree( $entity, $entityId) { return new ActiveDataProvider([ 'query' => self::find() @@ -202,7 +202,7 @@ ]); } - function deleteComment(): bool { + function deleteComment() { if(\Yii::$app->user->id != NULL && \Yii::$app->user->id == $this->user_id) { if($this->delete()) { return true; @@ -211,12 +211,12 @@ return false; } - function setEntityId(int $entityId) + function setEntityId( $entityId) { $this->entityId = $entityId; } - function getEntityId(): int + function getEntityId() { return $this->entityId; } diff --git a/common/modules/comment/models/interfaces/CommentInterface.php b/common/modules/comment/models/interfaces/CommentInterface.php index 4c5bd1d..342c4d1 100755 --- a/common/modules/comment/models/interfaces/CommentInterface.php +++ b/common/modules/comment/models/interfaces/CommentInterface.php @@ -10,14 +10,14 @@ */ interface CommentInterface { - function setEntity(string $entity); + function setEntity( $entity); - function getEntity(): string; + function getEntity(); - function setEntityId(int $entityId); + function setEntityId( $entityId); - function getEntityId(): int; + function getEntityId(); - static function getTree(string $entity, int $entityId): ActiveDataProvider; + static function getTree( $entity, $entityId); } \ No newline at end of file diff --git a/common/modules/comment/widgets/CommentWidget.php b/common/modules/comment/widgets/CommentWidget.php index 797b705..fb721cd 100755 --- a/common/modules/comment/widgets/CommentWidget.php +++ b/common/modules/comment/widgets/CommentWidget.php @@ -357,7 +357,7 @@ $this->model = $model; } - public function getModel(): \yii\base\Model + public function getModel() { if(!empty( $this->model )) { return $this->model; diff --git a/common/modules/product/widgets/views/product_smart.php b/common/modules/product/widgets/views/product_smart.php index 83884d4..a835c17 100755 --- a/common/modules/product/widgets/views/product_smart.php +++ b/common/modules/product/widgets/views/product_smart.php @@ -5,8 +5,14 @@ use yii\helpers\Html; use yii\helpers\Url; ?> -
+
+
+
+ + + +
diff --git a/frontend/assets/AppAsset.php b/frontend/assets/AppAsset.php index f9a03e2..1a17bab 100755 --- a/frontend/assets/AppAsset.php +++ b/frontend/assets/AppAsset.php @@ -26,7 +26,7 @@ class AppAsset extends AssetBundle //'js/js_head.js', //'js/js_footer.js', '/js/artbox_basket.js', -// 'js/script.js', + 'js/script.js', 'js/new_script.js', ]; public $depends = [ diff --git a/frontend/views/catalog/product.php b/frontend/views/catalog/product.php index caffa9f..a3cc04e 100755 --- a/frontend/views/catalog/product.php +++ b/frontend/views/catalog/product.php @@ -25,22 +25,21 @@ $this->params[ 'breadcrumbs' ][] = $product->fullname . ' #' . $product->enabledVariants[ 0 ]->sku; ?> - + + + + + + + + + + + + + + +
diff --git a/frontend/views/layouts/main.php b/frontend/views/layouts/main.php index 9fd1875..906e96e 100755 --- a/frontend/views/layouts/main.php +++ b/frontend/views/layouts/main.php @@ -59,6 +59,7 @@ AppAsset::register($this);
+
@@ -433,6 +434,9 @@ AppAsset::register($this);
+ + + diff --git a/frontend/web/css/comments.css b/frontend/web/css/comments.css index 75cb160..45ef1a9 100755 --- a/frontend/web/css/comments.css +++ b/frontend/web/css/comments.css @@ -1 +1 @@ -@import "https://fonts.googleapis.com/css?family=Roboto:400,700,500&subset=cyrillic-ext,latin,cyrillic,latin-ext";.input_bl,.area_bl,.form-comm-wr,.user_name,.user_txt,.comment-panel,.answer-form,.comments-start input,.comments-start textarea,.submit_btn button,.input_bl label{box-sizing:border-box}.comments-border{width:100%;margin-top:25px;margin-bottom:27px;height:1px;background:#d2d2d2}.comments-start{width:730px;margin:0 auto;font-family:'Roboto',sans-serif;font-weight:400;color:#333}.form-comm-wr{width:100%;background:#f5f5f5;padding:20px;float:left}.input_bl{margin-top:15px;float:left}.area_bl,.input_bl{position:relative}.input_bl input,.input_bl textarea,.answer-form textarea{width:258px;height:30px;border:1px solid #d2d2d2;background:#fff;outline:none!important;border-radius:4px;padding-left:10px}.area_bl textarea,.answer-form textarea{resize:none!important;height:140px;width:585px;padding-top:7px}.input_bl input:focus,.input_bl textarea:focus,.answer-form textarea:focus{box-shadow:1px 2px 2px 0 rgba(215,215,215,0.75) inset;transition:.1s}.input_bl label{font-size:12px;color:#7d7d7d;font-weight:400;text-transform:uppercase;position:relative;width:105px;float:left;text-align:right;padding-right:10px;margin-top:9px}.input_bl:nth-child(2) label{width:69px}.submit_btn{float:right;margin-top:27px}.submit_btn button,.answer-form button{padding:0 17px;height:32px;font-weight:500;font-size:15px;color:#fff;border-top:0;border-left:0;border-right:0;border-bottom:2px solid #799920;background:#95ba2f;border-radius:4px;cursor:pointer;outline:none!important}.submit_btn button:hover,.answer-form button:hover{border-bottom:2px solid #95ba2f}.submit_btn button:active,.answer-form button:active{border-bottom:2px solid #799920;background:#799920}.answer-form button{float:right;margin-top:27px}.comments-wr,.comment-answer{min-height:64px;position:relative;float:left;width:100%}.answer-form{float:left;width:100%}.user-ico{width:80px;height:80px;float:left;overflow:hidden;border-radius:50%;position:absolute;top:0;left:0}.user-ico img{width:100%;height:100%}.user_data{margin-top:-2px;font-size:12px;color:#636363}.user_name{margin-top:6px;font-weight:700;font-size:15px}.user_name,.user_txt,.comment-panel,.answer-form,.user_data{width:100%;float:left;padding-left:100px}.user_txt{margin-top:8px;font-size:13px;line-height:18px}.comment-panel{width:100%;float:left;margin-top:11px}.comment-panel a:first-child{margin-left:0}.btn-comm-answer,.btn-comm-delete{font-size:13px;color:#799920;border-bottom:1px dotted #799920}.btn-comm-answer,.btn-comm-delete,.btn-comm-like,.btn-comm-dislike{float:left;margin-left:10px;text-decoration:none}.btn-comm-answer,.btn-comm-delete{height:16px;line-height:16px}.btn-comm-answer:hover,.btn-comm-delete:hover{text-decoration:none;border-bottom:0}.btn-comm-like,.btn-comm-dislike{width:14px;height:16px;background-image:url(../images/like_dislike.png);background-repeat:no-repeat}.btn-comm-like{background-position:0 0}.btn-comm-like:hover{background-position:0 -16px}.btn-comm-dislike:hover{background-position:-14px -16px}.btn-comm-dislike{background-position:-14px 0}.btn-comm-like:active,.btn-comm-dislike:active{opacity:.7}.comment-answer{margin-top:40px}.comment-answer .user-ico{left:100px}.comment-answer .user_name,.comment-answer .user_txt,.comment-answer .comment-panel,.comment-answer .answer-form,.comment-answer .user_data{padding-left:200px}.comments-wr{margin-top:40px}.answer-form{margin-top:20px}.answer-form textarea{width:100%;height:90px}.input_bl.has-error input,.input_bl.has-error textarea,.answer-form .has-error textarea{box-shadow:1px 2px 2px 0 rgba(212,0,0,0.2) inset}.input_bl .help-block,.answer-form .help-block{display:none}.required label:before{display:block;content:"*";position:absolute;top:0;right:-7px}.comments-start ul.pagination{list-style:none;text-align:center;margin-top:40px;width:100%;float:left}.comments-start ul.pagination li{display:inline}.comments-start ul.pagination li.prev.disabled span{display:none}.comments-start ul.pagination li a{padding:3px;color:#82a02f;font-size:15px;margin:0;text-decoration:none}.comments-start ul.pagination li.active a{color:#333} \ No newline at end of file +@import "https://fonts.googleapis.com/css?family=Roboto:400,700,500&subset=cyrillic-ext,latin,cyrillic,latin-ext";.input_bl,.area_bl,.form-comm-wr,.user_name,.user_txt,.comment-panel,.answer-form,.comments-start input,.comments-start textarea,.submit_btn button,.input_bl label{box-sizing:border-box}.comments-border{width:100%;margin-top:25px;margin-bottom:27px;height:1px;background:#d2d2d2}.comments-start{width:730px;margin:0 auto;font-family:'Roboto',sans-serif;font-weight:400;color:#333}.form-comm-wr{width:100%;background:#f5f5f5;padding:20px;float:left}.input_bl{margin-top:15px;float:left}.area_bl,.input_bl{position:relative}.input_bl input,.input_bl textarea,.answer-form textarea{width:258px;height:30px;border:1px solid #d2d2d2;background:#fff;outline:none!important;border-radius:4px;padding-left:10px}.area_bl textarea,.answer-form textarea{resize:none!important;height:140px;width:585px;padding-top:7px}.input_bl input:focus,.input_bl textarea:focus,.answer-form textarea:focus{box-shadow:1px 2px 2px 0 rgba(215,215,215,0.75) inset;transition:.1s}.input_bl label{font-size:12px;color:#7d7d7d;font-weight:400;text-transform:uppercase;position:relative;width:105px;float:left;text-align:right;padding-right:10px;margin-top:9px}.submit_btn{float:right;margin-top:27px}.submit_btn button,.answer-form button{padding:0 17px;height:32px;font-weight:500;font-size:15px;color:#fff;border-top:0;border-left:0;border-right:0;border-bottom:2px solid #1e5488;background:#256caf;border-radius:4px;cursor:pointer;outline:none!important}.submit_btn button:hover,.answer-form button:hover{border-bottom:2px solid #256caf}.submit_btn button:active,.answer-form button:active{border-bottom:2px solid #1e5488;background:#1e5488}.answer-form button{float:right;margin-top:27px}.comments-wr,.comment-answer{min-height:64px;position:relative;float:left;width:100%}.answer-form{float:left;width:100%}.user-ico{width:80px;height:80px;float:left;overflow:hidden;border-radius:50%;position:absolute;top:0;left:0}.user-ico img{width:100%;height:100%}.user_data{margin-top:-2px;font-size:12px;color:#636363}.user_name{margin-top:6px;font-weight:700;font-size:15px}.user_name,.user_txt,.comment-panel,.answer-form,.user_data{width:100%;float:left;padding-left:100px}.user_txt{margin-top:8px;font-size:13px;line-height:18px}.comment-panel{width:100%;float:left;margin-top:11px}.comment-panel a:first-child{margin-left:0}.btn-comm-answer,.btn-comm-delete{font-size:13px;color:#799920;border-bottom:1px dotted #799920}.btn-comm-answer,.btn-comm-delete,.btn-comm-like,.btn-comm-dislike{float:left;margin-left:10px;text-decoration:none}.btn-comm-answer,.btn-comm-delete{height:16px;line-height:16px}.btn-comm-answer:hover,.btn-comm-delete:hover{text-decoration:none;border-bottom:0}.btn-comm-like,.btn-comm-dislike{width:14px;height:16px;background-image:url(../images/like_dislike.png);background-repeat:no-repeat}.btn-comm-like{background-position:0 0}.btn-comm-like:hover{background-position:0 -16px}.btn-comm-dislike:hover{background-position:-14px -16px}.btn-comm-dislike{background-position:-14px 0}.btn-comm-like:active,.btn-comm-dislike:active{opacity:.7}.comment-answer{margin-top:40px}.comment-answer .user-ico{left:100px}.comment-answer .user_name,.comment-answer .user_txt,.comment-answer .comment-panel,.comment-answer .answer-form,.comment-answer .user_data{padding-left:200px}.comments-wr{margin-top:40px}.answer-form{margin-top:20px}.answer-form textarea{width:100%;height:90px}.input_bl.has-error input,.input_bl.has-error textarea,.answer-form .has-error textarea{box-shadow:1px 2px 2px 0 rgba(212,0,0,0.2) inset}.input_bl .help-block,.answer-form .help-block{display:none}.required label:before{display:block;content:"*";position:absolute;top:0;right:-7px}.comments-start ul.pagination{list-style:none;text-align:center;margin-top:40px;width:100%;float:left}.comments-start ul.pagination li{display:inline}.comments-start ul.pagination li.prev.disabled span{display:none}.comments-start ul.pagination li a{padding:3px;color:#82a02f;font-size:15px;margin:0;text-decoration:none}.comments-start ul.pagination li.active a{color:#333}.field-commentmodel-email label{width: 69px;}#artbox-comment-list .empty{font-size: 14px;color: #7d7d7d;float:left;margin-top:10px;width:100%;} \ No newline at end of file diff --git a/frontend/web/css/css_header.css b/frontend/web/css/css_header.css index 72670d5..2a4ea3b 100755 --- a/frontend/web/css/css_header.css +++ b/frontend/web/css/css_header.css @@ -4615,7 +4615,7 @@ fieldset[disabled] .navbar-inverse .btn-link:focus { .breadcrumb > .active { color: #777 } - +.breadcrumb li a {} .pagination { display: inline-block; padding-left: 0; @@ -7251,7 +7251,7 @@ body, .background-body { background:#edeeef; } a { - color: #003569 + color: #0f6fc7; } a.popup { @@ -7470,7 +7470,7 @@ a.popup { width: 100%; background: #a7acb0; position: fixed; - z-index: 1999; + z-index: 2000; height: 40px; } @@ -9342,6 +9342,31 @@ footer .content-title { float: left; } .artweb-wr:hover a {text-decoration: none;} +.btn-fixeds { + position: fixed; + bottom: 0; + height: 44px; + width: 150px; + background: #fff; + box-shadow: 0 0 7px 0 rgba(0, 0, 0, 0.35); +} +.btn-fixeds a { + display: block; + width: 100%; + height: 100%; + line-height: 44px; + text-align: center; + text-decoration: none; + text-transform: uppercase; + font-size: 15px; + font-weight: 700; +} +.fixed-events {border-bottom: 3px solid #ed1c24;right: 40px;} +.fixed-events a {color: #ed1c24;} +.fixed-sale {border-bottom: 3px solid #01974a;left: 40px;} +.fixed-sale a {color: #01974a;} + + /****************/ /*******brbeadcrumbs*********/ .brbeadcrumbs-wr { @@ -10588,14 +10613,27 @@ footer .vacancies p { display: inline-block } -/*.catalog_product_list {*/ - /*margin: 0 0 20px 0*/ -/*}*/ - +.catalog_product_list { + margin: 0 0 20px 0 +} +.slider_mp_items .catalog_product_list { + margin: 0; +} .catalog_product_list.view_table .catalog_item, .category_popular_list .catalog_item { + float: left; + width: 33%; + height: 420px; + margin: 0 0 10px 0; + position: relative; + z-index: 1; +} +.catalog_product_list .catalog_item.home_slider_it { height: 420px; border: 1px solid #e4e4e4; + float: none; + margin: 0; + } .catalog_product_list.view_table.view_list .catalog_item { @@ -10610,12 +10648,66 @@ footer .vacancies p { .catalog_product_list.view_table .catalog_item .wrapper, .category_popular_list .catalog_item .wrapper { + position: absolute; + z-index: 1; + width: 100%; + min-height: 360px; + height: 360px; + overflow: hidden; + left: 0; + top: 0; + border-radius: 4px; + background: #fff; + -webkit-box-sizing: content-box !important; + -moz-box-sizing: content-box !important; + box-sizing: content-box !important; +} + +.catalog_product_list .catalog_item.home_slider_it .wrapper { position: relative; z-index: 1; width: 100%; height: 100%; + min-height: 100%; overflow: hidden; background: #fff; + left: auto; + top: auto; + border-radius: 0; + box-sizing: border-box !important; + +} +.status_block-wr { + position: absolute; + top:20px; + left: 20px; + width: 42px; + height: 42px; + z-index: 999; +} +.staus_new, .staus_hit, .status_sale { + position: absolute; + top:0; + left: 0; + width: 100%; + height: 100%; + border-radius: 100%; + overflow: hidden; +} +.staus_new { + background: url("../images/new_img/ico/ico-15.png") no-repeat; +} +.staus_hit { + background: url("../images/new_img/ico/ico-16.png") no-repeat; +} +.status_sale { + background: #e22229; + color: #fff; + text-align: center; + font-size: 14px; + font-weight: 700; + line-height: 42px; + cursor: pointer; } .catalog_product_list.view_table.view_list .catalog_item .wrapper { @@ -10633,17 +10725,27 @@ footer .vacancies p { z-index: 1999 } -.catalog_product_list.view_table .catalog_item:hover { - box-shadow: 0px 0px 12px 0px rgba(0, 0, 0, 0.35); +.catalog_product_list.view_table .catalog_item .wrapper:hover { + box-shadow: 0 0 5px #ccc; + padding: 0 20px; + margin-left: -20px; +} +.catalog_product_list.view_table .catalog_item.home_slider_it .wrapper:hover { + padding: 0 0; + margin-left: 0; +} +.catalog_product_list.view_table .catalog_item.home_slider_it:hover { + box-shadow: 0 0 12px 0 rgba(0, 0, 0, 0.35); + padding: 0 0; + margin-left: 0; } - .catalog_product_list.view_table .catalog_item .wrapper:hover { - + height: auto; } -.img a { +.catalog_item.home_slider_it .img a { display: table-cell; width: 172px; height: 258px; @@ -10653,12 +10755,19 @@ footer .vacancies p { .catalog_product_list.view_table .catalog_item .wrapper .item_container, .category_popular_list .catalog_item .wrapper .item_container { + padding: 15px 5px; +} +.catalog_product_list .catalog_item.home_slider_it .wrapper .item_container { height: 100%; + padding: 0; } .slider_mp_items .owl-carousel .owl-item {padding: 7px 15px 30px 15px;} +.catalog_product_list .catalog_item .img, .category_popular_list .catalog_item .img { + min-height: 205px; +} .catalog_product_list .img, .category_popular_list .catalog_item .img { - margin: 9px 0 0 0; + margin: 0 0 10px 0; position: relative; z-index: 1 } @@ -10672,14 +10781,25 @@ footer .vacancies p { .catalog_product_list .catalog_item .img img, .category_popular_list .catalog_item .img img { + max-width: 250px; + max-height: 250px; + min-height: 15px; + display: block; + margin: 0 auto; +} +.catalog_product_list .catalog_item .img img.selected, .category_popular_list .catalog_item .img +img.selected { + display: block; +} +.catalog_product_list .catalog_item.home_slider_it .img img { max-width: 172px; max-height: 258px; margin: 0 auto; vertical-align: middle; + display: block; } -.catalog_product_list .catalog_item .img, -.category_popular_list .catalog_item .img { + .catalog_product_list .catalog_item.home_slider_it .img { height: 258px; display: table; margin: 0 auto; @@ -10890,13 +11010,14 @@ footer .vacancies p { .catalog_product_list .additional_info.params .descr ul, .category_popular_list .catalog_item .additional_info.params .descr ul { - padding: 0 + padding: 0; + margin-top: 10px; } .catalog_product_list .additional_info.params .descr ul li, .category_popular_list .catalog_item .additional_info.params .descr ul li { list-style-type: none; - line-height: 12px; + line-height: 17px; padding: 0 0 5px 0 } @@ -11236,8 +11357,9 @@ footer .vacancies p { } .product_detail .img_part { - max-width: 400px; - min-width: 300px; + /*max-width: 400px;*/ + max-width: 342px; + min-width: 327px; width: 30%; margin: 0 50px 30px 0; float: left; @@ -11254,9 +11376,10 @@ footer .vacancies p { } .product_detail .img_part .position.fixed { - max-width: 410px; + /*max-width: 410px;*/ + max-width: 342px; width: 30%; - padding-right: 10px + /*padding-right: 10px;*/ } .product_detail .img_part_big { @@ -14314,5 +14437,31 @@ h1.title { float:left; width: 100%; } + .comments-start { + width: 563px !important; + } + .input_bl input, .input_bl textarea, .answer-form textarea { + width: 172px !important; + } + .area_bl textarea, .answer-form textarea {width: 413px !important;} + + .fixed-events { + transform: rotate(-90deg); + -webkit-transform: rotate(-90deg); + right: -53px; + + } + .fixed-sale { + transform: rotate(90deg); + -webkit-transform: rotate(90deg); + left: -53px; + } + .fixed-sale a { + transform: rotate(-180deg); + -webkit-transform: rotate(-180deg); + } + .btn-fixeds { + bottom: 53px; + } } diff --git a/frontend/web/js/script.js b/frontend/web/js/script.js index 221dee6..33756d5 100755 --- a/frontend/web/js/script.js +++ b/frontend/web/js/script.js @@ -1,231 +1,234 @@ -// var artbox_basket = new ArtboxBasket(); -// -// /*order basket form js logic*/ -// -// var recountPrice = function(container,new_value){ -// var new_price = +$(container).find('.price span').html() * new_value; -// $(container).find('.cost span').html(new_price); -// var total_price = 0; -// $('#orderFrom').find('#cost span').each(function(){ -// total_price += +$(this).html(); -// }); -// -// var total = $('#total span').html(total_price); -// }; -// -// $(document).on('click', '#ordersFrom .count_choise .plus', function(e) { -// e.preventDefault(); -// var container = $(this).parents('.order_item'); -// var input = $(container).find('.prod_count'); -// var value = $(input).val(); -// var new_value = parseInt(value) + 1; -// $(input).val(new_value); -// $(input).trigger('change'); -// recountPrice(container,new_value); -// -// }); -// -// $(document).on('click', '#ordersFrom .count_choise .minus', function(e) { -// e.preventDefault(); -// var container = $(this).parents('.order_item'); -// var input = $(container).find('.prod_count'); -// var value = $(input).val(); -// if(value > 1 ){ -// var new_value = parseInt(value) - 1; -// $(input).val(new_value); -// $(input).trigger('change'); -// recountPrice(container,new_value); -// } -// -// }); -// -// $(document).on('change', '#ordersFrom .prod_count', function(e) { -// e.preventDefault(); -// var container = $(this).parents('.order_item'); -// var new_value = $(this).val(); -// recountPrice(container,new_value); -// var product_variant_id = container.data('id'); -// var value = $(this).val(); -// if(value < 0) { -// value = 0; -// } -// artbox_basket.set(product_variant_id, value); -// }); -// -// -// -// $(document).on('click', '#ordersFrom .cart_remove', function(e) { -// e.preventDefault(); -// var container = $(this).parents('.order_item'); -// -// var id = $(container).data('id'); -// container.remove(); -// artbox_basket.set(id, 0); -// }); -// -// -// /*end order basket form js logic*/ -// -// $(document).on('click', '.buy_button', function(e) { -// e.preventDefault(); -// var product_variant_id = $(this).data('id'); -// var count = 1; -// artbox_basket.add(product_variant_id, count); -// }); -// $(document).on('change', '#buyForm .prod_count', function(e) { -// e.preventDefault(); -// var product_variant_id = $(this).parents('tr').data('id'); -// var value = $(this).val(); -// if(value < 0) { -// value = 0; -// } -// artbox_basket.set(product_variant_id, value); -// }); -// -// $(document).on('click', '#buyForm .count_choise .minus', function(e) { -// e.preventDefault(); -// var container = $(this).parents('tr'); -// var input = $(container).find('.prod_count'); -// var value = $(input).val(); -// var new_value = parseInt(value) - 1; -// $(input).val(new_value); -// $(input).trigger('change'); -// }); -// -// -// $(document).on('click', '#buyForm .count_choise .plus', function(e) { -// e.preventDefault(); -// var container = $(this).parents('tr'); -// var input = $(container).find('.prod_count'); -// var value = $(input).val(); -// var new_value = parseInt(value) + 1; -// $(input).val(new_value); -// $(input).trigger('change'); -// }); -// -// -// $(document).on('click', '#top-cart-info', function() { -// if(artbox_basket.count > 0) { -// location.href='/order' -// } -// }); -// -// $(document).on('click', '#buyForm .cart_remove', function() { -// var container = $(this).parents('tr'); -// var id = $(container).data('id'); -// artbox_basket.set(id, 0); -// }); -// -// /* Category filter open submenu */ -// $(document).on('click', '.properties_block', function(e) { -// var active = $(this).hasClass('opened'); -// if(active) { -// $(this).removeClass('opened').addClass('closed'); -// $(this).find('.chechboxes').hide(); -// } else { -// $(this).removeClass('closed').addClass('opened'); -// $(this).find('.chechboxes').show(); -// } -// }); -// /* End Category filter open submenu */ -// /* Cart resize on scroll */ -// $('.img_part').height($('.info').height()); -// $(document).on('scroll', window, function(e) -// { -// currentScroll = $(window).scrollTop(); -// if (currentScroll > 0) { -// $('#top-cart-content').addClass('small-cart'); -// } else { -// $('#top-cart-content').removeClass('small-cart'); -// } -// }); -// /* End cart resize on scroll */ -// /* Catalog product scroll watcher */ -// $(document).on('scroll', window, function(e) { -// checkFixed(e); -// checkSelector(e); -// }); -// function checkFixed(e) { -// var img_part = $('.img_part'); -// var position = $(img_part).find('.position'); -// var position_height = $(position).height(); -// var info = $('.info'); -// var info_position = $(info).position(); -// var info_height = $(info).height(); -// var info_top = info_position.top; -// var info_bottom = info_top + info_height; -// var currentScroll = $(window).scrollTop(); -// if(info_bottom - currentScroll > 0 && info_bottom - currentScroll < position_height) { -// $(position).removeClass('fixed').css({ -// position: 'absolute', -// bottom: 0, -// top: 'auto', -// }); -// } else if(currentScroll > info_top && currentScroll < info_bottom) { -// $(position).addClass('fixed').css({ -// position: 'fixed', -// top: '100px', -// bottom: 'auto' -// }); -// } else { -// $(position).removeClass('fixed').css({ -// position: 'relative', -// top: 0, -// bottom: 'auto' -// }); -// } -// } -// function checkSelector(e) { -// var tab_content = $('#characteristics'); -// var tab_content_top = $(tab_content).position().top - 100; -// var comments_block = $('#reviews'); -// var comments_block_top = $(comments_block).position().top - 100; -// var collection = $('#collection'); -// var collection_top = $(collection).position().top - 100; -// var currentScroll = $(window).scrollTop(); -// var detail_main_tabs = $('.detail_main_tabs'); -// var active; -// if(currentScroll > tab_content_top && currentScroll < collection_top) { -// active = 'characteristics'; -// } else if(currentScroll > comments_block_top) { -// active = 'reviews'; -// } else if(currentScroll > collection_top && currentScroll < comments_block_top) { -// active = 'collection'; -// } -// $(detail_main_tabs).find('li.selected').removeClass('selected'); -// $(detail_main_tabs).find('[data-target='+active+']').addClass('selected'); -// } -// $(window).scroll(function(e) { -// checkFixed(e); -// checkSelector(e); -// }); -// /* End catalog product scroll watcher */ -// /* Animated links */ -// $(document).on('click', '.detail_main_tabs a', function(e) { -// e.preventDefault(); -// var hash = $(this).attr('href').replace(/^.*?(#|$)/,''); -// var target = $('#'+hash); -// var target_top = $(target).position().top - 50; -// var body = $('html, body'); -// body.stop().animate({scrollTop:target_top}, 500, 'swing', function() {}); -// }); -// /* End animated links */ -// /* Ajax form submit */ -// $(document).on('submit', '#feedback-form', function(e) { -// e.preventDefault(); -// $.post('/ajax/feedback', $(this).serialize(), function(data) { -// $('#myCallback').find('.modal-body').html(data.result); -// }); -// }); -// $(document).on('submit', '#quickbuy-form', function(e) { -// e.preventDefault(); -// var container = $(this).parents('.fast_order_form'); -// $.post('/order/quick', $(this).serialize(), function(data) { -// if(!data.error) { -// $(container).html(data.result); -// } else { -// $(container).html(data.error); -// } -// }) -// }); -// /* End ajax form submit */ \ No newline at end of file +var artbox_basket = new ArtboxBasket(); + +/*order basket form js logic*/ + +var recountPrice = function(container,new_value){ + var new_price = +$(container).find('.price span').html() * new_value; + $(container).find('.cost span').html(new_price); + var total_price = 0; + $('#orderFrom').find('#cost span').each(function(){ + total_price += +$(this).html(); + }); + + var total = $('#total span').html(total_price); +}; + +$(document).on('click', '#ordersFrom .count_choise .plus', function(e) { + e.preventDefault(); + var container = $(this).parents('.order_item'); + var input = $(container).find('.prod_count'); + var value = $(input).val(); + var new_value = parseInt(value) + 1; + $(input).val(new_value); + $(input).trigger('change'); + recountPrice(container,new_value); + +}); + +$(document).on('click', '#ordersFrom .count_choise .minus', function(e) { + e.preventDefault(); + var container = $(this).parents('.order_item'); + var input = $(container).find('.prod_count'); + var value = $(input).val(); + if(value > 1 ){ + var new_value = parseInt(value) - 1; + $(input).val(new_value); + $(input).trigger('change'); + recountPrice(container,new_value); + } + +}); + +$(document).on('change', '#ordersFrom .prod_count', function(e) { + e.preventDefault(); + var container = $(this).parents('.order_item'); + var new_value = $(this).val(); + recountPrice(container,new_value); + var product_variant_id = container.data('id'); + var value = $(this).val(); + if(value < 0) { + value = 0; + } + artbox_basket.set(product_variant_id, value); +}); + + + +$(document).on('click', '#ordersFrom .cart_remove', function(e) { + e.preventDefault(); + var container = $(this).parents('.order_item'); + + var id = $(container).data('id'); + container.remove(); + artbox_basket.set(id, 0); +}); + + +/*end order basket form js logic*/ + +$(document).on('click', '.buy_button', function(e) { + e.preventDefault(); + var product_variant_id = $(this).data('id'); + var count = 1; + artbox_basket.add(product_variant_id, count); +}); +$(document).on('change', '#buyForm .prod_count', function(e) { + e.preventDefault(); + var product_variant_id = $(this).parents('tr').data('id'); + var value = $(this).val(); + if(value < 0) { + value = 0; + } + artbox_basket.set(product_variant_id, value); +}); + +$(document).on('click', '#buyForm .count_choise .minus', function(e) { + e.preventDefault(); + var container = $(this).parents('tr'); + var input = $(container).find('.prod_count'); + var value = $(input).val(); + var new_value = parseInt(value) - 1; + $(input).val(new_value); + $(input).trigger('change'); +}); + + +$(document).on('click', '#buyForm .count_choise .plus', function(e) { + e.preventDefault(); + var container = $(this).parents('tr'); + var input = $(container).find('.prod_count'); + var value = $(input).val(); + var new_value = parseInt(value) + 1; + $(input).val(new_value); + $(input).trigger('change'); +}); + + +$(document).on('click', '#top-cart-info', function() { + if(artbox_basket.count > 0) { + location.href='/order' + } +}); + +$(document).on('click', '#buyForm .cart_remove', function() { + var container = $(this).parents('tr'); + var id = $(container).data('id'); + artbox_basket.set(id, 0); +}); + +/* Category filter open submenu */ +$(document).on('click', '.properties_block', function(e) { + var active = $(this).hasClass('opened'); + if(active) { + $(this).removeClass('opened').addClass('closed'); + $(this).find('.chechboxes').hide(); + } else { + $(this).removeClass('closed').addClass('opened'); + $(this).find('.chechboxes').show(); + } +}); +/* End Category filter open submenu */ +/* Cart resize on scroll */ +$('.img_part').height($('.info').height()); +$(document).on('scroll', window, function(e) +{ + currentScroll = $(window).scrollTop(); + if (currentScroll > 0) { + $('#top-cart-content').addClass('small-cart'); + } else { + $('#top-cart-content').removeClass('small-cart'); + } +}); +/* End cart resize on scroll */ +/* Catalog product scroll watcher */ +$(document).on('scroll', window, function(e) { + if(($('.detail_main_tabs').length)>0) { + checkFixed(e); + checkSelector(e); + } + +}); +function checkFixed(e) { + var img_part = $('.img_part'); + var position = $(img_part).find('.position'); + var position_height = $(position).height(); + var info = $('.info'); + var info_position = $(info).position(); + var info_height = $(info).height(); + var info_top = info_position.top; + var info_bottom = info_top + info_height; + var currentScroll = $(window).scrollTop(); + if(info_bottom - currentScroll > 0 && info_bottom - currentScroll < position_height) { + $(position).removeClass('fixed').css({ + position: 'absolute', + bottom: 0, + top: 'auto', + }); + } else if(currentScroll > info_top && currentScroll < info_bottom) { + $(position).addClass('fixed').css({ + position: 'fixed', + top: '100px', + bottom: 'auto' + }); + } else { + $(position).removeClass('fixed').css({ + position: 'relative', + top: 0, + bottom: 'auto' + }); + } +} +function checkSelector(e) { + var tab_content = $('#characteristics'); + var tab_content_top = $(tab_content).position().top - 100; + var comments_block = $('#reviews'); + var comments_block_top = $(comments_block).position().top - 100; + var collection = $('#collection'); + var collection_top = $(collection).position().top - 100; + var currentScroll = $(window).scrollTop(); + var detail_main_tabs = $('.detail_main_tabs'); + var active; + if(currentScroll > tab_content_top && currentScroll < collection_top) { + active = 'characteristics'; + } else if(currentScroll > comments_block_top) { + active = 'reviews'; + } else if(currentScroll > collection_top && currentScroll < comments_block_top) { + active = 'collection'; + } + $(detail_main_tabs).find('li.selected').removeClass('selected'); + $(detail_main_tabs).find('[data-target='+active+']').addClass('selected'); +} +$(window).scroll(function(e) { + // checkFixed(e); + // checkSelector(e); +}); +/* End catalog product scroll watcher */ +/* Animated links */ +$(document).on('click', '.detail_main_tabs a', function(e) { + e.preventDefault(); + var hash = $(this).attr('href').replace(/^.*?(#|$)/,''); + var target = $('#'+hash); + var target_top = $(target).position().top - 50; + var body = $('html, body'); + body.stop().animate({scrollTop:target_top}, 500, 'swing', function() {}); +}); +/* End animated links */ +/* Ajax form submit */ +$(document).on('submit', '#feedback-form', function(e) { + e.preventDefault(); + $.post('/ajax/feedback', $(this).serialize(), function(data) { + $('#myCallback').find('.modal-body').html(data.result); + }); +}); +$(document).on('submit', '#quickbuy-form', function(e) { + e.preventDefault(); + var container = $(this).parents('.fast_order_form'); + $.post('/order/quick', $(this).serialize(), function(data) { + if(!data.error) { + $(container).html(data.result); + } else { + $(container).html(data.error); + } + }) +}); +/* End ajax form submit */ \ No newline at end of file -- libgit2 0.21.4