Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Liam 4 posts 74 karma points
    Mar 27, 2017 @ 20:21
    Liam
    0

    Product Images Not Rendering

    Hello,

    Umbraco Version: 7.5.9 Merchello Version: 2.4.0 FastTrack: 2.4.0

    I've installed the above recently and am now trying to do something very simple. I have assigned a Content Type to a Product and trying to render the Image property for a Product. When I select an Image and save it looks to have save fine, no errors in UI or Console but when I try render and look in immediate window:

    Model.HasProperty("image") true

    This suggests the ContentType association has worked but HasValue is always false:

    Model.HasValue("image") false

    Any ideas?

    Thanks, Liam

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Mar 28, 2017 @ 23:36
    Rusty Swayne
    0

    Hey Liam

    Assuming:

    1. You are using a media picker
    2. In the back office you've added an image to a media picker on a content type associated with your product.
    3. The image shows in the back office associated with the product.
    4. Your view that has some model that implements IProductContent

    Are you saying?

          @{
                var condition1 = Model.HasProperty("image");   // is true
                var condition2 = Model.HasValue("image"); // is false
    
                var image = Model.GetPropertyValue("image"); // is not null???
           }
    
  • Liam 4 posts 74 karma points
    Mar 29, 2017 @ 06:02
    Liam
    0

    Hi Rusty,

    Your assumptions are correct but the output is:

    @{
            var condition1 = Model.HasProperty("image");   // is true
            var condition2 = Model.HasValue("image"); // is false
    
            var image = Model.GetPropertyValue("image"); // is null
       }
    

    i.e. It has the property, it looks saved in the backend but never appears to save the value.

    Thanks, Liam

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Mar 29, 2017 @ 16:40
    Rusty Swayne
    0

    Hey Liam,

    There has to be something else in the mix ... we definitively would have noticed that if it was systemic.

    If you return to the back office is the image still associated with the picker?

    You can check the merchProductVariantDetachedContect table to see if there are values associated with the productVariantKey ...

    Can you post the code from the view (and controller if you're building the model)?

  • Liam 4 posts 74 karma points
    Mar 29, 2017 @ 20:05
    Liam
    0

    Aha, you pointing me to that table has revealed that there are two versions of the product, one for en-GB and one for en-US - I had initially removed en-US from this site but I think I had to put it back in as some packages were complaining about it being missing.

    I think I will just leave it as it is in future :S

    One last thing, when I go to a listing page it shows me the image set for en-GB, (currently set in culture and hostnames) but when I click through to the product (www.mysite.com/product-slug) I get the US version.

    I suppose I can set the same image twice for each product as a workaround if it can't be helped but is there a better way to set the culture?

    Thanks again for a great product and all of your help.

    Liam

  • Liam 4 posts 74 karma points
    Mar 29, 2017 @ 20:32
    Liam
    0

    I just removed en-US again and looks good so far, thanks for you help Rusty

  • Biagio Paruolo 1456 posts 1595 karma points c-trib
    Mar 23, 2019 @ 15:28
    Biagio Paruolo
    0

    This is a bit a confusion for an user...How to configure content for a language or another?

  • Biagio Paruolo 1456 posts 1595 karma points c-trib
    Mar 23, 2019 @ 15:41
    Biagio Paruolo
    0

    I found how to configure. In action there is the button.

    enter image description here

Please Sign in or register to post replies

Write your reply to:

Draft