Fix getThumbnailUrl in the Product, which was called by the Shelf directly causing failures.
Fix getPrice in the Product, which returned undef until a variant was applied to it. These two fixes fix the Shelf.
This commit is contained in:
parent
b338e660ea
commit
68db4f8e46
3 changed files with 19 additions and 5 deletions
|
|
@ -24,6 +24,7 @@
|
||||||
- added: Next and Previous GalleryAlbum links in the GalleryAlbum views
|
- added: Next and Previous GalleryAlbum links in the GalleryAlbum views
|
||||||
- fixed: Shop: Variants in dropdown and on page
|
- fixed: Shop: Variants in dropdown and on page
|
||||||
- fixed: OLD subscription table still hanging around?
|
- fixed: OLD subscription table still hanging around?
|
||||||
|
- fixed: Shelf
|
||||||
|
|
||||||
7.5.12
|
7.5.12
|
||||||
- skipping this release
|
- skipping this release
|
||||||
|
|
|
||||||
|
|
@ -400,7 +400,14 @@ Product.
|
||||||
|
|
||||||
sub getPrice {
|
sub getPrice {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
return $self->getOptions->{price};
|
if (! keys %{ $self->getOptions} ) {
|
||||||
|
my $variants = $self->getAllCollateral('variantsJSON');
|
||||||
|
return '' unless @{ $variants };
|
||||||
|
return $variants->[0]->{price};
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return $self->getOptions->{price};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
@ -437,8 +444,14 @@ sub getQuantityAvailable {
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
sub getThumbnailUrl {
|
sub getThumbnailUrl {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $store = shift || WebGUI::Storage::Image->get($self->session, $self->get('image1'));
|
my $store = shift;
|
||||||
return $store->getThumbnailUrl($store->getFiles->[0]);
|
if (! defined $store and $self->get('image1')) {
|
||||||
|
$store = WebGUI::Storage::Image->get($self->session, $self->get('image1'));
|
||||||
|
return $store->getThumbnailUrl($store->getFiles->[0]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -112,8 +112,8 @@ sub view {
|
||||||
if (defined $asset) {
|
if (defined $asset) {
|
||||||
my $sku = $asset->get;
|
my $sku = $asset->get;
|
||||||
$sku->{url} = $asset->getUrl;
|
$sku->{url} = $asset->getUrl;
|
||||||
$sku->{thumbnailUrl} = $asset->getThumbnailUrl;
|
$sku->{thumbnailUrl} = $asset->getThumbnailUrl;
|
||||||
$sku->{price} = sprintf("%.2f", $asset->getPrice);
|
$sku->{price} = sprintf("%.2f", $asset->getPrice);
|
||||||
push @skus, $sku;
|
push @skus, $sku;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue