Announcement

Collapse
No announcement yet.

Need to include category in Related Product link

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

    Need to include category in Related Product link

    I need to find a way to include the category code in the Related Product link. Without it, it seems that a custom category tree built with the Toolkit disappears when going to the product page. I know one of the issues is that the product could be in more than one category - if I could get the link to at least have one category in it.

    In the back of my mind - I'm also wondering if I need to change the cat tree. It does exactly what I need - EXCEPT it disappears when a Related Product link is clicked.

    Code:
    <div id="sidebar">
    <mvt:item name="toolkit" param="childof|parentfound|g.Category_Code" />
    <mvt:if expr="g.parentfound">
    <h2>&mvt:childof:name;</h2>
    <mvt:else>
    <h2>&mvt:category:name;</h2>
    </mvt:if>
    <ul>
    
    
    <mvt:item name="toolkit" param="subcat|ccount|g.Category_Code" />
    <mvt:if expr="ccount GT 0">
    <mvt:foreach iterator="sub_category" array="sub_categories">
    <mvt:if expr="g.Category_Code EQ l.settings:sub_category:code">
    <li class="active"><a href="&mvt:global:sessionurl;Screen=CTGY&amp;Store_Code=&mvta:global:Store_Code;&amp;Category_Code=&mvt:sub_category:code;">&mvt:sub_category:name;</a></li>
    <mvt:else>
    <li><a href="&mvt:global:sessionurl;Screen=CTGY&amp;Store_Code=&mvta:global:Store_Code;&amp;Category_Code=&mvt:sub_category:code;">&mvt:sub_category:name;</a></li>
    </mvt:if>
    </mvt:foreach>
    </mvt:if>
    
    <mvt:item name="toolkit" param="sibling|scount|g.Category_Code" />
    <mvt:if expr="scount GT 0">
    <mvt:foreach iterator="sibling" array="siblings">
    <mvt:if expr="g.Category_Code EQ l.settings:sibling:code">
    <li class="active"><a href="&mvt:global:sessionurl;Screen=CTGY&amp;Store_Code=&mvta:global:Store_Code;&amp;Category_Code=&mvt:sibling:code;">&mvt:sibling:name;</a>
    </li>
    <mvt:else>
    <li><a href="&mvt:global:sessionurl;Screen=CTGY&amp;Store_Code=&mvta:global:Store_Code;&Category_Code=&mvt:sibling:code;">&mvt:sibling:name;</a></li>
    </mvt:if>
    </mvt:foreach>
    </mvt:if>
    </ul>
    </div>
    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: X | Facebook | Pinterest

    #2
    Re: Need to include category in Related Product link

    I haven't tested this, it's just a thought to find a category of a product.

    <mvt:item name="toolkit" param="productincategory|incatcount|g.Product_Code " />
    <mvt:if expr="incatcount GT 0">
    <mvt:foreach iterator="incategory" array="incategories">
    <mvt:if expr="pos1 EQ 1">
    <mvt:item name="toolkit" param="vassign|cat_code|l.all_settings:incategory: code" />
    &mvt:global:cat_code;
    </mvt:if>
    </mvt:foreach>
    </mvt:if>
    Gary

    [email protected]
    www.icCommerce.com

    Comment


      #3
      Re: Need to include category in Related Product link

      Hi Gary,

      Thanks - it looked good - but didn't pull in any category code. Here's how I attempted to implement the Toolkit snippet you provided. Maybe my implementation is incorrect:

      Code:
      <mvt:item name="toolkit" param="productincategory|incatcount|g.Product_Code " />
          <mvt:if expr="incatcount GT 0">
          <mvt:foreach iterator="incategory" array="incategories">
          <mvt:if expr="pos1 EQ 1">
          <mvt:item name="toolkit" param="vassign|cat_code|l.all_settings:incategory: code" />
      <h4><a href="&mvt:global:sessionurl;Screen=PROD&Store_Code=&mvta:store:code;&Product_Code=&mvta:product:code;&Category_Code=&mvt:global:cat_code;" title="&mvte:product:name;">&mvte:product:name;</a></h4></mvt:if>
          </mvt:foreach>
          </mvt:if>
      The thing that strikes me as odd is I was thinking I should at least see a link that looks like

      merchant.mvc?Store_Code=ABC&Screen=PROD&Product_Co de=123&Category_Code=

      but instead it's just

      merchant.mvc?Store_Code=ABC&Screen=PROD&Product_Co de=123

      FWIW if I can just get a cat code at the tail end of the URL does get the cat tree back.
      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: X | Facebook | Pinterest

      Comment


        #4
        Re: Need to include category in Related Product link

        Mumble grumblin creeping crud brain fog. I just realized that I missed the link around the thumbnail - it's the one not adding the &Category_Code=

        AND I just realized that the Toolkit snippet is completely removing the link it's wrapped around - so in other words it thinks there is no category so it's not displaying.

        Back to square one and another cup of hot tea.

        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: X | Facebook | Pinterest

        Comment


          #5
          Re: Need to include category in Related Product link

          Well not quite square one. I did test it and for some reason the for each loop is not working. But if the last category a product is assigned to is as good as the first we don't need the loop.

          This should work:

          <mvt:item name="toolkit" param="productincategory|incatcount|g.Product_Code " />
          <mvt:if expr="incatcount GT 0">
          <h4><a href="&mvt:global:sessionurl;Screen=PROD&Store_Cod e=&mvta:store:code;&Product_Code=&mvta:product:cod e;&Category_Code=&mvt:incategory:code;" title="&mvte:product:name;">&mvte:product:name;</a></h4>
          </mvt:if>
          Gary

          [email protected]
          www.icCommerce.com

          Comment


            #6
            Re: Need to include category in Related Product link

            watch for the spaces the forum is adding,it should be:
            Store_Code= not Store_cod e=
            Gary

            [email protected]
            www.icCommerce.com

            Comment


              #7
              Re: Need to include category in Related Product link

              g.Product_Code is not the related product. That is the primary product. The related product in the related product list array should be l.all_settings:product:code or something similar. You need to look at the related product foreach loop and use the iterator value in the middle of that variable.
              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


                #8
                Re: Need to include category in Related Product link

                Quick note while I go dink around with this again, this is the foreach iteration:


                Code:
                <mvt:foreach iterator="product" array="related_products:products">
                I may also need to turn on the KSE module to take a peek.
                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: X | Facebook | Pinterest

                Comment


                  #9
                  Re: Need to include category in Related Product link

                  LOL - sometimes the simplest route is the answer. Here's what "works for me":


                  Code:
                  <a href="&mvt:global:sessionurl;Screen=PROD&Store_Code=&mvta:store:code;&Product_Code=&mvta:product:code;&Category_Code=&mvta:category:code;" title="&mvte:product:name;">&mvte:product:name;</a>
                  FYI - all of my attempts have been within the related products foreach iteration

                  Thanks everyone!
                  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: X | Facebook | Pinterest

                  Comment


                    #10
                    Re: Need to include category in Related Product link

                    are you sure? It looks to me like it's using the category code of the main product, not the related product.

                    I've been trying to pull the related products category using:
                    <mvt:item name="toolkit" param="productincategory|incatcount|l.all_settings :RELATED_PRODUCTS:PRODUCTS:CODE" />
                    but the incatcount always comes back null.
                    Gary

                    [email protected]
                    www.icCommerce.com

                    Comment


                      #11
                      Re: Need to include category in Related Product link

                      The variable in the related products foreach loop in your store is l.all_settings:product:code It is based on the iterator of the array. Replace g.Product_Code with that variable.
                      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

                      Working...
                      X