Upgrade path for Amazon associate tools module?
asb - March 8, 2008 - 14:33
| Project: | Amazon Module |
| Version: | 6.x-1.0-beta7 |
| Component: | Miscellaneous |
| Category: | feature request |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | needs work |
Description
Hi,
I'm not sure if this was asked before; since the Amazon associate tools module is abandoned for over a year and the maintainer already declared that he will not port the module to Drupal 6.x, the question arises, if there will be an upgrade path (or something like this) for data from Amazon associate tools module.
Thanks & regards, -asb

#1
Yes. I've got a very rough skeleton 'Amazon Associate Tools legacy' module that takes control of AAT's two existing node types and allows any existing data to continue in use. Moving forward, though, I'm hoping to keep the CCK field as the primary integration point with the node system.
#2
Rather than preserve existing amazon nodes I'd like a route where those nodes can be converted to an equivalent CCK-based node type. On one of my sites I have hundreds of amazon nodes.
#3
Same here, with several thousands of "Amazon" and "Amazon item" nodes on a bunch of sites. However, migrating them to CCK-based node types programmatically is not trivial, if you have a mixture of DVDs, CDs, books and other stuff amazon is offering.
It might be possible to code a solution for sites facilitating exactly one product type from Amazon (like books), or for sites with very solid tagging.
I think, most of us will be stuck with 'Amazon Associate Tools legacy' module for a long, long time. I'm pretty glad that we have at least this migration path!
Greetings, -asb
#4
Sorry to be redundant and ask for clarification, but the info I've been reading in regards to the Amazon Assoc Tools is conflicted.
This is my understanding based on what I just read in this post. The basic affiliate links will work in the new Amazon module, but you are just trying to further refine it to do something else.
In other words, if I used the Drupal 5 + the regular amazon assoc tools, I could upgrade to Drupal 6 + the new amazon.module and my affiliate links would continue to work?
Thank you for sharing your knowledge with those of us Drupal users who do not have your skills. I bow to you each day before turning on the computer.
Ashford
#5
I just upgraded to Amazon for Drupal 6, and I cannot get this module to work at all, starting with new CCK fields and data. The old associates module worked for me though, so I'm not sure if there aren't some major bugs affecting people with this. See http://drupal.org/node/269335
I'm glad Amazon wasn't "mission critical" for me. If it is critical for you, I would stick with Drupal 5 or test with a development environment first.
#6
@Ashford:
> This is my understanding based on what I just read in this post: The basic affiliate links will work in the new Amazon module,
> but you are just trying to further refine it to do something else.
> In other words, if I used the Drupal 5 + the regular amazon assoc tools, I could upgrade to Drupal 6 + the new amazon.module
> and my affiliate links would continue to work?
I'm still not sure what Amazon.module for D6 is supposed to do and what to do not, but as far as I can see, it only offers a partial upgrade path, at best. My testings so far show that you will lose all "amazon" and "amazon-node" content; those Amazontools-specific content types are IMHO not handled (i.e.: not migrated) through Amazon.module at all; the nodes still exist in some kind of limbo, but don't show affiliate links anymore, and can't be edited. Of course, your Amazontools setting aren't handled by the upgrade, also.
In my testing scenarios, neither CCK fields of the "ASIN/ISBN" type were migrated, nor "Related product(s)" attached to other legacy content types like "story" or "blog" through an "Related Amazon.com product id" field: They don't show up after the migration, either. As far as I have learned so far, practically any Amazontools content gets lost during the migration. However, I'll have to investigate this further.
Please keep in mind that the Amazon.module is as of this writing still Beta and it never promised a full upgrade path for Amazontools module. I think we'll have to stick with D5 for some more time; maybe someone is able to contribute a migration script, similar to the migration from Image.module to CCK Imagefield.
Greetings, -asb
#7
Btw...:
> Yes. I've got a very rough skeleton 'Amazon Associate Tools legacy' module that takes control of AAT's two existing node types
> and allows any existing data to continue in use.
@Eaton: I seem to be unable to enable this 'Amazon Associate Tools legacy' module; is this already part of the new "Amazon" module, or more some kind of concept in your huge drawer of Drupal treasures??
Greetings, -asb
#8
Hi,
I'm sorry to sound impatient - but: Is there any progress regarding an upgrade path for the Amazon associate tools module since March 2008?
On our D5 sites more and more contributed modules become "unsupported", thus "Update status" issues warnings on a daily basis; because the Amazon associate tools won't be upgraded to D6, my upgrade path is blocked; I'm not even sure how long Drupal 5 core will be supported.
So please give us an update, or a short notice, if there's anything we can do to help.
In the meantime, I'm changing the status to "critical"; please change it back if you disagree.
Thank you very much & greetings, -asb
#9
I noticed that the aat_legacy directory has been emptied on cvs.drupal.org. Is that because the legacy support didn't work very well? Are there any plans to bring it back? This is a critical feature for our site...
#10
The code posted below is a rough version of a script to import Amazon Associate Tools nodes into the new Amazon module. Note that it still contains code specific to my site's implementation of the module (i.e., the part of the code that imports taxonomy terms), but this should at least give you a base to build off when creating your own import solution.
Also note that the code has *not yet been tested* on more than one node at a time. If that scares you, wait & I should have a tested version soon. I thought considering how important this feature is that I should get this out as soon as possible.
To run this code, just put it in a page & set the input filter to PHP code. A more refined version should be coming.
<?php
/* 5.x Amazon.module -> 6.x Amazon.module import script by EvanDonovan, 4/17/09
Based on <a href="http://www.lullabot.com/articles/quick_and_dirty_cck_imports
Cf" title="http://www.lullabot.com/articles/quick_and_dirty_cck_imports
Cf" rel="nofollow">http://www.lullabot.com/articles/quick_and_dirty_cck_imports
Cf</a>. the comments, starting with the one titled "D6" */
module_load_include('inc', 'node', 'node.pages'); // Needed for drupal_execute as per API docs
$amazon_nodes = db_query("SELECT * FROM {amazonnode} LIMIT 1"); // Get nodes from Amazon.module -- remove the LIMIT 1 if you want to try this with multiple nodes at a time
while ($amazon_node = db_fetch_object($amazon_nodes)) { // Iterate through the nodes
// Make an Amazon book node & create an alias for it
$node = array('type' => 'amazon_book', 'pathauto_perform_alias' => 1);
$amazon_details = db_fetch_object(db_query("SELECT * FROM {amazonitem} WHERE asin = %d", $amazon_node->asin)); // Get the extended info for the old Amazon nodes
$form_state = array(); // form_state is needed for drupal_execute
// Set Node Basics
$form_state['values']['title'] = $amazon_details->title; // Node title
$form_state['values']['teaser'] = $amazon_details->editorialreview; // Node teaser
$form_state['values']['body'] = $amazon_details->editorialreview; // Node body (the same)
// Set CCK Field
$form_state['values']['field_amazon_item'][0]['asin'] = $amazon_node->asin; // ASIN (needed to pull data from Amazon API)
// Get Taxonomy Terms
/* $old_node = new stdClass();
$old_node->vid = db_result(db_query("SELECT MAX(vid) FROM {node_revisions} WHERE nid = %d", $amazon_node->nid));
$terms = taxonomy_node_get_terms($old_node); */
/* This method is too awkward b/c of the way that taxonomy_node_get_terms returns its results.
Instead I will go 1 vocabulary at a time & use the helper functions from um_common.module */
$voc_12 = taxonomy_node_list_terms_by_vocabulary($amazon_node->nid, 12);
$voc_3 = taxonomy_node_list_terms_by_vocabulary($amazon_node->nid, 3);
$voc_7 = taxonomy_node_tid_array_by_vocabulary($amazon_node->nid, 7);
$voc_10 = taxonomy_node_get_tid_by_vocabulary($amazon_node->nid, 10);
$voc_8 = taxonomy_node_tid_array_by_vocabulary($amazon_node->nid, 8);
$voc_43 = taxonomy_node_tid_array_by_vocabulary($amazon_node->nid, 43);
$voc_11 = taxonomy_node_tid_array_by_vocabulary($amazon_node->nid, 11);
$voc_24 = taxonomy_node_tid_array_by_vocabulary($amazon_node->nid, 24);
$voc_4 = taxonomy_node_get_tid_by_vocabulary($amazon_node->nid, 4);
$voc_5 = taxonomy_node_tid_array_by_vocabulary($amazon_node->nid, 5);
// Set Taxonomy Terms
if($voc_12 != '') { $form_state['values']['taxonomy']['tags']['12'] = $voc_12; } // Speaker/Author (free-tagging, terms as comma-delimited string)
if($voc_3 != '') {$form_state['values']['taxonomy']['tags']['3'] = $voc_3; } // Other Tags (free-tagging, terms as comma-delimited string)
if(count($voc_7) > 0) { $form_state['values']['taxonomy']['7'] = $voc_7; } // Audience (array of tids)
if($voc_10 != '') { $form_state['values']['taxonomy']['10'] = $voc_10; } // Category (tid as string)
if(count($voc_8) > 0) { $form_state['values']['taxonomy']['8'] = $voc_8; } // Channel/Issue Area (aot)
if(count($voc_43) > 0) { $form_state['values']['taxonomy']['43'] = $voc_43; } // Content Display (aot)
if(count($voc_11) > 0) { $form_state['values']['taxonomy']['11'] = $voc_11; } // Content Type (aot)
if(count($voc_24) > 0) { $form_state['values']['taxonomy']['24'] = $voc_24; } // TM Program Affiliation for Content (aot)
if($voc_4 != '') {$form_state['values']['taxonomy']['4'] = $voc_4; } // UrbanResource.net (tid as string)
if(count($voc_5) > 0) { $form_state['values']['taxonomy']['5'] = $voc_5; } // Organization Affiliation (aot)
// Settings needed to create the node
$form_state['values']['is_new'] = TRUE; // New node
$form_state['values']['status'] = 1; // Published
$form_state['values']['op'] = t('Save'); // Save it!
//kprint_r($form_state);
drupal_execute('amazon_book_node_form', $form_state, (object)$node); //Programmatically submit this to the Amazon Book form
}
?>
#11
I forgot to include the taxonomy functions in my last post. You'll need to include those if you want the script to run (unless you comment out those lines). They are as follows:
<?php
function taxonomy_node_list_terms_by_vocabulary($nid, $voc_id) {
$node = new stdClass();
$node->vid = db_result(db_query("SELECT MAX(vid) FROM {node_revisions} WHERE nid = %d", $nid));
$terms = taxonomy_node_get_terms_by_vocabulary($node, $voc_id);
$term_list = "";
foreach($terms as $term) {$term_list .= $term->name . ", "; }
$term_list = rtrim($term_list, ", ");
return $term_list;
}
function taxonomy_node_tid_array_by_vocabulary($nid, $voc_id) {
$node = new stdClass();
$node->vid = db_result(db_query("SELECT MAX(vid) FROM {node_revisions} WHERE nid = %d", $nid));
$terms = taxonomy_node_get_terms_by_vocabulary($node, $voc_id);
$tid_array = array();
foreach($terms as $term) {$tid_array[$term->tid] = $term->tid; }
return $tid_array;
}
function taxonomy_node_get_tid_by_vocabulary($nid, $voc_id) {
$node = new stdClass();
$node->vid = db_result(db_query("SELECT MAX(vid) FROM {node_revisions} WHERE nid = %d", $nid));
$terms = taxonomy_node_get_terms_by_vocabulary($node, $voc_id);
foreach($terms as $term) {$tid = $term->tid; }
return $tid;
}
?>
#12
Subscribing (and playing with that highly interesting upgrade path toy, thank you EvanDonovan !)
#13
Somehow the text of this comment got lost. Anyway, attached is the updated version of the script, tested to work with 100 nodes at once. When added to a page in the PHP input format, it shows a link that you click to start the import.
#14
Here's an updated version of the script. I added stripslashes() in, so that the editorialreview field won't have the annoying backslashes in it when it's turned into the node body.
#15
subscribe :)
#16
subscribe
#17
Hi,
the project page still reads: "Also in the works is an automated upgrade path for users of Drupal 5's Amazon Associate Tools module."
Is there any progress with this task? Since more and more modules become unsupported for D5, I'm getting quite nervous about not even having seen the outline of a migration route yet...
Is there anything we non-developers can do to help, e.g. testing development versions?
Thanks & greetings, asb
#18
Hi Evan,
thank you for your efforts to at least start working on an upgrade path!
I took some time on the weekend to try a sandbox upgrade since an "official" upgrade path seems... let's say "unsure" at the moment. I was hoping to get an idea what your script would to, not expecting a click-and-run-solution. That said, here's my approach:
After upgrading core, then cck, then date, then installing "amazon" module, the first error (related to the upgrade of "amazontools" data) I encountered when running update.php:
user warning: Table 'migration_drupal.amazon_item' doesn't exist query: ALTER TABLE amazon_item ADD mpn varchar(128) in /var/www/migration/update.php on line 69....
The following queries were executed
amazon module
Update #6001
Failed: ALTER TABLE {amazon_item} ADD mpn varchar(128)
(No idea what this means and if this has any effect on your script)
Then I created, as instructed, a node with the PHP input filter; saving this resulted in a node with a link "start Amazon node import: rows 0 to 99"; clicking on this, resulted in "continue Amazon node import: rows 101 to 200", then it went back to "start Amazon node import: rows 0 to 99". Nothing else happened accorting to ./tracker or ./recent_changes. According to ./admin/reports/systeminfo I now have
* amazon 2042 nodes
* amazon_node 6023 nodes
Beforde the D5->D6 upgrade (and before running the import script):
* Review (= amazon) 2042 nodes
* Product (= amazon node) 6023 nodes
None of these node type are selectable/filterable from ./admin/content/node. Old nodes from "Amazontools" have still no nodetype anymore, are not connected to Amazon's ECA REST interface or whatever (meaning: they don't show a cover image or pricing information), and they're not editable. Neither data from Amazon associate tools 5.x-1.6, nor from the ISBN/ASIN 5.x-1.4 CCK field (re-) appears. As far as I have seen, absolutely no content has been migrated or even touched.
If your time permits maybe you could write a few words about your script, targeted to those without coding skills: What does it do, what is the expected behaviour? What has to be modified to make it work in a different environment? What skills are required to use the script? Or asked the other way aroung: Will people without substancial coding skills have any chance to use this script?
Thanks & greetings, -asb
#19
asb:
To be honest, I haven't run the update script in several months. It is a very hackish solution & relies on several assumptions that I could make only because I knew the configuration of my site. I posted it up here since I thought something is better than nothing. I am not sure whether it will help people without coding skills. I don't have a great deal of PHP knowledge myself, however, and I based the script off of several things I saw on Drupal.org & most specifically off http://www.lullabot.com/articles/quick_and_dirty_cck_imports. If you have any interest in importing or exporting data from a Drupal site, I highly recommend you read that article, as the details given in it and the comments are the foundation for my script.
If you are not interested in coding, I highly recommend you try the latest version of the Amazon module (the dev version) because it contains an Amazon Legacy module which is more sophisticated in some respects than my solution. It won't create nice new CCK nodes for you, so you may not be able to use things like the Amazon Store module, or even, I think, get updated data, but you won't have to run a script. Basically, it looks like the Amazon Legacy module just makes your old Amazon nodes appear to have an ASIN field in the new format, so they will show up again.
That said, on to the documentation of my script: I know it may seem unusual that it is a click & run script, but that's because something more sophisticated (like Batch API) is currently beyond my coding abilities. Note that it will not actually turn any of your existing nodes into nodes of the new Amazon module. Instead, it will create new nodes programmatically which have the same information represented in the new format.
Before testing the script, ensure that you are using the most up-to-date version of the script (the one I actually used) is in #14. I don't have time to be too detailed in documenting the script tonight, but here's a few key assumptions that it makes:
1) You have a CCK content type with the machine name of "amazon_book".
2) You have the Pathauto module enabled.
3) Your new CCK content type has an Amazon Item field called "field_amazon_item".
4) You have taxonomy terms on your books in particular vocabularies (vid's).
Assumptions 1 & 2 you can alter accordingly for your site by changing the line that reads
$node = array('type' => 'amazon_book', 'pathauto_perform_alias' => 1);. If you do change the name of the node type, make sure to change the name of the form (in the line starting withdrupal_execute) to match.The first part should be the machine name of your CCK content type (that is, the content type which you create to have an Amazon Item field in it). The second part should be removed if you aren't using Pathauto.
Assumption 3 you can alter accordingly for your site by changing the line that reads
$form_state['values']['field_amazon_item'][0]['asin'] = $amazon_node->asin;Assumption 4 you should work around by either removing all the Get & Set Taxonomy Terms code from the middle of the script, or else (if you feel confident about it), altering the second parameter of my
taxonomy_node_tid_array_by_vocabularycustom function to the proper vocabulary id.Beyond these four assumptions there may be other things that the script assumes which I currently have forgotten about. I know that the script did not run exactly the same in my production site as it had in testing. I believe we ended up having to run it as admin (user 1). You definitely have to run it with a user who has the privilege to create nodes of the new Amazon Book type & to both view & edit the Amazon Item field in them.
You can tell if the script has run correctly because the script will get filled with green messages saying "Book Name has been created". You will also be able to see the new nodes on admin/content/node.
Once the number of Amazon Book nodes equals the number of Amazon nodes you had under the old module, you can go ahead & delete the old Amazon nodes. But this may be difficult, especially if you have a lot of them, and it doesn't hurt anything to leave them in there.
#20
Hi Evan,
thank you very much for the explanations, I'll play around the these parameters even if I don't fully understand what the Taxonomy section does. At least when matching the CCK content type (e.g. "film" instead of "amazon_book") and the ASIN field (e.g. "field_asin" instead of "field_amazon_item") it still does not create new nodes for me.
However, I ran into another issue (I had experienced before with other migration attempts, when abandoned modules were involved): CCK does neither disply nor allow to edit these abandoned CCK fields:
This content type has inactive fields. Inactive fields are not included in lists of available fields until their modules are enabled.ASIN (field_asin) is an inactive Amazon item field that uses a asin widget.
CCK requires a widget to get access to those data back; in other cases I tried to manipulate the database directly to force CCK into deisplaying those fields (based on suggestions from 500360; my attempt), which led - due to the unmanageable complexity of CKK - nowhere except to a bunch of follow-up errors. As far as I have understood your script, those ASIN fields (coming from the abandoned ASIN Field modules) couldn't be handled by your script anyway?
Thanks & greetings, -asb
#21
I'm not sure what the field_asin is. You need to create a field that is of the type Amazon Item, which comes from the Amazon module. Otherwise, the script will not work.
I would highly recommend you try upgrading to the latest dev of Amazon module. I haven't tested it myself, but there is an Amazon Legacy module which should be much easier to use. In fact, I would suggest that everyone who is following this thread should test the Amazon Legacy module. If it works as advertised, then I think we can finally mark this thread fixed.
#22
> I would highly recommend you try upgrading to the latest dev of Amazon module. I haven't tested it myself,
> but there is an Amazon Legacy module which should be much easier to use.
That's what I'm hoping for many, many months.
Enabling Amazon legacy support from 6.x-1.x-dev (2009-Jun-25) results in:
Fatal error: Cannot use object of type stdClass as array in /var/www/migration/sites/all/modules/amazon/aat_legacy/aat_legacy.install on line 13The module simply can not be anabled.
Greetings, -asb
#23
aat_legacy module is definitely incomplete. (As can be seen from the crashing...) The first portion of upgrade code for the 'ASIN' CCK field type from Drupal 5 has been committed to the -dev branch. Once the CCK field has a clean upgrade path, I'll try to put together some utility functions to migrate an old-style amazon node to a new CCK-field type.
#24
The script that was posted above appears to be very specific to one site's specific set of taxonomy terms and CCK field types.
#25
EDIT: this comment is a bit verbose. Scroll to the next comment for the condensed version.
asb:
Ok, I guess that rules out the aat_legacy module, at least for now. I hadn't tested it myself, since I had already imported my site's Amazon nodes using the script I posted above. Sorry if I misled you; I thought from a quick scan of that module's code that it might work.
I quickly reviewed the code of the ASIN Field module & it looks like it is storing its information in the {amazonnode} table, just like the default Amazon Associate Tools node types (which my script was built for). So the script should be able to import data, as long you have made the proper changes to it, as I described in #19.
What I meant to say in #21 was that the content type that will be "receiving" the old Amazon nodes' content has to have a CCK field from the 6.x Amazon module in it. The name of this field should not matter if the script is modified as I stated above:
[change] the line that reads
$form_state['values']['field_amazon_item'][0]['asin'] = $amazon_node->asin;The modifications for the taxonomy terms are definitely trickier. You need to know what the vid's are for the vocabularies on your legacy Amazon nodes and make sure that the same vocabularies are available on the "receiving" 6.x Amazon content type. If you can't figure that part out, you may simply remove it from the script.
So here are the steps for running the script, best as I can tell:
1) Log in to your site as admin (uid 1) -- the script may not run otherwise.
2) Install & enable the 6.x Amazon module, ensuring that all its tables have been created correctly. (You mentioned an error relating to {amazon_item} in #18. Check to make sure that table exists.)
3) Configure the Amazon module.
a) Set up your Amazon Web Services key & test to make sure it is properly pulling data from Amazon.
b) Create a new content type to "receive" the data from your legacy Amazon nodes. To match my script, give this content type the machine name of "amazon_book". Otherwise, you will need to alter my script.
c) Create a new field of type Amazon Item. To match my script, give this field the machine name of "field_amazon_item". Otherwise, you will need to alter my script.
d) (OPTIONAL) Add the same vocabularies to your new content type as were on your legacy Amazon nodes.
4) Perform the Amazon node import.
a) Copy my script from #14 into a node & select the PHP input format. (Enable the PHP module & that input format if it is not available.)
b) (IF NEEDED) Modify the script as per #19 (i.e., changing the name of the "receiving" content type & "receiving" field, removing pathauto variable if necessary, altering or removing taxonomy import settings)
c) Click to run the script, repeating until all your Amazon items have been imported into the "receiving" content type. You will know when the script runs correctly because it will say Book name created, where "Book name" is the name of the Amazon item.
#26
Let me try to be more succinct :)
I'll play around the these parameters even if I don't fully understand what the Taxonomy section does.
Then remove the Taxonomy section, at least for a test.
At least when matching the CCK content type (e.g. "film" instead of "amazon_book") and the ASIN field (e.g. "field_asin" instead of "field_amazon_item") it still does not create new nodes for me.
I think you are matching based on the old CCK content type & CCK field. You need to create a new CCK content type & field in order to store the Amazon data in the new format. You can call the content type whatever you want, but the script won't have to be modified if you call it "amazon_book".
As part of this new CCK content type, you need to create a new CCK field of the type "Amazon item". Again, you can call it what you like, but the script won't have to be modified if you call it "field_amazon_item". (Make sure content permissions are set so that users in the role which will run the import script have the ability to view & edit this field.)
Sorry if my explanations have been confusing. Hopefully, this is a bit better.
#27
A quick note -- that only applies to the Drupal 5 version of the module. The D6 version of ASIN FIeld stores things in the 'proper' CCK way. Thus the in-progress import path for it.
#28
eaton: Thanks for the clarification. I think what I said in #26 applies in this case, though, since I believe asb is using the 5.x version of the module.
#29
I've just checked in an update to ASIN module that allows people using the ASIN field under Drupal 5 to migrate their CCK field data forward to D6 properly. The next step is a migration path for Amazon Associates Tools style 'amazonnode' content, but this is definitely a step in the right direction.
#30
Well, that sounds like it would fix asb's issue anyway. Great!
#31
Hi Eaton,
thank you for working on an upgrade path!
Trying to enable "Amazon legacy support" after upgrading to Amazon 6.x-1.0-beta7: Still no luck, damn! ;)
Fatal error: Cannot use object of type stdClass as array in /var/www/migration/sites/all/modules/amazon/aat_legacy/aat_legacy.install on line 13Any prerequisits I might have missed? Dancing three circles around the kitchen sink?
Greetings, -asb
#32
Alas, AAT_Legacy is still incomplete -- the upgrade path referred to in the above post is specifically for people who were using Amazon Associates Tools with the 'ASIN' module on Drupal 5 to add CCK fields that held Amazon products. the AAT Legacy module is/will be for those who were using the native 'amazonnode' content types...
#33
Hi,
thanks; I'm using both (native 'amazonnode' content types and 'ASIN' module) together, as probably most legacy users will do (the 'ASIN' field requires 'Amazontools', and, if I remember correctly, 'Amazontools' automatically creates the two native node types, so basically everybody using 'ASIN' field will also have those node types). So currently the migration path handles very special case where someone might have used 'Amazontools' exclusively to enable the 'ASIN' field and build own CCK content types on top of that, but has never touched 'amazon_node' and 'amazon' nodes. Such an setup I've never used, so there's currently nothing where I could help testing?
Thanks & greetings, -asb
#34
Related issuees:
* aat_legacy
* aat_legacy fixes
Greetings, -asb
#35
Relinking issues using the [#issue number] syntax, so that they will show up w/changing status color as they are worked on:
#541998: aat_legacy sub-module can't be enabled
#555624: aat_legacy fixes
#36
Thanks, Evan, for adding the proper linking to the related issues.
Is there any progress on this issue? (still stuck with D5...)
Thanks & greetings, -asb
#37
@asb:
Are you at all comfortable with using MySQL directly?
The DB admin at my organization was able to transfer 100's of nodes from a non-CCK type (Weblink) to a CCK type (Weblink CCK - which is just a node with a Link field) by first migrating the 'extra' node data from the non-CCK table ({links} in this case) to the table that was the CCK field ({content_field_weblink}), and then by changing the node.type field from "weblink" to "weblink_cck".
That migration was actually a lot easier and more effective than the export/re-import which my code in this issue does. So I would recommend that you pursue a similar route if possible.
Let me know if you need more specifics. I don't have a lot of time to devote, but I might be able to put a brief list of steps involved.
Actually, I do have one additional suggestion, which might be easier, though more tedious. You could consider using the Node Convert module. It would at least turn the nodes into the correct type, although it might not preserve the field data. It's worth a test, anyway.
#38
Eaton and I were talking tonight about this issue. There's still regret that it never got done.
However, we need to ask: Is this still worth doing at this late point? How many people are still waiting for an AAT upgrade? Or should we just move on?
Drupal 7 beckons to us, with a major upgrade project. It's possible that we should just say "sorry" and move on at this point. So I'm interested in what people have to say.
#39
Marked #541998: aat_legacy sub-module can't be enabled as a duplicate of this issue.
#40
> Is this still worth doing at this late point? How many people are still waiting for an AAT upgrade?
If you really are going to take this road - abandoning legacy users and their data - why even bother with problems like "Drupal 7 beckons to us, with a major upgrade project? Why not "just say "sorry" and move on at this point" once more, meaning: drop "Amazon" module for D6, get rid of the tedious D6-D7 migration and start with an "Amazon2" module for D7 from scratch? That might sound a bit cynic, but if you're willing to lose trust once, wouldn't it be consequent not to bother with a "major upgrade project" (migration to D7) at all?
However, I definitely do need a robust migration path from "Amazontools" for some 50k nodes scattered through different D5 sites. I defintely can't "migrate" this data by hand, and I definitely can't do this without help - CCK is far too complex to be manipulated without coding skills or proper tools.
According to recent stats, there are still a few hundred users of the "Amazontools" module. I doubt that the majority of those users is willing to drop their sites when support for D5 ends... And I guess, that the majority of those users are merely users of Drupal as a Content Management System, not developers using it as a Content Management Framework. So I think most of these installations will die without a migration path, or at least lose a lot of data when they're trying to upgrade.
If you seriously are thinking about dropping the promised migration path and If you seriously want feedback from those stuck with D5 because of the "Amazontools" module, maybe I'd make sense to ask this question over there. MGParisi, are you reading this? Should this be discussed at the "Amazontools" project page that still reads: "For Drupal 6 and above, see Amazon module, which will come bundled with an aat_legacy.module."
Thanks for taking over co-maintainership & greetings, -asb
#41
@asb, Thanks,.
I created #595596: Amazon Module AAT support - Should we do it?.
#42
Amazon Associate Tools was originally written for Drupal 4.6, a little over 4 years ago. It worked by creating two custom Node Types: "Amazon" and "Amazon Node." Because I needed its functionality for a site I was building, I did most of the heavy lifting upgrading that module for Drupal 4.7, and 5.0. However, I was frustrated with the limitations of its hard-coded content types and wrote another module, 'ASIN Field', which piggybacked on AAT to allow the use of CCK for storing Amazon product information instead of the hard-coded node types.
This module -- Amazon -- was written from scratch for Drupal 6 with the intent of being a sound basis for future development of Amazon API related projects. It uses a different (read, more reliable and more flexible) data storage mechanism and takes advantage of new Drupal tools like Views where the old AAT module was not able to leverage them very well. This module -- 'Amazon' module -- also provides a CCK field to store product information, and it has a tested, working upgrade path from the D5 'ASIN Field' module to its own Drupal 6 CCK field.
What it does not do at present is automatically create its own hard-coded node types to mirror the AAT module's "Amazon" and "Amazon Node" content types. As such, AAT users who used those specific content types in D4.x and 5.x do not have a clean upgrade path. Or at least, they don't have a clean upgrade path without writing some of their own SQL queries.
There is no need to drop Amazon for D6 -- it works, and the Drupal 7 port of Amazon module will involve new code rather than entirely new data storage mechanisms.
#43
> This module -- 'Amazon' module -- also provides a CCK field to store product information, and it has a tested,
> working upgrade path from the D5 'ASIN Field' module to its own Drupal 6 CCK field.
Should the ASIN field appear on migrated D6 sites indeed? That would be very cool...!
However, on my migration sandbox I'm getting for content types with an ASIN field the following messages (first line is "red", second line is "green"):
This content type has inactive fields. Inactive fields are not included in lists of available fields until their modules are enabled.ASIN (field_asin) is an inactive Amazon item field that uses a asin widget.
Of course no content from the D5 ASIN field appears (that's what the warning/error suggests, doesn't it?). I'm running "Amazon" module 6.x-1.0-beta7, enabled are all availale sub-modules (Amazon API, Amazon field, Amazon Filter, Amazon legacy support, Amazon media, and Amazon search).
Those "inactive fields" are a neverending nightmare I encountered several times when trying to update sites based on CCK from D5 to D6. My example approach to "fix" this: #501400: Upgrade to D6 blocks access to Content types. To others reading this and having similar issues with "inactive fields" on updated sites: KarenS explicitly warns to "never never never manually alter the database values! Unless you are an expert on the internals of CCK, which I assume you are not, you will probably break everything" (e.g. in #335597: All CCK custom fields are inactive after upgrading; that's why I try not to touch CCK database tables on production sites). I think, KarenS is right with this, but what options do we have on the other hand?
KarenS suggests the following general procedure to get access to those fields back: "If you have fields that are inactive disable and then re-enable the modules that create those fields.". I already tried this several times on my migration sandbox (disabled, "Amazon" module, ran update.php, re-enabled "Amazon" module, ran update.php again), but the "inactive fields" warnings/errors are still there.
Would it make sense to try something like this (from #500360: This content type has inactive fields...):
UPDATE `content_node_field_instance` SET `widget_type` = 'optionwidgets_select',`widget_module` = 'optionwidgets' WHERE `field_name` = 'field_[YOUR-FIELD-HERE]';
TRUNCATE `cache`;
Thanks & greetings, -asb
#44
@asb, if you get to a stable place and want to, you can make the database available to me and I'll try to understand a way out. You can email me a link to a dump, or just email the db if it's small. Probably the best case situation is for you to try to boil this down to a smaller test case, but I'm willing to take a look at your database if you make it available.
#45
asb, have you visited update.php on that site with the ASIN Field module itself enabled? Amazon module dosn't handle the update path for it -- it's specific to the ASIN field.
#46
Hi,
main and most important question: Have others been following this "tested, working upgrade path" from the D5 'ASIN Field' module to the D6 'Amazon' CCK field? What were their experiences? What was their approach? (Jeff accomplishes lots of things 'normal' people can't accomplish ;)
Until now my understanding was that there's simply absolutely no working path between AAT an Amazon module (left aside home-brewed custom solutions like those Evan succeeded with). If 'ASIN Fields' already should work, we'd IMHO have a completely different situation (meaning: something I could at least try to work with).
@eaton (#45): Yes, several times in different sequences (re-enabled every sub-module one by one or all together).
@rfay (#44): My migration sandbox is a copy of the smallest site of the six installations I currently need to update/migrate (database dump less than 200 MB), and it's one of the newest (about 3 years online), so I thought it should be the easiest (not much more than ~10k nodes). Is this small enough, or how should I "boil this down to a smaller test case" (simply delete a few thousand random nodes? or delete mostly Amazon nodes?) What would be a small enough test case?
Thanks & greetings, -asb
PS: Lots of thanks to you both that things seem to start moving again!
Edit: At least that one didn't work:
mysql> UPDATE `content_node_field_instance` SET `widget_type` = 'text_field', `widget_module` = 'text' WHERE `field_name` = 'field_asin';Now I'm getting:
This content type has inactive fields. Inactive fields are not included in lists of available fields until their modules are enabled. ASIN (field_asin) is an inactive Amazon item field that uses a text_field widget.. I think I'll try to disable and re-enable CCK completely as a next approach...#47
@asb, give me a shot at it. I can't guarantee to get to it right away, but it's a starting point.
Thanks,
-Randy
#48
Hi,
still nobody that succeeded with the existing upgrade path from the D5 'ASIN Field' module to the D6 'Amazon' CCK field?
I want success stories ;)
Greetings, -asb
#49
@asb, I haven't received a demo database from you... Any size you want will be fine. Just put it somewhere I can download it and email me a link, or if you get it small enough, send me it as an attachment to randy at randyfay.com