diff --git a/controllers/OrderController.php b/controllers/OrderController.php
index 49904e7..3e9d3ed 100755
--- a/controllers/OrderController.php
+++ b/controllers/OrderController.php
@@ -399,6 +399,9 @@
);
}
$model->save();
+ $sum = $count * $variant->price;
+
+ return $sum;
}
/**
diff --git a/views/order/_form.php b/views/order/_form.php
index 05932c0..85aa65d 100755
--- a/views/order/_form.php
+++ b/views/order/_form.php
@@ -283,13 +283,13 @@ JS;
-
+
- Всего: =$sum?>
+
= Html::submitButton(
$model->isNewRecord ? Yii::t('order', 'Create') : Yii::t('order', 'Update'),
diff --git a/web/js/order.js b/web/js/order.js
index 792df54..48be52e 100755
--- a/web/js/order.js
+++ b/web/js/order.js
@@ -20,11 +20,15 @@ $(function() {
id: id.val(),
count: count.val(),
order: order
- }, function() {
+ }, function(data) {
$.pjax.reload(selector, {
timeout: 5000,
fragment: selector
});
+
+ var sum = $(".sum_all").children('p').text();
+ $(".sum_all").children('p').html(parseInt(sum)+parseInt(data));
+
});
id.val(null)
.trigger('change');
--
libgit2 0.21.4