Sj03rs
Sj03rs

Reputation: 937

Magento exporting and indexing gives internal server error

We are having trouble exporting products from a webshop running Magento 1.6.2.
As we are trying to export 7600 products, we are getting the infamous internal server error.
System.log and Exception.log does not show anything.
I have tried using a Magento cleanup tool to reset the file permissions.
We have changed the execution time and this did not work.
I have used the magento check utility (checks for required components on server).
This says that Magento needs MySQL 4.1.20 (or greater).
Which I think is not the problem for the internal server error.

The only thing that I need is an CSV export of the products. The export needs a layout of how the export function of Magento would do it.
Like:
sku,_store,_attribute_set,_type,_category etc.
So if anyone has any script which can also complete this task, or has any suggestion, I would like the hear from you!

Edit

I exported the products using created at filter. Yet, for other people, this might not be a solution. So an answer is still appreciated!

Upvotes: 0

Views: 440

Answers (1)

Max Bongiorno
Max Bongiorno

Reputation: 166

If you can't export all your products directly from Administration, you can use this snippet to export them via shell.

<? php 
require_once(_PATH_TO_ . 'Mage.php');
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);

$file = 'my_file_name.csv';
    $csv = new Varien_File_Csv();
    $csvdata = array();
    $products = Mage::getModel('catalog/product')->getCollection();

    foreach ($products as $product)
    {
        $product_data = array();
        $product_data['id'] = $product->getId();
        $product_data['sku'] = $product->getSku();
        [... enter here all data you want to export]
        $csvdata[] = $product_data;
    }

    $csv->saveData($file, $csvdata);

To run this in shell :

php -f PATH_TO_YOUR_SCRIPT/scriptname.php

Then, you just have to get the file.

This snippet can be used with other models.

If you want to specify another delimiter, enclosure or line length use :

$csv->setLineLength(1000);
$csv->setDelimiter(';');
$csv->setEnclosure('"');

Upvotes: 1

Related Questions