I have a block which shows one entry from my amazon wishlist on my homepage (from http://www.garyarnold.com/content/Drupal-random-Amazon-wishlist-item).
Today I installed the patch from rfay http://drupal.org/node/465516#comment-1697066 and entered the secret key.
Now I always get this error: warning: Illegal offset type in isset or empty in /var/www/html/magenbrot.net/sites/all/modules/amazon/amazon.module on line 258.
But the Item is correctly fetched and displayed in its block.
I already tried a complete reinstall of the module (also deleted amazon% from the variable table) with no effect, it even displays the error without the patch now. I also installed the dev version, still the error message, very mysterious.
This is the code I use in the block:
<?php
$list = '3V4RX81EM9KP';
$params = array(
'ListType' => 'WishList',
'ListId' => $list,
'ResponseGroup' => 'ListFull',
'IsOmitPurchasedItems' => 1,
);
$results = amazon_http_request('ListLookup', $params);
if (!empty($results->Error)) {
return;
}
$total_items = (int)$results->Lists->List->TotalItems;
$random_item = rand(1, $total_items) - 1;
$page = (int)($random_item / 10) + 1;
$item_on_page = $random_item % 10;
$params = array(
'ListType' => 'WishList',
'ListId' => $list,
'ResponseGroup' => 'ListItems',
'ProductPage' => $page
);
$results = amazon_http_request('ListLookup', $params);
if (empty($results->Error)) {
$asin = $results->Lists->List->ListItem[$item_on_page]->Item->ASIN;
$items = amazon_item_lookup($asin);
if (is_array($items)) {
$item = array_pop($items);
$item[detailpageurl] .= '%26colid='.$list;
amazon_item_save($item);
$markup = theme('amazon_item', $item, 'details');
print $markup;
}
}
?>
I can't find the error and I also don't know why this error occurs now. Maybe anyone could give me a hint?
regards,
Oliver
Comments
Comment #1
magenbrot commentedI've found a solution in the comments on Gary Arnolds page.
I don't know if this is relevant for this module or if this error occurs only in Garys code.