Recent Topics

1 Mar 16, 2005 03:23    

Update 2: This is now a plugin for b2evolution 1.8, called [url=http://plugins.b2evolution.net/index.php/2006/10/12/evoamazon]evoAmazon[/url]. You can disregard the rest of this thread.

Update: I've upgraded this hack to be a full-fledged plugin for b2evolution 1.7. It's all in one file now and you can change the Amazon Associate ID in the backoffice. I made some changes to make it match the look of b2evolution and I did some work on internationalization (a first for me). Most of the important strings match up with strings that are already translated. The rest are in the T_() function, ready to be translated. Grab the file [url=http://brendoman.com/dev/blogs/plugins/_b2media.plugin.txt]here[/url], replace the .txt with a .php on the end of the name and put it in the plugins folder of b2evolution 1.7 (won't work with anything earlier, including 1.6-alpha). Once 1.7 is released I'll make a better page for this plugin, but for now you can post problems and feedback in this thread.

------------------------------
And now, the hack instructions for 0.9.x:

I put together a little hack to make it easier for me and my friends to add links and pictures from Amazon Web Services to posts in b2evolution. I use it for the Recent Media section on my sidebar. I wanted it to function like [url=http://www.majordojo.com/projects/BookQueueToo]BookQueToo[/url], a plugin for Movable Type. My hack is based on [url=http://www.chipdir.nl/amazon/]Jaap's Free Amazon PHP Script[/url] (amazonh3.php). I used some code from b2upload.php to get the popup window and pass html back to the textarea. There's very little of my own code in here. I mostly just put these peices together to make it do what I want. I'll give a description of how I use it, then I'll show how to apply the hack in case anyone wants to try it.

When I log into the backoffice and go to 'Write,' I have an extra button below the textarea labeled 'Add media.'

http://www.brendoman.com/images/danny/1.jpg

If I click on that button a window pops up with some options and a search window.

http://www.brendoman.com/images/danny/2.jpg

Choose a product category, type a search term and hit 'Search.' Then you'll see this:

http://www.brendoman.com/images/danny/3.jpg

The search script builds a table from the results that most closely match your search. Find the one that you want to add to your post and click 'Add the code to your post.' Then you'll have this in your post:

http://www.brendoman.com/images/danny/4.jpg

At this point you can edit the code if you want to add or remove any text or change image attributes. When you post, it looks something like this:

http://www.brendoman.com/images/danny/5.jpg

And here's how it looks in the mediablog that I've included in my sidebar:

http://www.brendoman.com/images/danny/6.jpg

If you would like to give this a try, then here's how I did it. The usual disclaimers apply. Back your files up. If this breaks your blog, then don't blame me. I use b2evolution version 0.9.0.11. If you get this to work with other versions, please let me know. Download [url=http://www.brendoman.com/images/danny/b2media-both.zip]this zip file[/url], unzip it and upload the four php files to your admin directory. If you have modified your _edit_form.php, then you won't want to upload this file and erase your modifications. If you're used to messing with that file, then it won't be too hard for you to see the two sections where I added the code for the new button. Just search my file for 'b2media.' If you're not using 0.9.0.11, then I'm not sure what would happen if you overwrite your _edit_form.php file with mine. Back yours up first in case something gets broken. The other three files won't overwrite anything.

If you want to try and make money from Amazon referrals, then you can go to [url=http://www.amazon.com/gp/browse.html/103-9097117-8134260?node=3435371]amazon.com[/url], get an associate ID and replace Jaap's id with yours in b2media.php. That part is optional.

If you want to include another blog in your sidebar like I have, then look in the zip file for a file called sideblog.txt. Paste that into your _main.php and set the blog id number to match your sideblog that you create in the backoffice.

This has been my first major attempt at hacking b2evolution. Basically, I was amazed that I could get it to work. If you have ideas for improving this hack or turning it into an actual plugin, then I'm all ears.

Edit (9-20-05): Some web hosts turn off allow_url_fopen, which this hack uses to connect to Amazon. I rewrote the connection to use cURL by default, but to check to make sure the cURL module is loaded. If that fails, it will use fopen.

2 Sep 09, 2005 12:02

Great hack... works as advertised.

3 Sep 20, 2005 17:49

I rewrote part of this hack to use cURL to connect to Amazon rather than fopen. My new webhost doesn't allow fopen with urls, so the hack was broken until I changed it. If your webhost doesn't have cURL loaded, it will fall back on fopen.

4 Sep 21, 2005 17:55

personman wrote:

I rewrote part of this hack to use cURL to connect to Amazon rather than fopen. My new webhost doesn't allow fopen with urls, so the hack was broken until I changed it. If your webhost doesn't have cURL loaded, it will fall back on fopen.

This is such an awesome hack. Would it be possible to make a version that could be called as a standalone php page?

5 Sep 21, 2005 18:00

Thanks! I'm not sure I understand your question. Do you mean can the backend (where you search for an Amazon item) be called as a standalone page? You can go directly to /admin/b2media.php rather than using the button in the edit area. Or do you mean stand-alone as in separate from b2evolution?

6 Sep 21, 2005 19:03

personman wrote:

Thanks! I'm not sure I understand your question. Do you mean can the backend (where you search for an Amazon item) be called as a standalone page? You can go directly to /admin/b2media.php rather than using the button in the edit area. Or do you mean stand-alone as in separate from b2evolution?

I'm looking for a standalone, that would not require a b2evo. ADD CODE TO POST would just copy to clipboard.

7 Sep 21, 2005 20:40

You can download the script that this hack is based on here: [url=http://www.chipdir.nl/amazon/]Jaap's Amazon Scripts[/url].

Or you could make this modification to change the add code to post button to a textarea with the code ready to be copied.

Open b2media.php and find

<form>
<input type="button" name="close" value="<?php echo T_('Add the code to your post !') ?>" class="search" onclick="targetopener('<?php echo "&lt;img src=&quot;$imgurl&quot; border=&quot;0&quot; alt=&quot;&quot; /&gt;&lt;br /&gt;&lt;a href=&quot;$url&quot;&gt;".addslashes($pname)."&lt;/a&gt; by ".addslashes($d); ?>');self.close()" />
	</form>

and change it to:

Copy this code to your post:<br />
<textarea rows="6" cols="80"><?php echo "&lt;img src=&quot;$imgurl&quot; border=&quot;0&quot; alt=&quot;$pname&quot; /&gt;&lt;br /&gt;&lt;a href=&quot;$url&quot;&gt;$pname&lt;/a&gt; by ".addslashes($d); ?></textarea>

Then just point your browser directly at b2media.php (or rename it if you want.)

8 Sep 21, 2005 21:15

Ok I've been working on making a standalone version of the b2media script. If you want to see the end result, see [url=http://mrshiney.froppy.com/amazon.php]here[/url]. I'm not 100% happy with it yet (I'm new at this PHP stuff) but it seems to work. ;-)

The script is pretty long to post here. If anyone wants a copy, PM me here and I'll send it.

9 Nov 11, 2005 18:12

danny,

what happened to the sideblog.txt file in the zip download? why is it no longer included?

btw, the 'Add Media' button works like a charm. very easy to install, works as advertised and will save a ton of time. great plugin. many thanks.

11 Jan 12, 2006 21:56

I've updated this to be a real plugin for b2evolution 1.7. I editing the first post with more info and a link if you want to try it out.

12 Jun 04, 2006 18:51

Hello Danny,
trying to dl your file from http://brendoman.com/dev/blogs/plugins/_b2media.plugin.php.txt gives me a no-no-page stating "Please, do not access this page directly."
Trying to be smart and just selecting 'download target as...' on the links context menu also gives me only a text file containg the line "Please, do not access this page directly."
What am I missing? Thank you for your help!
'lex

14 Jun 04, 2006 22:35

Hello Danny, thx, could download it without any pains now :)
Can't seem to get it to work tho. :(
2 reasons I can think of:
a) Is it because the /plugins folder (not a subdirectoryof that?) wasn't the correct place to put it?
b) I was under the impression that 0.9.1 (which I run) was "younger" / newer than 1.7 (I've read somewhere here that the numbering isn't consistent) and therefore tried it despite your mentioning that it's no go below ver 1.7.
No chance with 0.9.1? (Please bear with me, since I am rather a freshman to b2evo). :oops:
Thanks for your patience and your help.
Best regards,

'lex

15 Jun 04, 2006 22:39

uh, where IS that 1.7 anyways? - Highest version I can find at the Downloads page is 1.6 alpha, and on SF there's 0.9.2 on display .. 8|

16 Jun 04, 2006 22:50

No, the plugin won't work with 0.9.1, but the first post (everything below the "--------------") is instructions for 0.9.1. Here's the zip file you need for the 0.9.1 version of the hack:

http://www.brendoman.com/images/danny/b2media-both.zip

btw, if you want the very newest developement code, you can find instructions on how to get it [url=http://manual.b2evolution.net/CVS_version]here[/url]. It's not a good idea to use the CVS code unless you know exactly what you're doing.

17 Jun 05, 2006 15:24

Hey, Danny, thanks for the hint! Works as advertised; great!! :-) Best regards, 'lex

18 Jun 24, 2006 17:06

I get the following error when I click the "Add Media" button.

Notice: Use of undefined constant lite - assumed 'lite' in C:\Websites\blogs\admin\b2media.php on line 96

Fatal error: Call to undefined function: curl_close() in C:\Websites\blogs\admin\b2media.php on line 311

I can't seem to find an answer. What is the problem and fix. Thank you in advance for your help.

19 Jul 07, 2006 08:56

What happened to the sideblog code? Anybody got it?

20 Jul 07, 2006 15:07

I've made that into a plugin, too. I'll try to get it released soon.

21 Jul 15, 2006 05:33

I tried installing this on 1.8, but the file 'tools.php' has disappeared. Will this work with 1.8, or is a major rewrite necessary?

22 Jul 15, 2006 05:52

I've got it working on my 1.8-beta blog. I just need to clean it up and release it. Coming soon.

23 Aug 02, 2006 22:13

I'm having the same issue with 1.8. What has become of tools.php? The plugin looks like it's dying to work, because its admin and settings are working perfectly. personman, I'm very much looking forward to your release!

24 Aug 08, 2006 00:08

I'm having the same issue. I can't wait for the update!

25 Oct 11, 2006 20:21

This looks like a terrific plug in. Any progress reports for 1.8.2?

26 Oct 12, 2006 02:32

I just released my youtube, poll and star ratings plugins. Next up is the Amazon plugin. Sorry about the wait.

27 Oct 12, 2006 03:36

No need to apologize-- I appreciate the work you put into your plugins. Just curious!

29 Oct 18, 2006 04:37

This is great plugin-- thank you!

30 Oct 18, 2006 22:04

Thank you for taking the time to update this and post it. I've been waiting for it ever since I caught wind of it.

/off to install

31 Oct 19, 2006 04:20

Do you know why when the plugin finds a book with multiple authors, it prints only the first author's name?

32 Oct 19, 2006 12:49

Yes I know why. It's because I'm an amateur. I just fixed that and uploaded the new zip. It should work the way it's supposed to now. Thanks for catching that.

33 Oct 21, 2006 06:13

Thank you sir. I proved my amateur status as well by updating the plugin and forgetting to insert my Amazon ID again. :)

34 Dec 03, 2006 20:25

I upgraded my blog

www.comiclist.com

to 1.91, and it appears the evoAmazon plugin is not working. I can get to the administration area to search, but clicking on the "IMG" button does nothing.

35 Dec 09, 2006 05:08

Thanks for the update, Danny.

Is it my imagination, or did the "only print one of the authors" bug reappear in this version?

36 Dec 09, 2006 08:49

Good catch again. I fixed it and updated the zip file at AstonishMe.co.uk

37 Sep 25, 2008 23:17

is this plugin still available?

38 Jul 16, 2009 11:42

Just received this from Amazon:

You are receiving this email because we have identified you as a user of the Amazon Product Advertising API (previously known as the Amazon Associates Web Service or the Amazon E-Commerce Web Service). If you are not aware that you use the API, that may be because you use it via a third-party script or application that calls the API.
We wanted to let you know that all Product Advertising API developers will be required to authenticate all calls to the Product Advertising API using request signatures by August 15, 2009. Calls to the Product Advertising API that are not signed will not be processed after August 15, 2009.

If you are not the developer of the script or application you use that calls the API, or you are unsure how you are using the API, please contact the original developer of the script or application you are using to ensure that your site or application will comply with the signed requests requirement and will continue to work after August 15 2009.

We’d also like to take this opportunity to point out the resources available to help you make this change to your applications:

-The Developer Guide has details on what signed requests are and how to construct signed requests.

-Sample Code for Signed Requests is available in Java, C# and Perl.

-Our technical staff and other customers are available to answer questions on our Community Forums.

-Other resources can be found at the Product Advertising API home page.

Thank you for advertising our products and we look forward to sharing the revenue from these sales.

Sincerely,

The Product Advertising API Team


Form is loading...