Magento Configurable Product Disable Dropdown if Out of Stocks Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?How to change the dropdown option on a product page?Show out of stock product “variants” for configurable productsCan Magento handle configurable swatches functionality?Configurable not resetting after selecting either size/colorConfigurable product still displayed but accosiated simple product is out of stockAttribute dropdown not showing on product page Magento1.9.2.1Configurable Product Show Out of Stock Simple Product in DropdownShow/Hide product configurable attributes depending on another attributeConvert Color and Size attribute dropdown values to Button linksShow out of stock product for configurable product Magento 2.1.13

Amount of permutations on an NxNxN Rubik's Cube

ArcGIS Pro Python arcpy.CreatePersonalGDB_management

Trademark violation for app?

Take 2! Is this homebrew Lady of Pain warlock patron balanced?

Time to Settle Down!

How could we fake a moon landing now?

Dating a Former Employee

Is CEO the "profession" with the most psychopaths?

Converted a Scalar function to a TVF function for parallel execution-Still running in Serial mode

Is there any word for a place full of confusion?

Should I use a zero-interest credit card for a large one-time purchase?

Sum letters are not two different

Do I really need to have a message in a novel to appeal to readers?

Is it a good idea to use CNN to classify 1D signal?

What's the meaning of "fortified infraction restraint"?

Why do early math courses focus on the cross sections of a cone and not on other 3D objects?

Hangman Game with C++

Why does it sometimes sound good to play a grace note as a lead in to a note in a melody?

Is a ledger board required if the side of my house is wood?

How to react to hostile behavior from a senior developer?

Maximum summed subsequences with non-adjacent items

Why does the remaining Rebel fleet at the end of Rogue One seem dramatically larger than the one in A New Hope?

How often does castling occur in grandmaster games?

How would a mousetrap for use in space work?



Magento Configurable Product Disable Dropdown if Out of Stocks



Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?How to change the dropdown option on a product page?Show out of stock product “variants” for configurable productsCan Magento handle configurable swatches functionality?Configurable not resetting after selecting either size/colorConfigurable product still displayed but accosiated simple product is out of stockAttribute dropdown not showing on product page Magento1.9.2.1Configurable Product Show Out of Stock Simple Product in DropdownShow/Hide product configurable attributes depending on another attributeConvert Color and Size attribute dropdown values to Button linksShow out of stock product for configurable product Magento 2.1.13



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








3















There is 2 attribute on my configurable product (Size and Color)



I want to disable option on dropdown (Size or Color) if there is a out of stock product.It should be seen as gray and disable.



How can I do?



Magento ver. 1.9.2.1










share|improve this question
















bumped to the homepage by Community 2 days ago


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















  • can you please paste your view.phtml file code here ?

    – Shashank Kumrawat
    Oct 20 '18 at 4:28


















3















There is 2 attribute on my configurable product (Size and Color)



I want to disable option on dropdown (Size or Color) if there is a out of stock product.It should be seen as gray and disable.



How can I do?



Magento ver. 1.9.2.1










share|improve this question
















bumped to the homepage by Community 2 days ago


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















  • can you please paste your view.phtml file code here ?

    – Shashank Kumrawat
    Oct 20 '18 at 4:28














3












3








3


2






There is 2 attribute on my configurable product (Size and Color)



I want to disable option on dropdown (Size or Color) if there is a out of stock product.It should be seen as gray and disable.



How can I do?



Magento ver. 1.9.2.1










share|improve this question
















There is 2 attribute on my configurable product (Size and Color)



I want to disable option on dropdown (Size or Color) if there is a out of stock product.It should be seen as gray and disable.



How can I do?



Magento ver. 1.9.2.1







magento-1.9 configurable-product






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Oct 30 '15 at 12:56









Amit Bera

60.2k1678178




60.2k1678178










asked Oct 30 '15 at 12:55









B.EsenB.Esen

162




162





bumped to the homepage by Community 2 days ago


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 2 days ago


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














  • can you please paste your view.phtml file code here ?

    – Shashank Kumrawat
    Oct 20 '18 at 4:28


















  • can you please paste your view.phtml file code here ?

    – Shashank Kumrawat
    Oct 20 '18 at 4:28

















can you please paste your view.phtml file code here ?

– Shashank Kumrawat
Oct 20 '18 at 4:28






can you please paste your view.phtml file code here ?

– Shashank Kumrawat
Oct 20 '18 at 4:28











1 Answer
1






active

oldest

votes


















0














First you get out configurable product have out of stock child product by below code and set a flag;



$hasOutofStock=false;
$allProducts = Mage::registry('current_product')->getTypeInstance(true)
->getUsedProducts(null, Mage::registry('current_product'));

foreach ($allProducts as $product)
/* Check child product is not for sales or out of stock*/
if (!$product->isSaleable())
$hasOutofStock=true;
break;




Then use of this flag and with help js disable drop down.



<?php if ($hasOutofStock == true): ?>
<script>
jQuery(".product-options-wrapper select).prop('disabled',true);
</script>
<?php endif: ?>





share|improve this answer

























  • thank you for answered . can you tell me where those file directory?

    – B.Esen
    Oct 30 '15 at 13:31












  • just goto app/design/frontend/[your_Package]/[Your_Theme]/template/catalog/product/view.phtml

    – Amit Bera
    Oct 30 '15 at 13:56











  • I tried but didn't work :/

    – B.Esen
    Oct 30 '15 at 14:12











  • @Anyone Help :: after selecting drop-down value the price going to "0", how can I solve the issue?

    – Gem
    May 3 '18 at 4:47











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%2f88376%2fmagento-configurable-product-disable-dropdown-if-out-of-stocks%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














First you get out configurable product have out of stock child product by below code and set a flag;



$hasOutofStock=false;
$allProducts = Mage::registry('current_product')->getTypeInstance(true)
->getUsedProducts(null, Mage::registry('current_product'));

foreach ($allProducts as $product)
/* Check child product is not for sales or out of stock*/
if (!$product->isSaleable())
$hasOutofStock=true;
break;




Then use of this flag and with help js disable drop down.



<?php if ($hasOutofStock == true): ?>
<script>
jQuery(".product-options-wrapper select).prop('disabled',true);
</script>
<?php endif: ?>





share|improve this answer

























  • thank you for answered . can you tell me where those file directory?

    – B.Esen
    Oct 30 '15 at 13:31












  • just goto app/design/frontend/[your_Package]/[Your_Theme]/template/catalog/product/view.phtml

    – Amit Bera
    Oct 30 '15 at 13:56











  • I tried but didn't work :/

    – B.Esen
    Oct 30 '15 at 14:12











  • @Anyone Help :: after selecting drop-down value the price going to "0", how can I solve the issue?

    – Gem
    May 3 '18 at 4:47















0














First you get out configurable product have out of stock child product by below code and set a flag;



$hasOutofStock=false;
$allProducts = Mage::registry('current_product')->getTypeInstance(true)
->getUsedProducts(null, Mage::registry('current_product'));

foreach ($allProducts as $product)
/* Check child product is not for sales or out of stock*/
if (!$product->isSaleable())
$hasOutofStock=true;
break;




Then use of this flag and with help js disable drop down.



<?php if ($hasOutofStock == true): ?>
<script>
jQuery(".product-options-wrapper select).prop('disabled',true);
</script>
<?php endif: ?>





share|improve this answer

























  • thank you for answered . can you tell me where those file directory?

    – B.Esen
    Oct 30 '15 at 13:31












  • just goto app/design/frontend/[your_Package]/[Your_Theme]/template/catalog/product/view.phtml

    – Amit Bera
    Oct 30 '15 at 13:56











  • I tried but didn't work :/

    – B.Esen
    Oct 30 '15 at 14:12











  • @Anyone Help :: after selecting drop-down value the price going to "0", how can I solve the issue?

    – Gem
    May 3 '18 at 4:47













0












0








0







First you get out configurable product have out of stock child product by below code and set a flag;



$hasOutofStock=false;
$allProducts = Mage::registry('current_product')->getTypeInstance(true)
->getUsedProducts(null, Mage::registry('current_product'));

foreach ($allProducts as $product)
/* Check child product is not for sales or out of stock*/
if (!$product->isSaleable())
$hasOutofStock=true;
break;




Then use of this flag and with help js disable drop down.



<?php if ($hasOutofStock == true): ?>
<script>
jQuery(".product-options-wrapper select).prop('disabled',true);
</script>
<?php endif: ?>





share|improve this answer















First you get out configurable product have out of stock child product by below code and set a flag;



$hasOutofStock=false;
$allProducts = Mage::registry('current_product')->getTypeInstance(true)
->getUsedProducts(null, Mage::registry('current_product'));

foreach ($allProducts as $product)
/* Check child product is not for sales or out of stock*/
if (!$product->isSaleable())
$hasOutofStock=true;
break;




Then use of this flag and with help js disable drop down.



<?php if ($hasOutofStock == true): ?>
<script>
jQuery(".product-options-wrapper select).prop('disabled',true);
</script>
<?php endif: ?>






share|improve this answer














share|improve this answer



share|improve this answer








edited Aug 1 '17 at 0:45









sv3n

10k62557




10k62557










answered Oct 30 '15 at 13:12









Amit BeraAmit Bera

60.2k1678178




60.2k1678178












  • thank you for answered . can you tell me where those file directory?

    – B.Esen
    Oct 30 '15 at 13:31












  • just goto app/design/frontend/[your_Package]/[Your_Theme]/template/catalog/product/view.phtml

    – Amit Bera
    Oct 30 '15 at 13:56











  • I tried but didn't work :/

    – B.Esen
    Oct 30 '15 at 14:12











  • @Anyone Help :: after selecting drop-down value the price going to "0", how can I solve the issue?

    – Gem
    May 3 '18 at 4:47

















  • thank you for answered . can you tell me where those file directory?

    – B.Esen
    Oct 30 '15 at 13:31












  • just goto app/design/frontend/[your_Package]/[Your_Theme]/template/catalog/product/view.phtml

    – Amit Bera
    Oct 30 '15 at 13:56











  • I tried but didn't work :/

    – B.Esen
    Oct 30 '15 at 14:12











  • @Anyone Help :: after selecting drop-down value the price going to "0", how can I solve the issue?

    – Gem
    May 3 '18 at 4:47
















thank you for answered . can you tell me where those file directory?

– B.Esen
Oct 30 '15 at 13:31






thank you for answered . can you tell me where those file directory?

– B.Esen
Oct 30 '15 at 13:31














just goto app/design/frontend/[your_Package]/[Your_Theme]/template/catalog/product/view.phtml

– Amit Bera
Oct 30 '15 at 13:56





just goto app/design/frontend/[your_Package]/[Your_Theme]/template/catalog/product/view.phtml

– Amit Bera
Oct 30 '15 at 13:56













I tried but didn't work :/

– B.Esen
Oct 30 '15 at 14:12





I tried but didn't work :/

– B.Esen
Oct 30 '15 at 14:12













@Anyone Help :: after selecting drop-down value the price going to "0", how can I solve the issue?

– Gem
May 3 '18 at 4:47





@Anyone Help :: after selecting drop-down value the price going to "0", how can I solve the issue?

– Gem
May 3 '18 at 4:47

















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%2f88376%2fmagento-configurable-product-disable-dropdown-if-out-of-stocks%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

Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form