I use the amazon-module to display some books on my site. For that, I inserted the amazon field to a content type. I already changed the ‘amazon-item.tpl.php’ file so that some addition information from the amazon api is shown. That works fine.
I am now looking for a solution to the following:
I want to show the content of a CCK field (already in the used content type) together with the data of the amazon api. For example
Amazon: $title
Amazon: $creator
CCK: $node->field_own_description[0][‘view’]
Amazon: $numberofpages
And I am not able to do that so far.
1) If I enable that CCK field to be shown in the node body (admin/content/node-type/shop/display), it is below the amazon data. I want it to be shown between the amazon data (see above)
2) If I insert <?php print $node->field_own_description[0][‘view’] ?> directly to amazon-item.tpl.php, than no data is show for that field
Any idea how this can be done?
Comments
Comment #1
rfayI've never tried to do this. Anybody have a technique?
The key thing to do is to use a debugger or devel module's dsm() function to explore the variables available to you.
Comment #2
fragtom commentedHello DrupSpa,
if you would like to come to result i a fast way, you could do that in the following way.. I expect, that you are showing the node in page mode, then you are able to get the node-id via argument. Use the following in the amazon-item.tpl.php
After loading the node_build_content() you're able to access the cck-fields..
Comment #3
DrupSpa commented@ #2
Thanks. That worked.
Comment #4
rfayNice work, @fragtom!