Copied to clipboard

Flag this post as spam?

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


  • René 327 posts 852 karma points
    Jul 14, 2014 @ 08:29
    René
    0

    Update product image

    HI 

    I have a problem with updating the product image when changing variant.

    I am using parts of the starterkit, and the ecommerce.js file.

    All othere properties are updating. 

    To get the image

    var imageStr = TC.GetPropertyValue(storeId, product, "productImage");
    string[] imageIds = imageStr.Split(new char[] { ',' });
    int imgeidsCount = imageIds.Count();

    To display the image:

    @{
       for (dynamic i = 0; i < imgeidsCount; i++)
         {
           string productImage = imageIds.Length > 0 ? Library.MediaById(imageIds[i]).umbracoFile : string.Empty;
        <a class="image-popup-vertical-fit" href="@productImage" title="@name">
        <img src="/ImageGen.ashx?Width=555&amp;Height=555&amp;Constrain=True&amp;Image=@productImage&amp;[email protected]" class="productImage" alt="@name" title="@name" />
    </a>
     }
    } 

    The form line to update

    <form action="/base/TC/FormPost.aspx" method="post" class="ajaxForm">
            <input name="storeId" type="hidden" value="@storeId" />
            <input name="AddOrUpdateOrderLine" type="hidden" value="productIdentifier : productIdentifier, orderLineId : orderLineId, quantity : quantity, propertyKeys : propertyKeys, productImage : productImage" />

    Refresh with

    refreshwithtemplate="Products/Product.cshtml"

    And this is allowed in the teacommerece settings.

    This works fine when shoving the product.

    When updating the dropdown the image wont update, all the othere parameters updates 

    Any hint,  and thanks in advance.

    René

Please Sign in or register to post replies

Write your reply to:

Draft