Add fields to display media + workaround

charos - March 6, 2009 - 03:46
Project:Amazon Module
Version:6.x-1.0-beta5
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:needs work
Description

By default the module displays what is in amazon-items-details.tpl . How do I override that to display media details (like Artist,Label,Studio,Number of discs etc). I haven't dealt with module template files before and I don't know how to make things my-way.

#1

charos - March 6, 2009 - 05:26

ok , got it how it works. For music there is no tpl so I had to create mine. I added also few other fields like release date etc. but I was wondering how come the api doesn't catch the track listing. Currently though my biggest issue is that doesn't get the xml for OriginalReleaseDate.

#2

rfay - October 5, 2009 - 00:17
Status:active» fixed

Glad you got it. It would be good of you to write up how you solved it and attach the tpl.php that you used, in order to help other people with this problem. Patches and feature requests are accepted for your new issue.

#3

charos - October 5, 2009 - 14:54
Title:Add fields to display media» Add fields to display media + workaround
Component:Documentation» Code
Status:fixed» needs review

Here is the related info and files. This is just for music. What I wanted to do , is use the amazon module for automatic insertion of album cover ,release information and tracklist. The idea behind this was to create a "Review" content type that users can write reviews but automatically insert the reviewed album data through the ASIN number. There is different tpl for full nodes and teasers. So basically this workaround is ONLY for Music but with the same proceedure ,all content can be done. I would like to thank Radek W. for helping out in this one !
Here is the documentation for it:
All changes made in amazon module in march 2009
(all added/changed code is put into //added(or changed) for Haris - start and //added(or changed) for Haris - end:
- amazon.module
+ in function amazon_item_clean_xml - reading tracks data
- amazon_media/amazon_media.install
+ in function amazon_media_schema - new schema amazon_music_tracks
+ new function amazon_media_update_1
- amazon_media/amazon_media.module
+ in fucntion amazon_media_preprocess_amazon_item - copy Tracks data from one variable to another
+ in function amazon_media_amazon_item_load - reading Tracks data from DB
+ in function amazon_media_amazon_item_insert - inserting Tracks data to DB
+ in function amazon_media_amazon_item_delete - deleting Tracks data
- amazon_search/amazon_search.module
+ in function amazon_search_search - colecting data about new values like: artist,image,label,relasedate,etc
+ in function amazon_search_simple_search - add new attributes to query which is send to Amazon (and receive new data, see above)
- asin/asin.module
+ in function asin_theme - new type of show template ("Large image and full info")
+ in function hook_field_formatter_info - new type of show template ("Large image and full info")
+ new function theme_asin_formatter_fornodes - new type of show template ("Large image and full info")

New files:
modules/search/search-result-amazon_search.tpl.php - new way of show search results
amazon_media/amazon-item-music-details.tpl.php - added show of Tracks data
amazon_media/amazon-item-music-fornodes.tpl.php - represents "Large image and full info"

All files are added with .txt extension to be uploaded here.

Hope this helps. Nice to know Amazon module is back in action !

AttachmentSize
amazon.module.txt 21.27 KB
amazon_media.install.txt 2.96 KB
amazon_media.module.txt 4.94 KB
amazon_search.module.txt 2.44 KB
amazon-item-music-details.tpl_.php_.txt 850 bytes
amazon-item-music-fornodes.tpl_.php_.txt 855 bytes
asin.module.txt 12.22 KB

#4

charos - October 5, 2009 - 15:00

Here are the 2 screenshots of what it's achieved:

AttachmentSize
screenshot1.jpg 66.54 KB
screenshot2.jpg 37.42 KB

#5

rfay - October 17, 2009 - 17:27
Status:needs review» needs work

The files you attached don't help me as much as I certainly would like.

Please learn how to make a patch, which is the *differences* between what you did and what the files were like before. Instructions are at http://drupal.org/patch.

With a patch, I can evaluate what you've done, and if it works, apply it. Others can also see what needs to be changed.

#6

charos - October 19, 2009 - 01:17

All the changes are done at 6.x-1.0-beta5. The project that this was done is frozen for now. So I'm not really sure whether a patch for 6.x-1.0-beta5 will have any point nowdays that module is in 6.x-1.0-beta9. Spotting the changes that are done is quite simple since in all of them there is "//added for Haris - start" and " //added for Haris - end" for anything that was added to the code and for the changes I did the "//changed for Haris - start" and "//changed for Haris - start". If you still want to me to create a patch for the 6.x-1.0-beta5 let me know about it. This was more of sharing a case scenario though :)

#7

rfay - October 19, 2009 - 01:34

Patches need to apply against the current version.

It's not to hard to sort this all out: You grab a clean version of beta5, do a diff -rup from that to your version.

Then you see if that patch applies to the current version. If it doesn't you fiddle with it to figure out the differences. Once you have the current version working the way you want, you create a patch from it.

#8

charos - October 19, 2009 - 01:57

If patches have to apply against current version of the module then this can't be done. As I said before, the site that this modification was done is not under development right now so it still has the beta5. I've created the patches with WinMerge for beta5 but it seems it's pointless since I cannot test it with current version (beta9). I guess we have to let it go.

#9

rfay - October 19, 2009 - 02:02

I encourage you to pursue it. Otherwise, you'll never be able to upgrade your module! And that's annoying. Keeping patched versions around is always ugly.

If you've successfully created the patches on beta5, now you just need to see if they apply on beta9.

If you don't have a local test and development environment, you need one. I encourage you to set it up.

Thanks,
-Randy

#10

charos - October 19, 2009 - 02:22

This site development was abandoned for many months now and the only reason is not deleted from server is for a guidance/reference whenever it might be built from scratch. Keeping patched versions of contrib modules is never my intention for active sites! I will make a mirror test site and fiddle with it there. I cannot promise any time-line here because university duties are keeping me off my geeky interests but I really want to give something back to drupal community - even if that's just a drop in the ocean , so I'll give it a go whenever I find adequate time for it.

 
 

Drupal is a registered trademark of Dries Buytaert.