14
14
use Magento \Store \Model \Store ;
15
15
16
16
/**
17
+ * Class to set flags for tax display setting
18
+ *
17
19
* @SuppressWarnings(PHPMD.ExcessivePublicCount)
18
20
*/
19
21
class Config
20
22
{
21
- // tax notifications
23
+ /**
24
+ * Tax notifications
25
+ */
22
26
const XML_PATH_TAX_NOTIFICATION_IGNORE_DISCOUNT = 'tax/notification/ignore_discount ' ;
23
27
24
28
const XML_PATH_TAX_NOTIFICATION_IGNORE_PRICE_DISPLAY = 'tax/notification/ignore_price_display ' ;
@@ -70,7 +74,11 @@ class Config
70
74
71
75
const XML_PATH_DISPLAY_CART_SHIPPING = 'tax/cart_display/shipping ' ;
72
76
73
- /** @deprecated */
77
+ /**
78
+ * Tax cart display discount
79
+ *
80
+ * @deprecated
81
+ */
74
82
const XML_PATH_DISPLAY_CART_DISCOUNT = 'tax/cart_display/discount ' ;
75
83
76
84
const XML_PATH_DISPLAY_CART_GRANDTOTAL = 'tax/cart_display/grandtotal ' ;
@@ -88,7 +96,11 @@ class Config
88
96
89
97
const XML_PATH_DISPLAY_SALES_SHIPPING = 'tax/sales_display/shipping ' ;
90
98
91
- /** @deprecated */
99
+ /**
100
+ * Tax sales display discount
101
+ *
102
+ * @deprecated
103
+ */
92
104
const XML_PATH_DISPLAY_SALES_DISCOUNT = 'tax/sales_display/discount ' ;
93
105
94
106
const XML_PATH_DISPLAY_SALES_GRANDTOTAL = 'tax/sales_display/grandtotal ' ;
@@ -231,6 +243,7 @@ public function discountTax($store = null)
231
243
232
244
/**
233
245
* Get taxes/discounts calculation sequence.
246
+ *
234
247
* This sequence depends on "Apply Customer Tax" and "Apply Discount On Prices" configuration options.
235
248
*
236
249
* @param null|int|string|Store $store
@@ -353,6 +366,8 @@ public function setShippingPriceIncludeTax($flag)
353
366
}
354
367
355
368
/**
369
+ * Return the flag for display sales for cart prices including tax
370
+ *
356
371
* @param null|string|bool|int|Store $store
357
372
* @return bool
358
373
*/
@@ -366,6 +381,8 @@ public function displayCartPricesInclTax($store = null)
366
381
}
367
382
368
383
/**
384
+ * Return the flag for display sales for cart prices excluding tax
385
+ *
369
386
* @param null|string|bool|int|Store $store
370
387
* @return bool
371
388
*/
@@ -379,6 +396,8 @@ public function displayCartPricesExclTax($store = null)
379
396
}
380
397
381
398
/**
399
+ * Return the flag for display sales for cart prices both including and excluding tax
400
+ *
382
401
* @param null|string|bool|int|Store $store
383
402
* @return bool
384
403
*/
@@ -392,6 +411,8 @@ public function displayCartPricesBoth($store = null)
392
411
}
393
412
394
413
/**
414
+ * Return the flag for display sales for cart subtotal including tax
415
+ *
395
416
* @param null|string|bool|int|Store $store
396
417
* @return bool
397
418
*/
@@ -405,6 +426,8 @@ public function displayCartSubtotalInclTax($store = null)
405
426
}
406
427
407
428
/**
429
+ * Return the flag for display sales for cart subtotal excluding tax
430
+ *
408
431
* @param null|string|bool|int|Store $store
409
432
* @return bool
410
433
*/
@@ -418,6 +441,8 @@ public function displayCartSubtotalExclTax($store = null)
418
441
}
419
442
420
443
/**
444
+ * Return the flag for display sales for cart subtotal both including and excluding tax
445
+ *
421
446
* @param null|string|bool|int|Store $store
422
447
* @return bool
423
448
*/
@@ -431,6 +456,8 @@ public function displayCartSubtotalBoth($store = null)
431
456
}
432
457
433
458
/**
459
+ * Return the flag for display sales for cart shipping including tax
460
+ *
434
461
* @param null|string|bool|int|Store $store
435
462
* @return bool
436
463
*/
@@ -444,6 +471,8 @@ public function displayCartShippingInclTax($store = null)
444
471
}
445
472
446
473
/**
474
+ * Return the flag for display sales for cart shipping excluding tax
475
+ *
447
476
* @param null|string|bool|int|Store $store
448
477
* @return bool
449
478
*/
@@ -457,6 +486,8 @@ public function displayCartShippingExclTax($store = null)
457
486
}
458
487
459
488
/**
489
+ * Return the flag for display sales for shipping both including and excluding tax
490
+ *
460
491
* @param null|string|bool|int|Store $store
461
492
* @return bool
462
493
*/
@@ -470,6 +501,8 @@ public function displayCartShippingBoth($store = null)
470
501
}
471
502
472
503
/**
504
+ * Return the flag for display cart discount for including tax
505
+ *
473
506
* @param null|string|bool|int|Store $store
474
507
* @return bool
475
508
* @deprecated 100.1.3
@@ -484,6 +517,8 @@ public function displayCartDiscountInclTax($store = null)
484
517
}
485
518
486
519
/**
520
+ * Return the flag for display cart discount for excluding tax
521
+ *
487
522
* @param null|string|bool|int|Store $store
488
523
* @return bool
489
524
* @deprecated 100.1.3
@@ -498,6 +533,8 @@ public function displayCartDiscountExclTax($store = null)
498
533
}
499
534
500
535
/**
536
+ * Return the flag for display cart discount for both including and excluding tax
537
+ *
501
538
* @param null|string|bool|int|Store $store
502
539
* @return bool
503
540
* @deprecated 100.1.3
@@ -512,6 +549,8 @@ public function displayCartDiscountBoth($store = null)
512
549
}
513
550
514
551
/**
552
+ * Return the flag for display cart tax with grand total for both including and excluding tax
553
+ *
515
554
* @param null|string|bool|int|Store $store
516
555
* @return bool
517
556
*/
@@ -525,6 +564,8 @@ public function displayCartTaxWithGrandTotal($store = null)
525
564
}
526
565
527
566
/**
567
+ * Return the flag for display cart full summary
568
+ *
528
569
* @param null|string|bool|int|Store $store
529
570
* @return bool
530
571
*/
@@ -538,6 +579,8 @@ public function displayCartFullSummary($store = null)
538
579
}
539
580
540
581
/**
582
+ * Return the flag for display cart zero tax
583
+ *
541
584
* @param null|string|bool|int|Store $store
542
585
* @return bool
543
586
*/
@@ -551,6 +594,8 @@ public function displayCartZeroTax($store = null)
551
594
}
552
595
553
596
/**
597
+ * Return the flag for display sales prices for including tax
598
+ *
554
599
* @param null|string|bool|int|Store $store
555
600
* @return bool
556
601
*/
@@ -564,6 +609,8 @@ public function displaySalesPricesInclTax($store = null)
564
609
}
565
610
566
611
/**
612
+ * Return the flag for display sales prices for excluding tax
613
+ *
567
614
* @param null|string|bool|int|Store $store
568
615
* @return bool
569
616
*/
@@ -577,6 +624,8 @@ public function displaySalesPricesExclTax($store = null)
577
624
}
578
625
579
626
/**
627
+ * Return the flag for display sales prices for both including and excluding tax
628
+ *
580
629
* @param null|string|bool|int|Store $store
581
630
* @return bool
582
631
*/
@@ -590,6 +639,8 @@ public function displaySalesPricesBoth($store = null)
590
639
}
591
640
592
641
/**
642
+ * Return the flag for display sales subtotal for including tax
643
+ *
593
644
* @param null|string|bool|int|Store $store
594
645
* @return bool
595
646
*/
@@ -603,6 +654,8 @@ public function displaySalesSubtotalInclTax($store = null)
603
654
}
604
655
605
656
/**
657
+ * Return the flag for display sales subtotal for excluding tax
658
+ *
606
659
* @param null|string|bool|int|Store $store
607
660
* @return bool
608
661
*/
@@ -616,6 +669,8 @@ public function displaySalesSubtotalExclTax($store = null)
616
669
}
617
670
618
671
/**
672
+ * Return the flag for display sales subtotal for both including and excluding tax
673
+ *
619
674
* @param null|string|bool|int|Store $store
620
675
* @return bool
621
676
*/
@@ -629,6 +684,8 @@ public function displaySalesSubtotalBoth($store = null)
629
684
}
630
685
631
686
/**
687
+ * Return the flag for display sales for shipping including tax
688
+ *
632
689
* @param null|string|bool|int|Store $store
633
690
* @return bool
634
691
*/
@@ -642,6 +699,8 @@ public function displaySalesShippingInclTax($store = null)
642
699
}
643
700
644
701
/**
702
+ * Return the flag for display sales for shipping excluding tax
703
+ *
645
704
* @param null|string|bool|int|Store $store
646
705
* @return bool
647
706
*/
@@ -655,6 +714,8 @@ public function displaySalesShippingExclTax($store = null)
655
714
}
656
715
657
716
/**
717
+ * Return the flag for display sales for shipping both including and excluding tax
718
+ *
658
719
* @param null|string|bool|int|Store $store
659
720
* @return bool
660
721
*/
@@ -668,6 +729,8 @@ public function displaySalesShippingBoth($store = null)
668
729
}
669
730
670
731
/**
732
+ * Return the flag for display sales discount for including tax
733
+ *
671
734
* @param null|string|bool|int|Store $store
672
735
* @return bool
673
736
* @deprecated 100.1.3
@@ -682,6 +745,8 @@ public function displaySalesDiscountInclTax($store = null)
682
745
}
683
746
684
747
/**
748
+ * Return the flag for display sales discount for excluding tax
749
+ *
685
750
* @param null|string|bool|int|Store $store
686
751
* @return bool
687
752
* @deprecated 100.1.3
@@ -696,6 +761,8 @@ public function displaySalesDiscountExclTax($store = null)
696
761
}
697
762
698
763
/**
764
+ * Return the flag for display sales discount for both including and excluding tax
765
+ *
699
766
* @param null|string|bool|int|Store $store
700
767
* @return bool
701
768
* @deprecated 100.1.3
@@ -710,6 +777,8 @@ public function displaySalesDiscountBoth($store = null)
710
777
}
711
778
712
779
/**
780
+ * Return the flag for display sales tax with grand total
781
+ *
713
782
* @param null|string|bool|int|Store $store
714
783
* @return bool
715
784
*/
@@ -723,6 +792,8 @@ public function displaySalesTaxWithGrandTotal($store = null)
723
792
}
724
793
725
794
/**
795
+ * Return the flag for display sales full summary
796
+ *
726
797
* @param null|string|bool|int|Store $store
727
798
* @return bool
728
799
*/
@@ -736,6 +807,8 @@ public function displaySalesFullSummary($store = null)
736
807
}
737
808
738
809
/**
810
+ * Return the flag for display sales zero tax
811
+ *
739
812
* @param null|string|bool|int|Store $store
740
813
* @return bool
741
814
*/
@@ -829,23 +902,24 @@ public function getInfoUrl($store = null)
829
902
830
903
/**
831
904
* Check if necessary do product price conversion
905
+ *
832
906
* If it necessary will be returned conversion type (minus or plus)
833
907
*
834
908
* @param null|int|string|Store $store
835
- * @return bool|int
909
+ * @return bool
836
910
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
837
911
*/
838
912
public function needPriceConversion ($ store = null )
839
913
{
840
- $ res = 0 ;
914
+ $ res = false ;
841
915
$ priceIncludesTax = $ this ->priceIncludesTax ($ store ) || $ this ->getNeedUseShippingExcludeTax ();
842
916
if ($ priceIncludesTax ) {
843
917
switch ($ this ->getPriceDisplayType ($ store )) {
844
918
case self ::DISPLAY_TYPE_EXCLUDING_TAX :
845
919
case self ::DISPLAY_TYPE_BOTH :
846
920
return self ::PRICE_CONVERSION_MINUS ;
847
921
case self ::DISPLAY_TYPE_INCLUDING_TAX :
848
- $ res = false ;
922
+ $ res = $ this -> displayCartPricesInclTax ( $ store ) ;
849
923
break ;
850
924
default :
851
925
break ;
0 commit comments