Amazon-MWS
view release on metacpan or search on metacpan
lib/Amazon/MWS/XML/Product.pm view on Meta::CPAN
{ 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.
=item 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 L<Amazon::MWS::Uploader> may want
to throttle the inventory. Other code is discouraged to use this as a
modifier.
=item 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.
=item 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.
=item currency
Valid values are: AUD BRL CAD CNY DEFAULT EUR GBP INR JPY MXN USD.
Defaults to EUR.
=item sale_price
A sale price (optional)
=item sale_start
A DateTime object with the sale start date
=item sale_end
A DateTime object with the sale end date
=item 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 B<only http:// links> are allowed. If you pass https://
links, they will be rejected by Amazon.
=item children
An (optional) arraryref of children sku.
=item search_terms
An (optional) arrayref of search terms (max 5)
=item features
An (optional) arrayref of strings with features (max 5)
=item condition
Possible values which validates correctly: Club CollectibleAcceptable
CollectibleGood CollectibleLikeNew CollectibleVeryGood New Refurbished
UsedAcceptable UsedGood UsedLikeNew UsedVeryGood
Defaults to C<New>
=item condition_note
An arbitrary string shorter than 2000 characters with comments about
the condition.
=item manufacturer
Maker of the product (max 50 chars)
=item manufacturer_part_number
Part number manufacturer.
=back
=cut
has sku => (is => 'ro', required => 1);
has feeds_needed => (is => 'rw', isa => ArrayRef,
default => sub { [qw/product inventory price image variants/] });
sub is_feed_needed {
my ($self, $feed) = @_;
return unless $feed;
return scalar(grep { $_ eq $feed } @{ $self->feeds_needed });
}
has timestamp_string => (is => 'ro',
default => sub { '0' });
has ean => (is => 'ro',
lib/Amazon/MWS/XML/Product.pm view on Meta::CPAN
Weight of the package.
=item package_weight_unit
Unit for the package weight. Possible values are C<GR>, C<KG>, C<LB>,
C<MG>, C<OZ>. Defaults to C<GR>.
=item shipping_weight
Weight of the product when packaged to ship.
=item shipping_weight_unit
Unit for the package weight for shipping. Possible values are C<GR>,
C<KG>, C<LB>, C<MG>, C<OZ>. Defaults to C<GR>.
=back
=cut
has package_weight => (is => 'ro');
has package_weight_unit => (is => 'ro',
default => sub { 'GR' },
isa => \&_check_units,
);
has shipping_weight => (is => 'ro');
has shipping_weight_unit => (is => 'ro',
default => sub { 'GR' },
isa => \&_check_units,
);
has inventory => (is => 'rw',
default => sub { '0' },
isa => Int);
has ship_in_days => (is => 'ro',
isa => Int,
default => sub { '2' });
has price => (is => 'ro',
required => 1,
isa => \&_validate_price);
sub _validate_price {
my ($price) = @_;
die "$price is not a number" unless is_Num($price);
die "$price is negative" if $price < 0;
}
has sale_price => (is => 'ro',
isa => \&_validate_price);
has sale_start => (is => 'ro',
isa => sub {
die "Not a datetime"
unless $_[0]->isa('DateTime');
});
has sale_end => (is => 'ro',
isa => sub {
die "Not a datetime"
unless $_[0]->isa('DateTime');
});
has currency => (is => 'ro',
isa => sub {
my %currency = map { $_ => 1 } (qw/AUD BRL CAD CNY DEFAULT
EUR GBP INR JPY MXN USD/);
die "Not a valid currency" unless $currency{$_[0]};
},
default => sub { 'EUR' });
has images => (is => 'ro',
isa => sub {
die "Not an arrayref" unless is_ArrayRef($_[0]);
foreach my $url (@{ $_[0] }) {
my $check = URI->new($url)->as_string;
die "Non-URI character in url $url (should be $check)"
if $check ne $url;
}
});
has children => (is => 'rw',
isa => ArrayRef);
# has restock_date => (is => 'ro');
=head1 METHODS
=head2 price_is_zero
Return true if the price is 0.
=cut
sub price_is_zero {
my $self = shift;
my $price = $self->price;
if ($price > 0) {
return 0;
}
else {
return 1;
}
}
=head2 is_inactive
Return true if price is 0 or inventory is 0. Inactive items will not
get a price, variants, image feed output.
=cut
sub is_inactive {
my $self = shift;
if ($self->price_is_zero or $self->inventory < 1) {
return 1;
}
else {
return;
( run in 1.512 second using v1.01-cache-2.11-cpan-39bf76dae61 )