how to display different description for each virtual product which was create with configurable products?Different Template for Configurable ProductsMagento group prices for simple products associated with configurable productsCreate a product with different colors (associated products) where each color shares stock with all other colorsHow to link two different products to each otherDo I have to create a new attribute set for each configurable product?Create product for each color on catalog, but all link to one configurablehow to set different prices to a magento configurable product in assoiciated product?How to handle same item with multiple prices based on condition without configurable products?Invalid entity_type specified Magento2Configurable products variants -> Show price different with color swatches (M2)

Are taller landing gear bad for aircraft, particulary large airliners?

Why are on-board computers allowed to change controls without notifying the pilots?

The One-Electron Universe postulate is true - what simple change can I make to change the whole universe?

Resetting two CD4017 counters simultaneously, only one resets

Is there an Impartial Brexit Deal comparison site?

Why are all the doors on Ferenginar (the Ferengi home world) far shorter than the average Ferengi?

How can I raise concerns with a new DM about XP splitting?

Lightning Web Component - do I need to track changes for every single input field in a form

Have I saved too much for retirement so far?

Simple recursive Sudoku solver

Taylor series of product of two functions

Why isn't KTEX's runway designation 10/28 instead of 9/27?

Female=gender counterpart?

Do all polymers contain either carbon or silicon?

Simulating a probability of 1 of 2^N with less than N random bits

Proving by induction of n. Is this correct until this point?

Indicating multiple different modes of speech (fantasy language or telepathy)

Can I create an upright 7-foot × 5-foot wall with the Minor Illusion spell?

How to prevent YouTube from showing already watched videos?

Giant Toughroad SLR 2 for 200 miles in two days, will it make it?

In Star Trek IV, why did the Bounty go back to a time when whales were already rare?

Word describing multiple paths to the same abstract outcome

Could solar power be utilized and substitute coal in the 19th century?

Is there a good way to store credentials outside of a password manager?



how to display different description for each virtual product which was create with configurable products?


Different Template for Configurable ProductsMagento group prices for simple products associated with configurable productsCreate a product with different colors (associated products) where each color shares stock with all other colorsHow to link two different products to each otherDo I have to create a new attribute set for each configurable product?Create product for each color on catalog, but all link to one configurablehow to set different prices to a magento configurable product in assoiciated product?How to handle same item with multiple prices based on condition without configurable products?Invalid entity_type specified Magento2Configurable products variants -> Show price different with color swatches (M2)













4















In Magento 2 , when we create configurable product its child product also created, we can provide different description for child products too.




> 1. How to access description of each child product on product page?
> 2. can we make it throw on change of fields , like if we changes color on product
page, so it will show description of that color child product?



Any help will thank full.










share|improve this question
















bumped to the homepage by Community 7 mins ago


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















  • Try this bsscommerce.com/…

    – MageX
    Nov 24 '17 at 10:19















4















In Magento 2 , when we create configurable product its child product also created, we can provide different description for child products too.




> 1. How to access description of each child product on product page?
> 2. can we make it throw on change of fields , like if we changes color on product
page, so it will show description of that color child product?



Any help will thank full.










share|improve this question
















bumped to the homepage by Community 7 mins ago


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















  • Try this bsscommerce.com/…

    – MageX
    Nov 24 '17 at 10:19













4












4








4








In Magento 2 , when we create configurable product its child product also created, we can provide different description for child products too.




> 1. How to access description of each child product on product page?
> 2. can we make it throw on change of fields , like if we changes color on product
page, so it will show description of that color child product?



Any help will thank full.










share|improve this question
















In Magento 2 , when we create configurable product its child product also created, we can provide different description for child products too.




> 1. How to access description of each child product on product page?
> 2. can we make it throw on change of fields , like if we changes color on product
page, so it will show description of that color child product?



Any help will thank full.







magento2 product admin configurable-product






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 23 '17 at 10:29









ABHISHEK TRIPATHI

1,9721726




1,9721726










