real quick cause i'm actually re-tiling the bathroom floor...
try replacing
l.settings:subcategories
in
<mvt:assign name="l.settings:subcategory_count" value="miva_array_elements(l.settings:subcategorie s)" />
with
l.settings:category_children
Announcement
Collapse
No announcement yet.
Miva9 Listing All products under multiple categories
Collapse
X
-
To better explain. Let's say the first subcat has 5 products, it will show them. Say the second subcat has 10 products. Still will be good. But if the third subcat only has 5 products, it will show those 5, and then spit out another 5 from the previous categories product list, to bring that sub-cats total to 10, and each after, no matter how many are in it, will fill out at 10 by filling in products from the row above. It's maddening haha. There has to be a way to exit, and only spit however many are SUPPOSED TO SHOW. I presume something with the offset is screwing it up.
Leave a comment:
-
OK, well this isn't quite working. What I have happening now is instead of just spitting out the subcategories products, if one category has 10 products, but the next only has 5, it's adding 5 products to the end of the one group to get it to the same #? Very odd.
So how do I get the for each loop for the subcategory's products to stop at JUST WHAT'S ASSIGNED? Here's what I have so far.....
HTML Code:<mvt:foreach array="cattree_categories" iterator="category_children"> <mvt:if expr="l.settings:category_children:parent_id EQ l.settings:category:id"> <mvt:assign name="l.null" value="miva_array_insert(l.settings:subcategories, l.settings:category_children, -1)" /> </mvt:if> </mvt:foreach> <mvt:assign name="l.settings:subcategory_count" value="miva_array_elements(l.settings:subcategories)" /> <mvt:if expr="l.settings:subcategories GT 0"> <section class="o-layout"> <div class="o-layout__item"> <mvt:foreach iterator="subcategory" array="subcategories"> <h2 class="u-text-uppercase"><a href="&mvte:subcategory:link;"> <strong>&mvte:subcategory:name;</strong> </a></h2> <mvt:do name="l.doit" file="g.Module_Library_DB" value="Category_Load_Code( l.settings:subcategory:code, l.settings:thisCategory)" /> <mvt:do name="l.doit" file="g.Module_Library_DB" value="Runtime_ProductList_Load_Offset_Category( l.settings:thisCategory:id, g.Offset, 100, g.NextOffset, l.settings:myProducts )" /> <table class="table-compact"> <mvt:foreach iterator="product" array="myProducts"> <mvt:assign name="l.uri:store_id" value="g.Store:id" /> <mvt:assign name="l.uri:screen" value="''" /> <mvt:assign name="l.uri:page_id" value="0" /> <mvt:assign name="l.uri:cat_id" value="0" /> <mvt:assign name="l.uri:product_id" value="1" /> <mvt:do file="g.Module_Feature_URI_DB" name="l.have_uri" value="URI_Load_Item_Canonical( l.uri, l.settings:canonical_uri )" /> <mvt:do name="l.success" file="g.Module_Library_DB" value="ProductImage_Load_Type(l.settings:product:id, 1, l.settings:imagetype)" /> <mvt:do name="l.success" file="g.Module_Library_DB" value="Image_Load_ID(l.settings:imagetype:image_id, l.settings:imagedata)" /> <mvt:assign name="g.subProductImage" value="g.baseurl $ l.settings:imagedata:image" /> <tr> <td>&mvt:product:name;</td> </tr> </mvt:foreach> </table> </mvt:foreach> </div> </section>
Leave a comment:
-
I was going to ask if you were trying to do something similar to this. I have been working hard with the help of a few people to convert the code used on the page from Toolkit to native coding.
Leave a comment:
-
Got it, changed the first line to this.....
HTML Code:<mvt:do name="l.doit" file="g.Module_Library_DB" value="Category_Load_Code( l.settings:subcategory:code, l.settings:thisCategory)" />
- 1 like
Leave a comment:
-
Hey bruce, I've been trying to get this to work, and I think I'm "close". I have included the code below within the foreach loop for the SUBCATEGORIES. I am now "manually" assigning a category code to prove I can spit the products out, but I can't get this to actually show for the SUBCAT that is being looped through for each.....
HTML Code:<mvt:do name="l.doit" file="g.Module_Library_DB" value="Category_Load_Code( 'pepsi', l.settings:thisCategory)" /> <mvt:do name="l.doit" file="g.Module_Library_DB" value="Runtime_ProductList_Load_Offset_Category( l.settings:thisCategory:id, g.Offset, 100, g.NextOffset, l.settings:myProducts )" /> <mvt:comment> Now you have an array of products so</mvt:comment> <mvt:foreach iterator="product" array="myProducts"> &mvt:product:code; &mvt:product:name; &mvt:product:thumb; etc </mvt:foreach>
HTML Code:<mvt:foreach array="cattree_categories" iterator="category_children"> <mvt:if expr="l.settings:category_children:parent_id EQ l.settings:category:id"> <mvt:assign name="l.null" value="miva_array_insert(l.settings:subcategories, l.settings:category_children, -1)" /> </mvt:if> </mvt:foreach> <mvt:assign name="l.settings:subcategory_count" value="miva_array_elements(l.settings:subcategories)" /> <mvt:if expr="l.settings:subcategories GT 0"> <section class="o-layout u-grids-2 u-grids-3--l x-product-list"> <mvt:foreach iterator="subcategory" array="subcategories"> <div class="o-layout__item u-text-center x-product-list__item"> <a class="u-block x-product-list__link" href="&mvte:subcategory:link;"> <figure class="x-product-list__figure"> <mvt:if expr="l.settings:subcategory:image"> <img class="x-product-list__image" src="&mvt:subcategory:image;"> </mvt:if> <figcaption> <strong class="x-product-list__name u-text-uppercase">&mvte:subcategory:name;</strong> </figcaption> </figure> </a> </div> <mvt:do name="l.doit" file="g.Module_Library_DB" value="Category_Load_Code( 'pepsi', l.settings:thisCategory)" /> <mvt:do name="l.doit" file="g.Module_Library_DB" value="Runtime_ProductList_Load_Offset_Category( l.settings:thisCategory:id, g.Offset, 100, g.NextOffset, l.settings:myProducts )" /> <mvt:comment> Now you have an array of products so</mvt:comment> <mvt:foreach iterator="product" array="myProducts"> &mvt:product:code; &mvt:product:name; &mvt:product:thumb; etc </mvt:foreach> </mvt:foreach> </section> <mvt:else> <mvt:item name="category_listing" /> </mvt:if>
Leave a comment:
-
You'd need to take the code from Content - Sub Categories (which creates a list of the sub cats for a top level cat) then INSIDE that array, run something like:
Code:<mvt:do name="l.getCatID" file="g.Module_Library_DB" value="Category_Load_Code( 'category_code', l.settings:thisCat)" /> <mvt:do name="l.getProductArray" file="g.Module_Library_DB" value="Runtime_ProductList_Load_Offset_Category( l.settings:thisCat:id, g.Offset, 100, g.NextOffset, l.settings:products )" /> <mvt:foreach iterator="product" array="products"> &mvt:product:code;<br> //Add the code you used for the product display of specific subcats </mvt:foreach> <mvt:assign name="l.settings:thisCat" value="''"/> <mvt:assign name="l.settings:products" value="''"/>
Leave a comment:
-
Miva9 Listing All products under multiple categories
Hi,
Can anyone help me?
I want to be able to list all the products under multiple sub-categories. e.g. When I click Drinkware + Kitchen, how do I list "ALL" the products under the main category Drinkware + Kitchen. Currently, I am only able to list one sub-category at a time. I wish to have a CTGY page that will list all the products in each of the categories below when they click DRINKWARE + KITCHEN- Mugs + Water Bottles + Tumblers
- Barware Glasses + Flask + Shakers
- Crystal Rhinestones Drinkware
- Wine Boxes + Bottle Carriers
- Bar Tool Sets + Wine Accessories
- Utensils + Coasters + Organization
- Cutting Boards + Chef Cutlery Sets
Please see image and go to link https://www.hansonellis.com/personal...men-women.html
Thanks,
KeithAttached FilesLast edited by howsimple; 06-26-18, 08:33 AM.Tags: None
Leave a comment: