Magento Expert Forum - Improve your Magento experience
-
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()
{
$row=array();
//$filePath = $this->getfilepath();
$filePath = "/var/www/html/main/schoolsearch/schools.csv";
if (($handle = fopen($filePath, 'r')) !== FALSE)
{
$i=0;
while (($data = fgetcsv($handle, 1000, '\t')) !== FALSE)
{
if($i==0)
{
$i++;
continue;
}
if($data != "")
{
foreach ($data as $school) {
// echo $school.'';
$row=explode("\t",$school);
}
$school = Mage::getModel('schoolsearch/schools');
$school->setKundnr($row[0]);
$school->setSkola($row[1]);
$school->setBadress($row[2]);
$school->setBadress1($row[3]);
$school->setBpostnummer($row[4]);
$school->setBpostort($row[5]);
$school->setFakturamottagare($row[6]);
$school->setFakturaadress1($row[7]);
$school->setFakturaadress2($row[8]);
$school->setFpostnr($row[9]);
$school->setFpostort($row[10]);
$school->setBadressid($row[11]);
$school->setFakturaadressid($row[12]);
$school->setBcountrycode($row[13]);
$school->setFakturacountrycode($row[14]);
$school->save();
// print_r($school);
// echo $row[13].'->'.$row[14].'';
}
$i++;
}
}
else
{
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
$customer->save();
} catch ( Exception $e ) {
echo $e->getMessage;
}
}
}
?>
Why its not working?
View more threads in the same category:
- Was könnte sich lohnen, um mehr aus der eigenen Garage herauszuholen?
- https://counterfeitdeutsch.de/falsch...tift-rossmann/ Counterfeit deutsch, Falschgel
- Unforgettable Abu Dhabi City Tour: Discover Top Attractions!
- Explore Abu Dhabi City Tour – Discover Top Landmarks
- Falschgeld kaufen , counterfeit deutsch WhatsApp +4915212508422 Fake Banknoten ka
- BUY UNDETECTABLE GRADE A+ COUNTERFEIT BANKNOTE(https://legitcleandocs.com)passports,
- WO KANN ICH FALSCHES GELD KAUFEN WhatsApp&...+4915212508422. Falschgeld kaufen in ess
- buy biometric passports(https://legitcleandocs.com)drivers license, visa, id card
- Falschgeld kaufen,counterfeit deutsch , WhatsApp +4915212508422 Fake Banknoten kaufen
- kaufen Swiss Franc (CHF) WhatsApp…..+4915212508422 Kaufen Sie Fälschungen (IN, BR, MX
-
-
You need to debug the code and find out the error point at which it doesn't provide proper output. Here are some case which you need to debug.
1. First of all, Check File Path is Ok
2. File is loaded or not
3. Data is properly read from file
4. Check the code applied on file data.
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks