Showing results for 
Search instead for 
Did you mean: 

CSV import not working - Need Assistance

CSV import not working - Need Assistance

We have a scenario where schools.csv file will be uploaded under schoolsearch folder under the magento root directory. This should update the schools table under magento database. But since migration its not working. We are using a module for this task. But its not working. The following is the content of observer.php

class Attigo_Schoolsearch_Model_Observer 

	protected function getfilepath()
		Mage::getBaseDir(). DS .'csv'. DS . 'schoolsearch/schools.csv';

	public function schoolDetail()
		//$filePath = $this->getfilepath();
		$filePath = "/var/www/html/main/schoolsearch/schools.csv";
	if (($handle = fopen($filePath, 'r')) !== FALSE) 
            while (($data = fgetcsv($handle, 1000, '\t')) !== FALSE) 

                     if($data != "")
                        foreach ($data as $school) {
                         //   echo $school.'';
						$school = Mage::getModel('schoolsearch/schools');
                       // print_r($school);
                       // echo $row[13].'->'.$row[14].'';

			echo "permission denide";
	public function AddCustomerGroup(Varien_Event_Observer $observer)
            $_post = Mage::app()->getFrontController()->getRequest()->getParams();

        try {

            $customer = $observer->getEvent()->getCustomer();

            $customer->setData('group_id', $_post['group_id']); // or whatever the group id should be

        } catch ( Exception $e ) {
            echo $e->getMessage;



Can any one help me where it goes wrong?


Re: CSV import not working - Need Assistance

When you say its not working it gives "permission denied" as per the Observer or you get a 500 error?

Have you tried putting feeback in the code i.e. and echo "Here"; at various stages of your code to follow the path it is taking or to confirm if it is even getting into the functions at all?