- <?php
- /**
- * This file contains the two classes which store details of products returned by AWS.
- *
- * The two classes are {@link LiteDetails}, which stores information obtained by making a 'lite'
- * request; and {@link HeavyDetails}, which is created when making a 'heavy' request.
- *
- * Apparently the lite/heavy request types are going to change in AWS4, so this may
- * change (drastically?) in future releases.
- *
- * @author Mauricio Diaz <madd0@users.sourceforge.net>
- * @copyright 2004 (c) Mauricio Diaz Orlich
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public License
- * @version 0.3RC1
- *
- * @package amazOOP
- * @subpackage Details
- */
-
- /**
- * This file is included because it contains class {@link AmazonItem}, which is
- * the parent of class {@link LiteDetails} contained in this file.
- * @access private
- */
- require_once(CORE_PATH . 'item.class.php');
-
- /**
- * The LiteDetails class is used to store information on products returned when
- * doing a lite request to AWS.
- *
- * All string values are encoded with native PHP function rawurlencode(). But are returned
- * decoded by the corresponding accessor methods, which you are encouraged to use.
- *
- * As of version 0.3RC1 this is a list of the information returned by AWS that is
- * supported by amazOOP:
- * - <i>Artists</i> of a CD or casset ({@link getArtists()})
- * - <i>ASIN</i> of a product ({@link getASIN()})
- * - <i>Authors</i> of a book ({@link getAuthors()})
- * - Current <i>Availability</i> of a product ({@link getAvailability()})
- * - <i>Catalog</i> of a product ({@link getCatalog()})
- * - URLs of a <i>Product's image</i> ({@link getImage()})
- * - <i>List Price</i> of a product ({@link getListPrice()})
- * - <i>Manufacturer</i> of a product ({@link getManufacturer()})
- * - <i>Amazon's Price</i> for a product ({@link getOurPrice()})
- * - <i>Product's name</i> ({@link getProductName()})
- * - <i>Release Date</i> of a product to the market ({@link getReleaseDate()})
- * - <i>URL</i> of the product's details page on Amazon ({@link getURL()})
- * - Lowest <i>Used Price</i> at Amazon Marketplace. Note, however, that Third Party searches
- * are not yet supported by amazOOP. ({@link getUsedPrice()})
- * - <i>Merchant ID</i> of a Third Party Seller ({@link getMerchantId()})
- *
- * @link http://www.amazon.com/gp/aws/landing.html Amazon Web Services SDK
- *
- * @author Mauricio Diaz <madd0@users.sourceforge.net>
- * @copyright 2004 (c) Mauricio Diaz Orlich
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public License
- * @version 0.3RC1
- *
- * @package amazOOP
- */
- class LiteDetails extends AmazonItem {
- /*Do not check for alternative images
- Check with product's merchant
- Check with other Amazon sites (+ all of the above)
- Check if store is in Store List (+ all of the above)
- Check all stores in List (+ all of the above)*/
- /**#@+
- * @access private
- */
-
- /**
- * Link to product detail page at Amazon.
- * @var string
- */
- var $url;
- /**
- * Product category (book, music, etc.).
- * @var string
- */
- var $catalog;
- /**
- * Date the product was, or will be, released to market.
- * @var string
- */
- var $releaseDate;
- /**
- * Manufacturer of product. Can represent publishers (for books), labels (for music) or studios (for films).
- * @var string
- */
- var $manufacturer;
- /**
- * Lowest price of the used product in Amazon Marketplace
- * @var string
- */
- var $usedPrice;
- /**
- * Indicates if any errors were encountered while processing the service request.
- * @var string
- */
- var $status;
- /**
- * Current product availability at Amazon
- * @var string
- */
- var $availability;
- /**
- * ID of Third Party Seller
- * @var string
- */
- var $merchantid;
-
- /**
- * Product image or cover art.
- * Amazon returns 3 URLs for a small, medium and large image, which are stored in this array.
- * @var array
- */
- var $imageUrls;
- /**
- * Author(s) of a book.
- * @var array
- */
- var $authors;
- /**
- * Musician(s) or artist(s) of a CD or cassette.
- * @var array
- */
- var $artists;
- /**#@-*/
-
- /**#@+
- * This feature is not properly documented in the SDK, therefore I don't use it.
- * @var string
- * @access private
- */
- var $minPrice;
- var $maxPrice;
- var $minSalePrice;
- var $maxSalePrice;
- var $shipDate;
- var $multiMerchant;
- var $merchantSku;
- /**#@-*/
-
-
- /**
- * Can generate a hyperlink to the product details page at Amazon, or simply
- * return the URL to this page.
- *
- * @param string|boolean$makeLink is used to indicate whether a link should be created.
- * Accepted values are:
- * - false: no link is created, only the URL is returned
- * - "name": a link is created displaying the name of the product
- * between the anchor tags (<a>)
- * - "small": a link is created displaying the small version
- * of the product's image
- * - "medium": a link is created displaying the medium version
- * of the product's image
- * - "large": a link is created displaying the large version
- * of the product's image
- * - "special": a link is created using the string provided through
- * the $special parameter
- * @param string $linkAttributes any additional attributes to be added to the anchor tag (<a>)
- * such as style, onmouseover, etc.
- * @param string $additionalArguments when $makeLink is set to "special", the value of this parameter
- * is used as text for the link created. If $makeLink is set to any of the images, this parameter is
- * used to add information to the IMG tag, such as border (which is 0 if not specified), alignment,
- * etc.
- * @param string $type this experimental feature allows to obtain links for pages designed
- * for specific browsers in Amazon (i.e. WAP browsers, PDAs, etc.) the default is "html" for
- * a classic Amazon page. Accepted values are:
- * - "html": link to the classic Amazon.com product details page
- * - "wap": link to a WAP version of the Amazon.com product details page
- * - "pda": link version adapted for PDAs of the Amazon.com product details page
- * - "text": link to the text-only version of the Amazon.com product details page
- * NOTE that types different than "html" have only been tested to work with the "us" locale.
- *
- * @return string|booleanEither the URL to the details page of the product on Amazon, or the generated
- * hyperlink. Or false if the URL is not set.
- */
- function getURL($makeLink = false, $linkAttributes = "", $additionalArguments = "", $type = "html"){
- global $_AMAZOOP_ASSOC_IDS;
-
- if(getAmazoopConfig('close_tag_character') == "xhtml")
- $tagClose = " />";
- else
- $tagClose = ">";
-
- // Return false if the URL is not set
- if(!isset($this->url))
- return false;
-
- $sites = array( "us" => "com",
- "uk" => "co.uk",
- "de" => "de",
- "fr" => "fr",
- "jp" => "co.jp");
-
- $url = "";
-
- switch($type){
- case "wap":
- $url = "http://www.amazon." . $sites[$this->locale] . "/exec/obidos/redirect?tag=" . $_AMAZOOP_ASSOC_IDS[$this->locale] . "%26creative=" . _AMAZOOP_DEV_TOKEN . "%26camp=2025%26link_code=xm2%26path=ct/text/vnd.wap.wml/-/tg/aa/xml/glance-xml/-/" . $this->getASIN();
- break;
- case "pda":
- $url = "http://www.amazon." . $sites[$this->locale] . "/exec/obidos/redirect?tag=" . $_AMAZOOP_ASSOC_IDS[$this->locale] . "%26creative=" . _AMAZOOP_DEV_TOKEN . "%26camp=2025%26link_code=xm2%26path=dt/upda-1.0-anywhere/tg/aa/upda/item/-/" . $this->getASIN();
- break;
- case "text":
- $url = "http://www.amazon." . $sites[$this->locale] . "/exec/obidos/redirect?tag=" . $_AMAZOOP_ASSOC_IDS[$this->locale] . "%26creative=" . _AMAZOOP_DEV_TOKEN . "%26camp=2025%26link_code=xm2%26path=tg/detail/-/" . $this->getASIN() . "/t?v=glance";
- break;
- case "wishlist":
- $url = "http://www.amazon." . $sites[$this->locale] . "/exec/obidos/redirect?tag=" . $_AMAZOOP_ASSOC_IDS[$this->locale] . "%26creative=" . _AMAZOOP_DEV_TOKEN . "%26path=http%3A//www.amazon." . $sites[$this->locale] . "/gp/registry/registry.html%3Fid%3D" . "3MBWIMW5ILITP";
- break;
- default:
- $url = rawurldecode($this->url);
- break;
-
- }
-
- // If there are attributes to be added to the anchor tag, add a space before them
- if($linkAttributes != "")
- $linkAttributes = " " . $linkAttributes;
-
- // Test what kind of link should be created and create the appropiate response
- switch($makeLink){
- case "name":
- $res = "<a href=\"" . $url . "\"" . $linkAttributes . ">" . $this->getProductName() . "</a>";
- break;
- case "small":
- case "medium":
- case "large":
- $image = $this->getImage($makeLink, true, $additionalArguments);
- /*if(strpos($additionalArguments, "border") === false)
- $additionalArguments = "border=\"0\" " . $additionalArguments;*/
- //$res = "<a href=\"" . $url . "\"" . $linkAttributes . "><img src=\"" . $image['url'] . "\" width=\"" . $image['width'] . "\" height=\"" . $image['height'] . "\" alt=\"". $this->getProductName() . "\" " . $additionalArguments . $tagClose . "</a>";
- $res = "<a href=\"" . $url . "\"" . $linkAttributes . ">" . $image . "</a>";
- break;
- case "special":
- $res = "<a href=\"" . $url . "\"" . $linkAttributes . ">" . $additionalArguments . "</a>";
- break;
- default:
- // The decoded version of the URL should be returned
- $res = $url;
- }
-
- return $res;
- }
-
-
- /**
- * Decodes the catalog. The catalog determines which "aile" of the Amazon store
- * this product belongs to. This seems to be in English in all locales.
- *
- * @return string|booleanThe product's catalog. Or false if the catalog is not set.
- */
- function getCatalog(){
- if(!isset($this->catalog))
- return false;
- else
- return rawurldecode($this->catalog);
- }
-
- /**
- * Displays the authors of a book.
- *
- * You can specify how many authors you want to display, what character(s) should
- * separate each name and what should be appended at the end of the list if there are
- * more authors than were displayed.
- *
- * Additionally, since version 0.2, you can add a template that will be applied to
- * each name. This allows to create links, and apply other html transformation to each
- * name in the list.
- *
- * @param integer $howmany indicates how many authors you want to display. If the value is
- * zero or is greater than the total number of available authors, all authors are displayed.
- * @param string $separator determines what character(s) separate each name. The default value is
- * a comma followed by a space.
- * @param string $etc is the text appended to the end of a partial list of authors. The default
- * value is "et al.", but it could be something like "etc.", "and others", etc.
- * @param string $template a template to be applied to each name on the list. The default value
- * is "%name%" wich will display the name unmodified. You can submit templates such as
- * "<b>%name%</b>", which will display each name in bold characters, but not the separators, or
- * something like "<a href=\"/author/%rawName%\">%name%</a>", which will create a link to a page
- * using the URL encoded author's name.
- *
- * @return string|booleanA list of authors. Or false if there are no authors.
- *
- */
- function getAuthors($howmany = 0, $separator = ", ", $etc = "et al.", $template = "%name%"){
- $res = "";
-
- if(!isset($this->authors) || sizeof($this->authors) == 0)
- return false;
-
- // If no size was specified or if too many authors were requested
- if($howmany == 0 || $howmany > sizeof($this->authors))
- // The total number of authors will be returned
- $howmany = sizeof($this->authors);
-
- for($i = 0; $i < $howmany; $i++){
- // Each author is displayed
- $author = $this->authors[$i];
- $temp = preg_replace("/(%name%)/e", "rawurldecode(\$author)", $template);
- $res .= preg_replace("/(%rawName%)/e", "\$author", $temp);
-
- // Unless it's the last item, append the separator
- if($i < sizeof($this->authors)-1)
- $res .= $separator;
- }
-
- // If not all authors were displayed, append the $etc text
- if($howmany < sizeof($this->authors))
- $res .= $etc;
-
- // The list is returned
- return $res;
- }
-
- /**
- * Displays the musicians of a CD or cassette.
- *
- * You can specify how many artists you want to display, what character(s) should
- * separate each name and what should be appended at the end of the list if there are
- * more artists than were displayed.
- *
- * Additionally, since version 0.2, you can add a template that will be applied to
- * each name. This allows to create links, and apply other html transformation to each
- * name in the list.
- *
- * @param integer $howmany indicates how many artists you want to display. If the value is
- * zero or is greater than the total number of available artists, all artists are displayed.
- * @param string $separator determines what character(s) separate each name. The default value is
- * a comma followed by a space.
- * @param string $etc is the text appended to the end of a partial list of artists. The default
- * value is "et al.", but it could be something like "etc.", "and others", etc.
- * @param string $template a template to be applied to each name on the list. The default value
- * is "%name%" wich will display the name unmodified. You can submit templates such as
- * "<b>%name%</b>", which will display each name in bold characters, but not the separators, or
- * something like "<a href=\"/artist/%rawName%\">%name%</a>", which will create a link to a page
- * using the URL encoded artist's name.
- *
- * @return string|booleanA list of artists. Or false if there are no artists.
- *
- */
- function getArtists($howmany = 0, $separator = ", ", $etc = "et al.", $template = "%name%"){
- $res = "";
-
- if(!isset($this->artists) || sizeof($this->artists) == 0)
- return false;
-
- // If no size was specified or if too many artists were requested
- if($howmany == 0 || $howmany > sizeof($this->artists))
- // The total number of artists will be returned
- $howmany = sizeof($this->artists);
-
- for($i = 0; $i < $howmany; $i++){
- // Each artist is displayed
- $artist = $this->artists[$i];
- $temp = preg_replace("/(%name%)/e", "rawurldecode(\$artist)", $template);
- $res .= preg_replace("/(%rawName%)/e", "\$artist", $temp);
-
- // Unless it's the last item, append the separator
- if($i < sizeof($this->artists)-1)
- $res .= $separator;
- }
-
- // If not all artists were displayed, append the $etc text
- if($howmany < sizeof($this->artists))
- $res .= $etc;
-
- // The list is returned
- return $res;
- }
-
- /**
- * Decoded version of the date the product was or is supposed to be released to the
- * market.
- *
- * @return string|booleanProduct's release date. Or false if no date is set.
- */
- function getReleaseDate(){
- if(!isset($this->releaseDate))
- return false;
- else
- return rawurldecode($this->releaseDate);
- }
-
- /**
- * Manufacturer of product. Can represent publishers (for books), labels (for music)
- * or studios (for films).
- *
- * Additionally, since version 0.2, you can add a template that will be applied to
- * the name. This allows to create links, and apply other html transformation to the
- * manufacturer's name.
- *
- * @param string $template a template to be applied to the manufacturer's name. The default value
- * is "%name%" wich will display the name unmodified. You can submit templates such as
- * "<b>%name%</b>", which will display the name in bold characters, or something like
- * "<a href=\"/artist/%rawName%\">%name%</a>", which will create a link to a page
- * using the URL encoded manufacturer's name.
- *
- * @return string|booleanProduct's manufactuer. Or false if no manufacturer is set.
- */
- function getManufacturer($template = "%name%"){
- if(!isset($this->manufacturer))
- return false;
- else{
- $manufact = $this->manufacturer;
- $temp = preg_replace("/(%name%)/e", "rawurldecode(\$manufact)", $template);
- $res = preg_replace("/(%rawName%)/e", "\$manufact", $temp);
- return $res;
- }
- }
-
- /**
- * This function will return either the IMG or the URL for the specified image size.
- *
- * If the image returned by Amazon is a "non-image" (i.e. 1x1 transparent gif) the default
- * image for the specified size is returned. The URLs for the default images are stored in
- * {@link $defaultImages}, which is located in the {@link config.inc.php} file.
- *
- * This function alse tries go around some AWS bugs:
- * - when a product is imported (e.g. English books in Amazon.co.jp) their images
- * should be accessed using Amazon.com's store code (01) instead of Amazon.co.jp's (09).
- * If an image is not returned, amazOOP tries different store codes to go around this.
- * For more information on this problem, read
- * {@link http://www.amazon.com/gp/browse.html/ref=sc_bb_l_0/?%5Fencoding=UTF8&node=3434651&no=3435361&me=A36L942TSJ2AJA#misc this}
- * - when a product is provided by a Third Party Seller (such as products in the apparel,
- * gourmet, sports, jewelry and watch catalogs, which by the way are not officially supported)
- * the image's name should include the merchant's ID, but AWS doesn't return it like that,
- * therefore amazOOP tries to go around this by, first, trying to use the merchant ID AWS provides
- * (if a merchant ID is provided) or, second, tries a list of frequently used merchant IDs
- * which can be configured in {@link stores.inc.php}. Be aware that this is a crude and time-expensive
- * hack to go around this and can be turned off. To avoid going through the whole list of merchants,
- * what you should do is erase everything but the first 5 entries from array {@link $storeCodes}, which is
- * in file {@link stores.inc.php}.
- *
- * @param string $size the image's size. Can be "small", "medium" or "large"
- * @param boolean $makeTag whether the IMG tag should be created or not
- * @param string $addAttr additional attributes to be included in the IMG tag if it was created.
- *
- * @return string|arrayeither an IMG tag to display the requested image, or an array with the following
- * information:
- * - 'url': the URL of the image
- * - 'width': the image's width
- * - 'height': the image's height
- *
- */
- function getImage($size = "small", $makeTag = false, $addAttr = ""){
- global $_AMAZOOP_STORE_CODES, $_AMAZOOP_DEFAULT_IMAGES, $allowgetimagesize, $allowsettimelimit;
-
- if(getAmazoopConfig('close_tag_character') == "xhtml")
- $tagClose = " />";
- else
- $tagClose = ">";
-
- $checkAlternatives = getAmazoopConfig('check_alternative_images');
- $asis = (($checkAlternatives & IMAGE_AS_IS) != 0);
- $nosize = (($checkAlternatives & IMAGE_NO_SIZE) != 0);// || !$allowgetimagesize;
- $checkAlternatives = $checkAlternatives & (~IMAGE_AS_IS) & (~IMAGE_NO_SIZE);
-
- if($allowsettimelimit) set_time_limit(60);
-
- $image = array();
-
- if(!isset($this->imageUrl) || !isset($this->imageUrl[$size])){
- $AWSSource = "default";
- $imageExists = false;
- }
- else{
- $AWSSource = rawurldecode($this->imageUrl[$size]);
- $imageExists = $asis || imageExists($AWSSource);
- }
-
- if(!$imageExists){
- if($AWSSource != "default" && $checkAlternatives > IMAGE_ALTERNATIVES_0){
- if($checkAlternatives >= IMAGE_ALTERNATIVES_1 && isset($this->merchantid)){
- $temp = preg_replace ("(\.[0-9]+\.)", ".01-" . $_AMAZOOP_STORE_CODES[rawurldecode($this->merchantid)] . ".", $AWSSource);
- if(imageExists($temp)){
- if($nosize){
- $image['width'] = 0;
- $image['height'] = 0;
- }
- else{
- $img = getimagesize($temp);
- $image['width'] = $img[0];
- $image['height'] = $img[1];
- }
- $image['url'] = $temp;
- }
- }
-
- if(!isset($image['url']) && $checkAlternatives >= IMAGE_ALTERNATIVES_2){
- $amazonStores = array("us" => "01", "uk" => "02", "de" => "03", "fr" => "08", "jp" => "09");
- foreach($amazonStores as $code){
- $temp = preg_replace ("(\.[0-9]+\.)", "." . $code . ".", $AWSSource);
- if(imageExists($temp)){
- if($nosize){
- $image['width'] = 0;
- $image['height'] = 0;
- }
- else{
- $img = getimagesize($temp);
- $image['width'] = $img[0];
- $image['height'] = $img[1];
- }
- $image['url'] = $temp;
- break;
- }
- }
- }
-
- if(!isset($image['url']) && $checkAlternatives >= IMAGE_ALTERNATIVES_3){
- $temparr = array_change_key_case($_AMAZOOP_STORE_CODES, CASE_LOWER);
- if(array_key_exists(strtolower(rawurldecode($this->manufacturer)), $temparr)){
- $temp = preg_replace ("(\.[0-9]+\.)", "." . $temparr[strtolower(rawurldecode($this->manufacturer))] . ".", $AWSSource);
- if(imageExists($temp)){
- if($nosize){
- $image['width'] = 0;
- $image['height'] = 0;
- }
- else{
- $img = getimagesize($temp);
- $image['width'] = $img[0];
- $image['height'] = $img[1];
- }
- $image['url'] = $temp;
- }
- }
- }
-
- if(!isset($image['url']) && $checkAlternatives >= IMAGE_ALTERNATIVES_4) {
- foreach($_AMAZOOP_STORE_CODES as $code){
- $temp = preg_replace ("(\.[0-9]+\.)", "." . $code . ".", $AWSSource);
- if(imageExists($temp)){
- if($nosize){
- $image['width'] = 0;
- $image['height'] = 0;
- }
- else{
- $img = getimagesize($temp);
- $image['width'] = $img[0];
- $image['height'] = $img[1];
- }
- $image['url'] = $temp;
- break;
- }
- }
- }
- }
-
- if(!isset($image['url'])){
- $image = $_AMAZOOP_DEFAULT_IMAGES[$size];
- $image['url'] = "http://" . getAmazoopConfig('address') . $image['url'];
- }
- }
- else{
- if($nosize){
- $image['width'] = 0;
- $image['height'] = 0;
- }
- else{
- $img = getimagesize($AWSSource);
- $image['width'] = $img[0];
- $image['height'] = $img[1];
- }
- $image['url'] = $AWSSource;
- }
-
- if($makeTag){
- if(strpos($addAttr, "border") === false)
- $addAttr = " border=\"0\" " . $addAttr;
- elseif($addAttr != "")
- $addAttr = " " . $addAttr;
-
- if($image['width'] != 0)
- $dimension = ' width="' . $image['width'] . '" height="' . $image['height'] . '" ';
- else
- $dimension = "";
-
- $res = '<img src="' . $image['url'] . '"' . $dimension . $addAttr . $tagClose;
- }
- else
- $res = $image;
-
- if($allowsettimelimit) set_time_limit(30);
- return $res;
- }
-
- /**
- * The lowest used price in Amazon Marketplace.
- *
- * @return string|booleanthe lowest used price for a product
- * in Amazon Marketplace. Or false if no used price was returned.
- *
- */
- function getUsedPrice(){
- if(isset($this->usedPrice) && $this->usedPrice != "")
- return rawurldecode($this->usedPrice);
- else
- return false;
- }
-
- /**
- * Indicates if any errors were encountered while processing the service request.
- *
- * @return string|booleanThe request status. Or false there is no status set.
- */
- function getStatus(){
- if(isset($this->status) && $this->status != "")
- return rawurldecode($this->status);
- else
- return false;
- }
-
- /**
- * Shows the product current availability as indicated by Amazon.
- *
- * Apparently in AWS4 availability will come (at last!) as a code and as a string.
- * When (if) this happens, this function will receive a boolean parameter to determine
- * which format you want.
- *
- * @return string|bolleanThe product's availabiity. Or false there is no availability set.
- */
- function getAvailability(){
- if(isset($this->availability))
- return rawurldecode($this->availability);
- else
- return false;
- }
-
- /**
- * A remote "Add to Cart" form for the current product.
- *
- * This function will genereate an "Add to Cart" form for the current
- * product.
- *
- * @param string $text is the text that should be used in the button. If a blank
- * string is submitted, the default value is used.
- * @param boolean $img if set to true, instead of a regular button an image is used.
- * The image's URL is set in {@link $buyNowImg} in the {@link config.inc.php}. If this is set
- * to true, the $text parameter is used as the ALT text for the image.
- *
- * @return string An "Add to Cart" form for this product.
- *
- * @since version 0.2 the $locale parameter has been dropped. It must not be used anymore.
- */
- function buyNow($text = "", $img = false, $addAttributes = ""){
- global $_AMAZOOP_ASSOC_IDS, $_AMAZOOP_BUYNOW_BUTTONS;
-
- if(getAmazoopConfig('close_tag_character') == "xhtml")
- $closeTag = " />";
- else
- $closeTag = ">";
-
- $sites = array( "us" => "com",
- "uk" => "co.uk",
- "de" => "de",
- "fr" => "fr",
- "jp" => "co.jp");
-
- if($text == ""){
- if($this->locale == "us")
- $text = "buy now from Amazon.com";
- else if($this->locale == "uk")
- $text = "buy now from Amazon.co.uk";
- else if($this->locale == "de")
- $text = "Jetzt bei Amazon.de kaufen";
- else if($this->locale == "jp")
- //$text = "Amazon.co.jpからのこれを?。買いなさい";
- $text = "Buy now from Amazon.co.jp";
- }
-
- $res = "<form method=\"post\"";
- if(getAmazoopConfig("open_links_in") == "new")
- $res .= " target=\"_blank\"";
- $res .= " action=\"http://www.amazon." . $sites[$this->locale] . "/exec/obidos/dt/assoc/handle-buy-box=$this->asin\">\n";
- $res .= " <input type=\"hidden\" name=\"asin.$this->asin\" value=\"1\"" . $closeTag . "\n";
- $res .= " <input type=\"hidden\" name=\"tag-value\" value=\"" . $_AMAZOOP_ASSOC_IDS[$this->locale] . "\"" . $closeTag . "\n";
- $res .= " <input type=\"hidden\" name=\"tag_value\" value=\"" . $_AMAZOOP_ASSOC_IDS[$this->locale] . "\"" . $closeTag . "\n";
- $res .= " <input type=\"hidden\" name=\"dev-tag-value\" value=\"" . _AMAZOOP_DEV_TOKEN . "\"" . $closeTag . "\n";
-
- if(!$img)
- $res .= " <input type=\"submit\" name=\"submit.add-to-cart\" value=\"$text\"" . $addAttributes . $closeTag . "\n";
- else{
- $res .= " <input type=\"image\" name=\"submit.add-to-cart\" src=\"" . $_AMAZOOP_BUYNOW_BUTTONS[$this->locale]['url'] . "\" width=\"" . $_AMAZOOP_BUYNOW_BUTTONS[$this->locale]['width'] . "\" height=\"" . $_AMAZOOP_BUYNOW_BUTTONS[$this->locale]['height'] . "\" border=\"0\" alt=\"" . $text . "\"" . $closeTag . "";
- }
- $res .= "</form>\n";
-
- return $res;
- }
-
- /**
- * The merchant ID of a Third Party Seller.
- * This appears when a product is not offerd by Amazon, only by a Third Party Seller.
- *
- * @return string|booleanThe merchant ID, or false if none is set.
- */
- function getMerchantId(){
- if(isset($this->merchantid))
- return rawurldecode($this->merchantid);
- else
- return false;
- }
- }
- ?>