asked Nov 23 '17 at 10:24









Ganesh Ganesh

518




518





bumped to the homepage by Community 7 mins 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 7 mins ago


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














  • Try this bsscommerce.com/…

    – MageX
    Nov 24 '17 at 10:19

















  • Try this bsscommerce.com/…

    – MageX
    Nov 24 '17 at 10:19
















Try this bsscommerce.com/…

– MageX
Nov 24 '17 at 10:19





Try this bsscommerce.com/…

– MageX
Nov 24 '17 at 10:19










1 Answer
1






active

oldest

votes


















0














I got the answer : im using magento 2.0.4



i used 'appdesignfrontendVenusthemefasonyMagento_ConfigurableProducttemplatesproductviewtypeoptionsconfigurable.phtml' file to get work done.




some small code you will need to get job work done




$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$product = $objectManager->get('MagentoFrameworkRegistry')->registry('current_product');
$description=[];
$_children = $product->getTypeInstance()->getUsedProducts($product);
foreach ($_children as $child)
if($child->getDescription())

// $description array hold each child id and description
$description[$child->getID()]=$child->getDescription();



//In case if you did't added child product description for some product so they will display main product description
$description["product"]=$product->getDescription();

//code for product option change: what was this code

$get=json_decode($block->getJsonConfig($option_txt),true);

$checkOption=[];
foreach ($get['attributes'] as $key => $value)
if($value['code']=='color')

foreach ($value['options'] as $k => $v)
$checkOption[$v['id']]=$v['products'][0];






//code for product option change end :



//some script to use with select option
<script type="text/javascript">

require(['jquery'],function($)
var checkOption=<?php echo json_encode($checkOption);?>;
var description=<?php echo json_encode($description);?>;
jQuery(document).ready(function()
$("#attribute90").on('change',function()
var id= $(this).val();
if(description[checkOption[id]])

//get child product description
$('div[id="product.info.description"]').html(description[checkOption[id]]);

else
//if child product dont have description show , main product description
$('div[id="product.info.description"]').html(description["product"]);


);

);
);
</script>


full source code of my configurable.phtml file



<?php

$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$product = $objectManager->get('MagentoFrameworkRegistry')->registry('current_product');

$description=[];

//get all childrens
$_children = $product->getTypeInstance()->getUsedProducts($product);

foreach ($_children as $child)
if($child->getDescription())

$description[$child->getID()]=$child->getDescription();


$description["product"]=$product->getDescription();

?>
<?php if ($_product->isSaleable() && count($_attributes)):?>
<?php foreach ($_attributes as $_attribute):?>
<div class="field configurable required">
<label class="label" for="attribute<?php /* @escapeNotVerified */ echo $_attribute->getAttributeId() ?>">
<span><?php $label=$block->escapeHtml($_attribute->getProductAttribute()->getStoreLabel());
echo $label;
?></span>
</label>
<div class="control">
<select name="super_attribute[<?php /* @escapeNotVerified */ echo $_attribute->getAttributeId() ?>]"
data-validate="required:true"
id="attribute<?php /* @escapeNotVerified */ echo $_attribute->getAttributeId() ?>"
class="super-attribute-select" data-placholder="<?php /* @escapeNotVerified */
echo "$label:";
?>">
<option value="">
</option>
</select>
</div>
</div>
<?php endforeach;


//code for product option change
$get=json_decode($block->getJsonConfig($option_txt),true);

$checkOption=[];
foreach ($get['attributes'] as $key => $value)
if($value['code']=='color')

foreach ($value['options'] as $k => $v)
$checkOption[$v['id']]=$v['products'][0];




//code for product option change end:


?>
<script type="text/x-magento-init">

"#product_addtocart_form":
"configurable":
"spConfig": <?php echo json_encode($block->getJsonConfig($option_txt)); ?>



</script>
<?php endif;?>


<script type="text/javascript">

