Announcement

Collapse
No announcement yet.

Box of donuts (attribute quantities)

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

    Box of donuts (attribute quantities)

    I've got yet another store that needs the ability to have attribute quantities on the PROD page. The store does food delivery and needs to be able to allow customers to select the donuts they want in either a half dozen in a box or a dozen in a box. First issues is being able to offer the quantity box for each type of donut. Then next issue is assuring that either total of 6 or 12 have been selected.

    The store is using the Base ReadyTheme.

    FWIW - I could do this with the Sebenza Product Template Manager.
    Last edited by lesliekirk; 12-02-19, 09:29 AM. Reason: typo
    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
    https://docs.miva.com/template-langu...-documentation

    Would have given you more...but i came for donuts and got none ;)
    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


      #3
      Originally posted by Bruce - PhosphorMedia View Post
      https://docs.miva.com/template-langu...-documentation

      Would have given you more...but i came for donuts and got none ;)
      Well I can't share any donuts yet because I can't fill the box. The link you sent is for the CTGY page. I want to do this on the PROD page just like I've done in the past using the Sebenza Product Page Manager....
      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
        Not much of a difference other than that you think of this as an "array of one"

        Code:
        <form method="post" action="&mvte:global:sessionurl;Screen=BASK">
        <input type="hidden" name="Action" value="ADPM">
        <input type="hidden" name="Attributes" value="Yes">
        <input type="hidden" name="Store_Code" value="&mvte:store:code;">
        <input type="hidden" name="Products[ &mvt:product:id; ]:code" value="&mvte:product:code;">
        <input type="hidden" name="Products[ &mvt:product:id; ]:quantity" value="1">
        
        <mvt:item name="product_attributes" param="product:id" />
        
        </mvt:foreach>
        
        <input type="submit" value="Add to Basket">
        </form>
        then change the attribute template as noted....


        but wait...are you sure you could do that with Template Manager...cause I don't know how you could have a product X, with 2 option "glazed" and 4 option "sprinkles"

        You have to have

        Product Glazed = 2
        Product Sprinkles = 4

        So an easier method would be to have a Pseudo Product page (which is actually a Category Page) that runs through products.

        Alternately you can convert them into variants, but make the variants "active" and use the ADPM method
        Last edited by Bruce - PhosphorMedia; 10-01-17, 01:27 PM.
        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


          #5
          Which product attribute would be used for the quantity field? With the Sebenza template, it used the radio button so when the radio button attribute is used an that template was assigned it would display a quantity field instead of the radio button.
          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
            The question is (since i never really used the Template manager) how did the "product" appear in the basket. Like I said (in an update to the original post) the Product carries the quantity. Unless it broke down the attribute/option into mulitple products so you'd have

            Product Box of Donuts 2
            Option: glazed

            Product Box of Donuts 4
            Option: sprinkles


            Which, IMO is pretty ugly... I'd go the pseudo prod page route. It would also be easier to control the total quantity since you can use js/jquery to add up the product totals.
            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


              #7
              If you'd like to see an example of how the Sebenza template displays on the product page go here. Yes, the product does display as you've mentioned in the basket, but it works for the store.

              Using the product with attributes solves a lot of other problems that Miva has, including clearly identifying what the base product is and being able to assign a special shipping method for just the one product. But that's the other site I'm trying to get this to work for (build-a-basket)
              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


                #8
                Well I don't think you can use the ADPM function then. You'd need to look at maybe toolkit/toolbelt for a solution that basically "loops" and ADPR for every Prod/Attr combo. (At least that's what we used to do using a custom module. I could probably dig that up for you if you don't find another solution...the down side is we'd probably have to 'fix' some settings like what prod/attr combo it works on etc.

                It might also be possible to mash this into SMT Code.

                Create a form post WITHOUT the action=ADPR that goes to another template (using ajax), in that template, break down the prod/attribute pairs, and do another ajax ADPR for each one...

                But that's bit more time than i have...even for donuts :)
                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
                  Originally posted by Bruce - PhosphorMedia View Post

                  But that's bit more time than i have...even for donuts :)
                  Yup, that's why the Sebenza template was genius for this. But I need to dig through my emails. I swore Brennan gave me something to try, but I could never get it to work. I figured it was just me doing something wrong. Let me see if I have that snippet somewhere.



                  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


                    #10
                    So my donuts have gone stale so I went and got a new box. I found the full snippet that Bill created to do what I need to do http://www.emporiumplus.com/v5/tk_prod_quan.txt. But I need some help understand some of the sassign he has used and how they might impact the mvt:else. Here is the code for the Product Attribute Template:
                    Code:
                     
                     <mvt:item name="toolkit" param="variantarray|vcount|g.product_code" /> <mvt:if expr="g.vcount GT 0"> <mvt:item name="toolkit" param="sassign|lowest_attr|9999" /> <mvt:item name="toolkit" param="sassign|attrcode|#" /> <mvt:item name="toolkit" param="sassign|attrndx|#" /> <mvt:item name="toolkit" param="sassign|space| " /> <mvt:foreach iterator="variant" array="variants"> <mvt:foreach iterator="option" array="variant:variant_options"> <mvt:foreach iterator="attribute" array="attributes"> <mvt:if expr="(l.settings:attribute:code EQ l.settings:option:attr_code) OR (l.settings:attribute:template_code EQ l.settings:option:attr_code)"> 	<mvt:item name="toolkit" param="vassign|vindex|l.all_settings:attribute:index" /> 	<mvt:if expr="g.vindex LT g.lowest_attr"> 		<mvt:item name="toolkit" param="vassign|lowest_attr|g.vindex" /> 	</mvt:if> </mvt:if> </mvt:foreach> <mvt:if expr="('#'$l.settings:option:attr_code$'#' IN  g.attrcode) EQ 0"> <mvt:if expr="l.settings:option:template"> 	<input type="hidden" name="Multi_Product_Attributes[&mvte:global:current_nbr;][ &mvt:global:vindex; ]:code" value="&mvte:option:template;" /> 	<input type="hidden" name="Multi_Product_Attributes[&mvte:global:current_nbr;][ &mvt:global:vindex; ]:template_code" value="&mvte:option:attr_code;" /> <mvt:else> 	<input type="hidden" name="Multi_Product_Attributes[&mvte:global:current_nbr;][ &mvt:global:vindex; ]:code" value="&mvte:option:attr_code;" /> </mvt:if> <mvt:item name="toolkit" param="concat|attrcode|g.attrcode|l.all_settings:option:attr_code|'#'" />  <mvt:item name="toolkit" param="concat|attrndx|g.attrndx|g.vindex|'#'" />  </mvt:if> <mvt:if expr="g.vindex EQ g.lowest_attr"> <br /><br /><input type="text" name="Multi_Product_Attributes[&mvte:global:current_nbr;][&mvt:global:vindex;]:quantity" value="0" style="width: 20px;" /> &nbsp;  <mvt:item name="toolkit" param="sassign|option_prompt|" /> <mvt:else> <input type="hidden" name="Multi_Product_Attributes[&mvte:global:current_nbr;][&mvt:global:vindex;]:quantity" value="0" /> &nbsp;  </mvt:if> <input type="hidden" name="Multi_Product_Attributes[&mvte:global:current_nbr;][&mvt:global:vindex;]:value" value="&mvte:option:opt_code;" />  <mvt:item name="toolkit" param="concat|option_prompt|option_prompt|l.all_settings:option:opt_prompt" /> <mvt:item name="toolkit" param="concat|option_prompt|option_prompt|g.space" /> </mvt:foreach> &mvte:global:option_prompt; &nbsp; <mvt:if expr="l.settings:variant:count_onhand GT 0">  &mvte:variant:count_onhand; in stock <mvt:else> <span style="color : #ff0000;">  Sold out </span> </mvt:if> </mvt:foreach> <mvt:if expr="g.attrcode NE '#'"> <input type="hidden" name="VariantAttr" value="&mvte:global:attrcode;"> </mvt:if> </mvt:if>  <table> <mvt:foreach iterator="attribute" array="attributes"> <mvt:if expr="('#'$l.settings:attribute:index$'#' IN g.attrndx) EQ 0"> 	<tr> 		<td class="prompt"> 			<input type="hidden" name="Multi_Product_Attributes[&mvte:global:current_nbr;][ &mvt:attribute:index; ]:code" value="&mvte:attribute:code;" /> 			<mvt:if expr="l.settings:attribute:template_code NE 0"> 				<input type="hidden" name="Multi_Product_Attributes[&mvte:global:current_nbr;][ &mvt:attribute:index; ]:template_code" value="&mvte:attribute:template_code;" /> 			</mvt:if> 			<mvt:if expr="l.settings:attribute:type NE 'checkbox'"> 				<mvt:if expr="l.settings:attribute:image"> 					<img src="&mvte:attribute:image;" alt="&mvte:attribute:raw_prompt;" /> 				<mvt:else> 					<mvt:if expr="l.settings:attribute:required"> 						<span class="required"> 					<mvt:else> 						<span> 					</mvt:if> 							&mvt:attribute:prompt; 						</span> 				</mvt:if> 			<mvt:else> 				&nbsp; 			</mvt:if> 		</td> 		<td class="field"> 			<mvt:if expr="l.settings:attribute:type EQ 'text'"> 				<input type="text" name="Multi_Product_Attributes[&mvte:global:current_nbr;][&mvt:attribute:index;]:value" value="&mvte:attribute:value;" class="textfield" /> 			<mvt:elseif expr="l.settings:attribute:type EQ 'memo'"> 				<textarea name="Multi_Product_Attributes[&mvte:global:current_nbr;][&mvt:attribute:index;]:value">&mvte:attribute:value;</textarea> 			<mvt:elseif expr="l.settings:attribute:type EQ 'radio'"> 				<mvt:foreach iterator="option" array="attribute:options">	 					<div> 					<mvt:if expr="g.optionquantities"> 						<input type="text" name="Multi_Product_Attributes[&mvte:global:current_nbr;][&mvt:attribute:index;]:quantity" value="0" style="width: 20px;" /> &nbsp;    						<input type="hidden" name="Multi_Product_Attributes[&mvte:global:current_nbr;][&mvt:attribute:index;]:value" value="&mvte:option:code;" /> 					<mvt:else> 						<mvt:if expr="( ( g.Multi_Product_Attributes[g.current_nbr][l.settings:attribute:index]:value EQ 0 ) AND 									( l.settings:option:id EQ l.settings:attribute:default_id ) )   OR 									( g.Multi_Product_Attributes[g.current_nbr][l.settings:attribute:index]:value EQ l.settings:option:code )"> 							<input type="radio" name="Multi_Product_Attributes[&mvte:global:current_nbr;][&mvt:attribute:index;]:value" value="&mvte:option:code;" checked /> 						<mvt:else> 							<input type="radio" name="Multi_Product_Attributes[&mvte:global:current_nbr;][&mvt:attribute:index;]:value" value="&mvte:option:code;" /> 						</mvt:if> 					</mvt:if> 					<mvt:if expr="l.settings:option:image"> 						<img src="&mvte:option:image;" alt="&mvte:option:prompt;" /> 					<mvt:else> 						&mvte:option:prompt; 					</mvt:if> 					</div> 				</mvt:foreach> 			<mvt:elseif expr="( l.settings:attribute:type EQ 'select' ) OR ( l.settings:attribute:type EQ 'swatch-select' )"> 				<select name="Multi_Product_Attributes[&mvte:global:current_nbr;][&mvt:attribute:index;]:value"> 					<mvt:foreach iterator="option" array="attribute:options"> 						<mvt:if expr="( ( g.Multi_Product_Attributes[g.current_nbr][l.settings:attribute:index]:value EQ 0 ) AND ( l.settings:option:id EQ l.settings:attribute:default_id ) ) OR 										( g.Multi_Product_Attributes[g.current_nbr][l.settings:attribute:index]:value EQ l.settings:option:code )"> 							<option value="&mvte:option:code;" selected>&mvte:option:prompt;</option> 						<mvt:else> 							<option value="&mvte:option:code;">&mvte:option:prompt;</option> 						</mvt:if> 					</mvt:foreach> 				</select> 			<mvt:elseif expr="l.settings:attribute:type EQ 'checkbox'"> 				<mvt:if expr="g.Multi_Product_Attributes[g.current_nbr][l.settings:attribute:index]:value"> 					<input type="checkbox" name="Multi_Product_Attributes[&mvte:global:current_nbr;][&mvt:attribute:index;]:value" value="Yes" checked /> 				<mvt:else> 					<input type="checkbox" name="Multi_Product_Attributes[&mvte:global:current_nbr;][&mvt:attribute:index;]:value" /> 				</mvt:if> 				<mvt:if expr="l.settings:attribute:image"> 					<img src="&mvte:attribute:image;" alt="&mvte:attribute:raw_prompt;" /> 				<mvt:else> 					<mvt:if expr="l.settings:attribute:required"> 						<span class="required"> 					<mvt:else> 						<span> 					</mvt:if> 							&mvt:attribute:prompt; 						</span> 				</mvt:if>				 			</mvt:if> 		</td> 	</tr> </mvt:if> </mvt:foreach> </table> <div class="clear"></div>

                    The use of the pound sign (hashtag) has me confused because I thought it was one of the characters that could not be used? Bill's instructions say "This item is only to be used on pages where you have included the multiple quantities by option feature." I'm trying to figure out if he meant that only the one set of attributes are to be used when using this template?

                    I ask these questions because I have 2 text fields that need to be included with this product. It's not a big deal that they are included with every attribute added to the BASK. This configuration treats each radio button attribute as a separate product when listing in the BASK screen. It becomes a problem when I want to add another attribute to the product, it gets included with each of these radio button attributes - which means if there are for example 5 different radio button attributes added to the cart, the other attribute will be added (and charged) 5 times.

                    http://www.dutchbaskets.com/product/custom-basket.html

                    I removed the drop down select that was causing the price to be charged with each of the radio button (quantity) attributes. I can add it back if someone would like to see how it behaves.

                    But back to my first question - what is the # being used for in this?

                    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
                      I knew I had posted this somewhere but couldn't find it. I'm really trying to understand what Bill was doing when using the pound sign # (hash tag). Now when I look at this post I can see why it might have been hard to see what I was asking about. the code is all on one line So I am going to try again and insert returns between the lines:

                      Code:
                      <mvt:item name="toolkit" param="variantarray|vcount|g.product_code" />
                      
                      <mvt:if expr="g.vcount GT 0">
                      
                      <mvt:item name="toolkit" param="sassign|lowest_attr|9999" />
                      
                      <mvt:item name="toolkit" param="sassign|attrcode|#" />
                      
                      <mvt:item name="toolkit" param="sassign|attrndx|#" />
                      
                      <mvt:item name="toolkit" param="sassign|space| " />
                      Is Bill using # as part of an attribute code? That sort of throws things out the window if the symbol can't be used do to settings in the store - Use Strict Validation for Codes

                      But back to the code, can someone tell me what this line is trying to do?

                      Code:
                      <mvt:if expr="('#'$l.settings:option:attr_code$'#' IN  g.attrcode) EQ 0">
                      Is it looking for a # in the attribute code? Again, how would this even be able to work IF it is?

                      and again, Bill uses the #

                      Code:
                      <mvt:if expr="g.attrcode NE '#'">
                      I'd really love to have a better understanding what Bill is trying to do here, as it looks to be the answer to what I've trying to do.

                      http://www.emporiumplus.com/v5/tk_prod_quan.txt.



                      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