Amazon/eBay Parser

Amazon/eBay Parser 2.1.4

No permission to download
Just got an email from eBay saying I'm in violation again - nothing has changed on my end since last time.

I just updated my text at the bottom to now say "This post contains eBay links which may earn a commission at no additional cost to you.” instead of just the generic and mailed them back.

Let's see if that is ok.
 
I'm also tempted to change the template replacement so it puts the link above attachments instead of below, therefore right next to the text,

(Change replacement search to "<xf:if is="$post.attach_count">")
 
Andy B has an Amazon and Ebay parser addon.
When I looked a few years ago, it wasn't a realtime parser. It was a search-replace to add the affiliate link to older posts, and add them to new posts. No idea if it has changed since then, however. This is something that needs to be done on the fly, as it is in this addon, as affiliate IDs can change, and having to update 23+ million posts in the largest forum any time we might change IDs is something that I'm not about to do.
 
Andy B's parser addon does realtime conversions to links. I believe there is an option to replace older links but that is a separate thing which I didn't do. The parser addon just converts links as they are posted. It's worked well for me. This new version of the Amazon parser addon adds links as the post is rendered. I use both the Amazon and Ebay parser addons.

 
This is a different addon than I tried, and it was only recently posted here. The earlier addon I tried, called Amazon Parser, could only hard-code newly posted links with the affiliate ID. Amazon Parser All is a separate companion addon that adds the affiliate ID to older posts.

I'm sticking with this one since I know it works, and I know it rewrites affiliate IDs when some guests try to sneak in their own IDs. In fact, I wouldn't mind paying for this addon as it can be so important to a forum's revenue stream. @Painbaker
 
Been getting this error for months. It also mentions "Object(TickTackk\ChangeContentOwner\XF\Entity\Thread" not sure if it's @TickTackk's add-on that is the issue?

Code:
ErrorException: [E_WARNING] Undefined array key "host" src/addons/Snog/Amazon/XF/BbCode/Renderer/Html.php:183
Generated by: Unknown account Jan 4, 2026 at 6:03 PM
Stack trace
#0 src/addons/Snog/Amazon/XF/BbCode/Renderer/Html.php(183): XF::handlePhpError(2, '[E_WARNING] Und...', '/pub...', 183)
#1 src/addons/Snog/Amazon/XF/BbCode/Renderer/Html.php(35): Snog\Amazon\XF\BbCode\Renderer\Html->addAffiliateToHref('
   

    <div class...', Array, NULL)
#2 src/XF/BbCode/Renderer/Html.php(356): Snog\Amazon\XF\BbCode\Renderer\Html->renderTagUrl(Array, Array, Array, Array, Object(Snog\Amazon\XF\BbCode\Renderer\Html))
#3 src/XF/BbCode/Traverser.php(63): XF\BbCode\Renderer\Html->renderTag(Array, Array)
#4 src/XF/BbCode/Traverser.php(39): XF\BbCode\Traverser->renderSubTree(Array, Array)
#5 src/XF/BbCode/Traverser.php(22): XF\BbCode\Traverser->renderAst(Array, Object(XF\BbCode\RuleSet), Array)
#6 src/XF/Pub/View/FeedHelper.php(121): XF\BbCode\Traverser->render('Get...', Object(XF\BbCode\Parser), Object(XF\BbCode\RuleSet), Array)
#7 src/XF/Pub/View/Forum/Rss.php(72): XF\Pub\View\FeedHelper::setupEntryForThread(Object(Laminas\Feed\Writer\Entry), Object(TickTackk\ChangeContentOwner\XF\Entity\Thread))
#8 src/XF/Pub/View/Forum/Rss.php(31): XF\Pub\View\Forum\Rss->createEntry(Object(Laminas\Feed\Writer\Feed), Object(TickTackk\ChangeContentOwner\XF\Entity\Thread), 'last_post_date')
#9 src/XF/Mvc/Renderer/AbstractRenderer.php(92): XF\Pub\View\Forum\Rss->renderRss()
#10 src/XF/Mvc/Renderer/Xml.php(72): XF\Mvc\Renderer\AbstractRenderer->renderViewObject('XF:Forum\\Rss', '', Array)
#11 src/XF/Mvc/Dispatcher.php(471): XF\Mvc\Renderer\Xml->renderView('XF:Forum\\Rss', '', Array)
#12 src/XF/Mvc/Dispatcher.php(453): XF\Mvc\Dispatcher->renderView(Object(XF\Mvc\Renderer\Rss), Object(XF\Mvc\Reply\View))
#13 src/XF/Mvc/Dispatcher.php(412): XF\Mvc\Dispatcher->renderReply(Object(XF\Mvc\Renderer\Rss), Object(XF\Mvc\Reply\View))
#14 src/XF/Mvc/Dispatcher.php(66): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'rss')
#15 src/XF/App.php(2824): XF\Mvc\Dispatcher->run()
#16 src/XF.php(806): XF\App->run()
#17 index.php(23): XF::runApp('XF\\Pub\\App')
#18 {main}
Request state
array(4) {
  ["url"] => string(30) "/f****/index.rss"
  ["referrer"] => string(22) "*****"
  }
  ["_POST"] => array(0) {
  }
}
 
Code:
Server error log
ErrorException: [E_WARNING] Undefined array key "host" src/addons/Snog/Amazon/XF/BbCode/Renderer/Html.php:183
Generated by: Unknown account Jan 4, 2026 at 9:58 PM
Stack trace
#0 src/addons/Snog/Amazon/XF/BbCode/Renderer/Html.php(183): XF::handlePhpError(2, '[E_WARNING] Und...', '/pub...', 183)
#1 src/addons/Snog/Amazon/XF/BbCode/Renderer/Html.php(35): Snog\Amazon\XF\BbCode\Renderer\Html->addAffiliateToHref('
    

    <div class...', Array, NULL)
#2 src/XF/BbCode/Renderer/Html.php(356): Snog\Amazon\XF\BbCode\Renderer\Html->renderTagUrl(Array, Array, Array, Array, Object(Snog\Amazon\XF\BbCode\Renderer\Html))
#3 src/XF/BbCode/Traverser.php(63): XF\BbCode\Renderer\Html->renderTag(Array, Array)
#4 src/XF/BbCode/Traverser.php(39): XF\BbCode\Traverser->renderSubTree(Array, Array)
#5 src/XF/BbCode/Traverser.php(22): XF\BbCode\Traverser->renderAst(Array, Object(XF\BbCode\RuleSet), Array)
#6 src/XF/Pub/View/FeedHelper.php(121): XF\BbCode\Traverser->render('Hey guys! I hop...', Object(XF\BbCode\Parser), Object(XF\BbCode\RuleSet), Array)
#7 src/XF/Pub/View/Forum/Rss.php(72): XF\Pub\View\FeedHelper::setupEntryForThread(Object(Laminas\Feed\Writer\Entry), Object(PB\ReactionToVote\XF\Entity\Thread))
#8 src/XF/Pub/View/Forum/Rss.php(31): XF\Pub\View\Forum\Rss->createEntry(Object(Laminas\Feed\Writer\Feed), Object(PB\ReactionToVote\XF\Entity\Thread), 'last_post_date')
#9 src/XF/Mvc/Renderer/AbstractRenderer.php(92): XF\Pub\View\Forum\Rss->renderRss()
#10 src/XF/Mvc/Renderer/Xml.php(72): XF\Mvc\Renderer\AbstractRenderer->renderViewObject('XF:Forum\\Rss', '', Array)
#11 src/XF/Mvc/Dispatcher.php(471): XF\Mvc\Renderer\Xml->renderView('XF:Forum\\Rss', '', Array)
#12 src/XF/Mvc/Dispatcher.php(453): XF\Mvc\Dispatcher->renderView(Object(XF\Mvc\Renderer\Rss), Object(XF\Mvc\Reply\View))
#13 src/XF/Mvc/Dispatcher.php(412): XF\Mvc\Dispatcher->renderReply(Object(XF\Mvc\Renderer\Rss), Object(XF\Mvc\Reply\View))
#14 src/XF/Mvc/Dispatcher.php(66): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'rss')
#15 src/XF/App.php(2824): XF\Mvc\Dispatcher->run()
#16 src/XF.php(806): XF\App->run()
#17 index.php(23): XF::runApp('XF\\Pub\\App')
#18 {main}
Request state
array(4) {
  ["url"] => string(30) "***/index.rss"
  ["referrer"] => string(22) "***"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(0) {
  }
}

I disabled @TickTackk's add-on but that did not fix it, the error still happens this time it mentions @Painbaker's Reaction to Vote.
 
AI said:
This error indicates a PHP warning (specifically an "Undefined array key" or "Undefined variable") within the Snog Amazon/eBay Parser add-on for XenForo. It occurs when the forum attempts to generate an RSS feed for a specific forum section (in this case, /forums/*****.12/index.rss).
 
Does this make sense? (AI)

It looks like your XenForo installation is hitting a PHP warning (which XenForo treats as a hard error) within the Snog Amazon BBCode add-on.

The Problem​

The error Undefined array key "host" at line 183 of Html.php suggests that the add-on is trying to parse a URL to add an affiliate ID, but the URL provided is malformed or empty. Specifically, it's calling parse_url() on a string that doesn't contain a valid host, and then trying to access the ['host'] key without checking if it exists.

This is being triggered specifically when your forum generates an RSS feed (seen in the request state: /index.rss).


Recommended Solutions​

1. Quick Fix: Add "Null Coalescing" (Code Edit)​

If you are comfortable editing PHP files, you can prevent the crash by making the code more resilient.
  • File: src/addons/Snog/Amazon/XF/BbCode/Renderer/Html.php
  • Line: 183
  • Change: Look for where $variable['host'] is used and ensure it has a fallback. For example:$host = $parsedUrl['host'] ?? '';

2. Identify the Malformed Link​

The stack trace shows this happened while processing a thread in the "*****" forum (*****).
  • Check recent posts in that forum for Amazon links or URL tags.
  • Look for any broken BBCode, such as [URL='http://...']...[/URL] tags that are empty or contain only symbols.
  • If a user posted a link like [URL='http://amazon']amazon[/URL] (without the https://), the parser might fail to find a "host."

3. Check for Add-on Updates​

(I'm on 2.1.4)

Why is this happening now?​

RSS readers often request feeds with different parameters than a standard browser. When the RSS generator tries to "render" the BBCode for the feed, it hits this specific affiliate-link logic that isn't handling a blank or weird URL gracefully.

Would you like me to help you write a specific PHP patch for that line in the Html.php file?
 
Back
Top Bottom