Copied to clipboard

Flag this post as spam?

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

  • Richard B 14 posts 124 karma points
    Aug 26, 2016 @ 15:01
    Richard B

    Checking variant properties exist

    OK, so I just added a new text box property to a variant - but I haven't saved any content to it yet for any products.

    On my homepage I have a grid that shows 3 products. I'm checking to see if the property exists using variant.HasProperty - the first one returns false, but the second one returns true, and then gives an "Object reference not set to an instance of an object." error on the next line when I try to get the property, or property value.

    At first I thought I was doing something wrong - but why would two products return different things for these, and how should I be checking if the property and value exist?

Please Sign in or register to post replies

Write your reply to: