WordPress.org

Ready to get started?Download WordPress

Forums

Amazon plugin (44 posts)

  1. cahira
    Member
    Posted 9 years ago #

    I'm using the Amazon plugin as a way to show what book I am currently reading.

    I'd also like to do the same with video games I am playing, but I'd like them to be separate sections. I was thinking the only way to do this would be install a duplicate Amazon plugin, but I know that wouldn't be easy ...

    currently i have just renamed the section to "currently reading/playing" and added the video game ... so the book is shown and the video game is below it (all in the same section). that was the only thing i could think of doing to get what i want.

    is there another plugin I can use additionally, or can i do something with existing plugin to make two separate entities?

  2. davidchait
    Member
    Posted 9 years ago #

    WHICH amazon plugin? There's two or three already...

    CG-Amazon can do this easily, by adding products to its database, and specifically tagging/categorizing the "Currently Reading" and "Currently Playing" items, then making two calls to display each of those two categories. If you are trying to use CG-Amazon, lemme know and I can help.

    -d

  3. davidchait
    Member
    Posted 9 years ago #

    Okay, more detailed:

    In the CGA admin panel, you have your two items, a book, and a video game. (Well, let's say you have a bunch of books and bunch of video games!)

    If you click the "Edit" button to the right of the book you want to 'tag', you can then set a custom 'category' for the book, say "Reading". Then click Submit Changes. Do the same for the game, but set the category to be "Playing".

    Then inside of your sidebar, make TWO amazon blocks back to back. Change the titles to match what you want them to show. THEN, we modify the call to show_amazon_items, to something like:
    show_amazon_items(1, 'rand', true, "Reading");

    For the second call:
    show_amazon_items(1, 'rand', true, "Playing");

    That'll give you separate blocks. From then on, when you want to change what you are reading or playing, just go into the CGA page and set your new item to "Reading", and then set the old item back to "None".

    Okay, now for a little more detail on those calls:

    1 == how many items to show. this says show 1. you could have it be 3, and it will show up to 3 items.

    'rand' == show up to the above number of items randomly selected from the 'filtered' list. i.e., you could have 5 books categorized as "Reading", and it will randomly show 1 of the 5 on a page refresh...

    true == show the image. that's just so people could have longer lists of links without the images.

    This is only scratching the surface of what CG-Amazon can do. Including things like showing items off your wishlist (but not tagging them yet when clicking through -- that's an Amazon-side issue), some number of random items matching a keyword, the integration with CG-WhatTunes to show the music your iTunes is playing, integration with CG-Inline to insert a link to ANY amazon product within the body of a post, and more custom queries of the items you've added to the local database.

    Post away if you have more questions!

    -d

  4. cahira
    Member
    Posted 9 years ago #

    wow, thanks david. didn't think i could do that

    i did come across a problem after adding the code to my sidebar

    Parse error: parse error, unexpected '<' in
    .../blog-wp/wp-content/themes/ocadia/sidebar.php on line 13

    Here is the code I added that you suggested:

    -----------------------

    <li id="amazon">
    <h2><?php _e('Currently Reading'); ?></h2>
    <?php show_amazon_items(1, 'rand', true, "Reading");

  5. (closed li tag)

    <li id="amazon">
    <h2><?php _e('Currently Playing'); ?></h2>
    <?php show_amazon_items(1, 'rand', true, "Playing");

    (closed li tag)

    -----------------------

    Line 13 is the /li in the first block. This makes no sense to me of course, because taking away the "<" isn't an option, right?

    (please teach me how to post code appropriately!! the "`" doesn't seem to work)

  • lbessant

    Posted 9 years ago #

    Have you closed those <?php tags? Or is their apparent absence to do with the problem you're having getting code to display?

    The backtick has always worked for me here...

  • cahira
    Member
    Posted 9 years ago #

    yep they're closed!! am i supposed to type ` before and after code to get it to show up here? 'cause that doesnt work :(

  • cahira
    Member
    Posted 9 years ago #

    bump

  • Joni
    Member
    Posted 9 years ago #

    I'm using Chaitgear's CGA (Amazon Media) plugin, albeit on WP 1.2.2, so maybe this code won't work. But I have my books and music on separate pages. It almost seems "too easy" -- so maybe it's very different in WP 1.5. In any event, on each page I have this piece of code:

    <!-- CGA LIST -->
    <div id="music-list">
    <?php get_media('2',20); ?>
    </div>

    <!-- CGA LIST -->
    <div id="book-list">
    <?php get_media('1',20); ?>
    </div>

    The code is very easy to understand. The numbers 2 and 1 respectively, in the "get" tag are the Amazon numbers for the particular media you want displayed (e.g., 1 for books and 2 for CDs). The second number (20 in both instances here) represents the maximum number of items you wish displayed in each of your lists.

    You can see it in action at my blog, http://www.babygotblog.com, just click on the Books or Music links.

    HTH.

  • cahira
    Member
    Posted 9 years ago #

    thanks joni i will try that out...i'm using 1.5 though. wonder if the coding will be different? i don't know much about php, so i'm not sure if the calling code has to be the same format throughout the entire template

  • davidchait
    Member
    Posted 9 years ago #

    actually joni is using WP-Amazon, a completely different animal (at least as far as I could see). get_media is 'his' call structure. ;)

    cahira - one thing I noticed is your second block needs to be
    id="amazon2"

    id's must be unique. classes can be shared.

    If that doesn't work, I can always have you send me your sidebar and I can take a quick look. But if it was working before, the id= thing might be the issue. or if the ? > isn't on the end of the show_amazon_items lines...

    -d

  • cahira
    Member
    Posted 9 years ago #

    hi david. i'll try giving it a unique id. if that doesn't work i will surely like to send you my entire sidebar hehe

    yes the tags are properly closed, the code didn't show up properly here

  • cahira
    Member
    Posted 9 years ago #

    thanks david, it worked!!

  • davidchait
    Member
    Posted 9 years ago #

    Glad to hear it. Stuff's been working for so long, it had to be something simple on the call or CSS side. It does stink that you don't usually get 'errors' about such things from the browser. I guess using a validator would have pointed that out.

    -d

  • nyifan
    Member
    Posted 9 years ago #

    Hi
    Im trying to use the CGA, and while i have no problem getting it to work, I am having some issues configuring it's output. All I really want is the image, no title, or pricing info, and i'd like it centered in the block I have it in. I admit not having the greatest of CSS skills, but I do know enough html and css to be a hazard to myself ;-) Is there an idiots guide to the style sheet for this, or am i not even looking in the right place to set this up?

    Thanks

  • davidchait
    Member
    Posted 9 years ago #

    I can give you a hack for the moment: set your image size to be "Preview". That will give you the Small image, and >nothing< else.

    The older hack (which is here in the forums somewhere) is to use CSS to hide those fields you don't want to see (the CSS tag is usually "t-amazon" or something like that).

    For more than that, I'd need to see the site, and a better description of how you are trying to use it. In the long run, I just need to make a 'templating' system so you can pass in the output format you are looking for. ;)

    -d

  • nyifan
    Member
    Posted 9 years ago #

    Thanks for the quick fix David

    I had tried setting everything in the css with .t-amazon (i think thats what it was, i saw your comments in the style sheet regarding title but can't remember the exact tag) as display: none; but it didn't seem to do anything. I'm off to try the preview option now and will let you know!

  • nyifan
    Member
    Posted 9 years ago #

    OK, that takes away the title etc, but leaves the time date stamp, it is still aligning to the right and is no longer a clickable link. Also I'd like to go with an image a tad bigger if possible. Would you mind taking a peek?

    http://www.danisown.com/blog (right sidebar is where the 2 blocks are)

    Thanks!

  • adb
    Member
    Posted 9 years ago #

    I'm using CG-Amazon. I'd like to add my Amazon Associate ID. How can I do this?

  • nyifan
    Member
    Posted 9 years ago #

    the associates id is added in the cga-config.php file

    // set this if you have an Associates ID you want to use
    // $AmazonID = ' ';

    add your id, and uncomment the line

  • adb
    Member
    Posted 9 years ago #

    Thanks!

  • davidchait
    Member
    Posted 9 years ago #

    nyifan -

    Which function(s) are you calling? That'll make a difference in how I approach this.

    I'm going to need to code something up. I thought I had a solution, but the Preview thing isn't it... The display:none should work (others have used that), but there should be a simple solution for folks who just want to output a list of picture-links of a given size. Lemme look into it, and I'll try to get 1.5a7 out with a fix in the next day or two... if my schedule plays nice! ;)

    -d

  • davidchait
    Member
    Posted 9 years ago #

    I have a solution roughed out, with a new cga-config variable to control it, and the added ability to allow the Annotations to be output if you say to (turns off all text generally, but allows you a per-item override if you want it, and only where you specify it in the local database...). Timestamp is also turned off as a side-effect for the moment.

    What this will allow you is basically to say you just want images, nothing else. The overall 'wrappering' of amazon block output will occur as normal, so that you have extra divs/etc. that you can apply CSS to in order to have a LOT of flexibility with formatting.

    Note that cga-config also allows other control of the output, via $amazonWrapperDiv, $amazonWrapInfo, $amazonInfoBreak, $defaultAmazonImage, and more. Write back if you need more help (I didn't see a CG-Amazon block on your site -- just your existing amazon stuff...).

    Keep an eye out, as not sure if I'll make one new thread or multiple crossposts as I get A7 out the door...

    -d

  • nyifan
    Member
    Posted 9 years ago #

    Hi David
    I got frustrated last night and yanked it off until I could get it the way I wanted it - long way around, temp fix

    When i get home from work I will check to see if the new version is available for download and start again =) Thank you so much for your help and for the changes!!

  • davidchait
    Member
    Posted 9 years ago #

    If you send me an email at cgcode at chait dot net, with more details of exactly what you are trying to do in terms of results, formatting, etc., I can try to mock it up locally and 'prove out' the CSS tweaks.

    -d

  • nyifan
    Member
    Posted 9 years ago #

    Hi David
    I got frustrated last night and yanked it off until I could get it the way I wanted it - long way around, temp fix

    When i get home from work I will check to see if the new version is available for download and start again =) Thank you so much for your help and for the changes!!

  • davidchait
    Member
    Posted 9 years ago #

    Don't know if you just accidentally double posted, but do drop me an email or post here with what 'visually' you are trying to get for results, so I can help make sure the output is generating the results you'll want/need. ;)

    -d

  • nyifan
    Member
    Posted 9 years ago #

    That is BEYOND weird - I didn't do the 2nd posting - HONEST lol

    I just sent the email your way. THANK YOU!

  • davidchait
    Member
    Posted 9 years ago #

    New version posted. ;)

    -d

  • nyifan
    Member
    Posted 9 years ago #

    We're closer! Have some weirdness still though!
    I realize you have many other things on your plate, so when you get a chance to look, great =)

    1 - I have image size set to medium, but image still seems like it's small
    2 - If you mouse over the image, it's like there is a size set for the image and when you hover you see the outline
    3 - the positioning is closer to what I wanted, but it appears that there is a set left margin instead of a true center option. larger images (music) are left aligned with the books, rather than taking a centered position

    and finally,
    4 - the VH album is obviously music, and it is tagged as "Listening" in the CGA options, yet for some odd reason, it shows in Reading, with the 2 books
    while Listening shows "no products found"

    I am calling the list with:
    <? show_amazon_items(3, true, "Reading"); ?>
    and
    <? show_amazon_items(3, true, "Listening"); ?>

    Leaving it up even though it's off in case you get a chance to take a peek.

    Many thanks!
    -=D

  • davidchait
    Member
    Posted 9 years ago #

    Will send this in email as well, but cc here so others can learn.

    1. cga-config.php. try uncommenting the line:
    // $defaultAmazonImage = 'SmallMediumShadowed';
    And note the sizes are all InitCapsWords -- lowercase won't match. So if you want medium, use 'Medium'. Medium is big though, you likely want SmallMedium (but SmallMediumShadowed might be cool/different for many folks, so I added that as a 'sample default').

    2. Well, the link IS being tagged as display: block. If #3 below doesn't make things look better, let me know. If you want to 'adjust' just the hover, I just tested on my site something like:
    .amazon-item-wrap a:hover { background: #223366; }
    Obviously, you can adjust the 'a' as well as 'a:hover' if you want. There's an existing ".amazon-item-wrap a" in the css that does the block control.

    3. The css for the sidebar that's important is ".amazon-block li". You want something like:
    .amazon-block li { text-align: center; }
    The 'float' and 'inline' cases are only used with CG-Inline. (HINT: Do a View Source on the page, find the output, and look at how it generates -- good to see what you want to try to tag.) (HINT 2: The cg-amazon.css file is only an example approach -- feel free to rip it apart, start from scratch, modify what's there.. whatever works for you!)

    4. Try:
    <? show_amazon_items(3, 'time', true, "Reading"); ?>
    and
    <? show_amazon_items(3, 'time', true, "Listening"); ?>

    -d

  • 12

    Topic Closed

    This topic has been closed to new replies.

    About this Topic

    Tags

    No tags yet.