Announcement

Collapse
No announcement yet.

Counting skipped products

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

    Counting skipped products

    So I thought I had a simple fix to not display products based on a condition

    Code:
    	 <mvt:if expr="l.settings:product:price NE '0.00'">
    </mvt:if>
    On the surface, it appeared to work very well, but now it seems to not know how to "count". For example, it's set to display 36 products per page. But when the conditional is in place to check for prices not equal to 0.00, it seems to not be able to display 36 per page leaving an empty product space at the end of the last row on the bottom. Then is displays the next button.

    So how do I make it count?

    Leslie
    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

    #2
    Re: Counting skipped products

    I don't believe there's a way to add the next sequential product to the loop for each one skipped in that manner, and the only other solutions I'm thinking of would cause the page offsets to not work properly.

    Is there a reason the products can't just be made inactive? Or their inventory reduced to 0 with "hide out of stock products" turned on? Or add them to an availability group?
    Kyle Newbrough
    Technical Support / Web Developer
    Miva Merchant

    Comment


      #3
      Re: Counting skipped products

      Long story, short. Store owner used a custom field for all "sold" products and is using a price of 0.00. I'm trying to find a way to work with what is already being used to prevent having to go back in and change 100's of products. I'm thinking that probably using the Inventory set at Track Out of Stock Level but not hide them.
      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


        #4
        Re: Counting skipped products

        I've run into this problem before. When you add a condition that removes some products from the display, the store keeps putting out 36 (or whatever number) products per page; it doesn't know that some of them are being skipped by the page template. Fixing this requires a custom module that can alter the product listings at a lower level, before they get to the page template. -- unless you can think of a clever work-around using the Active setting, or a price group, or some other built-in feature that the store already knows how to work with. Or instead of removing the product from the display, you can just remove the Add To Basket button, maybe replacing it with a "Sorry, sold out" message.
        Kent Multer
        Magic Metal Productions
        http://TheMagicM.com
        * Web developer/designer
        * E-commerce and Miva
        * Author, The Official Miva Web Scripting Book -- available on-line:
        http://www.amazon.com/exec/obidos/IS...icmetalproducA

        Comment


          #5
          Re: Counting skipped products

          Thanks Kent, I'm going to advise the store owner to use the Inventory to continue displaying the products. On a side note, I wish the Availability / Price groups had the flexibility that the Inventory conditional does.
          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


            #6
            Re: Counting skipped products

            Okay, what the store owner wants and what I tried to do still isn't quite there. The store owner doesn't want the sold items to appear on the category pages, but still wants the product pages to be active. If I wrap the entire product thumbnail div with the inventory token it too can't count
            Code:
            <mvt:if expr="l.settings:product:inv_level NE 'out'">     <div class="product-item" style="width:33%">
              
            		<div class="padding">
            			<div class="product-details">
            				<div class="product-thumbnail">
            					<mvt:if expr="NOT ISNULL l.settings:product:thumbnail"><a href="&mvte:product:link;"><img src="&mvte:product:thumbnail;" alt="&mvte:product:name;" /></a><mvt:else><a class="thumbnail-not-available" href="&mvte:product:link;" title="&mvte:product:name;"></a></mvt:if>
            				</div>
            				<div class="product-name"><a href="&mvte:product:link;">&mvt:product:name;</a></div>
                           <mvt:if expr="l.settings:product:price NE '0.00'">
            				<div class="product-price">Price: <span class="bold">&mvt:product:formatted_price;</span></div>
                            </mvt:if>
            				<mvt:if expr="NOT ISNULL l.settings:product:customfield_values:customfields:Size">
            				<div class="custom-field" id="customfields-Size">&mvte:customfield_names:customfields:Size;: <span class="bold">&mvt:product:customfield_values:customfields:Size;</span></div>
            				</mvt:if>
                            <mvt:if expr="NOT ISNULL l.settings:product:customfield_values:customfields:sold">
            				<div class="custom-field" id="customfields-Size"><span class="bold" id="sold">&mvt:product:customfield_values:customfields:sold;</span></div>
            				</mvt:if>
            				<mvt:if expr="l.settings:product:inv_active">&mvt:product:inv_long;<br></mvt:if>
            			</div>
            			
            			<div class="purchase-buttons">
            				<form method="post" action="&mvte:global:sessionurl;Screen=BASK">
            				<input type="hidden" name="Old_Screen" value="&mvte:global:Screen;" />
            				<input type="hidden" name="Old_Search" value="&mvte:global:Search;" />
            				<input type="hidden" name="Action" value="ADPR" />
            				<input type="hidden" name="Quantity" value="1" />
            				<input type="hidden" name="Attributes" value="Yes" />
            				<input type="hidden" name="Store_Code" value="&mvte:store:code;" />
            				<input type="hidden" name="Product_Code" value="&mvte:product:code;" />
            				<input type="hidden" name="Current_Product_Code" value="&mvte:global:Product_Code;" />
            				<input type="hidden" name="Category_Code" value="&mvte:global:Category_Code;" />
            				<input type="hidden" name="Offset" value="&mvte:global:CatListingOffset;" />
            				<input type="hidden" name="AllOffset" value="&mvte:global:AllOffset;" />
            				<input type="hidden" name="CatListingOffset" value="&mvte:global:CatListingOffset;" />
            				<input type="hidden" name="RelatedOffset" value="&mvte:global:RelatedOffset;" />
            				<input type="hidden" name="SearchOffset" value="&mvte:global:SearchOffset;" />
            				<mvt:item name="buttons" param="AddToBasketE" />
            				</form>
            			</div>
            			
            		</div>
                    
            	</div>
            </mvt:if>
            Just hiding the buy buttons isn't what is needed. Using the Hide Out of Stock Products will defeat the ability to find the products. I'm thinking it might be best to just unassign the products from the categories. It's only a couple thousand. So can that be done via a flat file without wiping out all of data?

            Leslie
            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


              #7
              Re: Counting skipped products

              I think you can use the store's built-in product-import module to turn category assignments on and off. If not, drop me a line and I'll write you one that can :^) .
              Kent Multer
              Magic Metal Productions
              http://TheMagicM.com
              * Web developer/designer
              * E-commerce and Miva
              * Author, The Official Miva Web Scripting Book -- available on-line:
              http://www.amazon.com/exec/obidos/IS...icmetalproducA

              Comment


                #8
                Re: Counting skipped products

                Just off the top of my head, what about changing the value of the offset when the product is skipped. For example,

                <mvt:if expr="l.settings:product:price NE '0.00'">

                <mvt:else>
                <mvt:assign name="g.OffsetValue" value="g.OffsetValue - 1" />
                </mvt:if>

                However, I DO strongly suggest you get the client to start using the product (merchant) correctly.

                (Note, Offsetvalue is a place holder, I don't recall off hand what the actual value is and I believe there are three others that might require conditioning.)
                Last edited by Bruce - PhosphorMedia; 03-26-14, 08:07 AM.
                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


                  #9
                  Re: Counting skipped products

                  I don't think that you can fix this by fiddling with the offset. You'll still have pages with less than 36 products. The decision to display or skip a product occurs after each group of 36 is read from the DB.
                  Kent Multer
                  Magic Metal Productions
                  http://TheMagicM.com
                  * Web developer/designer
                  * E-commerce and Miva
                  * Author, The Official Miva Web Scripting Book -- available on-line:
                  http://www.amazon.com/exec/obidos/IS...icmetalproducA

                  Comment


                    #10
                    Re: Counting skipped products

                    Originally posted by Bruce - PhosphorMedia View Post
                    However, I DO strongly suggest you get the client to start using the product (merchant) correctly.
                    Agreed and I'm going to work on unassigning all of the "sold" products from all the categories other than the "sold" category - I just need to make sure I don't screw anything up trying to unassign them via a flat-file import.
                    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: Counting skipped products

                      yea, you are correct kent...so much for posting before coffee.

                      i fall back on my followup...get the client to use Merchant correctly.
                      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

                      Working...
                      X