Now this is the sort of problem I would help others with but I am flummoxed. I am creating new categories in an import routine, e.g.
$this->magObject = Mage::getModel("catalog/category");
$this->magObject->setName($item["name"]);
$this->magObject->setData("agilityId",$item["id"]);
$this->magObject->setIsActive($this->isActive);
$this->magObject->setIsAnchor($this->isAnchor);
$this->magObject->setPageLayout($this->pageLayout);
$this->magObject->setStoreId(Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID));
//$this->magObject->setPath ("1/2/6") ); //actually got by getting path of specific required parent
$this->magObject->save();
Without the setPath it saves fine, but with the wrong path (obviously). When the setPath is included, nothing happens. I know that there are devious magento elements at work that prevent writing to _entity tables unless certain circumstances are met but I thought I was meeting them . I am already performing the usual
define("ADMIN_STORE_ID",1);
//...
Mage::app();
Mage::setIsDeveloperMode(true);
Mage::app()->setCurrentStore(Mage::getModel('core/store')->load(Mage_Core_Model_App::ADMIN_STORE_ID));
at the start but in this instance it just is not working. I have similar scripts on other sites that do work. Only difference with this site is that there are multiple store fronts
3 UK
7 Spanish
5 German
6 French
1 Default Store View
Anyone spot something obvious that I am missing, whilst I still have some hair left?
Oh this is using Magento 1.9.1.1.