Search in sources :

Example 1 with SkuMediaXref

use of org.broadleafcommerce.core.catalog.domain.SkuMediaXref in project BroadleafCommerce by BroadleafCommerce.

the class SkuSiteMapGenerator method constructImageURLs.

protected void constructImageURLs(SiteMapBuilder siteMapBuilder, SiteMapURLWrapper siteMapUrl, Sku sku) {
    for (SkuMediaXref skuMediaXref : sku.getSkuMediaXref().values()) {
        SiteMapImageWrapper siteMapImage = new SiteMapImageWrapper();
        siteMapImage.setLoc(BroadleafSitemapUtils.generateImageUrl(siteMapBuilder, skuMediaXref.getMedia()));
        siteMapUrl.addImage(siteMapImage);
    }
}
Also used : SkuMediaXref(org.broadleafcommerce.core.catalog.domain.SkuMediaXref) SiteMapImageWrapper(org.broadleafcommerce.common.sitemap.wrapper.SiteMapImageWrapper)

Example 2 with SkuMediaXref

use of org.broadleafcommerce.core.catalog.domain.SkuMediaXref in project BroadleafCommerce by BroadleafCommerce.

the class SeoDefaultPropertyServiceImpl method getImage.

@Override
public String getImage(Product product) {
    Sku defaultSku = product.getDefaultSku();
    Map<String, SkuMediaXref> mediaXrefs = defaultSku.getSkuMediaXref();
    SkuMediaXref primaryMediaXref = mediaXrefs.get("primary");
    if (primaryMediaXref != null) {
        Media primaryMedia = primaryMediaXref.getMedia();
        return urlResolver.getSiteBaseUrl() + primaryMedia.getUrl();
    }
    return null;
}
Also used : Media(org.broadleafcommerce.common.media.domain.Media) SkuMediaXref(org.broadleafcommerce.core.catalog.domain.SkuMediaXref) Sku(org.broadleafcommerce.core.catalog.domain.Sku)

Aggregations

SkuMediaXref (org.broadleafcommerce.core.catalog.domain.SkuMediaXref)2 Media (org.broadleafcommerce.common.media.domain.Media)1 SiteMapImageWrapper (org.broadleafcommerce.common.sitemap.wrapper.SiteMapImageWrapper)1 Sku (org.broadleafcommerce.core.catalog.domain.Sku)1