Thursday 10 May 2007 10:25:36 am
Hi Børge, I'm not sure I can give you a out-of-the-box solution, but I have a clue that you can work with. I experienced problem with importing data to the ezkeyword datatype but not from the default RSS import script in eZ. When I look into the rssimport.php in you will see this code to write the value:
function setObjectAttributeValue( &$objectAttribute, $value )
{
if ( $value === false )
{
return;
}
$dataType = $objectAttribute->attribute( 'data_type_string' );
if ( $dataType == 'ezxmltext' )
{
setEZXMLAttribute( $objectAttribute, $value );
}
elseif ( $dataType == 'ezurl' )
{
$objectAttribute->setContent( $value );
}
else
{
$objectAttribute->setAttribute( 'data_text', $value );
}
$objectAttribute->store();
}
This shows that ezkeywords just will be tried inserted with the commaseparated string in setAttribute. What you need to do in order to store a eZkeyword is to initialize a keyword object, my import code looks like this:
$key = new eZKeyword();
$key->initializeKeyword( $value );
$keyword = $myContentObjectAttributes['keyword_trigger'];
$keyword->setContent( $key );
$keyword->store();
What I suggest is that you try to edit your rssimport.php to something like this:
function setObjectAttributeValue( &$objectAttribute, $value )
{
if ( $value === false )
{
return;
}
$dataType = $objectAttribute->attribute( 'data_type_string' );
if ( $dataType == 'ezxmltext' )
{
setEZXMLAttribute( $objectAttribute, $value );
}
elseif ( $dataType == 'ezurl' )
{
$objectAttribute->setContent( $value );
}
elseif ( $dataType == 'ezkeyword' )
{
$key = new eZKeyword();
$key->initializeKeyword( $value );
$objectAttribute->setContent( $key );
}
else
{
$objectAttribute->setAttribute( 'data_text', $value );
}
$objectAttribute->store();
}
I don't know if this will works out, but hopefully you got a idea about where the problem is located. Good luck Børge :)
BuildCMS - Av. Paulista 777, 15° Andar - CEP: 01311-100 - São Paulo
URL: http://www.buildcms.com
|