Help - Search - Members - Calendar
Full Version: Wishlist with MT
Movable Type Community Forum > Additional Resources > Tips and Tricks
jivany
Has anyone put together a generic wishlist with MT?  Something that allows you to point to other sites that may or may not have their own wishlist.  

I don't mean a flat file wishlist where you hand edit each item, I mean using an MT entry as a wishlist entry.  Then you'd be able to remove items as you recieve them.  You'd also be able to use the MT search and sorting capabilities.

It seems pretty simple to put this together since it would basically just be another blog with customized templates, but I was wondering if anyone else has done it so I don't re-invent the wheel.

If not, I may throw this together on the weekend.

Jeff
kadyellebee
I haven't seen anybody using just MT as a wishlist.  But I could see how this could work *really* nicely with the MTAmazon plugin to display the items, if you were wishing for anything that Amazon sells from their site.

I wrote a script for displaying a random wishlist item with the MTAmazon plugin, but when you click it and purchase, it doesn't associate itself with the wishlist at all.  So it wouldn't go to the wishlist-creator, it would be a purchase for the purchaser.

Kristine
jivany
I saw the MTAmazon plugin and that is what got me thinking about this.

My problem is I have wishlists on a couple different sites, not just Amazon.  I think it would be nice if I could instead put together something with MT so I wouldn't have to send everyone an email full of wishlist links!  :)

Jeff
nytshade
well, this isn't something you do IN MT, but there is a website called www.thethingsiwant.com You can make one large conglomeration of your wishlists there (and even places that dont have a wishlist because you are linking directly to the page of the item you want). You can then put ONE link in your blog, and in one click, your viewers see EVERYTHING you want on one page.
AMK4
QUOTE (kadyellebee @ Nov 27 2002, 10:14 PM)
I wrote a script for displaying a random wishlist item with the MTAmazon plugin, but when you click it and purchase, it doesn't associate itself with the wishlist at all.  So it wouldn't go to the wishlist-creator, it would be a purchase for the purchaser.

Do you mind sharing this?
kadyellebee
Sure! I don't know if I went about it the right way, but its still sitting in my templates for my collectics blog, so here ya go...

Example

Just the code; no outside formatting (so that it can be included easily into whatever formatting desired)
CKMJ6HGH0QV4 is my wishlist code.
CODE
<?
$titles = array(<MTGlueContainer><MTAmazon method="Wishlist" search="CKMJ6HGH0QV4" lastn="30">'<MTAmazonTitle encode_php="q">'<MTGlue>, </MTGlue></MTAmazon></MTGlueContainer>);
$links = array(<MTGlueContainer><MTAmazon method="Wishlist" search="CKMJ6HGH0QV4" lastn="30">'<MTAmazonLink>'<MTGlue>, </MTGlue></MTAmazon></MTGlueContainer>);
$images = array(<MTGlueContainer><MTAmazon method="Wishlist" search="CKMJ6HGH0QV4" lastn="30">'<MTAmazonSmallImage>'<MTGlue>, </MTGlue></MTAmazon></MTGlueContainer>);
$prices = array(<MTGlueContainer><MTAmazon method="Wishlist" search="CKMJ6HGH0QV4" lastn="30">'<MTAmazonSalePrice>'<MTGlue>, </MTGlue></MTAmazon></MTGlueContainer>);

$count = count($titles)-1;
$random = rand(0, $count);

$title = $titles[$random];
$link = $links[$random];
$image = $images[$random];
$price = $prices[$random];

echo "<div class=\"blogbody\">\n\r";
echo "<a href=\"", $link, "\/loveproductions\" target=\"_blank\">";
echo "<img src=\"", $image, "\" align=\"left\" border=\"0\"></a>\n\r";
echo "<span class=\"title\">", $title, "</span><br \>\n\r";
echo $price, "<br clear=\"all\" /></div>\n\r";
?>


Like I said, there's probably better ways to do this; I just made 4 arrays and picked the corresponding piece of data by using the same random number. Then echoed it out.

I used the MTAmazon plugin to get the data, and then the Glue plugin to format the arrays - just easier that way, but not essential.

Hope that helps!
Kristine
AMK4
QUOTE
Sure!  I don't know if I went about it the right way...

It's a start. Those are always good.
CODE
$count = count($titles)-1;
$random = rand(0, $count);

$title = $titles[$random];
$link = $links[$random];
$image = $images[$random];
$price = $prices[$random];

Myah, there are better ways to do this. A better method would be where you'd end up with something like:

CODE
$wishlist = array (
       "<MTAmazonASIN>" => array(
               "title"        => "<MTAmazonTitle>",
               "link"         => "<MTAmazonLink>",
               "image"     => "<MTAmazonSmallImage>",
               "price"       => "<MTAmazonSalePrice>",
               "category" => "<MTAmazonCatalog>"
       )
);

Then run a random select on $wishlist and you have all the values you need to create your html code:

CODE
$random = rand(0, count($wishlist)-1);

echo $wishlist[$random]["title"];
echo $wishlist[$random]["link"];
echo $wishlist[$random]["image"];
echo $wishlist[$random]["price"];
echo $wishlist[$random]["category"];


Of course now, I have to write this for myself. smile.gif
bmk
here's another example:

http://www.emptypages.org/more/plugins/ran...dom_amazon.html
AMK4
That's exactly what I was talking about. It generates the same array format as my example, but using an index key, as opposed to my AmazonASIN number. This method is much cleaner than holding separate arrays, one for title, one for link, etc., etc. I'll post my code when I'm done.
kadyellebee
Oh very nice, B! I haven't played with arrays of arrays much yet, so this makes a lot more sense than my way now that I've seen it! smile.gif

Kristine
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.