Announcement

Collapse
No announcement yet.

Toolkit snippet replacement needed

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

    Toolkit snippet replacement needed

    I think this may have been done, but I checked the Miva docs and didn't find it.

    The snippet also needs to be able to reflect any Sale or other Price Group Pricing when the customer is logged in. This snippet never had that ability, and it is needed.

    Here's what I have:

    Code:
    <div class="row related-products">
    <mvt:item name="toolkit" param="vquick|pcount|l.all_settings:product:custom field_values:customfields:alsobought" />
    <mvt:if expr="pcount GT 0">
    <mvt:do name="l.success" file="g.Module_Library_DB" value="ImageType_Load_Code( 'main', l.settings:imagetype )" />
    <mvt:assign name="l.width" value="255" />
    <mvt:assign name="l.height" value="333" />
    <div class="column whole">
    <h4 class="nm">Customers who bought this item also bought</h4>
    <div class="green">&bull;&bull;&bull;&bull;&bull;</div>
    </div>
    <div class="breaker show medium-hide"></div>
    <div class="column whole related-products-carousel">
    <div id="js-also-bought-carousel" class="column whole np">
    <mvt:foreach iterator="quicklist" array="quicklists">
    <mvt:comment><mvt:assign name="l.settings:generated_image:image" value="''" />
    <mvt:assign name="l.settings:imagedata:image" value="''" />
    <mvt:assign name="l.settings:imagedata" value="''" />
    <mvt:assign name="l.settings:image:image_id" value="''" /></mvt:comment>
    <mvt:do file="g.Module_Feature_URI_UT" name="l.settings:quicklist:uri" value="Store_Product_URL(l.settings:quicklist, NULL)" />
    <div class="category-product">
    <a data-mm-linktype="product-list-link" href="&mvt:quicklist:uri;" title="&mvt:quicklist:name;">
    <span class="category-product-image-wrapper border-cool-grey">
    <img src="&mvt:quicklist:thumbnail;" alt="&mvt:quicklist:name;" title="&mvt:quicklist:name;" />
    </span>
    <p class="category-product-name"><a href="&mvt:quicklist:uri;">&mvt:quicklist:name;</a></p>
    <mvt:if expr="g.customer:login">
    <p class="category-product-price-container">
    <span class="category-product-price">&mvt:quicklist:formatted_price;</span>
    </p>
    </mvt:if>
    </a>
    </div>
    </mvt:foreach>
    </div>
    </div>
    </mvt:if>
    </div>
    I figure this might be another one that should go into the repository. Thanks! Leslie
    Leslie Kirk
    Miva Certified Developer
    Miva Merchant Specialist since 1997
    Previously of Webs Your Way
    (aka Leslie Nord leslienord)

    Email me: [email protected]
    www.lesliekirk.com

    Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

    #2
    lesliekirk This code is hard to replicate one to one with template code, the software was more powerful then Toolkit could account for in it's legacy state.

    That being said it is just checking a product custom field called "alsobought" then looping through the array to render the product data. Here is a snippet that gets you that information. Not sure if it is worthy of a code snippet in our repo but feel free to save it and modify as needed. Note this does not use the runtime function which would give you any applied discounts based on the basket and take into account availability groups and other runtime data.

    Code:
    <mvt:comment> Extract the comma-separated list of product codes from the custom field "alsobought" </mvt:comment>
    <mvt:assign name="l.settings:alsobought_codes" value="l.settings:product:customfield_values:custo mfields:alsobought" />
    <mvt:comment> Split the codes by comma and store them in an array, trimming whitespace from each code </mvt:comment>
    <mvt:assign name="l.settings:alsobought_count" value="miva_splitstring( l.settings:alsobought_codes, ',', l.settings:alsobought_code_array, 'trim' )" />
    <mvt:comment> Loop through each product code in the array </mvt:comment>
    <mvt:foreach iterator="alsoboughtproduct_code" array="alsobought_code_array">
        <mvt:comment> Load the product data using its product code </mvt:comment>
        <mvt:do file="g.Module_Library_DB" name="l.success" value="Product_Load_Code( l.settings:alsoboughtproduct_code, l.settings:alsobought )" />
    
        <mvt:comment> If product was successfully loaded, get its primary product image (type 1) </mvt:comment>
        <mvt:if expr="l.success GE 1">    
            <mvt:do file="g.Module_Library_DB" name="l.void" value="ProductImage_Load_Type( l.settings:alsobought:id, 1, l.settings:productimage )" />
        </mvt:if>
    </mvt:foreach>
    Side note this feature is available in different ways using PageBuilder. The workflow might need to improve from what is currently being done but the end result will be the same plus using Page Builder.
    Nicholas Adkins
    Technical Training Specialist / Miva, Inc.
    [email protected]
    https://www.miva.com/mivalearn

    Comment


      #3
      Originally posted by Nick View Post
      lesliekirk


      Side note this feature is available in different ways using PageBuilder. The workflow might need to improve from what is currently being done but the end result will be the same plus using Page Builder.
      Sorry for the delay in getting back to you, Nick (I've been recovering from emergency surgery). I agree, using the PageBuilder Components is the way to go. Which one is going to allow me to build an "Also Bought" based on the custom field? It would need to be able to include any price group pricing, etc.

      Then I think the bigger question here is - how to replace the Toolkit "alsobought" function - it's what loads the data into the "alsobought" product custom field. Is there a replacement for it?
      Leslie Kirk
      Miva Certified Developer
      Miva Merchant Specialist since 1997
      Previously of Webs Your Way
      (aka Leslie Nord leslienord)

      Email me: [email protected]
      www.lesliekirk.com

      Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

      Comment


        #4
        lesliekirk The way the toolkit module did that functionality is not viable hence the reason we have depreciated the feature. The feature is just pulling a list of self populated values from a custom product field. You could apply the template code I gave with some additional checks that will check runtime items but that brings additional load time which is typically more important that the feature to display products from a custom field.

        Another option is to use this module: https://apps.miva.com/also-bought-products.html

        It has not been updated to use with Page Fragments but it is on the list. It could still be used in the footer of a page template.
        Nicholas Adkins
        Technical Training Specialist / Miva, Inc.
        [email protected]
        https://www.miva.com/mivalearn

        Comment

        Working...
        X