First of all, thanks for the great module which helps me a lot.

When I first intalled the module, I found out that 2 blocks "Random Review" and "We recommend" do not appear after I enable them.

I looked into the code "amazon.module" (latest stable version) and found the following problem.

1. in function amazon_form, missing '#default_value' => $node->rating for $form['rating'],

2. in function amazon_block, all of the SQL statements show ntype = 'amazon', indeed it should be 'amazon_node' otherwise we need define the nodetype as amazon

3. the SQL statements should be "LIMIT 1 OFFSET $random" instead of "LIMIT $random OFFSET 1"

Thanks!

Xin

CommentFileSizeAuthor
#4 amazon_2.module49.58 KBPrometheus6

Comments

xqi’s picture

please forget number 2. my mistake

Prometheus6’s picture

Assigned: Unassigned » Prometheus6
Status: Active » Fixed

No apology necessary. I just committed fixes. Give it a couple of hours to repackage.

Tracy Dean’s picture

Just downloaded the latest version and the SQL error is still there.

Prometheus6’s picture

StatusFileSize
new49.58 KB

*sigh*

I'm slowly getting back some discipline...

The attached file fixes it, in case you check in before today's repackaging.

Tracy Dean’s picture

Hi Prometheus6

There's still an error in the SQL on line 261.

There is also another problem in that line 289 refers to missingm.gif which does not exist - causing an error.

It would also be nice to print the book author's name in the block, say at between lines 293 & 294. Haven't been able to figure out how to do it though.

Tracy

Tracy Dean’s picture

Sorry, item two was a bit misleading.

What I meant was that is there is no image, you get an empty image source url.

Tracy

Prometheus6’s picture

Status: Fixed » Closed (fixed)

I added a theme_amazon_block() function that will let you get at all the fields the amazon_item returns. And the SQL thing is fixed.

I didn't provide a actual missingx.gif files (I envisioned missings.gif, missingm.gif and missingl.gif) after seeing how badly I did with the rating stars. I figured folks could whip up a little 100 x 150 rectangle that fit their site's theme.

At some point over the next month or two I need to clean this up and document it better.

Tracy Dean’s picture

Priority: Critical » Normal
Status: Closed (fixed) » Active

Sorry to keep this going but I didn't expain myself very well.

In the theme_amazon_block() function, if there is no image for the selected book, the module returns a string of the nature Only local images are allowed., rather than returning either nothing or missingm.gif.

Hope that makes more sense.

Tracy Dean’s picture

The last message got stripped of the output - it should have read

<img src="" alt="the title of the book"...>

Obviously this is invalid xhtml.

Prometheus6’s picture

Status: Active » Fixed

I fixed this a couple od days ago...sorry I was so dense.

Prometheus6’s picture

Status: Fixed » Closed (fixed)