0
public function productDataToJson(Varien_Event_Observer $observer)
{
  $array = array();
  $products = Mage::getModel('catalog/product')->getCollection();
  foreach ($products as $_product) {
      $array[] = $_product->getData();
  }
  $gallery_images = Mage::getModel('catalog/product')->getMediaGalleryImages();
  $items = array();
  foreach ($gallery_images as $g_image) {
      $items[] = $g_image['url'];
  }

  $jsonData = Mage::helper('core')->jsonEncode($array,$items);
  echo $jsonData;
  file_put_contents("c_node.json", $jsonData);
  exit;
}
0
public function productDataToJson(Varien_Event_Observer $observer)
{
  $array = array();
  $products = Mage::getModel('catalog/product')
      ->getCollection()
      ->addAttributeToSelect('*')
      ->addStoreFilter(Mage::app()->getStore()->getId());
  foreach ($products as $_product) {
      $array[] = $_product->getData();
  }

  $jsonData = Mage::helper('core')->jsonEncode($array);
  echo $jsonData;
  file_put_contents("c_node.json", $jsonData);
  exit;
}

I got all data from this. If this wrong, please let me know. Thank you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.