If Description is empty copy from short descriptionProduct not returning it's short descriptionShort description not updatingTranslate product's informations ( descriptions, short description, title,..)How to set default value to magento short description?Change all short_description field as emptyDuplicated Product Title and Short descriptionHow to get products description and short description in products list page?Magento 1 : duplicate data in description and short descriptionMagento 2 add short description dynamically using templateHow to remove <br> tags from short description programmatically in Magento 2?

Reducing the time for rolling hash

Adding a (stair/baby) gate without facing walls

What force enables us to walk? Friction or normal reaction?

Why are prop blades not shaped like household fan blades?

Create two random teams from a list of players

Applications of pure mathematics in operations research

"Fewer errors means better products" or fewer errors mean better products."

How char is processed in math mode?

Word for soundtrack music which is part of the action of the movie

When did J.K. Rowling decide to make Ron and Hermione a couple?

Should I put my name first or last in the team members list?

How do I respond appropriately to an overseas company that obtained a visa for me without hiring me?

Coworker mumbles to herself when working, how to ask her to stop?

Just how much information should you share with a former client?

If the Moon were impacted by a suitably sized meteor, how long would it take to impact the Earth?

LWC: Removing a class name on scroll

What do the novel titles of The Expanse series refer to?

My employer is refusing to give me the pay that was advertised after an internal job move

Why is Searing Smite not listed in the Roll20 Spell books?

How to structure presentation to avoid getting questions that will be answered later in the presentation?

How would a lunar colony attack Earth?

Value of a limit.

Puzzles with multiple, user-specific, solutions

How to efficiently shred a lot of cabbage?



If Description is empty copy from short description


Product not returning it's short descriptionShort description not updatingTranslate product's informations ( descriptions, short description, title,..)How to set default value to magento short description?Change all short_description field as emptyDuplicated Product Title and Short descriptionHow to get products description and short description in products list page?Magento 1 : duplicate data in description and short descriptionMagento 2 add short description dynamically using templateHow to remove <br> tags from short description programmatically in Magento 2?






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








0















I have many products that have no description but all have short descriptions
How can I copy from short description if description is empty?










