Jump to content

Import Pack VIA Csv


Recommended Posts

I'm capable of building a website for nearly everything..but when it comes to databases and things like that I don't know too much.. I tried searching around for a module in relation to this but couldn't find anything.  I looked around phpMyAdmin a bit and noticed that there are multiple tables that control the packs.  If you figure anything out please let me know!  I will do the same if I find something that might help..

Link to comment
Share on other sites

Yeah, if you look at my post history you will see that I've built a bunch of stuff in the past month, for example this simple "update order state via CSV upload". My client needs this feature and it seems I have to solve it. Most probably I will build a separate module, because the AdminImportController is too complex.. or maybe I should print out the code on paper and study it in minute detail, taking notes and taking my time. I will see tomorrow.

Link to comment
Share on other sites

I'm taking baby steps here.. went through the db tables and made notes of what I need to create packs. When importing, we need to first import all "base products" and after that in a separate pass all the packs that depend on (some of) those products. Do we have to do manual id matching in the CSV for the products and their packs? Could be automated, if we agreed to stick to a naming scheme which would allow us to match the packs with their products automatically.

 

I'm not even taking to account attributes.. sorry, I don't need them.

ps_stock:
id_stock     id_warehouse     id_product     id_product_attribute     reference     ean13     upc     physical_quantity     usable_quantity     price_te
1     1     8     0     testttt             42     42     5.000000

ps_warehouse_product_location:
id_warehouse_product_location     id_product     id_product_attribute     id_warehouse     location
3     10     0     1     
4     11     0     1     

ps_product:
id_product     id_supplier     id_manufacturer     id_category_default     id_shop_default     id_tax_rules_group     on_sale     online_only     ean13     upc     ecotax     quantity     minimal_quantity     price     wholesale_price     unity     unit_price_ratio     additional_shipping_cost     reference     supplier_reference     location     width     height     depth     weight     out_of_stock     quantity_discount     customizable     uploadable_files     text_fields     active     redirect_type     id_product_redirected     available_for_order     available_date     condition     show_price     indexed     visibility     cache_is_pack     cache_has_attachments     is_virtual     cache_default_attribute     date_add     date_upd     advanced_stock_management
10     0     0     2     1     1     0     0             0.000000     0     1     20.000000     0.000000         0.000000     0.00                 0.000000     0.000000     0.000000     0.000000     2     0     0     0     0     1     404     0     1     0000-00-00     new     1     1     both     1     0     0     0     2013-10-18 22:42:07     2013-10-18 23:11:21     1
11     0     0     2     1     1     0     0             0.000000     0     1     1000.000000     0.000000         0.000000     0.00                 0.000000     0.000000     0.000000     0.000000     2     0     0     0     0     1     404     0     1     0000-00-00     new     1     1     both     1     0     0     0     2013-10-18 22:52:25     2013-10-18 22:54:40     1

ps_product_lang:
id_product     id_shop     id_lang     description     description_short     link_rewrite     meta_description     meta_keywords     meta_title     name     available_now     available_later
10     1     1             kilo-testibulkkituotetta                 Kilo testibulkkituotetta         
10     1     2             kilo-testibulkkituotetta                 Kilo testibulkkituotetta         
11     1     1             10-kg-testibulkki                 10 kg testibulkki
11     1     2             10-kg-testibulkki                 10 kg testibulkki         
 
ps_pack:
id_product_pack     id_product_item     quantity
10     8     4
11     8     40
Edit: found this, it is more complete: http://www.prestashop.com/forums/topic/260734-php-class-class-for-import-insert-products-directly-into-database/

Have to study it..

Edited by Beluga (see edit history)
Link to comment
Share on other sites

I didn't even realize it was controlled by that many tables.

 

My process for packs is this:

 

1. Upload items that the packs will be comprised of (ex: CURT-13002, CURT-56096, CURT-40004, CURT-45020, CURT-21500)

 

2. Upload the items that will be turned into packs (ex: CURT-13002-56096-40004-45020-21500)

 

3. Go into the specific products and attach each individual item

 

I, along with others I'm sure, can handle the whole bulk import of individual products as well as importing the product that will be a pack.  But a module that we can import the ID of the pack item along with IDs of the individual products in that pack would be desired.

 

I'm not sure if I am wording this all correctly, but in my mind that is what would be easiest?  I could be wrong..

 

 

  • Like 1
Link to comment
Share on other sites

Yeah I was kind of thinking too complicated at first.. With this great modification to the AdminImportController, we can import stuff to the warehouse when using advanced stock management. Thus I only have to create a module to turn the "packs-to-be" products into actual packs by looking at the references of the products and matching them. It also has to get the quantity value of the packs and move it to the "quantity of product in pack" and reset the quantity imported from the original CSV to zero.

Edited by Beluga (see edit history)
Link to comment
Share on other sites

Hey,

 

So I just am looking over your posts and curious as to how it is working out?  Is it still written to only work with your setup?  Would hate to try and install it and only end up frustrated!

 

Thanks,

 

Jordan

Yes, you would have to modify it to match your naming scheme, but I guess it wouldn't be that hard (I have commented the code quite thoroughly). It works ok even though it doesn't give confirmation messages. However, Samar's import modifications would IMO need to be modified in a way that we can import straight into a warehouse and not have to do an update specified with the product IDs. This would save a lot of hassle. But Samar hasn't answered yet and I haven't yet taken a proper look at his code. If you use Samar's importer, note that you have to always specify a unit price in the CSV when adding quantities to warehouse.

Link to comment
Share on other sites

  • 7 months later...

i have had intermittent success with importing the pack table using phpMyadmin.  my problem is that i cannot determine what part of my process is causing the intermittent failures.

 

my process:

  1. i first import all of the components of my packs (with Store Manager).
  2. then i import the "packs" as individual products (again with Store Manager).
  3. then i change the "cache_is_pack" for those products to a "1".
  4. then i use phpMyAdmin to import the ps_pack table.

this has worked in the past, but maybe i am missing a step because i am not seeing the components of my pack showing up.

 

you can see it working here (sorry, the SSL cert isn't up to date, yet):

https://cat.classroomlibrarycompany.com/curriculum-kits-name/18926-bullied-what-every-parent-teacher-and-kid-needs-to-know-about-ending-the-cycle-of-fear-9781456949723.html

 

and here it's not:

https://ss.classroomlibrarycompany.com/index.php?id_product=1461&controller=product

 

any input on what i could be doing differently would be greatly appreciated.

thanks.

 

Link to comment
Share on other sites

  • 1 month later...
  • 2 weeks later...

dear ultimate,

i have not found an application.  however, i have found that the process noted above is in the right order and should hit all of the important steps. the problem i was running into was that the data has to be immaculately clean.  if there are any duplicate rows, it will choke.  also (and this one really got me), be aware of any white space rows at the top or bottom.  for some reason the application for import likes to add these on its own and these are also seen as duplicates... which cause it to choke.

 

sorry.  it's not necessarily a solution, but this is what was tripping me up.

good luck.

bs

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...