require(['jquery'],function($)
var checkOption=<?php echo json_encode($checkOption);?>;
var description=<?php echo json_encode($description);?>;
jQuery(document).ready(function()
$("#attribute90").on('change',function()
var id= $(this).val();
if(description[checkOption[id]])

//get child product description
$('div[id="product.info.description"]').html(description[checkOption[id]]);

else
//if child product dont have description show , main product description
$('div[id="product.info.description"]').html(description["product"]);


);

);
);
</script>





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%2f202888%2fhow-to-display-different-description-for-each-virtual-product-which-was-create-w%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














    I got the answer : im using magento 2.0.4



    i used 'appdesignfrontendVenusthemefasonyMagento_ConfigurableProducttemplatesproductviewtypeoptionsconfigurable.phtml' file to get work done.




    some small code you will need to get job work done




    $objectManager = MagentoFrameworkAppObjectManager::getInstance();
    $product = $objectManager->get('MagentoFrameworkRegistry')->registry('current_product');
    $description=[];
    $_children = $product->getTypeInstance()->getUsedProducts($product);
    foreach ($_children as $child)
    if($child->getDescription())

    // $description array hold each child id and description
    $description[$child->getID()]=$child->getDescription();



    //In case if you did't added child product description for some product so they will display main product description
    $description["product"]=$product->getDescription();

    //code for product option change: what was this code

    $get=json_decode($block->getJsonConfig($option_txt),true);

    $checkOption=[];
    foreach ($get['attributes'] as $key => $value)
    if($value['code']=='color')

    foreach ($value['options'] as $k => $v)
    $checkOption[$v['id']]=$v['products'][0];






    //code for product option change end :



    //some script to use with select option
    <script type="text/javascript">

    require(['jquery'],function($)
    var checkOption=<?php echo json_encode($checkOption);?>;
    var description=<?php echo json_encode($description);?>;
    jQuery(document).ready(function()
    $("#attribute90").on('change',function()
    var id= $(this).val();
    if(description[checkOption[id]])

    //get child product description
    $('div[id="product.info.description"]').html(description[checkOption[id]]);

    else
    //if child product dont have description show , main product description
    $('div[id="product.info.description"]').html(description["product"]);


    );

    );
    );
    </script>


    full source code of my configurable.phtml file



    <?php

    $objectManager = MagentoFrameworkAppObjectManager::getInstance();
    $product = $objectManager->get('MagentoFrameworkRegistry')->registry('current_product');

    $description=[];

    //get all childrens
    $_children = $product->getTypeInstance()->getUsedProducts($product);

    foreach ($_children as $child)
    if($child->getDescription())

    $description[$child->getID()]=$child->getDescription();


    $description["product"]=$product->getDescription();

    ?>
    <?php if ($_product->isSaleable() && count($_attributes)):?>
    <?php foreach ($_attributes as $_attribute):?>
    <div class="field configurable required">
    <label class="label" for="attribute<?php /* @escapeNotVerified */ echo $_attribute->getAttributeId() ?>">
    <span><?php $label=$block->escapeHtml($_attribute->getProductAttribute()->getStoreLabel());
    echo $label;
    ?></span>
    </label>
    <div class="control">
    <select name="super_attribute[<?php /* @escapeNotVerified */ echo $_attribute->getAttributeId() ?>]"
    data-validate="required:true"
    id="attribute<?php /* @escapeNotVerified */ echo $_attribute->getAttributeId() ?>"
    class="super-attribute-select" data-placholder="<?php /* @escapeNotVerified */
    echo "$label:";
    ?>">
    <option value="">
    </option>
    </select>
    </div>
    </div>
    <?php endforeach;


    //code for product option change
    $get=json_decode($block->getJsonConfig($option_txt),true);

    $checkOption=[];
    foreach ($get['attributes'] as $key => $value)
    if($value['code']=='color')

    foreach ($value['options'] as $k => $v)
    $checkOption[$v['id']]=$v['products'][0];




    //code for product option change end:


    ?>
    <script type="text/x-magento-init">

    "#product_addtocart_form":
    "configurable":
    "spConfig": <?php echo json_encode($block->getJsonConfig($option_txt)); ?>



    </script>
    <?php endif;?>


    <script type="text/javascript">

    require(['jquery'],function($)
    var checkOption=<?php echo json_encode($checkOption);?>;
    var description=<?php echo json_encode($description);?>;
    jQuery(document).ready(function()
    $("#attribute90").on('change',function()
    var id= $(this).val();
    if(description[checkOption[id]])

    //get child product description
    $('div[id="product.info.description"]').html(description[checkOption[id]]);

    else
    //if child product dont have description show , main product description
    $('div[id="product.info.description"]').html(description["product"]);


    );

    );
    );
    </script>





    share|improve this answer



























      0














      I got the answer : im using magento 2.0.4



      i used 'appdesignfrontendVenusthemefasonyMagento_ConfigurableProducttemplatesproductviewtypeoptionsconfigurable.phtml' file to get work done.




      some small code you will need to get job work done




      $objectManager = MagentoFrameworkAppObjectManager::getInstance();
      $product = $objectManager->get('MagentoFrameworkRegistry')->registry('current_product');
      $description=[];
      $_children = $product->getTypeInstance()->getUsedProducts($product);
      foreach ($_children as $child)
      if($child->getDescription())

      // $description array hold each child id and description
      $description[$child->getID()]=$child->getDescription();



      //In case if you did't added child product description for some product so they will display main product description
      $description["product"]=$product->getDescription();

      //code for product option change: what was this code

      $get=json_decode($block->getJsonConfig($option_txt),true);

      $checkOption=[];
      foreach ($get['attributes'] as $key => $value)
      if($value['code']=='color')

      foreach ($value['options'] as $k => $v)
      $checkOption[$v['id']]=$v['products'][0];






      //code for product option change end :



      //some script to use with select option
      <script type="text/javascript">

      require(['jquery'],function($)
      var checkOption=<?php echo json_encode($checkOption);?>;
      var description=<?php echo json_encode($description);?>;
      jQuery(document).ready(function()
      $("#attribute90").on('change',function()
      var id= $(this).val();
      if(description[checkOption[id]])

      //get child product description
      $('div[id="product.info.description"]').html(description[checkOption[id]]);

      else
      //if child product dont have description show , main product description
      $('div[id="product.info.description"]').html(description["product"]);


      );

      );
      );
      </script>


      full source code of my configurable.phtml file



      <?php

      $objectManager = MagentoFrameworkAppObjectManager::getInstance();
      $product = $objectManager->get('MagentoFrameworkRegistry')->registry('current_product');

      $description=[];

      //get all childrens
      $_children = $product->getTypeInstance()->getUsedProducts($product);

      foreach ($_children as $child)
      if($child->getDescription())

      $description[$child->getID()]=$child->getDescription();


      $description["product"]=$product->getDescription();

      ?>
      <?php if ($_product->isSaleable() && count($_attributes)):?>
      <?php foreach ($_attributes as $_attribute):?>
      <div class="field configurable required">
      <label class="label" for="attribute<?php /* @escapeNotVerified */ echo $_attribute->getAttributeId() ?>">
      <span><?php $label=$block->escapeHtml($_attribute->getProductAttribute()->getStoreLabel());
      echo $label;
      ?></span>
      </label>
      <div class="control">
      <select name="super_attribute[<?php /* @escapeNotVerified */ echo $_attribute->getAttributeId() ?>]"
      data-validate="required:true"
      id="attribute<?php /* @escapeNotVerified */ echo $_attribute->getAttributeId() ?>"
      class="super-attribute-select" data-placholder="<?php /* @escapeNotVerified */
      echo "$label:";
      ?>">
      <option value="">
      </option>
      </select>
      </div>
      </div>
      <?php endforeach;


      //code for product option change
      $get=json_decode($block->getJsonConfig($option_txt),true);

      $checkOption=[];
      foreach ($get['attributes'] as $key => $value)
      if($value['code']=='color')

      foreach ($value['options'] as $k => $v)
      $checkOption[$v['id']]=$v['products'][0];




      //code for product option change end:


      ?>
      <script type="text/x-magento-init">

      "#product_addtocart_form":
      "configurable":
      "spConfig": <?php echo json_encode($block->getJsonConfig($option_txt)); ?>



      </script>
      <?php endif;?>


      <script type="text/javascript">

      require(['jquery'],function($)
      var checkOption=<?php echo json_encode($checkOption);?>;
      var description=<?php echo json_encode($description);?>;
      jQuery(document).ready(function()
      $("#attribute90").on('change',function()
      var id= $(this).val();
      if(description[checkOption[id]])

      //get child product description
      $('div[id="product.info.description"]').html(description[checkOption[id]]);

      else
      //if child product dont have description show , main product description
      $('div[id="product.info.description"]').html(description["product"]);


      );

      );
      );
      </script>





      share|improve this answer

























        0












        0








        0







        I got the answer : im using magento 2.0.4



        i used 'appdesignfrontendVenusthemefasonyMagento_ConfigurableProducttemplatesproductviewtypeoptionsconfigurable.phtml' file to get work done.




        some small code you will need to get job work done




        $objectManager = MagentoFrameworkAppObjectManager::getInstance();
        $product = $objectManager->get('MagentoFrameworkRegistry')->registry('current_product');
        $description=[];
        $_children = $product->getTypeInstance()->getUsedProducts($product);
        foreach ($_children as $child)
        if($child->getDescription())

        // $description array hold each child id and description
        $description[$child->getID()]=$child->getDescription();



        //In case if you did't added child product description for some product so they will display main product description
        $description["product"]=$product->getDescription();

        //code for product option change: what was this code

        $get=json_decode($block->getJsonConfig($option_txt),true);

        $checkOption=[];
        foreach ($get['attributes'] as $key => $value)
        if($value['code']=='color')

        foreach ($value['options'] as $k => $v)
        $checkOption[$v['id']]=$v['products'][0];






        //code for product option change end :



        //some script to use with select option
        <script type="text/javascript">

        require(['jquery'],function($)
        var checkOption=<?php echo json_encode($checkOption);?>;
        var description=<?php echo json_encode($description);?>;
        jQuery(document).ready(function()
        $("#attribute90").on('change',function()
        var id= $(this).val();
        if(description[checkOption[id]])

        //get child product description
        $('div[id="product.info.description"]').html(description[checkOption[id]]);

        else
        //if child product dont have description show , main product description
        $('div[id="product.info.description"]').html(description["product"]);


        );

        );
        );
        </script>


        full source code of my configurable.phtml file



        <?php

        $objectManager = MagentoFrameworkAppObjectManager::getInstance();
        $product = $objectManager->get('MagentoFrameworkRegistry')->registry('current_product');

        $description=[];

        //get all childrens
        $_children = $product->getTypeInstance()->getUsedProducts($product);

        foreach ($_children as $child)
        if($child->getDescription())

        $description[$child->getID()]=$child->getDescription();


        $description["product"]=$product->getDescription();

        ?>
        <?php if ($_product->isSaleable() && count($_attributes)):?>
        <?php foreach ($_attributes as $_attribute):?>
        <div class="field configurable required">
        <label class="label" for="attribute<?php /* @escapeNotVerified */ echo $_attribute->getAttributeId() ?>">
        <span><?php $label=$block->escapeHtml($_attribute->getProductAttribute()->getStoreLabel());
        echo $label;
        ?></span>
        </label>
        <div class="control">
        <select name="super_attribute[<?php /* @escapeNotVerified */ echo $_attribute->getAttributeId() ?>]"
        data-validate="required:true"
        id="attribute<?php /* @escapeNotVerified */ echo $_attribute->getAttributeId() ?>"
        class="super-attribute-select" data-placholder="<?php /* @escapeNotVerified */
        echo "$label:";
        ?>">
        <option value="">
        </option>
        </select>
        </div>
        </div>
        <?php endforeach;


        //code for product option change
        $get=json_decode($block->getJsonConfig($option_txt),true);

        $checkOption=[];
        foreach ($get['attributes'] as $key => $value)
        if($value['code']=='color')

        foreach ($value['options'] as $k => $v)
        $checkOption[$v['id']]=$v['products'][0];




        //code for product option change end:


        ?>
        <script type="text/x-magento-init">

        "#product_addtocart_form":
        "configurable":
        "spConfig": <?php echo json_encode($block->getJsonConfig($option_txt)); ?>



        </script>
        <?php endif;?>


        <script type="text/javascript">

        require(['jquery'],function($)
        var checkOption=<?php echo json_encode($checkOption);?>;
        var description=<?php echo json_encode($description);?>;
        jQuery(document).ready(function()
        $("#attribute90").on('change',function()
        var id= $(this).val();
        if(description[checkOption[id]])

        //get child product description
        $('div[id="product.info.description"]').html(description[checkOption[id]]);

        else
        //if child product dont have description show , main product description
        $('div[id="product.info.description"]').html(description["product"]);


        );

        );
        );
        </script>





        share|improve this answer













        I got the answer : im using magento 2.0.4



        i used 'appdesignfrontendVenusthemefasonyMagento_ConfigurableProducttemplatesproductviewtypeoptionsconfigurable.phtml' file to get work done.




        some small code you will need to get job work done




        $objectManager = MagentoFrameworkAppObjectManager::getInstance();
        $product = $objectManager->get('MagentoFrameworkRegistry')->registry('current_product');
        $description=[];
        $_children = $product->getTypeInstance()->getUsedProducts($product);
        foreach ($_children as $child)
        if($child->getDescription())

        // $description array hold each child id and description
        $description[$child->getID()]=$child->getDescription();



        //In case if you did't added child product description for some product so they will display main product description
        $description["product"]=$product->getDescription();

        //code for product option change: what was this code

        $get=json_decode($block->getJsonConfig($option_txt),true);

        $checkOption=[];
        foreach ($get['attributes'] as $key => $value)
        if($value['code']=='color')

        foreach ($value['options'] as $k => $v)
        $checkOption[$v['id']]=$v['products'][0];






        //code for product option change end :



        //some script to use with select option
        <script type="text/javascript">

        require(['jquery'],function($)
        var checkOption=<?php echo json_encode($checkOption);?>;
        var description=<?php echo json_encode($description);?>;
        jQuery(document).ready(function()
        $("#attribute90").on('change',function()
        var id= $(this).val();
        if(description[checkOption[id]])

        //get child product description
        $('div[id="product.info.description"]').html(description[checkOption[id]]);

        else
        //if child product dont have description show , main product description
        $('div[id="product.info.description"]').html(description["product"]);


        );

        );
        );
        </script>


        full source code of my configurable.phtml file



        <?php

        $objectManager = MagentoFrameworkAppObjectManager::getInstance();
        $product = $objectManager->get('MagentoFrameworkRegistry')->registry('current_product');

        $description=[];

        //get all childrens
        $_children = $product->getTypeInstance()->getUsedProducts($product);

        foreach ($_children as $child)
        if($child->getDescription())

        $description[$child->getID()]=$child->getDescription();


        $description["product"]=$product->getDescription();

        ?>
        <?php if ($_product->isSaleable() && count($_attributes)):?>
        <?php foreach ($_attributes as $_attribute):?>
        <div class="field configurable required">
        <label class="label" for="attribute<?php /* @escapeNotVerified */ echo $_attribute->getAttributeId() ?>">
        <span><?php $label=$block->escapeHtml($_attribute->getProductAttribute()->getStoreLabel());
        echo $label;
        ?></span>
        </label>
        <div class="control">
        <select name="super_attribute[<?php /* @escapeNotVerified */ echo $_attribute->getAttributeId() ?>]"
        data-validate="required:true"
        id="attribute<?php /* @escapeNotVerified */ echo $_attribute->getAttributeId() ?>"
        class="super-attribute-select" data-placholder="<?php /* @escapeNotVerified */
        echo "$label:";
        ?>">
        <option value="">
        </option>
        </select>
        </div>
        </div>
        <?php endforeach;


        //code for product option change
        $get=json_decode($block->getJsonConfig($option_txt),true);

        $checkOption=[];
        foreach ($get['attributes'] as $key => $value)
        if($value['code']=='color')

        foreach ($value['options'] as $k => $v)
        $checkOption[$v['id']]=$v['products'][0];




        //code for product option change end:


        ?>
        <script type="text/x-magento-init">

        "#product_addtocart_form":
        "configurable":
        "spConfig": <?php echo json_encode($block->getJsonConfig($option_txt)); ?>



        </script>
        <?php endif;?>


        <script type="text/javascript">

        require(['jquery'],function($)
        var checkOption=<?php echo json_encode($checkOption);?>;
        var description=<?php echo json_encode($description);?>;
        jQuery(document).ready(function()
        $("#attribute90").on('change',function()
        var id= $(this).val();
        if(description[checkOption[id]])

        //get child product description
        $('div[id="product.info.description"]').html(description[checkOption[id]]);

        else
        //if child product dont have description show , main product description
        $('div[id="product.info.description"]').html(description["product"]);


        );

        );
        );
        </script>






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 24 '17 at 12:43









        Ganesh Ganesh

        518




        518



























            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%2f202888%2fhow-to-display-different-description-for-each-virtual-product-which-was-create-w%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

            Disable / Remove link to Product Items in Cart Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?How can I limit products that can be bought / added to cart?Remove item from cartHide “Add to Cart” button if specific products are already in cart“Prettifying” the custom options in cart pageCreate link in cart sidebar to view all added items After limit reachedLink products together in checkout/cartHow to Get product from cart and add it againHide action-edit on cart page if simple productRemoving Cart items - ObserverRemove wishlist items when added to cart

            Helsingin valtaus Sisällysluettelo Taustaa | Yleistä sotatoimista | Osapuolet | Taistelut Helsingin ympäristössä | Punaisten antautumissuunnitelma | Taistelujen kulku Helsingissä | Valtauksen jälkeen | Tappiot | Muistaminen | Kirjallisuutta | Lähteet | Aiheesta muualla | NavigointivalikkoTeoksen verkkoversioTeoksen verkkoversioGoogle BooksSisällissota Helsingissä päättyi tasan 95 vuotta sittenSaksalaisten ylivoima jyräsi punaisen HelsinginSuomalaiset kuvaavat sotien jälkiä kaupungeissa – katso kuvat ja tarinat tutuilta kulmiltaHelsingin valtaus 90 vuotta sittenSaksalaiset valtasivat HelsinginHyökkäys HelsinkiinHelsingin valtaus 12.–13.4. 1918Saksalaiset käyttivät ihmiskilpiä Helsingin valtauksessa 1918Teoksen verkkoversioTeoksen verkkoversioSaksalaiset hyökkäävät Etelä-SuomeenTaistelut LeppävaarassaSotilaat ja taistelutLeppävaara 1918 huhtikuussa. KapinatarinaHelsingin taistelut 1918Saksalaisten voitonparaati HelsingissäHelsingin valtausta juhlittiinSaksalaisten Helsinki vuonna 1918Helsingin taistelussa kaatuneet valkokaartilaisetHelsinkiin haudatut taisteluissa kaatuneet punaiset12.4.1918 Helsingin valtauksessa saksalaiset apujoukot vapauttavat kaupunginVapaussodan muistomerkkejä Helsingissä ja pääkaupunkiseudullaCrescendo / Vuoden 1918 Kansalaissodan uhrien muistomerkkim

            Adjektiivitarina Tarinan tekeminen | Esimerkki: ennen | Esimerkki: jälkeen | Navigointivalikko