Announcement

Collapse
No announcement yet.

Limitations of combining Toolkit randomcat & subcat

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

    Limitations of combining Toolkit randomcat & subcat

    I have a large database of products and to keep things organized I assigned them only to the category they apply to and not their parents. This of course has the side effect of empty parent category pages, aside from the category header which contains the description. To address this I decided to use Toolkit randomcat to load a few products from each of the subcategories. It actually works great unless those subcategories have children of their own which is frequently the case.

    The next step was to traverse down the tree a level with subcat and try to pull those products out. I managed to get those out too but since it runs inside the foreach loop it's returning three items from each of those sub-subcategories which isn't what I had in mind. To visualize the goal here's a dummy category structure to reference...

    Shirts (parent cat)
    - Mens (subcat)
    - - Big & Tall (subcat2)
    - - Short & Small (subcat2)
    - Womens (subcat)
    - Childrens (subcat)

    When the functions run it returns the subcat title and three random products beneath it from that category, except for Mens. There it would originally return nothing but with the subcat function it's now returning three for each of the categories beneath it. However, what I've been trying to do is get it to just grab three random products from the subcat2 categories combined.

    I've seen some other posts that all get up to the same point before factoring in the subcat2 level and then a post about bestsellers stating it doesn't work on multiple categories. That got me wondering if the same applies to randomcat or if a work around is possible. I've tried a number of different things with vassign and cxpc added to the mix and it still returns three products for each subcat2 category (or none because I'm trying stuff I know can't possibly work).

    So, I guess I'm wondering now if it's possible to dump the products from all subcat2 categories into a variable and then call on that with randomcat, obviously outside of the foreach to avoid looping through and displaying them all. The last resort is to use alternate display pages with a massive product update to add additional parent category assignments. This is a major task though so I want to make sure I'm not missing something in my use of subcat and randomcat first.

    As always, your knowledge and tips are greatly appreciated.

    Thanks,
    Tim

    #2
    Re: Limitations of combining Toolkit randomcat & subcat

    Not a direct answer to your question, but if you have sub-cats of cats (and sub-cats of sub-cats) that are primarily for segmenting products, why not just use a cascading menu so the customer only ends up selecting a category that is product bearing. Might have an advantage with SEO as products would be associate with a complete string of references (the cat, sub-cat, sub-cat linage) and you would have to deal with setting conical references.

    Just a thought.
    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


      #3
      Re: Limitations of combining Toolkit randomcat & subcat

      Hi Bruce,

      With a large category count and even larger product count the idea was to give the customer a visual representation of the items in the next level down. Since not every category in the store is clearly indicative of the products it contains I thought randomcat would be a great way to help visualize what's in store as they navigate down. Obviously searching is more effective than browsing in a catalog of this size but for those that insist on taking the long way we can hopefully prevent them from having to navigate through 20 pages of products only to not find what they were looking for.

      The idea for us was to use it on the parent categories and the sub-categories where they exist since no category goes more than two levels deep, as in my Shirts > Mens example. This would mean they would see a general sampling of the Mens subcat while on the Shirts page and a more accurate sampling if they decided to navigate into the Mens subcategory. By that point they should know if they're in the right place.

      Comment


        #4
        Re: Limitations of combining Toolkit randomcat & subcat

        After a quick email exchange with Bill it appears my original post was a bit confusing. Below is a code sample that hopefully clarifies it a bit...

        Code:
        <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:item name="toolkit" param="randomcat|pcount|l.all_settings:sub_category:code|3" />
                <h2 class="category-title">&mvt:sub_category:name;</h2>
                <mvt:if expr="pcount GT 0">
                    <mvt:foreach iterator="sub_product" array="sub_products">
                        <img src="&mvt:sub_product:thumbnail;" alt="&mvt:sub_product:name;" width="100" />
                    </mvt:foreach>
                <mvt:else>
                    <mvt:item name="toolkit" param="subcat2|ccount2|l.all_settings:sub_category:code" />
                    <mvt:if expr="ccount2 GT 0">
                        <mvt:foreach iterator="sub_category2" array="sub_categories2">
                            <mvt:item name="toolkit" param="randomcat|pcount|l.all_settings:sub_category2:code|3" />
                            <mvt:if expr="pcount GT 0">
                                <mvt:foreach iterator="sub_product" array="sub_products">
                                    <img src="&mvt:sub_product:thumbnail;" alt="&mvt:sub_product:name;" width="100">
                                </mvt:foreach>
                            </mvt:if>
                        </mvt:foreach>
                    </mvt:if>
                </mvt:if>
            </mvt:foreach>
        </mvt:if>
        The hurdle I'm facing is the product count returned when it runs through "subcat2". Obviously, since it runs inside the foreach loop, if there are 5 subcats it will return 15 products. What I'm trying to do is just grab a total of 3 random products from any of those 5 subcats, not 3 from each.

        Hopefully that lifts the fog from my conundrum :)

        - Tim
        Last edited by NightOwl; 02-23-14, 10:57 AM.

        Comment


          #5
          Re: Limitations of combining Toolkit randomcat &amp; subcat

          I'd be inclined to locate a subcat that has 3 or more products in it using cxp function. When you find one, then run the randomcat on that one specific category. You might need to put that code in a separate page template so that you can do an exit once the products are displayed. Use the render to pull that separate page into whatever pages you want this to show on.
          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


            #6
            Re: Limitations of combining Toolkit randomcat &amp; subcat

            Thanks Bill. I'm certainly not giving up on the original plan but that will at least get me the desired output for now while I keep tinkering with it.

            Comment

            Working...
            X