File tree 2 files changed +78
-0
lines changed
2 files changed +78
-0
lines changed Original file line number Diff line number Diff line change @@ -483,6 +483,20 @@ public function actions()
483
483
"services " => [
484
484
'class ' => ViewBackendAction::class,
485
485
'priority ' => 90 ,
486
+ 'name ' => 'Создание товаров ' ,
487
+ 'icon ' => 'fas fa-info-circle ' ,
488
+ 'accessCallback ' => function () {
489
+ if (\Yii::$ app ->user ->can (CmsManager::PERMISSION_ROLE_ADMIN_ACCESS )) {
490
+ return true ;
491
+ }
492
+
493
+ return false ;
494
+ },
495
+ ],
496
+
497
+ "other " => [
498
+ 'class ' => ViewBackendAction::class,
499
+ 'priority ' => 100 ,
486
500
'name ' => 'Инструменты ' ,
487
501
'icon ' => 'fas fa-info-circle ' ,
488
502
'accessCallback ' => function () {
@@ -606,6 +620,32 @@ public function actions()
606
620
}
607
621
608
622
623
+ public function actionQuantityZero ()
624
+ {
625
+ Skeeks::unlimited ();
626
+
627
+ $ rr = new RequestResponse ();
628
+ if ($ rr ->isRequestAjaxPost ()) {
629
+ $ rr ->success = true ;
630
+
631
+ if (!\Yii::$ app ->shop ->backendShopStore ) {
632
+ $ rr ->message = "Ошибка " ;
633
+ $ rr ->success = false ;
634
+ return $ rr ;
635
+ }
636
+
637
+ $ result = ShopStoreProduct::updateAll ([
638
+ 'quantity ' => 0
639
+ ], [
640
+ 'shop_store_id ' => \Yii::$ app ->shop ->backendShopStore ->id
641
+ ]);
642
+
643
+ $ rr ->message = "Обнулено: {$ result } товаров. " ;
644
+ }
645
+
646
+ return $ rr ;
647
+ }
648
+
609
649
public function actionAutoCreate ()
610
650
{
611
651
Skeeks::unlimited ();
Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * @link https://cms.skeeks.com/
4
+ * @copyright Copyright (c) 2010 SkeekS
5
+ * @license https://cms.skeeks.com/license/
6
+ * @author Semenov Alexander <semenov@skeeks.com>
7
+ */
8
+ /**
9
+ * @var $this yii\web\View
10
+ * @var $context \skeeks\cms\backend\BackendAction
11
+ */
12
+ $ context = $ this ->context ;
13
+
14
+ $ backendUrl = \yii \helpers \Url::to (['quantity-zero ' ]);
15
+
16
+ $ this ->registerJs (<<<JS
17
+
18
+ $(".btn-quantity-zero").on("click", function() {
19
+ var ajaxQuery = sx.ajax.preparePostQuery(" {$ backendUrl }");
20
+
21
+ new sx.classes.AjaxHandlerStandartRespose(ajaxQuery, {
22
+ 'blockerSelector' : 'body',
23
+ 'enableBlocker' : true,
24
+ }).on("success", function(e, response) {
25
+
26
+ });
27
+
28
+ ajaxQuery.execute();
29
+ });
30
+
31
+ JS
32
+ );
33
+
34
+ ?>
35
+ <div class="sx-bg-secondary" style="padding: 10px; max-width: 500px;">
36
+ <button class="btn btn-primary btn-quantity-zero">Обнулить количество</button>
37
+ </div>
38
+
You can’t perform that action at this time.
0 commit comments