I'm hoping this is just a configuration issue that I'm missing, but I'm working through the upgrade from 4.7 to 5.x and have many related product links. Since I've upgraded to 5.x and the latest amazon module all of my related books show at the top of the article instead of at the bottom.

I'm not sure if this is a bug, a weighting issue (although i don't know where to set that), or something else.

Any help would be appreciated.

CommentFileSizeAuthor
#6 amazontools-weight.patch510 bytesChad_Dupuis

Comments

Chad_Dupuis’s picture

I've also recreated this issue on a clean 5.x install to eliminate the possibility that the upgrade would have caused this behavior. Any help would be appreciated....

ambereyes’s picture

I have the same issue. I tried changing the weight of the module to 5, no good.

ambereyes’s picture

I fixed it.

I added a weight to the related links array in the amazon nodeapi hook.

{
        if ($node->in_preview == 1) {
          $amazondata = _amazon_product_data_from_Amazon($form_values['asin']);
        }
        else {
          $amazondata = $node->amazonnode_data;
        }
        if ($amazondata) {
          foreach($amazondata as $amazon_data) {
            $related_links .= theme('amazon_related_link', $amazon_data);
          }
          $node->content['related_links'] = array(
            '#weight' => 25,  //Added this line
            '#value' => $related_links
          );
        }
      }

If I have some time tomorrow I will try and create a patch ... but if you are faster .. by all means go for it.

ambereyes’s picture

Ooops left out some code ...

 case 'view': {
        if ($node->in_preview == 1) {
          $amazondata = _amazon_product_data_from_Amazon($form_values['asin']);
        }
        else {
          $amazondata = $node->amazonnode_data;
        }
        if ($amazondata) {
          foreach($amazondata as $amazon_data) {
            $related_links .= theme('amazon_related_link', $amazon_data);
          }
          $node->content['related_links'] = array(
			'#weight' => 25,  //Added this line
            '#value' => $related_links
          );
        }
      }
Chad_Dupuis’s picture

Thank you ambereyes -- works like a charm and I would have never found that! I had also tried changing the weight in the system table for amazon.module to no avail - I'm not sure why that wouldn't work... Oh well!

Chad_Dupuis’s picture

Category: support » bug
Priority: Normal » Critical
StatusFileSize
new510 bytes

I've attached the patch that fixes this issue, hopefully this can get rolled in to a release. Accordingly, I've marked the priority critical and moved it to bug reports....

csc4’s picture

Status: Active » Reviewed & tested by the community

Patch seems to work well - is there any chance of getting this committed to a full release?

jo1ene’s picture

+1 Works for me

ramper’s picture

Just another reminder of the real power of Drupal - it's the support from the community. I thank the module creator, as well as the user (s) who raised the issue. I was faced with the same situation where the related content was showing up at the top and I couldn't figure out a way to fix it -so here I come and found the solution. Thank you.

ramper’s picture

Title: related products show first instead of at bottom of article » related products showing up on teasers on front page

Hi, I am not creating a separate issue as this seems related to the original issue here: The patch seems to work, although initially it was working only for certain user roles - I enabled 'search amazon' for all roles, and then it seems to work for anonymous users as well, though I don't understand the connection. But here is one thing I would still like fixed, if possible:
On the teaser, the related products show up along with the text, on the front page. I have the 'excerpt' module and often use custom teasers, but there is no way to get rid of the amazon related products from showing up in the teasers - any suggestions, or anything I am overlooking? I am still a relative newbie, BTW, and I'm playing with my Linux sandbox.

ramper’s picture

Title: related products showing up on teasers on front page » Solved: related products showing up on teasers
Status: Reviewed & tested by the community » Fixed

I found the 'Retease' module, installed it and rebuilt the teasers - so now the amazon related products do not show up on the teasers anymore.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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

ambereyes’s picture

Status: Closed (fixed) » Reviewed & tested by the community

This issue was prematurely closed due to Ramper mistakenly changing the status.

Has this patch been included in the current release?

ambereyes’s picture

Title: Solved: related products showing up on teasers » related products show first instead of at bottom of article

Oh and he also changed the issue. Arrgh!

MGParisi’s picture

The patch has been included in my release. How this will be handled is upto the drupal staff and the original author. I would love to just post the new moduel!

mcurry’s picture

*subscribe*

MGParisi’s picture

fixed, should be in Dev

MGParisi’s picture

Status: Reviewed & tested by the community » Fixed

marked as fixed

Anonymous’s picture

Status: Fixed » Closed (fixed)

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