Announcement

Collapse
No announcement yet.

Subcategories on the PROD page.

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

    Subcategories on the PROD page.

    Hey all,
    I am trying to pull subcategories for a given product on the PROD page. I've tried using the Tool Belt Category_children function using the following code:

    Code:
    <mvt:item name="ry_toolbelt" param="category_children|g.Category_Code" />
    <mvt:item name="ry_toolbelt" param="category_children|l.all_settings:category:code" />    
    
    Example: Display subcategory images with links
    <mvt:if expr="l.settings:category_children">  
    <mvt:foreach iterator="subcat" array="category_children">    
    <div>      
    <a href="&mvt:subcat:href">        
    <img src="&mvt:subcat:image_tree;" border="0"><br>&mvte:subcat:name;      
    </a>    
    </div>  
    </mvt:foreach>
    </mvt:if>  
    
     View Returned Values:
    <mvt:item name="ry_toolbelt" param="eval|varlist('l', 'category_children', l.all_settings)" />
    But it isn't working. From all of the research I've done today, I am starting to think that the g.Category_Code isn't set on PROD pages. It returns nothing and warns me to use the l.all_settings in the code.

    Have any of you solved the subcategory issue on the PROD page? We want to have a left-navigation section on each product page with the subcategories for the products category.

    #2
    I think g.Category_Code use to be passed in through legacy urls but for some reason I thought was solved many updates ago.

    If not, Bruce provided a code snippet for a function that finds a list of global categories on a product page a few posts ago. You can combine it with Miva's CategoryList_Load_Parent function:

    Code:
    <mvt:do name="l.doit" file="g.Module_Library_DB" value="CategoryList_Load_Offset_Product_Assigned(l.settings:product:id,0,'','',0,l.null, g.categoriesOfProducts )" />
    
        <mvt:foreach iterator="category" array="global:categoriesOfProducts">
    
            <mvt:do name="g.cat_children_count" file="g.module_library_db" value="CategoryList_Load_Parent(l.settings:category:id, l.settings:category_children)" />
    
                <mvt:foreach iterator="subcat" array="category_children">
    
                    <div>      
                        <a href="&mvt:subcat:href">        
                            <img src="&mvt:subcat:image_tree;" border="0"><br>&mvte:subcat:name;      
                        </a>    
                    </div
    
                </mvt:foreach>
        </mvt:foreach>
    Looking at your code you may also need to call the URI_Load_Item_Canonical function and another function to call in the image_tree.
    http://www.alphabetsigns.com/

    Comment


      #3
      Yeah, the code I provided was the sample code from Toolbelt to pull subcategory information in their documentation. I'm not sure it's updated for 9.0 so that may be the issue. This is turning out to be a bit of a pain to display the subcategory on the product page. I guess others haven't really needed to do this as a lot of site simply put the entire tree on the side - but with so many categories and subcategories, the real estate taken up would be counter-productive. I will keep plugging, but if anyone has managed to skin this particular cat, I would love to hear from you.

      Comment


        #4
        Whether or not the category code is passed onto the Product page depends on several different settings and ONLY works with normal (aka Long) merchant links as that's the method used to pass it (URL CGI variables). When something like this is needed, you generally either have to use the reverse look up that Alphabet mentioned (time consuming, gets an 'arbitrary' cross referenced cat if more than one is assigned) or use a custom Product field. We've done on a number of sites.
        Bruce Golub
        Phosphor Media - "Your Success is our Business"

        Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
        phosphormedia.com

        Comment


          #5
          I think I have found a solution, but haven't had time to test it yet. Rather than fight Miva for this to work, I may just bypass the issue and use ToolBelt to run a query against the URIs and s01_Categories table to return the appropriate subcategory and hyperlink with a given category:parend_id.

          Comment

          Working...
          X