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?Product description is used as meta descriptionChange 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 template

Derivative of an interpolated function

What is it called when someone votes for an option that's not their first choice?

Should I warn a new PhD Student?

How can I, as DM, avoid the Conga Line of Death occurring when implementing some form of flanking rule?

I keep switching characters, how do I stop?

PTIJ: Which Dr. Seuss books should one obtain?

Capacitor electron flow

Asserting that Atheism and Theism are both faith based positions

Error in master's thesis, I do not know what to do

Mortal danger in mid-grade literature

Should a narrator ever describe things based on a character's view instead of facts?

How would a solely written language work mechanically

Showing mass murder in a kid's book

Can you take a "free object interaction" while incapacitated?

"Marked down as someone wanting to sell shares." What does that mean?

Why doesn't Gödel's incompleteness theorem apply to false statements?

Why can't I get pgrep output right to variable on bash script?

Not hide and seek

Reasons for having MCU pin-states default to pull-up/down out of reset

Why didn't Voldemort know what Grindelwald looked like?

Would this string work as string?

If the Dominion rule using their Jem'Hadar troops, why is their life expectancy so low?

Why does a 97 / 92 key piano exist by Bosendorfer?

Is there any common country to visit for persons holding UK and Schengen visas?



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?Product description is used as meta descriptionChange 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 template













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














bumped to the homepage by Community 12 mins ago


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



















    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














    bumped to the homepage by Community 12 mins ago


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

















      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

      638




      638





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


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






















          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,75511644




            6,75511644












            • 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,22911022




                1,22911022



























                    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

                    Magento 2 duplicate PHPSESSID cookie when using session_start() in custom php scriptMagento 2: User cant logged in into to account page, no error showing!Magento duplicate on subdomainGrabbing storeview from cookie (after using language selector)How do I run php custom script on magento2Magento 2: Include PHP script in headerSession lock after using Cm_RedisSessionscript php to update stockMagento set cookie popupMagento 2 session id cookie - where to find it?How to import Configurable product from csv with custom attributes using php scriptMagento 2 run custom PHP script

                    Can not update quote_id field of “quote_item” table magento 2Magento 2.1 - We can't remove the item. (Shopping Cart doesnt allow us to remove items before becomes empty)Add value for custom quote item attribute using REST apiREST API endpoint v1/carts/cartId/items always returns error messageCorrect way to save entries to databaseHow to remove all associated quote objects of a customer completelyMagento 2 - Save value from custom input field to quote_itemGet quote_item data using quote id and product id filter in Magento 2How to set additional data to quote_item table from controller in Magento 2?What is the purpose of additional_data column in quote_item table in magento2Set Custom Price to Quote item magento2 from controller

                    How to solve knockout JS error in Magento 2 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?(Magento2) knockout.js:3012 Uncaught ReferenceError: Unable to process bindingUnable to process binding Knockout.js magento 2Cannot read property `scopeLabel` of undefined on Product Detail PageCan't get Customer Data on frontend in Magento 2Magento2 Order Summary - unable to process bindingKO templates are not loading in Magento 2.1 applicationgetting knockout js error magento 2Product grid not load -— Unable to process binding Knockout.js magento 2Product form not loaded in magento2Uncaught ReferenceError: Unable to process binding “if: function()return (isShowLegend()) ” magento 2