share|improve this question






























    0















    I have many products that have no description but all have short descriptions
    How can I copy from short description if description is empty?










    share|improve this question


























      0












      0








      0








      I have many products that have no description but all have short descriptions
      How can I copy from short description if description is empty?










      share|improve this question














      I have many products that have no description but all have short descriptions
      How can I copy from short description if description is empty?







      magento-1.9 product






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Feb 6 '17 at 23:53









      Costas SaloubardosCostas Saloubardos

      688 bronze badges




      688 bronze badges























          2 Answers
          2






          active

          oldest

          votes


















          0














          You will need to change this file template/catalog/product/view/description.phtml like this:



          <?php $_description = $this->getProduct()->getDescription(); ?>
          <?php if ($_description): ?>
          <h2><?php echo $this->__('Details') ?></h2>
          <div class="std">
          <?php echo $this->helper('catalog/output')->productAttribute($this->getProduct(), $_description, 'description') ?>
          </div>
          <?php else: //adding short description?>
          <h2><?php echo $this->__('Short Details') ?></h2>
          <div class="std">
          <?php echo $_helper->productAttribute($this->getProduct(), $this->getProduct()->getShortDescription(), 'short_description') ?>
          </div>
          <?php endif; ?>


          This should give you short description if description is empty.



          UPDATE



          If you want to save short description as description if it is empty in backend then I would suggest to run a simple function like this:



          $products = Mage::getModel('catalog/product')->getCollection();
          foreach($proudcts as $product)
          if(!$product->getDescription() && $product->getShortDescription())
          $product->setDescription($product->getShortDescription())->save();
          Mage::getSingleton('adminhtml/session')->addSuccess($this->__($product->getId(). "'s description is saved."));




          Now, how to run this code? You can create a simple module and place above code in indexAction(), then call it.



          PS I would still stick with first solution that I provided. That works with not having description in the product. This helps you to know which product doesn't have description and can save later if needed for each product.






          share|improve this answer



























          • Hello and thanks for the response. I want to copy it in the backend if description does not exist

            – Costas Saloubardos
            Feb 7 '17 at 0:44











          • Check my update.

            – Adarsh Khatri
            Feb 7 '17 at 0:55


















          0














          I would recommend filtering the collection for performance's sake, and I would put this code into a file in your Magento root (maybe setDescription.php) and run it from either from the command line (php setDescription.php) or the browser (http://yourdevurl/setDescription.php).



          <?php

          require_once 'app/Mage.php';
          Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);


          $productCollection = Mage::getModel('catalog/product')->getCollection()
          ->addAttributeToSelect('short_description')
          ->addAttributeToSelect('description')
          ->addAttributeToFilter('description', array('neq' => NULL));

          foreach ($productCollection as $product)
          $product->setDescription($product->getShortDescription());
          $product->save();






          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%2f158432%2fif-description-is-empty-copy-from-short-description%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














            You will need to change this file template/catalog/product/view/description.phtml like this:



            <?php $_description = $this->getProduct()->getDescription(); ?>
            <?php if ($_description): ?>
            <h2><?php echo $this->__('Details') ?></h2>
            <div class="std">
            <?php echo $this->helper('catalog/output')->productAttribute($this->getProduct(), $_description, 'description') ?>
            </div>
            <?php else: //adding short description?>
            <h2><?php echo $this->__('Short Details') ?></h2>
            <div class="std">
            <?php echo $_helper->productAttribute($this->getProduct(), $this->getProduct()->getShortDescription(), 'short_description') ?>
            </div>
            <?php endif; ?>


            This should give you short description if description is empty.



            UPDATE



            If you want to save short description as description if it is empty in backend then I would suggest to run a simple function like this:



            $products = Mage::getModel('catalog/product')->getCollection();
            foreach($proudcts as $product)
            if(!$product->getDescription() && $product->getShortDescription())
            $product->setDescription($product->getShortDescription())->save();
            Mage::getSingleton('adminhtml/session')->addSuccess($this->__($product->getId(). "'s description is saved."));




            Now, how to run this code? You can create a simple module and place above code in indexAction(), then call it.



            PS I would still stick with first solution that I provided. That works with not having description in the product. This helps you to know which product doesn't have description and can save later if needed for each product.






            share|improve this answer



























            • Hello and thanks for the response. I want to copy it in the backend if description does not exist

              – Costas Saloubardos
              Feb 7 '17 at 0:44











            • Check my update.

              – Adarsh Khatri
              Feb 7 '17 at 0:55















            0














            You will need to change this file template/catalog/product/view/description.phtml like this:



            <?php $_description = $this->getProduct()->getDescription(); ?>
            <?php if ($_description): ?>
            <h2><?php echo $this->__('Details') ?></h2>
            <div class="std">
            <?php echo $this->helper('catalog/output')->productAttribute($this->getProduct(), $_description, 'description') ?>
            </div>
            <?php else: //adding short description?>
            <h2><?php echo $this->__('Short Details') ?></h2>
            <div class="std">
            <?php echo $_helper->productAttribute($this->getProduct(), $this->getProduct()->getShortDescription(), 'short_description') ?>
            </div>
            <?php endif; ?>


            This should give you short description if description is empty.



            UPDATE



            If you want to save short description as description if it is empty in backend then I would suggest to run a simple function like this:



            $products = Mage::getModel('catalog/product')->getCollection();
            foreach($proudcts as $product)
            if(!$product->getDescription() && $product->getShortDescription())
            $product->setDescription($product->getShortDescription())->save();
            Mage::getSingleton('adminhtml/session')->addSuccess($this->__($product->getId(). "'s description is saved."));




            Now, how to run this code? You can create a simple module and place above code in indexAction(), then call it.



            PS I would still stick with first solution that I provided. That works with not having description in the product. This helps you to know which product doesn't have description and can save later if needed for each product.






            share|improve this answer



























            • Hello and thanks for the response. I want to copy it in the backend if description does not exist

              – Costas Saloubardos
              Feb 7 '17 at 0:44











            • Check my update.

              – Adarsh Khatri
              Feb 7 '17 at 0:55













            0












            0








            0







            You will need to change this file template/catalog/product/view/description.phtml like this:



            <?php $_description = $this->getProduct()->getDescription(); ?>
            <?php if ($_description): ?>
            <h2><?php echo $this->__('Details') ?></h2>
            <div class="std">
            <?php echo $this->helper('catalog/output')->productAttribute($this->getProduct(), $_description, 'description') ?>
            </div>
            <?php else: //adding short description?>
            <h2><?php echo $this->__('Short Details') ?></h2>
            <div class="std">
            <?php echo $_helper->productAttribute($this->getProduct(), $this->getProduct()->getShortDescription(), 'short_description') ?>
            </div>
            <?php endif; ?>


            This should give you short description if description is empty.



            UPDATE



            If you want to save short description as description if it is empty in backend then I would suggest to run a simple function like this:



            $products = Mage::getModel('catalog/product')->getCollection();
            foreach($proudcts as $product)
            if(!$product->getDescription() && $product->getShortDescription())
            $product->setDescription($product->getShortDescription())->save();
            Mage::getSingleton('adminhtml/session')->addSuccess($this->__($product->getId(). "'s description is saved."));




            Now, how to run this code? You can create a simple module and place above code in indexAction(), then call it.



            PS I would still stick with first solution that I provided. That works with not having description in the product. This helps you to know which product doesn't have description and can save later if needed for each product.






            share|improve this answer















            You will need to change this file template/catalog/product/view/description.phtml like this:



            <?php $_description = $this->getProduct()->getDescription(); ?>
            <?php if ($_description): ?>
            <h2><?php echo $this->__('Details') ?></h2>
            <div class="std">
            <?php echo $this->helper('catalog/output')->productAttribute($this->getProduct(), $_description, 'description') ?>
            </div>
            <?php else: //adding short description?>
            <h2><?php echo $this->__('Short Details') ?></h2>
            <div class="std">
            <?php echo $_helper->productAttribute($this->getProduct(), $this->getProduct()->getShortDescription(), 'short_description') ?>
            </div>
            <?php endif; ?>


            This should give you short description if description is empty.



            UPDATE



            If you want to save short description as description if it is empty in backend then I would suggest to run a simple function like this:



            $products = Mage::getModel('catalog/product')->getCollection();
            foreach($proudcts as $product)
            if(!$product->getDescription() && $product->getShortDescription())
            $product->setDescription($product->getShortDescription())->save();
            Mage::getSingleton('adminhtml/session')->addSuccess($this->__($product->getId(). "'s description is saved."));




            Now, how to run this code? You can create a simple module and place above code in indexAction(), then call it.



            PS I would still stick with first solution that I provided. That works with not having description in the product. This helps you to know which product doesn't have description and can save later if needed for each product.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Feb 7 '17 at 0:55

























            answered Feb 7 '17 at 0:33









            Adarsh KhatriAdarsh Khatri

            6,8031 gold badge19 silver badges45 bronze badges




            6,8031 gold badge19 silver badges45 bronze badges















            • Hello and thanks for the response. I want to copy it in the backend if description does not exist

              – Costas Saloubardos
              Feb 7 '17 at 0:44











            • Check my update.

              – Adarsh Khatri
              Feb 7 '17 at 0:55

















            • Hello and thanks for the response. I want to copy it in the backend if description does not exist

              – Costas Saloubardos
              Feb 7 '17 at 0:44











            • Check my update.

              – Adarsh Khatri
              Feb 7 '17 at 0:55
















            Hello and thanks for the response. I want to copy it in the backend if description does not exist

            – Costas Saloubardos
            Feb 7 '17 at 0:44





            Hello and thanks for the response. I want to copy it in the backend if description does not exist

            – Costas Saloubardos
            Feb 7 '17 at 0:44













            Check my update.

            – Adarsh Khatri
            Feb 7 '17 at 0:55





            Check my update.

            – Adarsh Khatri
            Feb 7 '17 at 0:55













            0














            I would recommend filtering the collection for performance's sake, and I would put this code into a file in your Magento root (maybe setDescription.php) and run it from either from the command line (php setDescription.php) or the browser (http://yourdevurl/setDescription.php).



            <?php

            require_once 'app/Mage.php';
            Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);


            $productCollection = Mage::getModel('catalog/product')->getCollection()
            ->addAttributeToSelect('short_description')
            ->addAttributeToSelect('description')
            ->addAttributeToFilter('description', array('neq' => NULL));

            foreach ($productCollection as $product)
            $product->setDescription($product->getShortDescription());
            $product->save();






            share|improve this answer





























              0














              I would recommend filtering the collection for performance's sake, and I would put this code into a file in your Magento root (maybe setDescription.php) and run it from either from the command line (php setDescription.php) or the browser (http://yourdevurl/setDescription.php).



              <?php

              require_once 'app/Mage.php';
              Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);


              $productCollection = Mage::getModel('catalog/product')->getCollection()
              ->addAttributeToSelect('short_description')
              ->addAttributeToSelect('description')
              ->addAttributeToFilter('description', array('neq' => NULL));

              foreach ($productCollection as $product)
              $product->setDescription($product->getShortDescription());
              $product->save();






              share|improve this answer



























                0












                0








                0







                I would recommend filtering the collection for performance's sake, and I would put this code into a file in your Magento root (maybe setDescription.php) and run it from either from the command line (php setDescription.php) or the browser (http://yourdevurl/setDescription.php).



                <?php

                require_once 'app/Mage.php';
                Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);


                $productCollection = Mage::getModel('catalog/product')->getCollection()
                ->addAttributeToSelect('short_description')
                ->addAttributeToSelect('description')
                ->addAttributeToFilter('description', array('neq' => NULL));

                foreach ($productCollection as $product)
                $product->setDescription($product->getShortDescription());
                $product->save();






                share|improve this answer













                I would recommend filtering the collection for performance's sake, and I would put this code into a file in your Magento root (maybe setDescription.php) and run it from either from the command line (php setDescription.php) or the browser (http://yourdevurl/setDescription.php).



                <?php

                require_once 'app/Mage.php';
                Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);


                $productCollection = Mage::getModel('catalog/product')->getCollection()
                ->addAttributeToSelect('short_description')
                ->addAttributeToSelect('description')
                ->addAttributeToFilter('description', array('neq' => NULL));

                foreach ($productCollection as $product)
                $product->setDescription($product->getShortDescription());
                $product->save();







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Feb 7 '17 at 1:34









                AreDubyaAreDubya

                1,2391 gold badge10 silver badges22 bronze badges




                1,2391 gold badge10 silver badges22 bronze badges






























                    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%2f158432%2fif-description-is-empty-copy-from-short-description%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