Amazon does not work with Content Templates (Contemplate)!?

911 - July 28, 2008 - 22:51
Project:Amazon Module
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed
Description

Hi,
is there a problem with the Amazon Modul and the Content Templates Modul? I want to configure a teaser and full view for a review node in which I have the ASIN Field from Amazon Modul.

But no variables related from the Amazon Modul are rendered in the custom Content Template. I have no problem displaying other other custom CCK fields with the Content Templates, only the amazon related, like the Picture URL etc. are not wirking.

I tried the same some time ago with drupal 5, amazon associate tools modul und and the drupal 5 version of contemplate and everything worked fine. No problem creating custom teasers and using amazon images etc.

Can somebody please help?

Best Regards

#1

911 - July 30, 2008 - 14:43
Title:Amazon dies nit work with Content Templates (Contemplate)!?» Amazon does not work with Content Templates (Contemplate)!?

Hey,
can somebody please give some feedback on this? Is it only me who is having problems displaying variables from Amazon modul (amazon-6.x-1.0-beta3) with contentemplate (contemplate-6.x-0.13) modul? Would be very nice if somebody can check if it is working for him an give some feedback. Or any other Idea on this.

Perhaps it is a Problem of the contentemplate modul and I should better ask in the contemplate issus?

Best Regards

#2

911 - August 5, 2008 - 14:38

Really nobody who can help? Anything unclear in my support request?

How do you guys theme your Amazon Node output? Is Amazon modul incompatible with the Contemplate Modul?

Any tips on theming the output? I played with the template files wich come with the Modul. I get it work theming the Full Node view for my Amazon Nodes, but I want to have the teaser view different? How can I build a theme for teaser view?

I would appreciate it if someone could help.

Best Regards

#3

samarija - August 18, 2008 - 12:35

try to acces the node-variables this way:

$node->{0}[editorialreviews][0]['content']

#4

911 - August 22, 2008 - 13:35

Hi,
thanks.

@samarija

if I create a content template and simple put in the code
<?php $node->{0}[editorialreviews][0]['content'] ?>
I get a blank node body/teaser.
[EDIT] I forget the "print" in the snipped. looks like it is working for your code.

When I use
<?php print $node->field_asin[0]['view'] ?>
I get some output. But it is very unflexible. This only renders the layout which I can define for the "ASIN" CCK Field in the backend.

I want to build a template where I can render each Amazon related Item itself.

Like Big Amazon Product Picture
$node->imagesets['largeimage']['url']

Detailpage URL
$node->content['field_asin']['items'][0]['#node']->0['detailpageurl']

etc. like they are listet in the available variables list of contemplates.

Why dont they show up?

Best regards

#5

conniec - September 1, 2008 - 19:30

subscribing.

It works for me intermittently after I do many man cache dumps and browser refreshes. Both msie and firefox)

Connie

#6

conniec - September 4, 2008 - 17:35

I've been trying to find a pattern on why it ittermittently works for me. I think I have it--but would love someone to check behind me. It seems to me that the first time an item is added to the amazon database, it will show up once in my contemplate page (and sometimes that 'show up" is just a flash before it goes away). After that, it never shows up again.

Other fields are showing up without a problem. Just my amazon cck fields are not working. No errors, just not pulling in any information from the database, it seems.

Sorry, I'm not a developer so I have no idea why this happens. Anyone else have any ideas?

Connie

#7

eaton - September 25, 2008 - 00:35

the amazon data for a node is NOT reliably loaded during contemplate's lifecycle. You can get the ASIN for the item, and use the amazon module's lookup functions, to get the full data.

#8

911 - September 26, 2008 - 21:33

Did I understand it correct, that it is not possible to use content template to render for example "medium image" and "Produkt Title"?

Just the ASIN and the Complete description without templating?

Will this be fixed in a future release?

#9

Jaap Haitsma - November 23, 2008 - 22:13

OK I can get it to work e.g to get the URL of the small image you do

<?php
print $node->{0}[imagesets]['smallimage']['url']
?>

So the data is there only it is not shown correctly in the variable window

#10

bomarmonk - January 23, 2009 - 17:33

With the old 5.x amazon tools module, this was possible.

#11

EvanDonovan - June 22, 2009 - 23:23

It is possible to edit on a finer level by editing or overriding the tpl.php files in the Amazon module's amazon_media directory. These files print out the variables for the different types of Amazon item (book, DVD, etc.)

I believe the different approach in this module is due to the improvements to the theming system in 6.x.

In order to get the editorial review to show up, I added the following to amazon_media.module's amazon_media_amazon_item_load function:

<?php
switch ($item['producttypename']) {
    case
'ABIS_BOOK':
     
$additions = db_fetch_array(db_query("SELECT * FROM {amazon_book} WHERE asin = '%s'", $item['asin']));
// line below added
$additions += db_fetch_array(db_query("SELECT * FROM {amazon_item_editorial_review} WHERE asin = '%s'", $item['asin']));
?>

Then I added the following to the bottom of the amazon-item-book-details.tpl.php:

<div><strong><?php print t('Binding'); ?>:</strong> <?php print t('@binding, @pages pages', array('@binding' => $binding, '@pages' => $numberofpages)); ?></div>
// added code
<div class="clearing"></div>
<div><strong><?php print t('Review'); ?>:</strong> <?php print $content; ?></div>
// end added code
</div>

#12

rfay - October 4, 2009 - 07:53
Status:active» fixed

Theming with the .tpl.php files is widely supported in Amazon module and is the recommended way to change your output. You copy the files you want to use into your theme directory and then clear your cache, then change the .tpl.php files to do whatever you want.

#13

System Message - October 18, 2009 - 08:00
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

#14

bomarmonk - October 18, 2009 - 15:36
Version:6.x-1.0-beta3»
Category:bug report» feature request
Status:closed» active

As far as I know, this specific issue is not fixed with the Amazon module. While one person may recommend changing the theme with custom files (I do this as well), there is something to be said for being able to use contemplate to easily store theme changes in the database. While the output of most modules is done in a standard way that content templates can use, it seems that Amazon has broken this functionality which was previously available with Amazon Associate's Tools. The issue isn't "fixed." Changing to a feature request for the development version of this module to better reflect the nature of this issue.

#15

rfay - October 18, 2009 - 15:39
Version:» 6.x-1.0-beta7

Just FYI, the 2.x branch is not real.

#16

bomarmonk - October 19, 2009 - 06:20
Version:6.x-1.0-beta7»

Thanks. I'll change this to a version that hopefully is real. Great module, by the way! But I did like the contemplate way of theming, so I'm just trying to see if the functionality can be added back into this module some day.

#17

rfay - October 19, 2009 - 15:16
Status:active» fixed

Actually, it works fine with contemplate.

The default templates (that contemplate should present) are

teaser:

<?php
print $teaser;
?>

body:

<?php
print $body;
?>

If you enable the contemplate textareas and place those in there, it works fine. I can't guess why contemplate does not offer that default behavior. But I suspect that's something to take up with the maintainer of contemplate. I was unable to find any documentation on how it might work differently with custom fields.

For more sophisticated code to put in the contemplate, you can look at the various .tpl.php files that are provided for amazon. Some introductory information is at http://drupal.org/node/595464#theming

I think you are probably ready to start using .tpl.php files though, a much more robust solution to theming, and one that can be source-controlled.

Setting this to fixed. You can reopen it if you have further info or can point me to anything about contemplate that I can implement to help that module.

#18

System Message - November 2, 2009 - 15:20
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.