php - Magento Category Model not working -


im doing mass category insert iterating on mysqli result set , variables used in code correct reason code not create category:

$category = mage::getmodel('catalog/category');                  try{                     $category->setname($cat['category_name'])                          ->seturlkey(str_replace(" " , "-" , strtolower($cat['category_name'])))                          ->setisactive(1)                          ->setdisplaymode('products')                          ->setstoreid(0)                          ->setpath('1/2')                          ->save();                  }catch(exception $e)                 {                     die($e->getmessage());                 }                      if($category->getid() == 0): die("category didnt save!"); endif; 

any ideas?


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -