Author Topic: ABL CSV export problem  (Read 3616 times)

A. Wayne Webb

  • Guest
ABL CSV export problem
« on: 12 January 2013, 14:43:30 »
When I go to export a books category, such as "Fiction: Fantasy" all I get is a file with delimiters and quotes as below:

Code: [Select]
"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";""
"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";""

I see in another posting where Federica repaired the problem of a database with the string of "jos_" by changing it to "__".  I suspect I need to change <site>administrator/components/com_abook/models/importexport.php as described here to reflect my database string.

However, I get no error just an empty file.  Am I correct in that I need to replace "__" with "<variable string_>" where the variable is my database prefix?  This can be problematic in that many of the newer installations of Joomla use randomly generated strings of text as the first part of the database name.  This was done on their part as a security measure.

Cordially,
Wayne

Offline federica

  • Amministratore
  • Delfino
  • *****
  • Posts: 1.043
  • Karma: +1/-0
Re: ABL CSV export problem
« Reply #1 on: 12 January 2013, 18:40:28 »
This is the query that is used to export to csv. Try to run it, but before you have to substitute "#_" with your table prefix and modify the catid number in the WHERE.

Code: [Select]
SELECT title, subtitle, alias, ideditor, price, pag, user_id, created_by_alias, description, image, file,  year, idlocation, idlibrary, vote, numvote, hits, published, qty, isbn, approved, userid, url,  url_label, dateinsert, catalogo, checked_out, checked_out_time, access, metakey, metadesc, note, language, editedby,  GROUP_CONCAT(#__abbookauth.idauth SEPARATOR ',') as autori,  GROUP_CONCAT(#__abbooktag.idtag SEPARATOR ',') as tags  FROM #__abbook  LEFT JOIN #__abbookauth on #__abbookauth.idbook=#__abbook.id  LEFT JOIN #__abbooktag on #__abbooktag.idbook=#__abbook.id WHERE catid=2 GROUP BY #__abbook.id
What is the result?
Al mondo ci sono 10 tipi di persone, quelli che hanno capito il codice binario e quelli che non l'hanno capito.
http://www.antivirushelp.it
stacca la spina!

A. Wayne Webb

  • Guest
Re: ABL CSV export problem
« Reply #2 on: 12 January 2013, 19:43:09 »
This is the query that is used to export to csv. Try to run it, but before you have to substitute "#_" with your table prefix and modify the catid number in the WHERE.

Code: [Select]
SELECT title, subtitle, alias, ideditor, price, pag, user_id, created_by_alias, description, image, file,  year, idlocation, idlibrary, vote, numvote, hits, published, qty, isbn, approved, userid, url,  url_label, dateinsert, catalogo, checked_out, checked_out_time, access, metakey, metadesc, note, language, editedby,  GROUP_CONCAT(#__abbookauth.idauth SEPARATOR ',') as autori,  GROUP_CONCAT(#__abbooktag.idtag SEPARATOR ',') as tags  FROM #__abbook  LEFT JOIN #__abbookauth on #__abbookauth.idbook=#__abbook.id  LEFT JOIN #__abbooktag on #__abbooktag.idbook=#__abbook.id WHERE catid=2 GROUP BY #__abbook.id
What is the result?

Before I did that I went and opened the database ***_abbook and ran the export from MySql's menu.  That worked fine.

Then I went back and opened the abbook database again replacing the code:
Code: [Select]
SELECT * FROM `j25_abbook` WHERE 1
with

Code: [Select]
SELECT title, subtitle, alias, ideditor, price, pag, user_id, created_by_alias, description, image, file,  year, idlocation, idlibrary, vote, numvote, hits, published, qty, isbn, approved, userid, url,  url_label, dateinsert, catalogo, checked_out, checked_out_time, access, metakey, metadesc, note, language, editedby,  GROUP_CONCAT(j25_abbookauth.idauth SEPARATOR ',') as autori,  GROUP_CONCAT(j25_abbooktag.idtag SEPARATOR ',') as tags  FROM j25_abbook  LEFT JOIN j25_abbookauth on j25_abbookauth.idbook=j25_abbook.id  LEFT JOIN j25_abbooktag on j25_abbooktag.idbook=j25_abbook.id WHERE catid=4 GROUP BY j25_abbook.id
That got me a table with all the data in it.  At the bottom of the screen was an export link.  I exported with no problem.

While I was waiting for a response for my original posting, I tried some things.  I first copied the importexport.php file that came originally to my computer.  I then renamed the one on my server for safety.  The one on my computer then got edited.  In the importexport.php file I changed all the instances of "#__" to "j25_" in the "function datadumpCsv ($category) {" section.  There are 9 instances of the string of text.  Copying the file to my server I then refreshed my browser, cleaning the cache first.  The file I then got is a blank file, with nothing in it.  I was trying to export my Fiction: Fantasy catalog.  My browser indicates it is category ID 4.

If need be I can export using the MySql options as I understand how to do that.  But, for importing I am definitely not qualified to do so.  The other problem I will likely have is mapping of a different CSV file (different headers) when I go to import it into my existing database.

Cordially,
Wayne ;D