magento 2 Error: cannot call methods on priceBox prior to initialization; attempted to call method 'option'












1
















I am having an issue on my website



the issue



Error: cannot call methods on priceBox prior to initialization;
attempted to call method 'option'


My website
https://www.cartaroo.com.cy/?SID=5fe6b01812786b8145c48eaa0fde65ad



When I click on homepage product icon a view popup and due to js issue
it won't allow me to select drop down. screenshot
http://prntscr.com/h33mg9



Please help











share|improve this question

























  • I am also facing same issue for configurable product with Preorder. we have used VES Theme. if you find any help then please share with us

    – Pramod Kharade
    Feb 14 '18 at 9:27











  • Please check below link if it helps : community.magento.com/t5/Technical-Issues/…

    – Himmat Paliwal
    Mar 26 '18 at 9:52
















1
















I am having an issue on my website



the issue



Error: cannot call methods on priceBox prior to initialization;
attempted to call method 'option'


My website
https://www.cartaroo.com.cy/?SID=5fe6b01812786b8145c48eaa0fde65ad



When I click on homepage product icon a view popup and due to js issue
it won't allow me to select drop down. screenshot
http://prntscr.com/h33mg9



Please help











share|improve this question

























  • I am also facing same issue for configurable product with Preorder. we have used VES Theme. if you find any help then please share with us

    – Pramod Kharade
    Feb 14 '18 at 9:27











  • Please check below link if it helps : community.magento.com/t5/Technical-Issues/…

    – Himmat Paliwal
    Mar 26 '18 at 9:52














1












1








1









I am having an issue on my website



the issue



Error: cannot call methods on priceBox prior to initialization;
attempted to call method 'option'


My website
https://www.cartaroo.com.cy/?SID=5fe6b01812786b8145c48eaa0fde65ad



When I click on homepage product icon a view popup and due to js issue
it won't allow me to select drop down. screenshot
http://prntscr.com/h33mg9



Please help











share|improve this question

















I am having an issue on my website



the issue



Error: cannot call methods on priceBox prior to initialization;
attempted to call method 'option'


My website
https://www.cartaroo.com.cy/?SID=5fe6b01812786b8145c48eaa0fde65ad



When I click on homepage product icon a view popup and due to js issue
it won't allow me to select drop down. screenshot
http://prntscr.com/h33mg9



Please help








magento2 php javascript jquery debug






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Oct 28 '17 at 17:38









Umesh Kumar

2,3491328




2,3491328










asked Oct 28 '17 at 12:40









Danial ButtDanial Butt

548




548













  • I am also facing same issue for configurable product with Preorder. we have used VES Theme. if you find any help then please share with us

    – Pramod Kharade
    Feb 14 '18 at 9:27











  • Please check below link if it helps : community.magento.com/t5/Technical-Issues/…

    – Himmat Paliwal
    Mar 26 '18 at 9:52



















  • I am also facing same issue for configurable product with Preorder. we have used VES Theme. if you find any help then please share with us

    – Pramod Kharade
    Feb 14 '18 at 9:27











  • Please check below link if it helps : community.magento.com/t5/Technical-Issues/…

    – Himmat Paliwal
    Mar 26 '18 at 9:52

















I am also facing same issue for configurable product with Preorder. we have used VES Theme. if you find any help then please share with us

– Pramod Kharade
Feb 14 '18 at 9:27





I am also facing same issue for configurable product with Preorder. we have used VES Theme. if you find any help then please share with us

– Pramod Kharade
Feb 14 '18 at 9:27













Please check below link if it helps : community.magento.com/t5/Technical-Issues/…

– Himmat Paliwal
Mar 26 '18 at 9:52





Please check below link if it helps : community.magento.com/t5/Technical-Issues/…

– Himmat Paliwal
Mar 26 '18 at 9:52










2 Answers
2






active

oldest

votes


















0














I have also faced this problem after migrating from Magento 2.1.6 to 2.2.5.



Issue was due to the theme file phtml with scripts



Old File : app/design/frontend/Mytheme/theme/Magento_Catalog/templates/product/view/form.phtml



