Copied to clipboard

Flag this post as spam?

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


  • Greyhound 102 posts 124 karma points
    Nov 13, 2011 @ 19:49
    Greyhound
    0

    Listing products and multiple images

    Hi,

    I've got myself into a bit of a pickle.

    I've created a new document type called "Product Page". 
    The document type contains the TeaCommerce product picker so a user can select one or more products for the page.

    I have also modified the Product document so that a product can have up to 3 main images and 3 thumbnails. The thumbnails will action "click events" to open up a lightbox gallery.

    When I try to list the products on the page, I am getting nothing back. I can retrieve the product node ID but thats about it. Also I am not able to get the current Currency - that returns nothing.

    Please could someone throw me a rope as I've spent a day on this and I'm at an absolute loss!
    There is probably a better way to go about have a product image gallery than modifying the base Product document so any advice on that would be appreciated.

    Thanks.

  • Anders Burla 2560 posts 8256 karma points
    Nov 13, 2011 @ 19:55
    Anders Burla
    0

    Hi Greyhound

    Are you using the starter kit? If yes - which version? Could you try and give screenshot of your document type, and your template or xslt that need to output your product info

    Kind regards
    Anders

  • Bjarne Fyrstenborg 1282 posts 3994 karma points MVP 8x c-trib
    Nov 13, 2011 @ 20:51
    Bjarne Fyrstenborg
    0

    Hi..

    I've have just list multiple images using the DAMP 2.0 package and the image cropper datatype.
    You can see an example here: http://sub.ak-security.dk/da/shop/category-a/product-a3.aspx where I have combined this with Cloud Zoom

    <div class="thumb_wrapper">
            <div class="thumb">

            <rev="productImages" href='{$currentPage/productImage/DAMP/mediaItem[1]/Image/umbracoFile}' class='cloud-zoom' id='zoom1'
                rel="zoomHeight:350, zoomWidth:350, adjustX: -30, adjustY:0, smoothMove:3, lensOpacity:0.0, tintOpacity:0.5, tint: '#ffffff', position:'left'">
                <img src="{./productImage/DAMP/mediaItem[1]/Image/crops//crop [@name='productMediumThumb']/@url}" alt='' title="Optional title display" />
            </a>

            </div>
            <div class="clearBoth"></div>
            <xsl:if test="count(./productImage/DAMP/mediaItem/Image) > 1">
              <ul id="productThumbs">
              <xsl:for-each select="./productImage/DAMP/mediaItem/Image">
                <li>
                  <href='{./umbracoFile}' class='cloud-zoom-gallery' title='Thumbnail 1'
                      rel="useZoom: 'zoom1', smallImage: '{./crops//crop [@name='productThumb']/@url}' ">
                  <img src="{./crops//crop [@name='productSmallThumb']/@url}" alt="Thumbnail 1"/></a>
                </li>
              </xsl:for-each>
              </ul>
            </xsl:if>
          </div>

    But I'm not sure how it will work with the variants, as in the starter kit it use a productImage variable:

    <!-- The product image is fetched from either the product or the first variant -->
      <xsl:variable name="productImageId" select="teacommerce:GetProperty($variant, 'productImage')" />
      <xsl:variable name="productImage">
        <xsl:if test="$productImageId != ''">
          <xsl:value-of select="umbraco.library:GetMedia($productImageId, 0)/umbracoFile" />
        </xsl:if>
      </xsl:variable>

    Bjarne

     

     

     

     

  • Greyhound 102 posts 124 karma points
    Nov 14, 2011 @ 11:19
    Greyhound
    0

    Thanks for the replies.

    @Anders. I'm using the TeaCommerce 1.4.1.1 BETA version which I installed (ie. I did not install TeaCommerce into an existing Umbraco installation)
    I do have an option under packages called "Install Starter Kit" but this gives me an error if I click on it.

    Screen shots included of the alterations to the "Product" document type and the new document "Product Page".
    The "Product Page" doc type includes the "Product picker" control and it is the products in this picker that I wish to list on the page.

    Screen shots are included below and here is a snippet of my XML (which is currently only retriving the nodeId of the product using the variable $product.
    The currency and any product properties dont return anything - basically all I can get is the Id of the product node itself.

     <xsl:param name="currentPage"/>

    <xsl:variable name="currentCurrency" select="teacommerce:GetCurrentCurrency()"/>
      
    <xsl:template match="/">
      <xsl:variable name="product" select="$currentPage/pageproductlist"/>
      <xsl:value-of select="$product"/>
      <hr />
      <xsl:value-of select="$product/productTitle"/>
      <hr />
      <xsl:value-of select="$currentCurrency"/>
    xsl:template>

     


     


  • Greyhound 102 posts 124 karma points
    Nov 14, 2011 @ 11:34
    Greyhound
    0

    @Bjarne: Thanks for taking the time to post that code. I think I'm going to need something much more fine tuned (ie. a bit more of a manual process for the user)

    Basically I would need them to upload an Image and corresponding thumb for each gallery image. I'm sure this will be ok once I can work out how to get the properties of a product sorted out.

     

  • Anders Burla 2560 posts 8256 karma points
    Nov 14, 2011 @ 11:41
    Anders Burla
    0

    Hi Greyhound

    You $currentPage/pageproductlist i think return you a list of id's or an id - you will have to use the GetXmlByNodeId from the umbraco library to get the xml for the product node

    The currentCurrency I think you should try and make a copy-of instead of a value-of just to see it there is any data - as there should be that

  • Greyhound 102 posts 124 karma points
    Nov 19, 2011 @ 16:03
    Greyhound
    0

    Hi,

    Ok - I'm a couple of steps forward and have gotten my product to show but am getting an error when I try and add an item to the cart.

    The error is as follows: I'm not sure how to find out which property is not being sent  correctly.

    MESSAGE:
    Exception has been thrown by the target of an invocation.
    
    STACKTRACE:
       at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
       at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
       at TeaCommerce.Presentation.TeaCommerceBase.RequestModule.invokeMethod(restExtension myExtension, Object[] paras)
    
    INNEREXCEPTION:
    System.InvalidOperationException: Nullable object must have a value.
       at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
       at TeaCommerce.Base.FormAddOrderLine(Dictionary`2 fieldKeyValues)
       at TeaCommerce.Base.ParseAction(IDictionary`2 vars)
       at TeaCommerce.Base.SubmitForm()
  • Anders Burla 2560 posts 8256 karma points
    Nov 21, 2011 @ 08:37
    Anders Burla
    0

    Hi Greyhound

    Are you adding using the javascript API or server side API? Have you tried to mimic the html mark up of the starter kit to see how that works? Do you have a form element in your template? Is it a asp:form with runat server og just a normal html form that is wrapped about the add to cart button?

    Kind regards
    Anders

     

  • Greyhound 102 posts 124 karma points
    Nov 21, 2011 @ 10:52
    Greyhound
    0

    Hi,

    I've checked and my rendered html doesnt look any different to the starter kit and I've also checked the variable values which all seem to be correctly in place.

    I've reverted back to the boiler plate code for listing the products so its a regular form wrapped around the cart button.

    I think I'm going to have to restore the original starter kit and start the whole project again :( - that is unless you know of anyway I can get more detail on this error to actually find out which data the nullable exception is referring to?

     

     

  • Anders Burla 2560 posts 8256 karma points
    Nov 21, 2011 @ 11:03
    Anders Burla
    0

    Do you have a link to your html so I can see what might cause the problem?

  • Greyhound 102 posts 124 karma points
    Nov 21, 2011 @ 15:00
    Greyhound
    0

    Hi Anders,

    I was almost about to give up having started from scratch again this morning. I know have it working thank you.

    I've ended searching through the multinode picker to list my products on the page. This was giving me a javascript error and when I added in the :

    <div class="productToUpdate" productId="{$productNodeId}" itemprop="itemListElement" itemscope="" itemtype="http://schema.org/Product">

    line at the top of the form it started working. 

  • Anders Burla 2560 posts 8256 karma points
    Nov 21, 2011 @ 15:20
    Anders Burla
    0

    Ahh super you got it solved!

    Could you mark your own answer as the solution so others can easily find it - would be very helpful

    Kind regards
    Anders

Please Sign in or register to post replies

Write your reply to:

Draft