You are here:  » Special Amazon Mod - adjust item no.


Special Amazon Mod - adjust item no.

Submitted by tisbris on Sat, 2013-05-11 17:02 in

Hello David

You did a special Amazon mod for earlier.

This mod show 10 items, but I only like to show 5 - please advise.

{code saved}

//Brian

Submitted by support on Sun, 2013-05-12 09:07

Hello Brian,

I'm really sorry I accidentally deleted the code before saving it, but I did see that it has the $count variable, but it looks like this isn't being used within the myRecordHandler function. If you want to try as follows; look for the opening of the myRecordHandler function as follows:

  function myRecordHandler($item)
  {

...and then on the next line after the {, add this code:

  function myRecordHandler($item)
  {
    global $count;
    if (!$count) return TRUE;
    $count--;

If that doesn't do the trick, post the code again and I'll describe the fix for you...

Cheers,
David.
--
PriceTapestry.com

Submitted by tisbris on Sun, 2013-05-12 18:24

Hello David

No problem :o)

I tried different things, but it's either 0 or 10 items.

Code again:

{code saved}

//Brian

Submitted by support on Mon, 2013-05-13 08:14

Thanks Brian - spotted the problem!

The return TRUE; logic only applied when myAmazonDisplayRecordHandler() is being called directly from the parser, but in this case, it's being called in a foreach loop.

Easily fixed, where you have, towards the end of the script:

    foreach($amazonItems as $item)
    {
      myAmazonDisplayRecordHandler($item);
    }

...REPLACE with;

    foreach($amazonItems as $item)
    {
      if (myAmazonDisplayRecordHandler($item)) break;
    }

...and that should do the trick!

Cheers,
David.
--
PriceTapestry.com

Submitted by tisbris on Mon, 2013-05-13 14:37

spot on...

thank you.