Fantastic CSV import extension - Who owns it?

Author Message

Jean-Luc Nguyen

Monday 10 September 2007 2:44:37 am

Hello there, on this csv import extension, I cannot find where to define default language import, is a parameter missing? Thanks a lot!

http://www.acidre.com

Jean-Luc Nguyen

Monday 10 September 2007 4:16:47 am

As english is the default import language, I added at the end of script the SQL queries that update language contents (here french):

$sql = "UPDATE ezcontentobject SET initial_language_id=2, language_mask=2 WHERE id=".$contentObjectID;
$db->query( $sql );

$sql = "UPDATE ezcontentobject_attribute SET language_code='fre-FR', language_id=2 WHERE contentobject_id=".$contentObjectID;
$db->query( $sql );

$sql = "UPDATE ezcontentobject_name SET content_translation='fre-FR', language_id=2, real_translation='fre-FR' WHERE contentobject_id=".$contentObjectID;
$db->query( $sql );

$sql = "UPDATE ezcontentobject_version SET initial_language_id=2, language_mask=3 WHERE contentobject_id=".$contentObjectID;
$db->query( $sql );

http://www.acidre.com

Brendan Pike

Tuesday 11 December 2007 4:37:45 pm

Thought I would add my bit since I just used this extension for the first time, its very nice hopefully it will get maintained into the future. I did find it no longer works in 3.10.0 unfortunately, some problem in the module.php file. Like others I found the CLI failed so unfortunately I had to cut my csv into smaller parts of about 300 lines each to be safe. I needed to add support for ezprice which fortunately was very straight forward, just copy the case 'ezfloat': parts and change it to case 'ezprice'.

www.dbinformatics.com.au

We are always interested in hearing from experienced eZ PHP programmers and eZ template designers interested in contract work.

Clement Baronnet

Monday 18 February 2008 11:05:17 am

Hi,

I'm trying to install the contrib under eZ 3.10.
It's not working. And as soon as I use the eZ 3.9, it's allright, it's working fine.

Is anybody has a fix to pass through this issue. Or is anybody has already met this problem ?

Thanks for your help.

Clement Baronnet

Friday 22 February 2008 7:39:35 am

All is fine for me on the eZ 3.10.
Actually, right now I just a problem with the data's size 'cause it's like more than 5MB per csv file.
But anyways, it's working well on the 3.10.

Don't vacillate to cantact me about this post.

CU ..

Clement Baronnet

Friday 07 March 2008 1:32:12 am

The CSV import IS HUGE !!
I change a few stuff and now, it's working better than well. So good !

Thanks for your help.
ByE

Andrew K

Monday 04 August 2008 1:32:52 pm

How did you get CSV import to work in 3.10? I've got it installed but I keep getting an kernel error (1) and my error log shows:

There is mistake in the functions array data of the 'csv/csvimport' view. Please check the 'csv/module.php' file.

Gabriel Finkelstein

Monday 04 August 2008 3:52:35 pm

I had the same problem. Remove this from modules/csv/module.php:

    "functions" => array( 'read' ),

Wei Dai

Thursday 14 August 2008 1:59:33 am

I installed this extension on eZ Publish 3.10. But, I can't find where is the link to get this module in the admin interface.

Does it works on eZ Publish 3.10?

Certified eZ Publish 4 developer looking for develop information & collaboration.

Andrew K

Thursday 14 August 2008 7:44:06 am

You should be able to go to yourdomain.com/csv/csvimport

I got it to work with the instructions above for 3.10.

Gabriel Finkelstein

Thursday 14 August 2008 11:39:57 am

There is no link in the admin interface, but you can add the following to menu.ini (of your admin siteaccess):

[NavigationPart]
Part[]
.
.
.
Part[csv]=CSV Import

[TopAdminMenu]
Tabs[]
.
.
.
Tabs[]=csv

[Topmenu_csv]
NavigationPartIdentifier=csv
Name=CSV Import
URL[]
URL[default]=csv/csvimport
Enabled[]
Enabled[default]=true
Enabled[browse]=false
Enabled[edit]=false
Shown[]
Shown[default]=true
Shown[navigation]=true
Shown[browse]=false

Wei Dai

Wednesday 20 August 2008 12:49:45 am

Ok, I have added the topmenu.

However, it seems I can't get the navigationpart right, even though I set up the menu.ini file:

[NavigationPart]
Part[ezimportnavigationpart]=Import

[TopAdminMenu]
Tabs[]=import

[Topmenu_import]
NavigationPartIdentifier=ezimportnavigationpart
Name=Import
Tooltip=Import CSV
URL[]
URL[default]=csv/csvimport
Enabled[]
Enabled[default]=true
Enabled[browse]=true
Enabled[edit]=false
Shown[]
Shown[default]=true
Shown[edit]=false
Shown[navigation]=true
Shown[browse]=true

The admin interface always switch to the content structure part (highlited) with the dynamic content menu on the left. The center of the screen is the csvimport thought.

Certified eZ Publish 4 developer looking for develop information & collaboration.

Wei Dai

Wednesday 20 August 2008 1:13:20 am

Ok. Nevermind above. I resolved it.

Just change in module.php to:

...
"default_navigation_part" => 'ezimportnavigationpart',
...

Certified eZ Publish 4 developer looking for develop information & collaboration.

Wei Dai

Wednesday 20 August 2008 2:33:39 am

Hi Jean-Luc Nguyen,

I am also use French and English for my site. Could you tell me where did you add the SQL queries that update language contents? just at the very end of the csvimport.php and import.php files?

Thanks.

Certified eZ Publish 4 developer looking for develop information & collaboration.

Wei Dai

Friday 12 September 2008 3:43:37 am

Hi,
I am going to use this tool to do the real work. However, I still don't know exactly where is the SQL queries that update language contents. I need change it to french too!

And, another thing is how to set a pattern to support objectrelation. From the code I knew this tool is already support the objectrelation; but in the doc, no information mentioned it!

Thank you advance!

Certified eZ Publish 4 developer looking for develop information & collaboration.

Gabriel Finkelstein

Friday 12 September 2008 7:44:09 am

You want to choose the language instead of using the default? Try using this:

In csvimport.php, around line 460 change:

$contentObject =& $class->instantiate( $creatorID, $sectionID, false);

To:

$contentObject =& $class->instantiate( $creatorID, $sectionID, false, $language );

Around 550:

$version =& $contentObject->createNewVersion(false,true);
$version =& $contentObject->createNewVersion(false,true,$language);

Around 400:

function addContentObject( $rootNodeID, $parentNodeName, $parentNodeRemoteID, $creatorID, $classID, $sectionID, &$dataArray, &$logArray, $importKey,  $folderClassID, $convertTag = false, $tagList = null , $objectRelationClassID = 0, $pdate)
function addContentObject( $rootNodeID, $parentNodeName, $parentNodeRemoteID, $creatorID, $classID, $sectionID, &$dataArray, &$logArray, $importKey,  $folderClassID, $convertTag = false, $tagList = null , $objectRelationClassID = 0, $pdate , $language = false)

Around: 370:

                    if ( $convertTag )
                        addContentObject( $rootNodeID, $parentNodeName, $parentNodeRemoteID, $creatorID, $classID, $sectionID, $dataArray, $logArray, $importKey, $folderClassID, $convertTag, $tagList, $objectRelationClassID, $pdate);
                    else
                    {
                        addContentObject( $rootNodeID, $parentNodeName, $parentNodeRemoteID, $creatorID, $classID, $sectionID, $dataArray, $logArray, $importKey, $folderClassID, false, null, $objectRelationClassID, $pdate);
                    }
                    if ( $convertTag )
                        addContentObject( $rootNodeID, $parentNodeName, $parentNodeRemoteID, $creatorID, $classID, $sectionID, $dataArray, $logArray, $importKey, $folderClassID, $convertTag, $tagList, $objectRelationClassID, $pdate, $language );
                    else
                    {
                        addContentObject( $rootNodeID, $parentNodeName, $parentNodeRemoteID, $creatorID, $classID, $sectionID, $dataArray, $logArray, $importKey, $folderClassID, false, null, $objectRelationClassID, $pdate, $language );
                    }

And then set the $language variable, around 200:

    else
    {
        $logFieldList = null;
    }

Add below:

    if ( $http->hasVariable( 'language' ) ){
        $language = $http->variable( 'language' );
    } else {
        $language = false;
    }

(If you use the command line version, you'll have to do something similar in import.php)

And then in csvimport.tpl, add somewhere:

<h2>Choose language</h2>

<div class="block">
<select name="language">
{foreach ezini('RegionalSettings', 'SiteLanguageList') as $lang}
<option value="{$lang}"{if $post.language|eq($lang)} selected="selected"{/if}>{$lang}</option>
{/section}
</select>
</div>

Wei Dai

Friday 12 September 2008 9:53:43 pm

Thank you very much for your response.

I will try it. :)

As to use the objectrelation pattern in the setting: I checked out the code, it seems that I just need input the related object name in the objectrelation field. Right? And which means, I need import the related objects first, then import the data has the objectrelation attribute. Right?

Certified eZ Publish 4 developer looking for develop information & collaboration.

Wei Dai

Wednesday 24 September 2008 4:39:17 am

Can anyone tell me if s/he had successful experience to import data with objectrelation attribute? What I said above was correct or not? Thanks, need this information for an urgent project. :)

Certified eZ Publish 4 developer looking for develop information & collaboration.

Patrick Renaud

Wednesday 24 September 2008 5:23:17 am

> As to use the objectrelation pattern in the setting: I checked out the code, it seems that I just need input the related object name in the objectrelation field. Right? And which means, I need import the related objects first, then import the data has the objectrelation attribute. Right?

The answer to both your questions is : yes. ;)

Ca, c'est fait !

Wei Dai

Wednesday 24 September 2008 7:14:14 pm

Thank you very much for your replying!

Certified eZ Publish 4 developer looking for develop information & collaboration.

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.