vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   Dynamically Create Amazon Links to use your associate id (https://vborg.vbsupport.ru/showthread.php?t=92444)

dastar 05-24-2006 03:33 PM

Quote:

Originally Posted by amykhar
It seems to on my site contrary to earlier reports that the link format has changed.

Actually, the link formatting for some categories did change, but I think this hack still works. Not sure why some categories changed.

Phillip Chapman 05-24-2006 07:28 PM

Very nice hack. I do have a question for those who have been using it.

Is the hack smart enough to not change a link that already has your associates ID present?

Does this work on old posts or only on messages that are posted after the hack has been installed?

Phillip Chapman 06-06-2006 12:46 AM

Quote:

Originally Posted by Phillip Chapman
Very nice hack. I do have a question for those who have been using it.

Is the hack smart enough to not change a link that already has your associates ID present?

Does this work on old posts or only on messages that are posted after the hack has been installed?

Just wanted to bump this up in case anyone can help answer these questions.

amykhar 06-06-2006 02:31 AM

1. Yes. It won't change your current affiliate links.
2. This version only works on new messages. The 3.0 version worked on all of them. Jelsoft changed the way urls are parsed - hence the change.

Tralala 06-22-2006 02:28 PM

Is anyone else here running Psionic Vision's Advanced Plugin Manager v2?

I ask because when I enable that, "Create Amazon Links" disappears from my list of plugins and I therefore can no longer disable/enable it:

https://vborg.vbsupport.ru/showthrea...371#post952371

It's completely reproducible here, even on a clean vB 3.5.4 install. Wondering what might be different about amykhar's hack that would cause it to not appear, when using that Advanced Plugin Manager.

daFish 07-17-2006 03:11 PM

Hi there amykhar.

This Add-on is really great, but we're currently in trouble, because there seems to be a new kind of link for amazon.

The link syntax is the following:

http://www.amazon.de/gp/product/B000GJ0IPM/AFFILICODE

This on isn't corrected with your hack, so is there any chance to get this working?

Best regards,
Marcus

amykhar 07-17-2006 05:15 PM

Amazon keeps changing link formats on me. I can't promise I'll get to it any time soon.

StarBuG 10-20-2006 01:02 PM

Are you still supporting this hack?

I run a german forum (3.6.2 -> will this work on 3.6.x too?) and you only replace amazon.com links.
Could you add amazon.de links as well for the replacement?

Maybe you could also provide some infos where you define the links in your hack and how to adapt them ourself.

Would that be possible?

StarBuG

Tralala 10-21-2006 12:31 AM

Quote:

Originally Posted by StarBuG
Could you add amazon.de links as well for the replacement?

This hack does that:

https://vborg.vbsupport.ru/showthread.php?t=119220

Markith 11-27-2006 11:54 AM

does anyone know if this hack still works and is supported by amazon?? will it work with other sites such as buy.com??? Thanks!

amykhar 11-27-2006 11:56 AM

Yes it works. No, it's not supported by Amazon - although they did help me with testing of initial versions. No, it doesn't work for Buy.com

logastro 01-06-2007 07:24 PM

Your plugin works fine on my vBulletin 3.6 forum. Why don't you post it on vB3.6 Add-ons?

masons 03-19-2007 04:29 AM

works perfect on my 3.6.5! awesome!

VietPirates 03-30-2007 08:01 AM

From Amazon

Just as with other ASINs you can also use the format below to build links directly to Unbox products. Simply substitute the corresponding Unbox ASIN for "B000LEIOOY" and your Associates ID for "assocblog-20."

Code:

http://www.amazon.com/gp/product/B000LEIOOY/?tag=assocblog-20

Phillip Chapman 05-05-2007 06:43 PM

I've been using this hack for a long time. Very nice.

I did have a question though. I noticed under my plugin manager that the title of this hack is listed as "vBulletin" instead of "Dynamically Create Amazon Links". Likewise under manage products, this plugin isn't listed at all.

Can this possibly be updated? Thank you Amy for all of your work on this.

dpatel304 05-07-2007 05:08 AM

I got this working for the most part, however, my referral links have an extra "/" in it.

http://www.amazon.com/exec/obidos/ASIN/B000NHG7CK//ref=nosim/*****-20

right before ref=nos

Is this normal, and will this affect anything?

dpatel304 06-09-2007 10:07 PM

Sorry to bump, but can anyone answer my above post? Thank you.

reteep 09-05-2007 07:53 AM

Same here:
Code:

http://www.amazon.de/exec/obidos/ASIN/3934958664//ref=nosim/XXX-21

reteep 09-05-2007 08:16 AM

Ok this is fixing it the additional slash, replace line 59-68 with this:

Code:

$messagearray[1][$i] = "http://www.amazon.de/exec/obidos/ASIN".$asin[0]."ref=nosim/" . $associate_id.'"]';
                                }
                                elseif(stristr($messagearray[1][$i],"[/url]"))
                                {
                                        $messagearray[1][$i] = "http://www.amazon.de/exec/obidos/ASIN".$asin[0]."ref=nosim/" . $associate_id."[/url]";
                                }
                                else
                                {
                                        $messagearray[1][$i] = "http://www.amazon.de/exec/obidos/ASIN".$asin[0]."ref=nosim/" . $associate_id;
                                }


