daily pastebin goal
36%
SHARE
TWEET

Untitled

a guest Mar 20th, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php $_description = $this->getProduct()->getDescription(); ?>
  2. <?php if ($_description): ?>
  3.     <h2><?php echo $this->__('Details') ?></h2>
  4.     <div class="std">
  5.         <?php echo $this->helper('catalog/output')->productAttribute($this->getProduct(), $_description, 'description') ?>
  6.     </div>
  7. <?php else: //adding short description?>
  8.     <h2><?php echo $this->__('Short Details') ?></h2>
  9.     <div class="std">
  10.         <?php echo $_helper->productAttribute($this->getProduct(), $this->getProduct()->getShortDescription(), 'short_description') ?>
  11.     </div>
  12. <?php endif; ?>
  13.      
  14. $products = Mage::getModel('catalog/product')->getCollection();
  15. foreach($proudcts as $product){
  16.     if(!$product->getDescription() && $product->getShortDescription()){
  17.         $product->setDescription($product->getShortDescription())->save();
  18.         Mage::getSingleton('adminhtml/session')->addSuccess($this->__($product->getId(). "'s description is saved."));
  19.     }
  20. }
  21.      
  22. <?php
  23.  
  24. require_once 'app/Mage.php';
  25. Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
  26.  
  27.  
  28. $productCollection = Mage::getModel('catalog/product')->getCollection()
  29.     ->addAttributeToSelect('short_description')
  30.     ->addAttributeToSelect('description')
  31.     ->addAttributeToFilter('description', array('neq' => NULL));
  32.  
  33. foreach ($productCollection as $product) {
  34.     $product->setDescription($product->getShortDescription());
  35.     $product->save();
  36. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top