WordPress.org

Ready to get started?Download WordPress

Forums

Amazon Link
[resolved] Implementing live search product link (6 posts)

  1. guel
    Member
    Posted 1 year ago #

    Hi,

    I'm trying to put a single product link for book product searched by the keywords specified. The keyword is obtained by the user filling out the form from previous page. I get the inputs by GET and assign it to a variable for example, $book-title. I want to search for products in book category with this $book-title showing 1 result(hopefully the top result).

    Can you help me accomplishing this?

    http://wordpress.org/extend/plugins/amazon-link/

  2. paulstuttard
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    It's not something that the plugin supports in a 'user friendly' way, but I could probably give you a snippet of php code to do what you want. I'll try and post something tomorrow,

    Cheers,

    Paul

  3. paulstuttard
    Member
    Plugin Author

    Posted 1 year ago #

    This is the least 'back door'ish way I can think of to do a search:

    if (isset($awlfw)) {
    	$opts['s_title'] = $book_title;
    	$opts['s_index'] = 'Books';
    	$opts['s_page']  = 1;
    	$items = $awlfw->search->do_search($opts);
    	if (isset($items['Error'])) {
    		echo '<div class="Error">Search Failed: ' . (isset($items['Error']['Message']) ? $items['Error']['Message'] : 'No Error Message') . '</div>';
    	} else if (is_array($items) && (count($items) >0)) {
    		$asin = $items[0]['asin'];
    		echo amazon_shortcode("asin=$asin&template=wishlist&live=1");
    	} else {
    		echo "<PRE>";print_r($items); echo "</PRE>";
    
    	}
    }

    Works for me, at least,

    Good luck,

    Paul

  4. guel
    Member
    Posted 1 year ago #

    Hi Paul.

    It works. It helped a lot. Thank you for your assistance.

  5. guel
    Member
    Posted 1 year ago #

    I have another question. What is the keyword to place between %% to display "used price and new price starting from" other than amazon's price? Are these keywords listed somewhere?

    Where can I find a list of keywords for the associative array field? For example, how do I add a query for ISBN 10?

  6. paulstuttard
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    The keywords the plugin currently supports are listed in the 'Template Help' window on the plugin's Options page.

    You can add your own keywords by creating your own 'extras' plugin or adding some code to your themes files, here is a plugin I knocked up to add the ISBN, NEW_PRICE & USED_PRICE keywords:

    amazon-link-my-keywords.php

    Download it, remove the '_.txt' extension, upload to your plugins directory and activate it.

    If you have a play around with the Amazon Advertising Scratchpad you can see exactly what data is available and where in the response data structure it might be found:

    http://associates-amazon.s3.amazonaws.com/scratchpad/index.html

    Paul

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic