I'm working on my first uCommerce project. I've created some products, all of the same type, each of which has a few variants - so far so good.
I've specified a thumbnail and primary image for each product but I can't get either to display. The html output for the thumbnail image is <img src="" alt="Image"> so it looks like no image is being found for any of the products.
Here's the child products xslt for the category listings page where I am displaying the products. (The images also don't display on the individual product pages.)
RE the image id's, are you asking if the image tags have id's when the page is rendered? If so, no. The rendered image tags are just <img src="" alt="Image">
Image not displaying for products
Hi
I'm working on my first uCommerce project. I've created some products, all of the same type, each of which has a few variants - so far so good.
I've specified a thumbnail and primary image for each product but I can't get either to display. The html output for the thumbnail image is <img src="" alt="Image"> so it looks like no image is being found for any of the products.
Here's the child products xslt for the category listings page where I am displaying the products. (The images also don't display on the individual product pages.)
======================================
<!-- Display child products -->
<xsl:template match="childProducts">
<xsl:for-each select="product">
<xsl:variable name="productSku" select="@sku"></xsl:variable>
<xsl:variable name="product" select="CommerceLibrary:GetProduct($catalogName, $productSku)"></xsl:variable>
<div style="clear: both">
<h4>
<a>
<xsl:attribute name="href">
product.aspx?catalog=<xsl:value-of select="$catalogName"/>&product=<xsl:value-of select="@sku"/>
</xsl:attribute>
<xsl:value-of select="@displayName"/>
</a>
</h4>
<div style="float: left; width: 100px;">
<img alt="Image">
<xsl:attribute name="src">
<xsl:value-of select="umbraco.library:GetMedia(@thumbnailImage, true())/data[@alias = 'umbracoFile']"/>
</xsl:attribute>
</img>
</div>
<xsl:choose>
<xsl:when test="$product/product/@allowOrdering">
<form method="post">
<input type="hidden" name="sku">
<xsl:attribute name="value">
<xsl:value-of select="$product/product/@sku"/>
</xsl:attribute>
</input>
Quantity: <input type="text" name="quantityInput" value="1" style="width:30px"></input>
<xsl:if test="$product/product/@hasVariants = 'True'">
<select name="variantSku">
<option>Please select</option>
<xsl:for-each select="$product/product/variants/product">
<option>
<xsl:attribute name="value">
<xsl:value-of select="@variantSku"/>
</xsl:attribute>
<xsl:value-of select="@displayName"/>
</option>
</xsl:for-each>
</select>
</xsl:if>
<input type="submit" value="Add To Bag"></input>
</form>
</xsl:when>
<xsl:otherwise>
<p style="color: red;">
<xsl:value-of select="$product/product/@displayName"/> is temporarily unavailable.
</p>
</xsl:otherwise>
</xsl:choose>
<div style="margin-left: 150px">
<xsl:value-of select="@shortDescription" disable-output-escaping="yes" />
<xsl:choose>
<xsl:when test="@allowOrdering">
<!-- Order now! -->
</xsl:when>
<xsl:otherwise>
Not available right now.
</xsl:otherwise>
</xsl:choose>
</div>
</div>
</xsl:for-each>
<div style="clear: both"></div>
</xsl:template>
======================================
Can anyone tell me how to get the images to display?
Many thanks in advance!
Are the imageids outputted with the XML? Which version of uCommerce are you running?
Hi Soren
The uCommerce version is 1.3.0.3.
RE the image id's, are you asking if the image tags have id's when the page is rendered? If so, no. The rendered image tags are just <img src="" alt="Image">
Could you try and output the product XML to a textarea and see if imageid is set in the XML structure?
Here's the textarea contents for one of the products:
<product index="0" sku="Mawhero" displayName="Mawhero" shortDescription="" longDescription="" thumbnailImage="1101" primaryImage="1101" allowOrdering="True" isVariant="False" displayOnSite="True" hasVariants="True" price="139.0000" currency="NZD"><variants><product index="0" sku="Mawhero" displayName="Size 00 (2-9 months)" shortDescription="" longDescription="" thumbnailImage="0" primaryImage="0" allowOrdering="False" isVariant="True" displayOnSite="False" hasVariants="False" variantSku="Mawhero00" price="139.0000" currency="NZD" Size="Size 00 (2-9 months)" /><product index="1" sku="Mawhero" displayName="Size 0 (9-18 months)" shortDescription="" longDescription="" thumbnailImage="0" primaryImage="0" allowOrdering="False" isVariant="True" displayOnSite="False" hasVariants="False" variantSku="Mawhero0" price="149.0000" currency="NZD" Size="Size 0 (9-18 months)" /></variants></product>
Are you running Umbraco 4.0 or 4.5 (and up). I suspect it's probably the difference in schema tripping you up.
I would advise upgrade to 1.5.1 and store version 1.1.0.0. They support the new Umbraco schema in 4.5.
Thanks Soren, I'll try the upgrades. Umbraco version is v 4.6.1.
is working on a reply...