Announcement

Collapse
No announcement yet.

Sub Category Product count variable

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

    Sub Category Product count variable

    Is there a better variable to use for showing this product count? I'll explain:

    On a number of my category pages, I show a text link to the subcategories that reads, "See all X# products >>>" The variable I'm using to display the number of products in that sub category is this:
    Code:
    &mvt:subcat:pcount;
    The trouble is that product count includes products that are out of stock. They're active, with inventory tracking on, but none are in stock and therefore hidden. I have a subcategory with about 20 in-stock and active products, and about 220 that are out of stock and hidden. So the text link shows "See all 240 products >>>" when there are really only 20 available for sale.

    Is there a better variable to use? I went bonkers scrolling through the Var List for my category page in the admin looking for something that would work.

    Thanks,
    Mark

    #2
    Re: Sub Category Product count variable

    I am still hoping for answer to this, even if the answer is no. Any help out there?

    Thanks,
    Mark

    Comment


      #3
      Re: Sub Category Product count variable

      You may want to email emporium plus directly. That sub cat variable is coming from toolkit. Perhaps there is a way within toolkit to do what you need.
      Brennan Heyde
      VP Product
      Miva, Inc.
      [email protected]
      https://www.miva.com

      Comment


        #4
        Re: Sub Category Product count variable

        Ah... I didn't realize that. Thanks!

        Comment


          #5
          Re: Sub Category Product count variable

          I think subcat:pcount is coming from the Sebenza Category Template Manager. To my knowledge there is no way around it unless Sebenza makes the change, adds an additional token. As Brennan stated, might be worth following up with Emporium Plus to see if the Toolkit has a method of out of stock supression on the subcat function. From there, you would need to update your existing subcat display to use the Toolkit vs. the Sebenza Category Template Manager.

          Better yet, we finally see stock subcat display capabilities in a future
          Miva Merchant release :)

          Comment


            #6
            Re: Sub Category Product count variable

            I believe if you use cxp or cxpc to display the products in a category, it is not going to show you the out of stock if you have your inventory settings to hide out of stock. Likewise the pcount is the number it is going to show. Create a little test page and see what you get with the cxpc function.
            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: Sub Category Product count variable

              Thanks, everybody.

              Bill, cxp works!

              However, your example in the doc lists an incorrect variable (or could it be because I'm using Sebenza's Category Template manager?).
              Code:
              l.all_settings:sub_category:id
              Should be:
               l.all_settings:subcat:id
              In the end, this code gives me the correct number of products that are available for sale in a subcategory:

              Code:
              <mvt:item name="toolkit" param="cxp|subpcount|l.all_settings:subcat:id" />&mvte:global:subpcount;
              Last edited by Mark Stephens; 07-10-13, 09:31 AM.

              Comment


                #8
                Re: Sub Category Product count variable

                The variable is based on the iterator value in the foreach loop. The example is using sub_category which happens to be the iterator of some other example in the tool kit. So the variable is correct for an example but not for your specific scenario. Simply changing that to the same as the iterator value makes it work for you.
                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: Sub Category Product count variable

                  Oh, I get it now. Geesh, it's right in front of my eyes. Thanks!

                  Comment


                    #10
                    Re: Sub Category Product count variable

                    So it's been 2 years since this post. Is it now possible to display the number of products in a sub-category to display in conjunction with the new subcategory_listing function?
                    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


                      #11
                      Re: Sub Category Product count variable

                      l.settings:category_listing:total_prod_count

                      Sould work. Of course, you'd need :total_prod_count to match up with the actual Interator being used.
                      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


                        #12
                        Re: Sub Category Product count variable

                        So I've tried using &mvt:sub_category_listing:total_prod_count; since I'm trying to pull in the product count for each of the sub_categories listed - it displayed nothing. I'm sure I'm missing something:

                        Code:
                        <mvt:foreach iterator="sub_category" array="subcats">
                        
                        			<mvt:if expr="l.settings:sub_category:image">
                        			<div class="column whole sub-category uppercase">
                        					<a href="&mvt:sub_category:link;" title="&mvt:sub_category:name;">
                        						<img src="&mvt:sub_category:image;" alt="&mvt:sub_category:name;" title="&mvt:sub_category:name;" />
                        						&mvt:sub_category:name;
                        					</a>
                        				</div>
                        			<mvt:else>
                        			<div class="column whole sub-category uppercase">
                        
                        
                        					<a href="&mvt:sub_category:link;" title="&mvt:sub_category:name;" class="bold">&mvt:sub_category:name; (&mvt:sub_category_listing:total_prod_count;)</a>
                        			  </div>
                        			</mvt:if>
                        		</mvt:foreach>


                        My previous attempt used the Toolkit but also didn't pull in any results

                        Code:
                        <mvt:foreach iterator="sub_category" array="subcats">
                        
                        			<mvt:if expr="l.settings:sub_category:image">
                        			<div class="column whole sub-category uppercase">
                        					<a href="&mvt:sub_category:link;" title="&mvt:sub_category:name;">
                        						<img src="&mvt:sub_category:image;" alt="&mvt:sub_category:name;" title="&mvt:sub_category:name;" />
                        						&mvt:sub_category:name;
                        					</a>
                        				</div>
                        			<mvt:else>
                        			<div class="column whole sub-category uppercase">
                        <mvt:item name="toolkit" param="cxp|subpcount|l.all_settings:sub_category:id" />
                        					<a href="&mvt:sub_category:link;" title="&mvt:sub_category:name;" class="bold">&mvt:sub_category:name; (&mvte:global:subpcount;)</a>
                        			  </div>
                        			</mvt:if>
                        		</mvt:foreach>
                        so what am I doing wrong?
                        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


                          #13
                          Re: Sub Category Product count variable

                          Im not sure there is going to be a great way to do what you need without toolkit.

                          In the sub_category array you have all the category codes but nothing related to product data. You could then do a lookup to load all products in each category to get the count, but that would take too much time and essentially cause you to load all products in the store.

                          What you really need is a function that just does a count of products assigned to each category and I did a quick check and did not see anything in the LSK.
                          Brennan Heyde
                          VP Product
                          Miva, Inc.
                          [email protected]
                          https://www.miva.com

                          Comment


                            #14
                            Originally posted by Mark Stephens View Post
                            Re: Sub Category Product count variable

                            Oh, I get it now. Geesh, it's right in front of my eyes. Thanks!
                            Mark are you still around - this is so old but yet so still needed. What did you wind up doing?
                            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


                              #15
                              Hey Leslie, yeah still here. But regretfully I don't remember how this played out for us. If we ever did get it working we've since abandoned it. Sorry I don't have a better answer for you.

                              Comment

                              Working...
                              X