Tralala 09-09-2007 05:43 AM

Quote:

Originally Posted by reteep (Post 1332725)
Ok this is fixing it the additional slash, replace line 59-68 with this:

Code:

$messagearray[1][$i] = "http://www.amazon.de/exec/obidos/ASIN".$asin[0]."ref=nosim/" . $associate_id.'"]';
                                }
                                elseif(stristr($messagearray[1][$i],"[/url]"))
                                {
                                        $messagearray[1][$i] = "http://www.amazon.de/exec/obidos/ASIN".$asin[0]."ref=nosim/" . $associate_id."[/url]";
                                }
                                else
                                {
                                        $messagearray[1][$i] = "http://www.amazon.de/exec/obidos/ASIN".$asin[0]."ref=nosim/" . $associate_id;
                                }



Looks like all that does is replace the amazon.com with amazon.de?
How would that fix the extra slash???

reteep 09-09-2007 08:17 AM

Quote:

Originally Posted by Tralala (Post 1335219)
Looks like all that does is replace the amazon.com with amazon.de?
How would that fix the extra slash???

Oh yea sorry, I adapted it for amazon.de. Just change it back to amazon.com, the important part is this here:

Code:

/ASIN".$asin[0]."ref=nosim/"
I removed the slash in front of ref

Tralala 09-09-2007 11:43 AM

Gotcha, thanks!

Didi R. 09-18-2007 05:25 PM

Thx a lot. Great addon. works perfect!

Alfa1 09-18-2007 07:54 PM

Does this addon work out of the box or does it need code modification?

weeno 11-19-2007 02:52 AM

Quote:

Originally Posted by amykhar (Post 999723)
1. Yes. It won't change your current affiliate links.
2. This version only works on new messages. The 3.0 version worked on all of them. Jelsoft changed the way urls are parsed - hence the change.

Is there no way to make this parse posts while they are being rendered/displayed to replace links on-the-fly? I'm not that familiar with hook locations, but it seems this code could be run right before the post is displayed by showthread.

edit:
oh wait.... this may be an old post... looks ilke it does work on existing posts. right?

arn

felxi 11-20-2007 01:26 PM

I made some different fixes and this script works now with vBulletin 3.6.8. The code is not the best but seems to work much better. E.g. [ url=xxx]yyy[ /url] links will be replaces correctly. problems with missing tags like [/font][/size] behind the amazon link will be solved. there can also be an image in the post and the link will be replaced and some other small fixes.

new code for vB 3.6.8
PHP Code:

