Announcement

Collapse
No announcement yet.

Sub Category Product count variable

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

  • Bruce - PhosphorMedia
    replied
    Not sure if this is what you are looking for, but couldn't you use this inside the <foreach>?

    Code:
    <mvt:do name="g.doit" file="g.Module_Library_DB" value="Category_Load_Code( 'category_code', l.settings:current_category )" />
    <mvt:do name="g.numberOfProducts" file="g.Module_Library_DB" value="Runtime_ProductList_Load_Offset_Category( l.settings:current_category:id, g.Offset, 100, g.NextOffset, l.settings:products )" />
    
    &mvt:global:numberOfProducts;
    <mvt:assign name="g.numberOfProducts" value="''" />
    note: you'll need to check the input variables...this is just copied from my 'snippets' library.

    Leave a comment:


  • lesliekirk
    replied
    Originally posted by Mark Stephens View Post
    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.
    No worries, it was worth a shot. Many thanks!

    Leave a comment:


  • Mark Stephens
    replied
    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.

    Leave a comment:


  • lesliekirk
    replied
    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?

    Leave a comment:


  • Brennan
    replied
    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.

    Leave a comment:


  • lesliekirk
    replied
    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?

    Leave a comment:


  • Bruce - PhosphorMedia
    replied
    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.

    Leave a comment:


  • lesliekirk
    replied
    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?

    Leave a comment:


  • Mark Stephens
    replied
    Re: Sub Category Product count variable

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

    Leave a comment:


  • wcw
    replied
    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.

    Leave a comment:


  • Mark Stephens
    replied
    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.

    Leave a comment:


  • wcw
    replied
    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.

    Leave a comment:


  • Dan - Glendale Designs
    replied
    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 :)

    Leave a comment:


  • Mark Stephens
    replied
    Re: Sub Category Product count variable

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

    Leave a comment:


  • Brennan
    replied
    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.

    Leave a comment:

Working...
X