@@ -22,6 +22,11 @@ define([
22
22
options : {
23
23
superSelector : '.super-attribute-select' ,
24
24
selectSimpleProduct : '[name="selected_configurable_option"]' ,
25
+
26
+ /**
27
+ * @deprecated Not used anymore
28
+ * @see selectorProductPrice
29
+ */
25
30
priceHolderSelector : '.price-box' ,
26
31
spConfig : { } ,
27
32
state : { } ,
@@ -86,7 +91,7 @@ define([
86
91
_initializeOptions : function ( ) {
87
92
var options = this . options ,
88
93
gallery = $ ( options . mediaGallerySelector ) ,
89
- priceBoxOptions = $ ( this . options . priceHolderSelector ) . priceBox ( 'option' ) . priceConfig || null ;
94
+ priceBoxOptions = this . _getPriceBoxElement ( ) . priceBox ( 'option' ) . priceConfig || null ;
90
95
91
96
if ( priceBoxOptions && priceBoxOptions . optionTemplate ) {
92
97
options . optionTemplate = priceBoxOptions . optionTemplate ;
@@ -100,7 +105,7 @@ define([
100
105
101
106
options . settings = options . spConfig . containerId ?
102
107
$ ( options . spConfig . containerId ) . find ( options . superSelector ) :
103
- $ ( options . superSelector ) ;
108
+ this . element . parents ( this . options . selectorProduct ) . find ( options . superSelector ) ;
104
109
105
110
options . values = options . spConfig . defaultValues || { } ;
106
111
options . parentImage = $ ( '[data-role=base-image-container] img' ) . attr ( 'src' ) ;
@@ -580,7 +585,7 @@ define([
580
585
* configurable product's option selections.
581
586
*/
582
587
_reloadPrice : function ( ) {
583
- $ ( this . options . priceHolderSelector ) . trigger ( 'updatePrice' , this . _getPrices ( ) ) ;
588
+ this . _getPriceBoxElement ( ) . trigger ( 'updatePrice' , this . _getPrices ( ) ) ;
584
589
} ,
585
590
586
591
/**
@@ -654,7 +659,7 @@ define([
654
659
* @private
655
660
*/
656
661
_calculatePrice : function ( config ) {
657
- var displayPrices = $ ( this . options . priceHolderSelector ) . priceBox ( 'option' ) . prices ,
662
+ var displayPrices = this . _getPriceBoxElement ( ) . priceBox ( 'option' ) . prices ,
658
663
newPrices = this . options . spConfig . optionPrices [ _ . first ( config . allowedProducts ) ] || { } ;
659
664
660
665
_ . each ( displayPrices , function ( price , code ) {
@@ -702,8 +707,7 @@ define([
702
707
*/
703
708
_displayRegularPriceBlock : function ( optionId ) {
704
709
var shouldBeShown = true ,
705
- $priceBox = this . element . parents ( this . options . selectorProduct )
706
- . find ( this . options . selectorProductPrice ) ;
710
+ $priceBox = this . _getPriceBoxElement ( ) ;
707
711
708
712
_ . each ( this . options . settings , function ( element ) {
709
713
if ( element . value === '' ) {
@@ -785,6 +789,18 @@ define([
785
789
} else {
786
790
$ ( this . options . tierPriceBlockSelector ) . hide ( ) ;
787
791
}
792
+ } ,
793
+
794
+ /**
795
+ * Returns the price container element
796
+ *
797
+ * @returns {* }
798
+ * @private
799
+ */
800
+ _getPriceBoxElement : function ( ) {
801
+ return this . element
802
+ . parents ( this . options . selectorProduct )
803
+ . find ( this . options . selectorProductPrice ) ;
788
804
}
789
805
} ) ;
790
806
0 commit comments