なぜなら:
- Google sees this as a solution
私のソリューションは、クラスMage_Adminhtml_Block_Catalog_Product_Edit_Tab_CategoriesのPhp側にあります。
// start Added stuff
protected $_ubProductCategoriesParents;
public function getUbProductCategories()
{
if (is_null($this->_ubProductCategoriesParents)) {
$this->_ubProductCategoriesParents = array();
$this->_ubProductCategoriesParents = array();
foreach ($this->getCategoryIds() as $id) {
$storeId = (int) $this->getRequest()->getParam('store');
$path = Mage::getResourceModel('catalog/category')
->getAttributeRawValue($id, 'path', $storeId); // no model->load ever ever ever
if (empty($path)) {
$path = "";
}
$parentsIds = explode("/", $path);
if (!(is_array($parentsIds) && count($parentsIds) > 0)) {
$parentsIds = array();
}
$this->_ubProductCategoriesParents = array_unique(array_merge($this->_ubProductCategoriesParents, $parentsIds));
}
//Mage::log(print_r($this->_ubProductCategoriesParents, true));
}
return $this->_ubProductCategoriesParents;
}
// end Added stuff
// magento core function from class
protected function _getNodeJson($node, $level = 1)
{
$item = parent::_getNodeJson($node, $level);
if ($this->_isParentSelectedCategory($node)) {
$item['expanded'] = true;
}
// added new if statement
if (!(isset($item['expanded']) && $item['expanded'] == true) && array_search($node->getId(), $this->getUbProductCategories()) !== false) {
$item['expanded'] = true;
}
if (in_array($node->getId(), $this->getCategoryIds())) {
$item['checked'] = true;
}
if ($this->isReadonly()) {
$item['disabled'] = true;
}
return $item;
}
次に、上記のコードをリライトクラスに入れます。
ありがとうございました