Announcement

Collapse
No announcement yet.

Miva9 Listing All products under multiple categories

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

    #16
    Originally posted by aarcmedia View Post
    lesliekirk the FIX IS IN......

    Simply add this.....

    HTML Code:
    <mvt:assign name="l.settings:myProducts" value="0" />
    .....to the line just above Runtime_ProductList_Load_Offset_Category. And Boom, it works.
    Isn't that the same as this?

    Code:
    <mvt:assign name="l.settings:products" value="0" />
    If so, I'm still having issues....
    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


      #17
      I'd say it may be running into the normal "product" loop causing issues? Maybe try re-naming yours exactly as mine is? Here's my code exactly as I have it, stripped of the fluff......

      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:category_children" value="miva_array_elements(l.settings:subcategories)" />
                          <mvt:if expr="l.settings:subcategories GT 0">
      
                                  <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:assign name="l.settings:myProducts" value="0" />
                                      <mvt:do name="l.doit" file="g.Module_Library_DB" value="Runtime_ProductList_Load_Offset_Category( l.settings:thisCategory:id, g.Offset, l.settings:null, g.NextOffset, l.settings:myProducts )" />                
                                      <table>
                                          <tr>
                                              <th>Image</th>
                                              <th>Name</th>
                                              <th>Size</th>
                                              <th>Order</th>
                                          </tr>
      
                                          <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="l.settings:product:id" />
                                          <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" />
                                          <mvt:item name="customfields" param="Read_Product_Code(l.settings:product:code,'product_size', g.product_size)" />        
      
      
                                          <tr>
                                              <td>
                                                  <a href="&mvt:canonical_uri:uri;"><img src="&mvt:global:subProductImage;" alt="&mvt:product:name;" /></a>
                                              </td>
                                              <td><a href="&mvt:canonical_uri:uri;">&mvt:product:name;</a></td>
                                              <td nowrap>&mvt:global:product_size;</td>
                                              <td>
      
                                                  <!-- add to cart form is here, I removed because we're doing funky stuff there also -->
      
                                              </td>
                                          </tr>
                                          </mvt:foreach>
                                          <!-- end .x-product-list -->
      
                                      </table>
      
                                  </mvt:foreach>
      
                          <mvt:else>
                              <mvt:item name="category_listing" />
                          </mvt:if>
      Ted Hust
      AarcMediaGroup.com

      Celebrating 13 Years of Outstanding Service & Support
      Miva Merchant Design

      Comment


        #18
        I confirmed that worked and spit things out without getting funky and adding to rows below to make up where rows above had that dreaded "max" number of products.

        Was that what was still causing you issue? Or was it the add to cart forms? I removed the ordering mechanism from the above reply because we were doing some funky stuff there that would have convoluted this example. There is also probably a couple of items that I have planted on the page that aren't needed as well at the top of the foreach loop as I copy and pasted from the Miva examples and haven't stripped out the items not needed fully.

        I'm also a tab, not spaces kind of guy. Don't yell at me for that haha.
        Ted Hust
        AarcMediaGroup.com

        Celebrating 13 Years of Outstanding Service & Support
        Miva Merchant Design

        Comment


          #19
          For some reason, within this subcat w/ products loop, the "qty in cart" junk isn't working. What would have to be modified or called in to play in order to make this work on this custom loop the same way it works within the category product list loop?

          What's below doesn't pull anything...

          HTML Code:
          <mvt:if expr="l.settings:product:quantity GT 0">
              <span class="x-product-layout-purchase__product-quantity u-font-tiny">
                  QTY in Cart: <strong>&mvt:product:quantity;</strong>
              </span>
          </mvt:if>
          Ted Hust
          AarcMediaGroup.com

          Celebrating 13 Years of Outstanding Service & Support
          Miva Merchant Design

          Comment


            #20
            I think you'd have to come up with your own routine to loop through the basket and see if the product is in there. I believe that 'items in cart' variable is only created on Product Pages. That function could take up quite of bit of processing time BTW.
            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


              #21
              It works as part of the normal Category Product List loop, so it definitely goes beyond the PROD template (I have it working on the normal CTGY product page for each item now). I just can't figure out how I have to call it to work within this custom sub-category w/ products loop. I may reach out to partner support again haha. They helped get me square with the issue Leslie and I were having, so I may as well ping them and see if they'll allow me to abuse their kindness a bit more.
              Ted Hust
              AarcMediaGroup.com

              Celebrating 13 Years of Outstanding Service & Support
              Miva Merchant Design

              Comment


                #22
                OK, so thanks to developer support, I got the QTY stuff working now as well within this loop using by simply adding this little snippet just above the conditional for the qty in cart stuff, like so....

                HTML Code:
                <mvt:do file="g.Module_Library_DB" name="l.settings:product:quantity" value="Basket_Quantity(l.settings:item:basket_id, l.settings:product:id)" />
                <mvt:if expr="l.settings:product:quantity GT 0">
                    <span class="x-product-layout-purchase__product-quantity u-font-tiny">
                        QTY in Cart: <strong>&mvt:product:quantity;</strong>
                    </span>
                </mvt:if>
                Ted Hust
                AarcMediaGroup.com

                Celebrating 13 Years of Outstanding Service & Support
                Miva Merchant Design

                Comment


                  #23
                  This is great! Thanks for the code guys :)

                  Only problem I see is that the code aarcmedia provided pulls in the full-size product image. Even with lazyloading it's not going to work (for my needs)... Anyone know of a better method to produce/fetch thumbnails than the code I'm using below?

                  HTML Code:
                  <!-- placed outside product loop -->
                  <mvt:assign name="l.settings:img:width" value="400"/>
                  <mvt:assign name="l.settings:img:height" value="400"/>
                  
                  <!-- placed within the product loop -->
                  <mvt:do file="g.Module_Library_DB" name="l.settings:sub_category:product:image_count" value="ProductImageDataList_Load_Product(l.settings:product:id, l.settings:product:images)" />
                  <mvt:foreach iterator="image" array="product:images">
                      <mvt:if expr="l.settings:image:imagetype:code EQ 'main'">
                      <mvt:assign name="l.settings:product:main_image" value="l.settings:image" />
                      <mvt:foreachstop/>
                      </mvt:if>
                  </mvt:foreach>
                  
                  <mvt:do file="g.Module_Library_DB" name="l.result" value="GeneratedImage_FindOrInsert_Image_Dimensions( l.settings:product:main_image:image, l.settings:img:width, l.settings:img:height, l.settings:product:main_image:generated )" />
                  <mvt:assign name="l.settings:image:mainthumb" value="l.settings:product:main_image:generated:image" />
                  
                  &mvte:image:mainthumb;


                  Comment


                    #24
                    Originally posted by aarcmedia View Post
                    lesliekirk the FIX IS IN......

                    Simply add this.....

                    HTML Code:
                    <mvt:assign name="l.settings:myProducts" value="0" />
                    .....to the line just above Runtime_ProductList_Load_Offset_Category. And Boom, it works.
                    Hey Ted aarcmedia - hope you are around. This fix seems to have stopped working. It's back to displaying duplicates as if to "fill space". I noticed it in this category. The Rush is supposed to be the last sub-sub-category with the Rush product. But right after it, it start back with 3 previously listed categories. It's like it tries to shift the last 3 sub-sub-categories of the previous sub-category over to "fill space".


                    Code:
                    <mvt:assign name="l.settings:subcat:id" value=" " />
                    <mvt:do name="l.result" file="g.Module_Library_DB" value="Category_Load_Code( g.Category_Code, l.settings:current_category )" />
                    <mvt:do name="l.result" file="g.Module_Library_DB" value="Runtime_CategoryList_Load_Parent( l.settings:current_category:id, l.settings:sub_categories )" />
                    
                    <mvt:assign name="l.subcat_count" value="miva_array_elements( l.settings:sub_categories )" />
                    
                    <mvt:if expr="l.subcat_count GT 0">
                    <mvt:foreach iterator="subcat" array="sub_categories">
                    <h2 style="font-size:1.4rem; font-weight:bold;"><a name="&mvt:subcat:code;"></a>&mvte:subcat:name;</h2>
                    <mvt:assign name="l.settings:sub_categories2" value=" " />
                    <mvt:do name="l.result" file="g.Module_Library_DB" value="Runtime_CategoryList_Load_Parent( l.settings:subcat:id, l.settings:sub_categories2 )" />
                    <mvt:assign name="l.subcat2_count" value="miva_array_elements( l.settings:sub_categories2 )" />
                    <mvt:if expr="l.subcat2_count GT 0">
                    <mvt:foreach iterator="subcat2" array="sub_categories2">
                    <section>
                    <p></p>
                    <ul class="c-form-list o-layout o-layout--wide">
                    <li class="c-form-list__item o-layout__item u-width-10--m">
                    <a name="&mvte:subcat2:code;"></a>
                    <h3><strong>&mvte:subcat2:name;</strong></h3></li>
                    <li class="c-form-list__item o-layout__item u-width-2--m">
                    <h3> <a href="/&mvt:category:code;.html#top"><span class="u-font-small u-icon-chevron-up"></span>
                    <strong class="u-color-red">Back to top</strong></a></h3></li>
                    </ul>
                    </section>
                    <mvt:comment>tweaked with Ted's code</mvt:comment>
                    
                    <mvt:assign name="l.settings:myProducts" value="0" />
                    <mvt:do name="l.doit" file="g.Module_Library_DB" value="Runtime_ProductList_Load_Offset_Category( l.settings:subcat2:id, g.Offset, l.settings:null, g.NextOffset, l.settings:myProducts )" />
                    
                    <section class="o-layout o-layout--row--l o-layout--wide">
                    <div class="o-layout__item u-width-3--l">
                    <mvt:do file="g.Module_Root $ '/modules/component/cmp-cssui-cattitle.mvc'" name="l.success" value="CSSUI_CatTitle_Load(l.settings:subcat2:id, l.settings:subcat2:title_image)" />
                    <img src="&mvt:subcat2:title_image:image;" alt="&mvte:subcat2:name;">
                    </div>
                    <div class="o-layout__item u-width-9--l">
                    <mvt:foreach iterator="product" array="myProducts">
                    <section>
                    <form class="o-layout__item u-width-12 inline-labeling ctgy-add-form" data-hook="purchase" action="&mvte:urls:BASK:auto;" method="post" name="add">
                    <input type="hidden" name="Action" value="ADPR" />
                    <input type="hidden" name="Product_Code" value="&mvte:product:code;" />
                    <ul class="c-form-list o-layout o-layout--wide">
                    <li class="c-form-list__item o-layout__item u-width-6--m"><span>&mvt:product:name;</span>
                    <mvt:if expr="NOT ISNULL l.settings:product:descrip">
                    <br>&mvt:product:descrip;
                    </mvt:if>
                    <mvt:item name="customfields" param="Read_Product_ID(l.settings:product:id, 'notes', l.settings:product:notes)" />
                    <mvt:if expr="NOT ISNULL l.settings:product:notes">
                    <br><div class="custom-field" id="customfields-notes"><span class="bold">Notes:</span> &mvt:product:notes;</div>
                    </mvt:if>
                    </li>
                    <li class="c-form-list__item o-layout__item u-width-2--m"> <span>$<mvt:eval expr="l.settings:product:price ROUND 2" /></span></li>
                    <li class="c-form-list__item o-layout__item u-width-1--m"><span>
                    <input class="form-control form-control-sm col-sm-4 text-center float-right cart-quantity ctgyQuantity" autocomplete="off" style="margin:0 auto" type="tel" min="0" name="Quantity" value="1">
                    </span></li>
                    <li class="c-form-list__item o-layout__item u-width-3--m">
                    <input type="submit" value="Add to Cart" class="ctgyCart c-button c-button--full c-button--large c-control-group__button u-bg-primary u-color-yellow u-text-bold u-font-small u-text-uppercase">
                    </li>
                    </ul>
                    </form>
                    <hr class="c-keyline">
                    </section>
                    </mvt:foreach>
                    </div>
                    </section>
                    </mvt:foreach>
                    <mvt:assign name="l.settings:sub_categories2" value=" " />
                    </mvt:if>
                    </mvt:foreach>
                    </mvt:if>
                    Why would this stop working after working so nicely for a year and a half? Has something changed behind the scenes?




                    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

                    Working...
                    X