<script>
require([
'jquery',
'Magento_Catalog/js/price-box'
], function($){
var priceBoxes = $('.product-info-price [data-role=priceBox]');

priceBoxes = priceBoxes.filter(function(index, elem){
return !$(elem).find('.price-from').length;
});

priceBoxes.priceBox({'priceConfig': <?php /* @escapeNotVerified */ echo $block->getJsonConfig() ?>});
});
</script>


Copy script from new vendor file in your theme:



New Code: vendor/magento/module-catalog/view/frontend/templates/product/view/form.phtml



<script>
require([
'jquery',
'priceBox'
], function($){
var dataPriceBoxSelector = '[data-role=priceBox]',
dataProductIdSelector = '[data-product-id=<?= $block->escapeHtml($_product->getId()) ?>]',
priceBoxes = $(dataPriceBoxSelector + dataProductIdSelector);

priceBoxes = priceBoxes.filter(function(index, elem){
return !$(elem).find('.price-from').length;
});

priceBoxes.priceBox({'priceConfig': <?= /* @escapeNotVerified */ $block->getJsonConfig() ?>});
});
</script>





share|improve this answer

































    0














    I had the same problem with error



     cannot call methods on priceBox prior to initialization; attempted to call method 'option'


    I was try to create price-box-mixin.js to extend mage.priceBox widget.



    So it's the shame but that was my mistake. In the top of mixin I forgot to remove line
    'Magento_Catalog/js/price-box'.
    At the beginning I was try to extend the widget mage.priceBox and I needed this line in section



    define([
    'jquery',
    'Magento_Catalog/js/price-utils',
    'underscore',
    'mage/template',
    'jquery/ui',
    'Magento_Catalog/js/price-box'
    ], function ($, utils, _, mageTemplate) {


    But after updating the script when I transform this script to mixin I needed to remove this line. So it became:



    define([
    'jquery',
    'Magento_Catalog/js/price-utils',
    'underscore',
    'mage/template',
    'jquery/ui'
    ], function ($, utils, _, mageTemplate) {


    I hope this helps someone to save time.






    share|improve this answer























      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "479"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f199067%2fmagento-2-error-cannot-call-methods-on-pricebox-prior-to-initialization-attemp%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      0














      I have also faced this problem after migrating from Magento 2.1.6 to 2.2.5.



      Issue was due to the theme file phtml with scripts



      Old File : app/design/frontend/Mytheme/theme/Magento_Catalog/templates/product/view/form.phtml



      <script>
      require([
      'jquery',
      'Magento_Catalog/js/price-box'
      ], function($){
      var priceBoxes = $('.product-info-price [data-role=priceBox]');

      priceBoxes = priceBoxes.filter(function(index, elem){
      return !$(elem).find('.price-from').length;
      });

      priceBoxes.priceBox({'priceConfig': <?php /* @escapeNotVerified */ echo $block->getJsonConfig() ?>});
      });
      </script>


      Copy script from new vendor file in your theme:



      New Code: vendor/magento/module-catalog/view/frontend/templates/product/view/form.phtml



      <script>
      require([
      'jquery',
      'priceBox'
      ], function($){
      var dataPriceBoxSelector = '[data-role=priceBox]',
      dataProductIdSelector = '[data-product-id=<?= $block->escapeHtml($_product->getId()) ?>]',
      priceBoxes = $(dataPriceBoxSelector + dataProductIdSelector);

      priceBoxes = priceBoxes.filter(function(index, elem){
      return !$(elem).find('.price-from').length;
      });

      priceBoxes.priceBox({'priceConfig': <?= /* @escapeNotVerified */ $block->getJsonConfig() ?>});
      });
      </script>





      share|improve this answer






























        0














        I have also faced this problem after migrating from Magento 2.1.6 to 2.2.5.



        Issue was due to the theme file phtml with scripts



        Old File : app/design/frontend/Mytheme/theme/Magento_Catalog/templates/product/view/form.phtml



        <script>
        require([
        'jquery',
        'Magento_Catalog/js/price-box'
        ], function($){
        var priceBoxes = $('.product-info-price [data-role=priceBox]');

        priceBoxes = priceBoxes.filter(function(index, elem){
        return !$(elem).find('.price-from').length;
        });

        priceBoxes.priceBox({'priceConfig': <?php /* @escapeNotVerified */ echo $block->getJsonConfig() ?>});
        });
        </script>


        Copy script from new vendor file in your theme:



        New Code: vendor/magento/module-catalog/view/frontend/templates/product/view/form.phtml



        <script>
        require([
        'jquery',
        'priceBox'
        ], function($){
        var dataPriceBoxSelector = '[data-role=priceBox]',
        dataProductIdSelector = '[data-product-id=<?= $block->escapeHtml($_product->getId()) ?>]',
        priceBoxes = $(dataPriceBoxSelector + dataProductIdSelector);

        priceBoxes = priceBoxes.filter(function(index, elem){
        return !$(elem).find('.price-from').length;
        });

        priceBoxes.priceBox({'priceConfig': <?= /* @escapeNotVerified */ $block->getJsonConfig() ?>});
        });
        </script>





        share|improve this answer




























          0












          0








          0







          I have also faced this problem after migrating from Magento 2.1.6 to 2.2.5.



          Issue was due to the theme file phtml with scripts



          Old File : app/design/frontend/Mytheme/theme/Magento_Catalog/templates/product/view/form.phtml



          <script>
          require([
          'jquery',
          'Magento_Catalog/js/price-box'
          ], function($){
          var priceBoxes = $('.product-info-price [data-role=priceBox]');

          priceBoxes = priceBoxes.filter(function(index, elem){
          return !$(elem).find('.price-from').length;
          });

          priceBoxes.priceBox({'priceConfig': <?php /* @escapeNotVerified */ echo $block->getJsonConfig() ?>});
          });
          </script>


          Copy script from new vendor file in your theme:



          New Code: vendor/magento/module-catalog/view/frontend/templates/product/view/form.phtml



          <script>
          require([
          'jquery',
          'priceBox'
          ], function($){
          var dataPriceBoxSelector = '[data-role=priceBox]',
          dataProductIdSelector = '[data-product-id=<?= $block->escapeHtml($_product->getId()) ?>]',
          priceBoxes = $(dataPriceBoxSelector + dataProductIdSelector);

          priceBoxes = priceBoxes.filter(function(index, elem){
          return !$(elem).find('.price-from').length;
          });

          priceBoxes.priceBox({'priceConfig': <?= /* @escapeNotVerified */ $block->getJsonConfig() ?>});
          });
          </script>





          share|improve this answer















          I have also faced this problem after migrating from Magento 2.1.6 to 2.2.5.



          Issue was due to the theme file phtml with scripts



          Old File : app/design/frontend/Mytheme/theme/Magento_Catalog/templates/product/view/form.phtml



          <script>
          require([
          'jquery',
          'Magento_Catalog/js/price-box'
          ], function($){
          var priceBoxes = $('.product-info-price [data-role=priceBox]');

          priceBoxes = priceBoxes.filter(function(index, elem){
          return !$(elem).find('.price-from').length;
          });

          priceBoxes.priceBox({'priceConfig': <?php /* @escapeNotVerified */ echo $block->getJsonConfig() ?>});
          });
          </script>


          Copy script from new vendor file in your theme:



          New Code: vendor/magento/module-catalog/view/frontend/templates/product/view/form.phtml



          <script>
          require([
          'jquery',
          'priceBox'
          ], function($){
          var dataPriceBoxSelector = '[data-role=priceBox]',
          dataProductIdSelector = '[data-product-id=<?= $block->escapeHtml($_product->getId()) ?>]',
          priceBoxes = $(dataPriceBoxSelector + dataProductIdSelector);

          priceBoxes = priceBoxes.filter(function(index, elem){
          return !$(elem).find('.price-from').length;
          });

          priceBoxes.priceBox({'priceConfig': <?= /* @escapeNotVerified */ $block->getJsonConfig() ?>});
          });
          </script>






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Aug 11 '18 at 6:42









          Teja Bhagavan Kollepara

          2,94841847




          2,94841847










          answered Jul 25 '18 at 11:06









          Ahmad Vaqas KhanAhmad Vaqas Khan

          620616




          620616

























              0














              I had the same problem with error



               cannot call methods on priceBox prior to initialization; attempted to call method 'option'


              I was try to create price-box-mixin.js to extend mage.priceBox widget.



              So it's the shame but that was my mistake. In the top of mixin I forgot to remove line
              'Magento_Catalog/js/price-box'.
              At the beginning I was try to extend the widget mage.priceBox and I needed this line in section



              define([
              'jquery',
              'Magento_Catalog/js/price-utils',
              'underscore',
              'mage/template',
              'jquery/ui',
              'Magento_Catalog/js/price-box'
              ], function ($, utils, _, mageTemplate) {


              But after updating the script when I transform this script to mixin I needed to remove this line. So it became:



              define([
              'jquery',
              'Magento_Catalog/js/price-utils',
              'underscore',
              'mage/template',
              'jquery/ui'
              ], function ($, utils, _, mageTemplate) {


              I hope this helps someone to save time.






              share|improve this answer




























                0














                I had the same problem with error



                 cannot call methods on priceBox prior to initialization; attempted to call method 'option'


                I was try to create price-box-mixin.js to extend mage.priceBox widget.



                So it's the shame but that was my mistake. In the top of mixin I forgot to remove line
                'Magento_Catalog/js/price-box'.
                At the beginning I was try to extend the widget mage.priceBox and I needed this line in section



                define([
                'jquery',
                'Magento_Catalog/js/price-utils',
                'underscore',
                'mage/template',
                'jquery/ui',
                'Magento_Catalog/js/price-box'
                ], function ($, utils, _, mageTemplate) {


                But after updating the script when I transform this script to mixin I needed to remove this line. So it became:



                define([
                'jquery',
                'Magento_Catalog/js/price-utils',
                'underscore',
                'mage/template',
                'jquery/ui'
                ], function ($, utils, _, mageTemplate) {


                I hope this helps someone to save time.






                share|improve this answer


























                  0












                  0








                  0







                  I had the same problem with error



                   cannot call methods on priceBox prior to initialization; attempted to call method 'option'


                  I was try to create price-box-mixin.js to extend mage.priceBox widget.



                  So it's the shame but that was my mistake. In the top of mixin I forgot to remove line
                  'Magento_Catalog/js/price-box'.
                  At the beginning I was try to extend the widget mage.priceBox and I needed this line in section



                  define([
                  'jquery',
                  'Magento_Catalog/js/price-utils',
                  'underscore',
                  'mage/template',
                  'jquery/ui',
                  'Magento_Catalog/js/price-box'
                  ], function ($, utils, _, mageTemplate) {


                  But after updating the script when I transform this script to mixin I needed to remove this line. So it became:



                  define([
                  'jquery',
                  'Magento_Catalog/js/price-utils',
                  'underscore',
                  'mage/template',
                  'jquery/ui'
                  ], function ($, utils, _, mageTemplate) {


                  I hope this helps someone to save time.






                  share|improve this answer













                  I had the same problem with error



                   cannot call methods on priceBox prior to initialization; attempted to call method 'option'


                  I was try to create price-box-mixin.js to extend mage.priceBox widget.



                  So it's the shame but that was my mistake. In the top of mixin I forgot to remove line
                  'Magento_Catalog/js/price-box'.
                  At the beginning I was try to extend the widget mage.priceBox and I needed this line in section



                  define([
                  'jquery',
                  'Magento_Catalog/js/price-utils',
                  'underscore',
                  'mage/template',
                  'jquery/ui',
                  'Magento_Catalog/js/price-box'
                  ], function ($, utils, _, mageTemplate) {


                  But after updating the script when I transform this script to mixin I needed to remove this line. So it became:



                  define([
                  'jquery',
                  'Magento_Catalog/js/price-utils',
                  'underscore',
                  'mage/template',
                  'jquery/ui'
                  ], function ($, utils, _, mageTemplate) {


                  I hope this helps someone to save time.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 29 mins ago









                  GalinaGalina

                  592




                  592






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Magento Stack Exchange!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f199067%2fmagento-2-error-cannot-call-methods-on-pricebox-prior-to-initialization-attemp%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Magento 2 controller redirect on button click in phtml file

                      Polycentropodidae