<?php
function process_amazon_links($message) {
    
// Convert any amazon links to use your affilliate id.
    // enter your associate id here
    
$associate_id "your-id-here";

    if(
preg_match_all("/(\"\])/",$message,$tagarray)) {
        for(
$i=0;$i<count($tagarray[1]);$i++) {
            
$tagarray[1][$i] = $tagarray[1][$i]." ";
        }
        
$message str_replace($tagarray[0],$tagarray[1],$message);
    }

    
$message str_replace('[url=''[URL='$message);
    
$message str_replace('[url]''[URL]'$message);
    
$message str_replace('[/url]''[/URL]'$message);


    if(
preg_match_all("/(http:\/\/(?:[A-z0-9\.]+)?amazon.de\/\S+)/"$message$messagearray)) {
        for(
$i=0;$i<count($messagearray[1]);$i++) {
            if(!
stristr($messagearray[1][$i],"$associate_id") && strpos($messagearray[1][$i], '[img]') === false &&  strpos($messagearray[1][$i], '[IMG]') === false) {
                
$strippedurl preg_split("/\/[a-zA-Z0-9]{3}-[a-zA-Z0-9]{7}-[a-zA-Z0-9]{7}/"$messagearray[1][$i]);
                    
$messagearray[1][$i] = $strippedurl[0].$strippedurl[1];

                 
// Look for an asin number
                
if(!preg_match("/\/[a-zA-Z0-9]{10}\//"$messagearray[1][$i],$asin)) {
                    if(
stristr($messagearray[1][$i],"http://www.amazon.de/exec/obidos/")) {
                        
$strippedurl preg_split("/http:\/\/www.amazon.de\/exec\/obidos\//",$messagearray[1][$i]);
                        
$messagearray[1][$i] = $strippedurl[0].$strippedurl[1];
                    }

                    if(
stristr($messagearray[1][$i],"[/URL]")) {
                        
$strippedurl preg_split("/\[\/URL\]/",$messagearray[1][$i]);
                        
$messagearray[1][$i] = $strippedurl[0].$strippedurl[1];
                        
$messagearray[1][$i] = "http://www.amazon.de/exec/obidos/redirect?link_code=ur2&camp=1789&tag=".$associate_id."&creative=9325&path=".urlencode(str_replace('[/URL]'''$messagearray[1][$i]))."[/URL]";
                    } else {
                        
$messagearray[1][$i] = "http://www.amazon.de/exec/obidos/redirect?link_code=ur2&camp=1789&tag=".$associate_id."&creative=9325&path=".urlencode($messagearray[1][$i]);
                     }
                 } else {
                     if(
stristr($messagearray[1][$i],'"]')) {
                        
$bracketarray[0]='"]';
                        
$bracketarrayrep[0] = '"] ';
                        
$messagearray[1][$i]= str_replace($bracketarray,$bracketarrayrep,$messagearray[1][$i]);
                         
$messagearray[1][$i] = "http://www.amazon.de/exec/obidos/ASIN".$asin[0]."ref=nosim/" $associate_id.'"]';
                     } elseif(
stristr($messagearray[1][$i],"[/URL]")) {
                        
$messagearray[1][$i] = "http://www.amazon.de/exec/obidos/ASIN".$asin[0]."ref=nosim/" $associate_id."[/URL]";
                    } else {
                           
$messagearray[1][$i] = "http://www.amazon.de/exec/obidos/ASIN".$asin[0]."ref=nosim/" $associate_id;
                       }
                 }


                if(
$pos strpos($messagearray[0][$i], '[/URL]')) {
                    
$ext_str substr($messagearray[0][$i], $pos+6);
                    if(
strpos($messagearray[1][$i], $ext_str) === false) {
                        
$messagearray[1][$i] .= $ext_str;
                    }
                }

                if(
preg_match('/\](.*)\[\/URL\]/'$messagearray[0][$i], $out)) {
                    
$messagearray[1][$i] = substr_replace($messagearray[1][$i], $out[0], strpos($messagearray[1][$i], '[/URL]'), );
                }
            }
        }
    }

    
$message=str_replace($messagearray[0],$messagearray[1],$message);
    return 
$message;
}
?>

please let me know if u have some problems. dont forget to replace amazon.de with amazon.com.

weeno 11-22-2007 02:21 AM

Quote:

Originally Posted by felxi (Post 1386228)
I made some different fixes and this script works now with vBulletin 3.6.8. The code is not the best but seems to work much better. E.g. [ url=xxx]yyy[ /url] links will be replaces correctly. problems with missing tags like [/font][/size] behind the amazon link will be solved. there can also be an image in the post and the link will be replaced and some other small fixes.


Hi, thanks for posting.

You code, however, does not appear to work for

[URL="http://www.amazon.com/Logitech-970155-0403-V20-Notebook-Speakers/dp/B0009WKBGC"]these[/URL]

results in...

