Announcement

Collapse
No announcement yet.

Pulling Product Image Custom Fields (Image Machine) within a Toolkit subcat Function

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Pulling Product Image Custom Fields (Image Machine) within a Toolkit subcat Function

    So I've just implemented the image machine throughout a site (product and category display layouts, search results, product list, and basket) and have gotten stuck on how to pull the Image Type on my SFNT "Featured Items" category, which is pulled by the "subcat" function. This is what I currently have:

    Code:
    <mvt:item name="toolkit" param="sassign|cat_code|Featured" />
    <mvt:item name="toolkit" param="cxpc|pcount|g.cat_code" />
    <mvt:if expr="pcount GT 0">
      <mvt:foreach iterator="sub_product" array="sub_products">
        <div class="prod-block">
          <mvt:item name="toolkit" param="customimage|feature-thumb|l.all_settings:sub_product:ID|main-product-image" />
          <mvt:if expr="g.feature-thumb">
            <a href="&mvt:global:sessionurl;Screen=PROD&Store_Code=&mvta:global:Store_Code;&Product_Code=&mvta:sub_product:code;">
              <img src="&mvte:global:feature-thumb;" />
            </a><br />
          </mvt:if>
          &mvt:sub_product:name;<br />
          Price: <mvt:item name="toolkit" param="currencyformat|formatted_price|l.all_settings:sub_product:price" />&mvt:global:formatted_price;
        </div>
      </mvt:foreach>
    </mvt:if>
    The image type is "main-product-image", however the above code returns an empty string. I'm not even sure if the Toolkit "customimage" function is what I should be using.

    Any ideas?

    thanks
    Mike
    Mike Bader
    Visotek Designs
    www.visotek.net

    #2
    Re: Pulling Product Image Custom Fields (Image Machine) within a Toolkit subcat Funct

    That function will do it. It was put include in the tool kit in version 5.214. If you have that version or newer, it should be working.
    Bill Weiland - Emporium Plus http://www.emporiumplus.com/store.mvc
    Online Documentation http://www.emporiumplus.com/tk3/v3/doc.htm
    Question http://www.emporiumplus.com/mivamodu...vc?Screen=SPTS
    Facebook http://www.facebook.com/EmporiumPlus
    Twitter http://twitter.com/emporiumplus

    Comment


      #3
      Re: Pulling Product Image Custom Fields (Image Machine) within a Toolkit subcat Funct

      Thanks Bill,

      I updated to the latest version and I can pull the image, however for some reason my conditional that checks for g.feature-thumb existence isn't working. I can take the conditional out and it pulls fine though

      Code:
      <mvt:item name="toolkit" param="customimage|feature-thumb|l.all_settings:sub_product:ID|main-product-image" />
      
                            <mvt:if expr="g.feature-thumb">
                              <a href="&mvt:global:sessionurl;Screen=PROD&Store_Code=&mvta:global:Store_Code;&Product_Code=&mvta:sub_product:code;">
                                <img src="&mvte:global:feature-thumb;" class="thumbnail" />
                              </a>
                            </mvt:if>
      See anything off?
      Mike Bader
      Visotek Designs
      www.visotek.net

      Comment


        #4
        Re: Pulling Product Image Custom Fields (Image Machine) within a Toolkit subcat Funct

        Makes no sense. Sometimes hyphens cause problems. Change the variable in the token and conditional to feature_thumb
        Bill Weiland - Emporium Plus http://www.emporiumplus.com/store.mvc
        Online Documentation http://www.emporiumplus.com/tk3/v3/doc.htm
        Question http://www.emporiumplus.com/mivamodu...vc?Screen=SPTS
        Facebook http://www.facebook.com/EmporiumPlus
        Twitter http://twitter.com/emporiumplus

        Comment


          #5
          Re: Pulling Product Image Custom Fields (Image Machine) within a Toolkit subcat Funct

          that fixed it - many thanks Bill!
          Mike Bader
          Visotek Designs
          www.visotek.net

          Comment


            #6
            Re: Pulling Product Image Custom Fields (Image Machine) within a Toolkit subcat Funct

            I suspect <mvt:if expr="g.feature-thumb"> was trying to subtract thumb from g.feature, thinking both were variables.

            I avoid "-" except when I am wanting to use it as a negative/subtract/exclude feature.
            Bill Weiland - Emporium Plus http://www.emporiumplus.com/store.mvc
            Online Documentation http://www.emporiumplus.com/tk3/v3/doc.htm
            Question http://www.emporiumplus.com/mivamodu...vc?Screen=SPTS
            Facebook http://www.facebook.com/EmporiumPlus
            Twitter http://twitter.com/emporiumplus

            Comment


              #7
              Re: Pulling Product Image Custom Fields (Image Machine) within a Toolkit subcat Funct

              Is there a way to do the exact same thing, but in this case grab the generated thumbnail image from image machine instead of using the "larger" image?
              Steven Spriggs
              Web Developer
              ktm-parts.com

              Comment


                #8
                Re: Pulling Product Image Custom Fields (Image Machine) within a Toolkit subcat Funct

                The image machine is javascript which runs on the client after the page has loaded to the viewer's computer. Tool kit is store morph code that runs on the server before the page is sent to the client.
                Bill Weiland - Emporium Plus http://www.emporiumplus.com/store.mvc
                Online Documentation http://www.emporiumplus.com/tk3/v3/doc.htm
                Question http://www.emporiumplus.com/mivamodu...vc?Screen=SPTS
                Facebook http://www.facebook.com/EmporiumPlus
                Twitter http://twitter.com/emporiumplus

                Comment


                  #9
                  Re: Pulling Product Image Custom Fields (Image Machine) within a Toolkit subcat Funct

                  Originally posted by wcw View Post
                  The image machine is javascript which runs on the client after the page has loaded to the viewer's computer. Tool kit is store morph code that runs on the server before the page is sent to the client.
                  Yes I realize that, and I guess I could have worded the question better.

                  What I am trying to access is the "Product Display Layout Image Dimensions" thumbnail image that is utilized in Image Machine through a store morph code in toolkit.

                  Code example:
                  HTML Code:
                          <mvt:foreach iterator="sub_product" array="sub_products">
                              <li class="span2">
                                  <a href="&mvt:global:sessionurl;Screen=PROD&Store_Code=&mvt:store:code;&Product_Code=&mvt:sub_product:code;" class="thumbnail">
                                      
                                      <mvt:item name="toolkit" param="customimage|featured|l.all_settings:sub_product:ID|featured" />
                                                    
                                      <mvt:if expr="g.featured">
                  
                                                                          <!-- Instead of the full image here I want the thumb-nailed version from Image dimensions that is used in Image Machine code -->                                      
                                                            <img src="&mvt:global:imageroot;&mvte:global:featured;"  />
                  
                  
                  
                  
                                                    </mvt:if>
                                      
                                                      <h2>&mvt:sub_product:name;</h2>
                                                      <span class="price">Price: &mvt:sub_product:formatted_price;</span>
                                  
                                              </a>
                              </li>
                          </mvt:foreach>
                  Steven Spriggs
                  Web Developer
                  ktm-parts.com

                  Comment


                    #10
                    Re: Pulling Product Image Custom Fields (Image Machine) within a Toolkit subcat Funct

                    I forgot about something I added in the tool kit to the customimage function. This is from the admin screen in 5.234 or newer. Use the tokenlist item that miva added to every page to see what the variables are.

                    Beginning with version 5.234 of the Tool Kit you can also list all of the images for the product if you leave the 4th parameter blank. There are several image variables returned in the array. Below shows just the url.
                    Code:
                    <mvt:item name="toolkit" param="customimagec|big|g.product_code|" />
                    <mvt:if expr="g.big">
                    <mvt:foreach iterator="image" array="toolkitadditionalimages">
                    <img src="&mvt:global:imageroot;&mvte:image:image:image;">
                    </mvt:foreach>
                    </mvt:if>
                    Last edited by wcw; 06-20-12, 04:43 PM.
                    Bill Weiland - Emporium Plus http://www.emporiumplus.com/store.mvc
                    Online Documentation http://www.emporiumplus.com/tk3/v3/doc.htm
                    Question http://www.emporiumplus.com/mivamodu...vc?Screen=SPTS
                    Facebook http://www.facebook.com/EmporiumPlus
                    Twitter http://twitter.com/emporiumplus

                    Comment


                      #11
                      Re: Pulling Product Image Custom Fields (Image Machine) within a Toolkit subcat Funct

                      Is it possible to add that?

                      I mean I am assuming that others would like to be able to utilize this function. No reason why the:


                      HTML Code:
                      <mvt:item name="toolkit" param="customimage|featured|l.all_settings:sub_product:ID|featured" />
                      couldn't return an array a la:

                      HTML Code:
                      &mvt:global:imageroot;&mvte:global:featured[0-2]
                      Just like the javascript from Image Machine:

                      HTML Code:
                      {  "type_code":    "featured",  "image_data":
                         [ 
                             "graphics\/00000001\/01101700.jpg",  
                             "graphics\/00000001\/01101700_170x146.jpg", 
                             "graphics\/00000001\/01101700.jpg"
                         ]
                      }
                      Last edited by ZER0KTM; 06-20-12, 04:42 PM.
                      Steven Spriggs
                      Web Developer
                      ktm-parts.com

                      Comment


                        #12
                        Re: Pulling Product Image Custom Fields (Image Machine) within a Toolkit subcat Funct

                        See my edited post above.
                        Bill Weiland - Emporium Plus http://www.emporiumplus.com/store.mvc
                        Online Documentation http://www.emporiumplus.com/tk3/v3/doc.htm
                        Question http://www.emporiumplus.com/mivamodu...vc?Screen=SPTS
                        Facebook http://www.facebook.com/EmporiumPlus
                        Twitter http://twitter.com/emporiumplus

                        Comment


                          #13
                          Re: Pulling Product Image Custom Fields (Image Machine) within a Toolkit subcat Funct

                          Originally posted by wcw View Post
                          I forgot about something I added in the tool kit to the customimage function. This is from the admin screen in 5.234 or newer. Use the tokenlist item that miva added to every page to see what the variables are.

                          Beginning with version 5.234 of the Tool Kit you can also list all of the images for the product if you leave the 4th parameter blank. There are several image variables returned in the array. Below shows just the url.
                          Code:
                          <mvt:item name="toolkit" param="customimagec|big|g.product_code|" />
                          <mvt:if expr="g.big">
                          <mvt:foreach iterator="image" array="toolkitadditionalimages">
                          <img src="&mvt:global:imageroot;&mvte:image:image:image;">
                          </mvt:foreach>
                          </mvt:if>

                          Ok this gives me a list of all images, but still not quite what I am looking for.

                          For image:

                          Code:
                          <img src="graphics/00000001/12450SXFFE_2.jpg">
                          Which is returned by the above code. I am trying to access the resized version of that image:

                          Code:
                          <img src="graphics/00000001/12450SXFFE_2_170x113.jpg">
                          Steven Spriggs
                          Web Developer
                          ktm-parts.com

                          Comment


                            #14
                            Re: Pulling Product Image Custom Fields (Image Machine) within a Toolkit subcat Funct

                            No, that's not there.
                            Bill Weiland - Emporium Plus http://www.emporiumplus.com/store.mvc
                            Online Documentation http://www.emporiumplus.com/tk3/v3/doc.htm
                            Question http://www.emporiumplus.com/mivamodu...vc?Screen=SPTS
                            Facebook http://www.facebook.com/EmporiumPlus
                            Twitter http://twitter.com/emporiumplus

                            Comment


                              #15
                              Re: Pulling Product Image Custom Fields (Image Machine) within a Toolkit subcat Funct

                              Originally posted by wcw View Post
                              No, that's not there.
                              will it ever be?

                              can you add it?

                              To me it doesn't seem like this is a stretch to ask, it's something that seems fundamentally basic.

                              I would assume it would be fairly easy to grab the data from the image id and join it with data from the GeneratedImages table, add in the join for ImageTypes and you should be able to grab all resized images, and filter by 'type' if wanted.
                              Last edited by ZER0KTM; 06-20-12, 06:04 PM.
                              Steven Spriggs
                              Web Developer
                              ktm-parts.com

                              Comment

                              Working...
                              X