PrestaShop Forum

The best place in the world to ask questions about PrestaShop and get advice from our passionate community!

PrestaShop Forum

Jump to content

 

[TIPS] Import CSV

18 replies to this topic
#1
caparuni

    PrestaShop Apprentice

  • Members
  • PipPip
  • 292 posts
salah satu fitur PS adalah Import, bisa di akses lewat BO > Tools > Import. dgn fitur ini kita bisa import kategori, produk, atribut, kostumer, dsb. yg paling penting kita harus bikin dulu file .csv, bisa kita bikin di ms-excel ajah biar gampang, terus save ke csv. ada beberapa catatan gw soal fitur import ini.

* yg make versi 1.1 kebawah, harus update /admin/tabs/AdminImport.php. soalnya versi ini buggy abis... cara update nya, yah coba download versi terakhir, buka file zip nya, extract AdminImport.php timpa ke server. (gw seh update make yg 1.2 alpha 1)
* untuk import produk, cobalah untuk selalu masukan product_id, sebenarnya product_id akan otomatis di generate oleh system, tp dalam beberapa kasus ini harus dimasukin kalo ada kolom tag atau image, jd biar aman selalu masukan lah product_id.
* untuk kolom category (import produk), ini harus masukin nya berdasarkan category_id, misalnya 1,2 coba ke BO > catalog, liat category_id (paling kiri). oia untuk Home category_id nya adalah 1
* untuk kolom image, bikin satu folder di hosting/server, misalnya image_import, set chmod 777, upload image nya, format penulisannya path utk imagenya bisa dlm 3 variasi :
1. relative path >> ../image_import/produk.jpg
2. full path >> /home/caparuni/public_html/image_import/produk.jpg (rekomendasi gw seh make yg ini)
3. url >> http://domainanda/im...port/produk.jpg (url ke file image di server/hostingan, bukan ke url ke image di server lain)

segini dulu yah, kalo ada lg nanti gw tambah lg. ;))
[mod-id] Prestashop for Indonesian

kartunama.biz chenoel.com

phpMyAdmin / File Explorer / Thumb Popup
please send donation to support me making free modules. check my profile for complete module list

#2
pratama

    PrestaShop Apprentice

  • Members
  • PipPip
  • 192 posts
ada demo atau hasilnya gak,,
liat donk,,!!!

#3
first1

    PrestaShop Addict

  • Moderators
  • 546 posts
I might have the same problem
et me tell you what i have reached so far: – I noticed that there are some files being created in the /img/tmp directory with permission 600. i cant change their permission because the owner of these files is nobody (the php script). and i think that is why they are not been generated and put in the /img/tmp folder.
-I asked the hosting support people and they told me that the script should not write them with nobody as owner.
so now they removed safemode and they dont allow nobody to write to my domain, so now no files are generated at all
not in the tmp and not in the p folder.
we need someone to guide us as it is a big problem for many people, come one guys, someone clever might understand this. i am happy to work with someone even on phone to troubleshoot it.
If we answered your question, please add [Solved] at the beginning of your topic’s title by editing your first post !
Thanks.

#4
caparuni

    PrestaShop Apprentice

  • Members
  • PipPip
  • 292 posts

From 1239640318:

ada demo atau hasilnya gak,,
liat donk,,!!!


http://cakram.net/ hasil import semua dari csv, 421 produk. kalo tutorialnya ke http://www.prestasho...g_Product_Data/ ini ajah, gw juga ingikutin dr sini
[mod-id] Prestashop for Indonesian

kartunama.biz chenoel.com

phpMyAdmin / File Explorer / Thumb Popup
please send donation to support me making free modules. check my profile for complete module list

#5
caparuni

    PrestaShop Apprentice

  • Members
  • PipPip
  • 292 posts
first1 the problem is in ur hosting not in ps. every time the php uploading a filem the permision of the file will be the same with http user/group, since in ur hosting didnt asign a user/group for http service then nobody/nogroup will be asign for an uploaded file. there an options in httpd.conf about user/group for http service, after that still need to add user based on what you set on http.conf. so the solutions on this depend on ur hosting company, since u didnt have a root password ;))
lets make some simple upload script, upload it on the server, and try it. if file is uploaded normaly then the problem is ps.
[mod-id] Prestashop for Indonesian

kartunama.biz chenoel.com

phpMyAdmin / File Explorer / Thumb Popup
please send donation to support me making free modules. check my profile for complete module list

#6
first1

    PrestaShop Addict

  • Moderators
  • 546 posts
I started to like this, it seems that you know what you are talking about. thanks for trying to help.

How do I test it?
What should my host provider change (can you give me specific instruction and i will pass it to them)?
Do you think it is why i cant get the import to work?

Thanks again,
If we answered your question, please add [Solved] at the beginning of your topic’s title by editing your first post !
Thanks.

#7
first1

    PrestaShop Addict

  • Moderators
  • 546 posts
as well What script should i make to test it?
If we answered your question, please add [Solved] at the beginning of your topic’s title by editing your first post !
Thanks.

#8
caparuni

    PrestaShop Apprentice

  • Members
  • PipPip
  • 292 posts
http://www.php.net/m...post-method.php theres a sample about uploading files...


<form enctype="multipart/form-data" action="__URL__" method="POST">
<!-- MAX_FILE_SIZE must precede the file input field -->
<input type="hidden" name="MAX_FILE_SIZE" value="30000" />
<!-- Name of input element determines name in $_FILES array -->
Send this file: <input name="userfile" type="file" />
<input type="submit" value="Send File" />
</form>

<?php
// In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used instead
// of $_FILES.

$uploaddir = '/var/www/uploads/';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);

echo '
';
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
} else {
echo "Possible file upload attack!\n";
}

echo 'Here is some more debugging info:';
print_r($_FILES);

print "
";

?>


dont forget to change the $uploaddir to your directory (chmod 777) on server, upload this to a server, try to upload some file
[mod-id] Prestashop for Indonesian

kartunama.biz chenoel.com

phpMyAdmin / File Explorer / Thumb Popup
please send donation to support me making free modules. check my profile for complete module list

#9
first1

    PrestaShop Addict

  • Moderators
  • 546 posts
Ok i have created a file called test.php and pasted the above code in it. I have changed the $uploaddir = '/var/www/uploads/'
to $uploaddir = '/test'

I have created a new folder called test with permission 777 and it is located right under the public_html

It did not work, when i run the test.php and send file, the page gets redirected to another page which prestashp's header and look and it says
We're sorry, but the Web address you entered is no longer available.
To find a product, please type its name in the field below (it is like inside the shop page if you know what i mean).
so i cant tell what this page is trying to say before it gets hijacked
If we answered your question, please add [Solved] at the beginning of your topic’s title by editing your first post !
Thanks.

#10
caparuni

    PrestaShop Apprentice

  • Members
  • PipPip
  • 292 posts
my quick guessing because u turn on the Friendly URL in ps, turn off that 1st and dont forget to rename .htaccess
[mod-id] Prestashop for Indonesian

kartunama.biz chenoel.com

phpMyAdmin / File Explorer / Thumb Popup
please send donation to support me making free modules. check my profile for complete module list

#11
first1

    PrestaShop Addict

  • Moderators
  • 546 posts
I SENT YOU A PM
If we answered your question, please add [Solved] at the beginning of your topic’s title by editing your first post !
Thanks.

#12
first1

    PrestaShop Addict

  • Moderators
  • 546 posts
Can someone help with this please
If we answered your question, please add [Solved] at the beginning of your topic’s title by editing your first post !
Thanks.

#13
first1

    PrestaShop Addict

  • Moderators
  • 546 posts
I have disabled friendly URL , and renamed .htaccess

everytime i import 3 products, i get 3 new files in /img/tmp
/img/tmp/ps_import8kvyyZ
/img/tmp/ps_importmjaTi7
/img/tmp/ps_importoVPZmd

I get something like these names. and /img/p stays empty

Why are these pictures are getting stuck in the /img/tmp directory?
If we answered your question, please add [Solved] at the beginning of your topic’s title by editing your first post !
Thanks.

#14
caparuni

    PrestaShop Apprentice

  • Members
  • PipPip
  • 292 posts
the image gonna be copied to .../img/p/. check the folder permision first, must be 777
btw, u using what version of ps? on 1.1 theres a bug about image import, is better if u upgrade it to 1.2
[mod-id] Prestashop for Indonesian

kartunama.biz chenoel.com

phpMyAdmin / File Explorer / Thumb Popup
please send donation to support me making free modules. check my profile for complete module list

#15
first1

    PrestaShop Addict

  • Moderators
  • 546 posts
Yes they should be generated to /img/p but they are getting stuck in the tmp directory.
permission to the /img and all its subfolders 777
i am using 1.2
If we answered your question, please add [Solved] at the beginning of your topic’s title by editing your first post !
Thanks.

#16
caparuni

    PrestaShop Apprentice

  • Members
  • PipPip
  • 292 posts
hmmm... i can help help you any longer, since in my ps all worked.. try to search on bug sections and ask ur problem there...
[mod-id] Prestashop for Indonesian

kartunama.biz chenoel.com

phpMyAdmin / File Explorer / Thumb Popup
please send donation to support me making free modules. check my profile for complete module list

#17
devo

    PrestaShop Apprentice

  • Members
  • PipPip
  • 106 posts
first1, caparuni, everybody: I have exactly the same problem! Only generated files in img/tmp (chmod 777 !!!) with names e.g. ps_importaP7an6 and 0 bytes (?). Nothing in img/p (chamod 777). Please any advice? Thanks!!

#18
first1

    PrestaShop Addict

  • Moderators
  • 546 posts
sorry, i never managed to resolve this one
If we answered your question, please add [Solved] at the beginning of your topic’s title by editing your first post !
Thanks.

#19
devo

    PrestaShop Apprentice

  • Members
  • PipPip
  • 106 posts
Thanks! It seems to be a tragedy :-S Nobody knows?