How to approach dilemma: export orders from old ma

2019-07-22 20:22发布

During an upgrade from Magento 1.5 to 1.7 unfortunately we had to reinstall Magento (don't ask) and now I need to get all of the old order information into the live upgrade. I've researched several scenarios. First would be identifying the tables in the database they correspond to and migrating those tables over, but I have three issues with that. One: I already did a little bit of that and because of the discrepancies between 1.5 and 1.7 caused several hours of debugging fun. Two: I can't figure out specifically which of these freaking tables needs updating (was going to just replace all sales_ tables). Third: since the upgrade other orders have been placed, and as you know, started order ids all over again and I don't want those entries to get replaced.

My other choice is to attempt to build an extension like this one: http://www.magentocommerce.com/magento-connect/dataflow-batch-import-export-orders-to-csv-xml.html. I already started but alas am already stuck on the oAuth process.

Before I waste anymore time, I'd like some advice. What would be the best way to go about this process?

Update 1-17

I have tried UNION queries on applicable tables but of course I get error "#1062 - Duplicate entry '1' for key 'PRIMARY'" being there are several primary keys. Is there a query to increment those primary keys of the new orders to follow after the ids of the old orders? I tried to do this in individual columns via UPDATE sales_flat_invoice_grid SET increment_id = (increment_id+6150) or similar, but the ids are mapped to the ids on other tables! Please help! I'm afraid I'm going to have to tell boss that we need to buy that extension.

1条回答
叼着烟拽天下
2楼-- · 2019-07-22 20:53

Continued from comment above ^^

hmmm .. If that's the case, the way I've done exports/imports in the past (see my post HERE) is use MySQL Workbench EER Modeling tool to create myself a diagram of the order storage system. I would select only one table at first, then MySQL will tell you what other tables are tied to that table. I repeat this process so that in my EER diagram, I don't have unnecessary tables, and I am not missing tables. I end up with exactly the number of tables I need to understand the flow.

Next, do the same for your 1.7 setup ... And compare. You will need to generate a SQL query that will not only INSERT the 1.5 orders into the 1.7 database, but you may need to create your own link table in case there is an ID that is used, you may need to link X to Y by way of Z. It's messy, and a little confusing, but I spent 3 weeks writing a SQL/PHP script that pulled 1) Product Data, 2) Category Data, 3) Customer Data and 4) Order Data. I also wrote one for Admin backend users and preferences. This was before I discovered the aforementioned tool.

EDIT I might add , that extension is only $200.00. How much in development time is it going to cost your employer for you to develop your way out of this? Depending on your hourly cost (I know with what I charge, $200 would be a steal) it may make more sense to get the extension.

查看更多
登录 后发表回答