[url="http://www.amazon.com/exec/obidos/redirect?link_code=ur2&camp=1789&tag=AFFILIATECODE &creative=9325&path=http%3A%2F%2Fwww.amazon.com%2F Logitech-970155-0403-V20-Notebook-Speakers%2Fdp%2FB0009WKBGC%22%5D these[/URL]

felxi 11-22-2007 08:42 PM

I rewrote this modification completely within the last hours.

have a look at:
https://vborg.vbsupport.ru/showthread.php?t=163393

Coop1979 02-07-2009 03:15 AM

I just PM'd the coder. I offered financial compensation to update the mod, so hopefully that will help!

wraggster 03-22-2011 10:07 AM

ok got this working nicely in VB3.8.7 for amazon UK

basically did this

PHP Code:

<?php

function process_amazon_links($message)
{


// Convert any amazon links to use your affilliate id.

// enter your associate id here

$associate_id "dcemu-21";

   if(
preg_match_all("/(\"\])/",$message,$tagarray))
   {
      for(
$i=0;$i<count($tagarray[1]);$i++)
      {
         
$tagarray[1][$i] = $tagarray[1][$i]." ";
      }
     
$message=str_replace($tagarray[0],$tagarray[1],$message);   
   }
     if(!
preg_match_all("/(\[img\S+)/",$message,$messagearray)){
   if(
preg_match_all("/(http:\/\/[A-z0-9\.]+amazon.co.uk\/\S+)/",$message,$messagearray))
   {
     
          for(
$i=0;$i<count($messagearray[1]);$i++)
          {
               if(!
stristr($messagearray[1][$i],"$associate_id"))
              {
                     
$strippedurl preg_split("/\/[a-zA-Z0-9]{3}-[a-zA-Z0-9]{7}-[a-zA-Z0-9]{7}/"$messagearray[1][$i]);
                     
$messagearray[1][$i] = $strippedurl[0].$strippedurl[1];
                      
// Look for an asin number
                    
if(!preg_match("/\/[a-zA-Z0-9]{10}\//"$messagearray[1][$i],$asin))
                    {
                         if(
stristr($messagearray[1][$i],"http://www.amazon.co.uk/exec/obidos/"))
                         {
                              
$strippedurl preg_split("/http:\/\/www.amazon.co.uk\/exec\/obidos\//",$messagearray[1][$i]);
                              
$messagearray[1][$i] = $strippedurl[0].$strippedurl[1];
                         }
                 
                         if(
stristr($messagearray[1][$i],"[/url]"))
                         {
                             
$strippedurl preg_split("/\[\/url\]/",$messagearray[1][$i]);
                            
$messagearray[1][$i] = $strippedurl[0].$strippedurl[1];
                             
$messagearray[1][$i] = "http://www.amazon.co.uk/exec/obidos/redirect?link_code=ur2&camp=1789&tag=".$associate_id."&creative=9325&path=".$messagearray[1][$i]."[/url]";
                         }
                         else
                         {
                            
$messagearray[1][$i] = "http://www.amazon.co.uk/exec/obidos/redirect?link_code=ur2&camp=1789&tag=".$associate_id."&creative=9325&path=".$messagearray[1][$i];

                         }
                     }
                     else
                     {
                         if(
stristr($messagearray[1][$i],'"]'))
                         {
                         
$bracketarray[0]='"]';
                         
$bracketarrayrep[0] = '"] ';
                         
$messagearray[1][$i]= str_replace($bracketarray,$bracketarrayrep,$messagearray[1][$i]);
                         
$messagearray[1][$i] = "http://www.amazon.co.uk/exec/obidos/ASIN".$asin[0]."/ref=nosim/" $associate_id.'"]';
                     }
                     elseif(
stristr($messagearray[1][$i],"[/url]"))
                     {
                         
$messagearray[1][$i] = "http://www.amazon.co.uk/exec/obidos/ASIN".$asin[0]."/ref=nosim/" $associate_id."[/url]";
                     }
                     else
                     {
                         
$messagearray[1][$i] = "http://www.amazon.co.uk/exec/obidos/ASIN".$asin[0]."/ref=nosim/" $associate_id;
                     }
                 }
    
               }
          }
       }
   
$message=str_replace($messagearray[0],$messagearray[1],$message);   
   }
   return 
$message;
}


?>

you can use this plugin for amazon uk and https://vborg.vbsupport.ru/showthread.php?t=163393 for amazon usa at same time, works a treat.

insidegames 02-20-2012 04:29 PM

is their a way to get this works under vBulletin 4.1.10?

kisanjong 03-05-2012 08:33 AM

Quote:

Originally Posted by insidegames (Post 2301597)
is their a way to get this works under vBulletin 4.1.10?

also interested in this :)

4.1.11

Thanks


All times are GMT. The time now is 03:35 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01657 seconds
  • Memory Usage 1,919KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (5)bbcode_code_printable
  • (2)bbcode_php_printable
  • (8)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (32)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete