Stock availability status on Configurable simple products












5














On a Configurable product, the following gets displayed if the Configurable product has stock /is saleable. However, when one of the items in the dropdown of Simple products is actually out of stock the following is not correct.



<?php if ($this->displayProductStockStatus()): ?>
<?php if($_product->isSaleable()): ?>
<p class="availability in-of-stock">Availability: <span><?php echo $this->__('In stock') ?></span></p>
<?php else : ?>

<?php endif; ?>
<?php endif; ?>


What i'm trying to do is get that In stock text to change to out of stock when the out of stock product is selected. I wondered if anyone else has tried fixing this magento bug before?










share|improve this question














bumped to the homepage by Community yesterday


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • Do you mean dynamically, e.g. using Javascript?
    – Robbie Averill
    Mar 10 '16 at 20:41
















5














On a Configurable product, the following gets displayed if the Configurable product has stock /is saleable. However, when one of the items in the dropdown of Simple products is actually out of stock the following is not correct.



<?php if ($this->displayProductStockStatus()): ?>
<?php if($_product->isSaleable()): ?>
<p class="availability in-of-stock">Availability: <span><?php echo $this->__('In stock') ?></span></p>
<?php else : ?>

<?php endif; ?>
<?php endif; ?>


What i'm trying to do is get that In stock text to change to out of stock when the out of stock product is selected. I wondered if anyone else has tried fixing this magento bug before?










share|improve this question














bumped to the homepage by Community yesterday


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • Do you mean dynamically, e.g. using Javascript?
    – Robbie Averill
    Mar 10 '16 at 20:41














5












5








5







On a Configurable product, the following gets displayed if the Configurable product has stock /is saleable. However, when one of the items in the dropdown of Simple products is actually out of stock the following is not correct.



<?php if ($this->displayProductStockStatus()): ?>
<?php if($_product->isSaleable()): ?>
<p class="availability in-of-stock">Availability: <span><?php echo $this->__('In stock') ?></span></p>
<?php else : ?>

<?php endif; ?>
<?php endif; ?>


What i'm trying to do is get that In stock text to change to out of stock when the out of stock product is selected. I wondered if anyone else has tried fixing this magento bug before?










share|improve this question













On a Configurable product, the following gets displayed if the Configurable product has stock /is saleable. However, when one of the items in the dropdown of Simple products is actually out of stock the following is not correct.



<?php if ($this->displayProductStockStatus()): ?>
<?php if($_product->isSaleable()): ?>
<p class="availability in-of-stock">Availability: <span><?php echo $this->__('In stock') ?></span></p>
<?php else : ?>

<?php endif; ?>
<?php endif; ?>


What i'm trying to do is get that In stock text to change to out of stock when the out of stock product is selected. I wondered if anyone else has tried fixing this magento bug before?







configurable-product out-of-stock stock-status






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 10 '16 at 20:15









doubleplusgood

83316




83316





bumped to the homepage by Community yesterday


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community yesterday


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.














  • Do you mean dynamically, e.g. using Javascript?
    – Robbie Averill
    Mar 10 '16 at 20:41


















  • Do you mean dynamically, e.g. using Javascript?
    – Robbie Averill
    Mar 10 '16 at 20:41
















Do you mean dynamically, e.g. using Javascript?
– Robbie Averill
Mar 10 '16 at 20:41




Do you mean dynamically, e.g. using Javascript?
– Robbie Averill
Mar 10 '16 at 20:41










1 Answer
1






active

oldest

votes


















0














As doubleplusgood suggested, this functionality is controlled by Javascript and not PHP. In a default 1.9.3 install running RWD as the theme, when you click on a configurable product's simple product option swatch that is in stock, you get this result:



enter image description here



When you select a swatch for a product that is out of stock, you get this:



enter image description here



So while the code you posted is for a check against the stock of the product, it does not control the status for the a configurable product that has some simples with and without stock. The logic that controls that functionality (disabling the add to cart button and changing the 'out of stock' text) is in this file:



rwd/default/js/configurableswatches/swatches-product.js



So given that information I would take two guesses to what might be causing your issue.




  1. You have some kind of javascript error, the file is not loading correctly or you are using a custom template that doesn't have the correct class name for the HTML element that the javascript is targeting.


  2. You have a setting in the admin that allows for products that are out of stock to still be sold (system-> config-> catalog-> inventory). Check these settings as they can override what the theme might be doing.







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%2f105695%2fstock-availability-status-on-configurable-simple-products%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    As doubleplusgood suggested, this functionality is controlled by Javascript and not PHP. In a default 1.9.3 install running RWD as the theme, when you click on a configurable product's simple product option swatch that is in stock, you get this result:



    enter image description here



    When you select a swatch for a product that is out of stock, you get this:



    enter image description here



    So while the code you posted is for a check against the stock of the product, it does not control the status for the a configurable product that has some simples with and without stock. The logic that controls that functionality (disabling the add to cart button and changing the 'out of stock' text) is in this file:



    rwd/default/js/configurableswatches/swatches-product.js



    So given that information I would take two guesses to what might be causing your issue.




    1. You have some kind of javascript error, the file is not loading correctly or you are using a custom template that doesn't have the correct class name for the HTML element that the javascript is targeting.


    2. You have a setting in the admin that allows for products that are out of stock to still be sold (system-> config-> catalog-> inventory). Check these settings as they can override what the theme might be doing.







    share|improve this answer


























      0














      As doubleplusgood suggested, this functionality is controlled by Javascript and not PHP. In a default 1.9.3 install running RWD as the theme, when you click on a configurable product's simple product option swatch that is in stock, you get this result:



      enter image description here



      When you select a swatch for a product that is out of stock, you get this:



      enter image description here



      So while the code you posted is for a check against the stock of the product, it does not control the status for the a configurable product that has some simples with and without stock. The logic that controls that functionality (disabling the add to cart button and changing the 'out of stock' text) is in this file:



      rwd/default/js/configurableswatches/swatches-product.js



      So given that information I would take two guesses to what might be causing your issue.




      1. You have some kind of javascript error, the file is not loading correctly or you are using a custom template that doesn't have the correct class name for the HTML element that the javascript is targeting.


      2. You have a setting in the admin that allows for products that are out of stock to still be sold (system-> config-> catalog-> inventory). Check these settings as they can override what the theme might be doing.







      share|improve this answer
























        0












        0








        0






        As doubleplusgood suggested, this functionality is controlled by Javascript and not PHP. In a default 1.9.3 install running RWD as the theme, when you click on a configurable product's simple product option swatch that is in stock, you get this result:



        enter image description here



        When you select a swatch for a product that is out of stock, you get this:



        enter image description here



        So while the code you posted is for a check against the stock of the product, it does not control the status for the a configurable product that has some simples with and without stock. The logic that controls that functionality (disabling the add to cart button and changing the 'out of stock' text) is in this file:



        rwd/default/js/configurableswatches/swatches-product.js



        So given that information I would take two guesses to what might be causing your issue.




        1. You have some kind of javascript error, the file is not loading correctly or you are using a custom template that doesn't have the correct class name for the HTML element that the javascript is targeting.


        2. You have a setting in the admin that allows for products that are out of stock to still be sold (system-> config-> catalog-> inventory). Check these settings as they can override what the theme might be doing.







        share|improve this answer












        As doubleplusgood suggested, this functionality is controlled by Javascript and not PHP. In a default 1.9.3 install running RWD as the theme, when you click on a configurable product's simple product option swatch that is in stock, you get this result:



        enter image description here



        When you select a swatch for a product that is out of stock, you get this:



        enter image description here



        So while the code you posted is for a check against the stock of the product, it does not control the status for the a configurable product that has some simples with and without stock. The logic that controls that functionality (disabling the add to cart button and changing the 'out of stock' text) is in this file:



        rwd/default/js/configurableswatches/swatches-product.js



        So given that information I would take two guesses to what might be causing your issue.




        1. You have some kind of javascript error, the file is not loading correctly or you are using a custom template that doesn't have the correct class name for the HTML element that the javascript is targeting.


        2. You have a setting in the admin that allows for products that are out of stock to still be sold (system-> config-> catalog-> inventory). Check these settings as they can override what the theme might be doing.








        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Feb 4 '17 at 3:48









        circlesix

        2,68921446




        2,68921446






























            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.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • 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%2f105695%2fstock-availability-status-on-configurable-simple-products%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

            An IMO inspired problem

            Management

            Investment