Thursday 24 February 2005 1:12:42 am
I have written a script thats imporing products. Since there's around 500 of them id like them categorised into folders. This is a part of the script that does that, and it works. However the last part with ($node =& eZContentObjectTreeNode::fetch($node_id)) seems to me as pretty unnecceary, as I'd say it was natural that EznodeAssignment somehow contained that node_id after storing. Is it just me overlooking something obvious?
$folderclass =& eZContentClass::fetch( 1 );
$contentObject =& $folderclass->instantiate( $userID, 1 );
$contentObject->setAttribute( 'name', $folder['navn'] );
$contentObject->store();
//assign new object to parent node
$nodeAssignment =& eZNodeAssignment::create( array(
'contentobject_id' => $contentObject->attribute( 'id' ),
'contentobject_version' => $contentObject->attribute( 'current_version' ),
'parent_node' => $merch_node,
'is_main' => 0) );
$nodeAssignment->store();
//snipped version code
}
$node =& eZContentObjectTreeNode::fetch($node_id);
$children =& $node->subTree( array( 'Limitation' => array() ) );
foreach ($children as $child)
{
//Set each products group to $child->MainNodeID;
}
Senior Consultant
http://Umoe-consulting.no
|