The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Amazon::MWS::XML::Product

DESCRIPTION

Class to handle the products and emit data structures suitable for XML generation.

ACCESSORS

They has to be passed to the constructor

sku

Mandatory.

feeds_needed([qw/product inventory price image variants/])

If set to an arrayref, output only the selected feeds.

timestamp_string

An arbitrary string (usually a timestamp) which identifies the revision of the product.

ean
asin
title
description
brand
category_code
product_data

This accessor should contain category-specific structures. This appears to be needed when creating a product which is not present on Amazon.

Example values:

  { CE => { ProductType  => { PhoneAccessory => {} } } }

  { Sports => { ProductType => 'SportingGoods' } }

The exect structure to pass can be determined only looking at the specific xsd file.

Please keep in mind that the category_code has nothing to do with this structure, and doesn't even exist an exact mapping between these categories and the listing categories.

Documentation from Amazon:

Section containing category-specific information such as variations. Reference one or more of the following XSDs to complete the ProductData section (only one category can be used for a given item).

Keep in mind that some of these product categories might not be available for merchants on some Amazon websites. If a product category is available to merchants on a particular Amazon website, then the XSD files for that category are valid for that Amazon website as well.

inventory

Indicates whether or not an item is available (any positive number = available; 0 = not available). Every time a quantity is sent for an item, the existing quantity is replaced by the new quantity in the feed.

This accessor is read-write because Amazon::MWS::Uploader may want to throttle the inventory. Other code is discouraged to use this as a modifier.

ship_in_days

The number of days between the order date and the ship date (a whole number between 1 and 30). If not specified the info will not be set and Amazon will use a default of 2 business days, so we use the default of 2 here.

price

The standard price of the item. If the price is zero, it is assumed to be a product which should be set as inactive without removing it, flipping the inventory to zero and refraining to do pass images/variants/price feeds.

The price is rounded via sprintf '%.2f' by the module.

currency

Valid values are: AUD BRL CAD CNY DEFAULT EUR GBP INR JPY MXN USD.

Defaults to EUR.

sale_price

A sale price (optional)

sale_start

A DateTime object with the sale start date

sale_end

A DateTime object with the sale end date

images

An (optional) arrayref of image urls. The first will become the main image, the other one will become the PT1, etc.

Please note that only http:// links are allowed. If you pass https:// links, they will be rejected by Amazon.

children

An (optional) arraryref of children sku.

search_terms

An (optional) arrayref of search terms (max 5)

features

An (optional) arrayref of strings with features (max 5)

condition

Possible values which validates correctly: Club CollectibleAcceptable CollectibleGood CollectibleLikeNew CollectibleVeryGood New Refurbished UsedAcceptable UsedGood UsedLikeNew UsedVeryGood

Defaults to New

condition_note

An arbitrary string shorter than 2000 characters with comments about the condition.

manufacturer

Maker of the product (max 50 chars)

manufacturer_part_number

Part number manufacturer.

package_weight

Weight of the package.

package_weight_unit

Unit for the package weight. Possible values are GR, KG, LB, MG, OZ. Defaults to GR.

shipping_weight

Weight of the product when packaged to ship.

shipping_weight_unit

Unit for the package weight for shipping. Possible values are GR, KG, LB, MG, OZ. Defaults to GR.

METHODS

price_is_zero

Return true if the price is 0.

is_inactive

Return true if price is 0 or inventory is 0. Inactive items will not get a price, variants, image feed output.

as_product_hash

Return a data structure suitable to feed the Product slot in a Product feed.

as_inventory_hash

Return a data structure suitable to feed the Inventory slot in a Inventory feed. Negative quantities will be normalized to 0. Inactive products will get a quantity of 0.

as_price_hash

Return a data structure suitable to feed the Price slot in a Price feed. If it's a inactive product, return nothing so there is a chance that we don't need the price feed at all (if all products are inactive).

as_images_array

Return a data structure suitable to feed the ProductImage slot in a Image feed.

No output if the product is inactive.

SKU
ImageType The type of image (Main, Alternate, or Swatch)
Main - Main image for the product
Alternate (PT) - Other views of the product
Swatch - Color or fabric (Note: Swatch images will be scaled down to 30 x 30 pixels so they should only be used for displaying the color of your product's fabric, for example, not for displaying your whole product.)
ImageLocation

The exact location of the image using a full URL (such as http://mystore.com/images/1234.jpg). Amazon cannot access images stored with a secured URL (https) so be sure to use http instead.

as_variants_hash

Return a structure suitable for the Relationship feed. No output if the product is inactive.

condition_type_for_lowest_price_listing

This is a method, not an accessor. Extract from the condition the string needed by some API calls, where possible values are: New Used Collectible Refurbished Club