@@ -22,6 +22,11 @@ define([
2222 options : {
2323 superSelector : '.super-attribute-select' ,
2424 selectSimpleProduct : '[name="selected_configurable_option"]' ,
25+
26+ /**
27+ * @deprecated Not used anymore
28+ * @see selectorProductPrice
29+ */
2530 priceHolderSelector : '.price-box' ,
2631 spConfig : { } ,
2732 state : { } ,
@@ -86,7 +91,7 @@ define([
8691 _initializeOptions : function ( ) {
8792 var options = this . options ,
8893 gallery = $ ( options . mediaGallerySelector ) ,
89- priceBoxOptions = $ ( this . options . priceHolderSelector ) . priceBox ( 'option' ) . priceConfig || null ;
94+ priceBoxOptions = this . _getPriceBoxElement ( ) . priceBox ( 'option' ) . priceConfig || null ;
9095
9196 if ( priceBoxOptions && priceBoxOptions . optionTemplate ) {
9297 options . optionTemplate = priceBoxOptions . optionTemplate ;
@@ -100,7 +105,7 @@ define([
100105
101106 options . settings = options . spConfig . containerId ?
102107 $ ( options . spConfig . containerId ) . find ( options . superSelector ) :
103- $ ( options . superSelector ) ;
108+ this . element . parents ( this . options . selectorProduct ) . find ( options . superSelector ) ;
104109
105110 options . values = options . spConfig . defaultValues || { } ;
106111 options . parentImage = $ ( '[data-role=base-image-container] img' ) . attr ( 'src' ) ;
@@ -580,7 +585,7 @@ define([
580585 * configurable product's option selections.
581586 */
582587 _reloadPrice : function ( ) {
583- $ ( this . options . priceHolderSelector ) . trigger ( 'updatePrice' , this . _getPrices ( ) ) ;
588+ this . _getPriceBoxElement ( ) . trigger ( 'updatePrice' , this . _getPrices ( ) ) ;
584589 } ,
585590
586591 /**
@@ -654,7 +659,7 @@ define([
654659 * @private
655660 */
656661 _calculatePrice : function ( config ) {
657- var displayPrices = $ ( this . options . priceHolderSelector ) . priceBox ( 'option' ) . prices ,
662+ var displayPrices = this . _getPriceBoxElement ( ) . priceBox ( 'option' ) . prices ,
658663 newPrices = this . options . spConfig . optionPrices [ _ . first ( config . allowedProducts ) ] || { } ;
659664
660665 _ . each ( displayPrices , function ( price , code ) {
@@ -702,8 +707,7 @@ define([
702707 */
703708 _displayRegularPriceBlock : function ( optionId ) {
704709 var shouldBeShown = true ,
705- $priceBox = this . element . parents ( this . options . selectorProduct )
706- . find ( this . options . selectorProductPrice ) ;
710+ $priceBox = this . _getPriceBoxElement ( ) ;
707711
708712 _ . each ( this . options . settings , function ( element ) {
709713 if ( element . value === '' ) {
@@ -785,6 +789,18 @@ define([
785789 } else {
786790 $ ( this . options . tierPriceBlockSelector ) . hide ( ) ;
787791 }
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 ) ;
788804 }
789805 } ) ;
790806
0 commit comments