Announcement

Collapse
No announcement yet.

OUSM: Upsell Multiple Items with Attributes

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

    OUSM: Upsell Multiple Items with Attributes

    Has anyone ever developed code to include attributes on the OUSM screen? By default if the products require attributes you have to go through the UATM screen to select them. I would like to include the product attributes on the OUSM screen by default and only have to use UATM as a fallback.

    I thought that the tool kit had the ability to generate the attribute array given a product id, but I must have been dreaming because I don't see it in the docs now.

    My theory is that if I can generate the same form elements that are on UATM, the engine will be none-the-wiser. Has anyone tried this before and want to save me a few hours of work?

    #2
    Re: OUSM: Upsell Multiple Items with Attributes

    I recently tried this with a gift wrap upsell and ran into some oddball issues that made me conclude it wasn't possible without some sort of custom mivascripting. Since all we were upselling in this case was two different gift wrap options (box or wrap in a couple of different colors), I wound up hardcoding the page.

    One thing I didn't try though -- what if you captured your product ids and then rendered an included page that pulled the attributes based on the id?

    Comment


      #3
      Re: OUSM: Upsell Multiple Items with Attributes

      What do you mean when you say that you hardcoded the page? I tried copying the HTML for the attributes found in the UATM page over to the OUSM page, but it seems be be ignored which has me confused. Both forms submit to the same screen (OSEL) with the same action (AUPM) -- why does it have to be a two step process?
      I'm going to keep working on it to see what I can figure out.

      Comment


        #4
        Re: OUSM: Upsell Multiple Items with Attributes

        Does anyone know how to edit the "upsell_attr_mult" item? I see the item in UATM, but there isn't a tab to edit it. PATR has a tab so I can make changes (Product Attribute Template tab). Is UATM hardcoded?

        Comment


          #5
          Re: OUSM: Upsell Multiple Items with Attributes

          Ignore me while I continue to respond to my own thread, but I figured out the issue!

          The upsell_attr_mult item is just a distraction. If you want to include the attributes on the same page, look at the product_attributes item instead. You can pass the product id as a param like so: <mvt:item name="product_attributes" param="upsold_product:id" /> and then you have complete control over the template. The only other thing to notice was that the format of the form element names are different than usual. For this upsell page you want them looking like:
          Product[&mvt:upsold_product:index;]:Attributes[&mvt:attribute:index;]:value

          Almost done, but I'm confident I can get it to work from here.

          Comment


            #6
            Re: OUSM: Upsell Multiple Items with Attributes

            That's brilliant, and way easier than what I did (I had to use the OUS1 page to get the hard coding to work). Thanks for sharing the solution.

            Comment


              #7
              Re: OUSM: Upsell Multiple Items with Attributes

              I'm trying to get Emporium Plus's module, and a Quantity Option, on the Upsale Page. I've tried adding this
              <mvt:item name="cim_vol" param="upsold_product:id" />
              but that is not the ticket to get the volume price table to display... copied the volume price table over from product page.
              Is there a way to get it to display on this page?

              The other problem I'm hitting with that is how to get a Quantity option on that page, since it defaults with "add to basket" but no quantity box. Any ideas?

              Comment


                #8
                Re: OUSM: Upsell Multiple Items with Attributes

                Brandon, how exactly does the form code need to look to get this to work correctly. Thanks in advance.

                Originally posted by Brandon MUS View Post
                The only other thing to notice was that the format of the form element names are different than usual. For this upsell page you want them looking like:
                Product[&mvt:upsold_product:index;]:Attributes[&mvt:attribute:index;]:value
                Jamin Jones, CEO
                the Appalachian Offroad Motorcycle Company

                Comment


                  #9
                  Re: OUSM: Upsell Multiple Items with Attributes

                  This is the code I used in our product attribute template. Not guaranteed it works in all cases -- we typically only have 1 attribute format for all of our products:

                  Code:
                  <input type="hidden" name="Product[&mvt:upsold_product:index;]:Attribute_Count" value="&mvte:global:Product_Attribute_Count;" />
                  
                  <table cellspacing="0" class="product-attributes">
                  <mvt:foreach iterator="attribute" array="attributes">
                    <tr>
                  	<td class="attr_label">
                  		<input type="hidden" name="Product[&mvt:upsold_product:index;]:Attributes[&mvt:attribute:index;]:code" value="&mvt:attribute:code;" />
                  	<mvt:if expr="l.settings:attribute:required">
                  		<label for="Product_&mvt:upsold_product:index;_Attributes_&mvt:attribute:index;_value" class="required">&mvt:attribute:prompt;</label>
                  	<mvt:else>
                  		<label for="Product_&mvt:upsold_product:index;_Attributes_&mvt:attribute:index;_value">&mvt:attribute:prompt;</label>
                  	</mvt:if>
                  	</td>
                  	<td>
                  
                  <mvt:if expr="l.settings:attribute:type EQ 'text'">
                  	<input type="text" name="Product[&mvt:upsold_product:index;]:Attributes[&mvt:attribute:index;]:value" value="" />
                  <mvt:elseif expr="l.settings:attribute:type EQ 'memo'">
                  	<textarea name="Product[&mvt:upsold_product:index;]:Attributes[&mvt:attribute:index;]:value"></textarea>
                  <mvt:elseif expr="l.settings:attribute:type EQ 'checkbox'">
                  	<mvt:foreach iterator="option" array="attribute:options">
                  		<div class="checkbox-option">
                  			<input type="checkbox" name="Product[&mvt:upsold_product:index;]:Attributes[&mvt:attribute:index;]:value" id="Product[&mvt:upsold_product:index;]:Attributes[&mvt:attribute:index;]:value_Yes" class="inputCheckbox" value="Yes" />
                  			<label for="Product[&mvt:upsold_product:index;]:Attributes[&mvt:attribute:index;]:value_Yes">&mvte:option:prompt;</label>
                  		</div>
                  	</mvt:foreach>
                  <mvt:elseif expr="l.settings:attribute:type EQ 'radio'">
                  	<mvt:foreach iterator="option" array="attribute:options">
                  		<div class="radio-option">
                  		<mvt:if expr="l.settings:option:id EQ l.settings:attribute:default_id">
                  			<input type="radio" name="Product[&mvt:upsold_product:index;]:Attributes[&mvt:attribute:index;]:value" id="Product[&mvt:upsold_product:index;]:Attributes[&mvt:attribute:index;]:value_&mvte:option:code;" class="inputRadio" value="&mvte:option:code;" checked="checked" />
                  		<mvt:else>
                  			<input type="radio" name="Product[&mvt:upsold_product:index;]:Attributes[&mvt:attribute:index;]:value" id="Product[&mvt:upsold_product:index;]:Attributes[&mvt:attribute:index;]:value_&mvte:option:code;" class="inputRadio" value="&mvte:option:code;" />
                  		</mvt:if>
                  			<label for="Product[&mvt:upsold_product:index;]:Attributes[&mvt:attribute:index;]:value_&mvte:option:code;">&mvte:option:prompt;</label>
                  		</div>
                  	</mvt:foreach>
                  <mvt:elseif expr="l.settings:attribute:type EQ 'select'">
                  		<select name="Product[&mvt:upsold_product:index;]:Attributes[&mvt:attribute:index;]:value" id="Product_&mvt:upsold_product:index;_Attributes_&mvt:attribute:index;_value">
                  			<option value="">&lt; Select One &gt;</option>
                  	<mvt:foreach iterator="option" array="attribute:options">
                  		<mvt:if expr="l.settings:option:id EQ l.settings:attribute:default_id">
                  			<option value="&mvte:option:code;" selected="selected">&mvte:option:prompt;</option>
                  		<mvt:else>
                  			<option value="&mvte:option:code;">&mvte:option:prompt;</option>
                  		</mvt:if>
                  	</mvt:foreach>
                  		</select>
                  </mvt:if>
                  
                  	</td>
                    </tr>
                  </mvt:foreach>
                  </table>

                  Comment


                    #10
                    Re: OUSM: Upsell Multiple Items with Attributes

                    Using Brandon's extremely helpful information in this thread, I've managed to get the attribute options to display how I want on my OUSM page. Unfortunately, after selecting attribute options and clicking 'continue', the customer sees the UATM page and is prompted to enter them again.

                    I am using his code above, modified slightly for layout, and I am using <mvt:item name="product_attributes" param="upsold_product:id" /> to call the attribute options.

                    I do have the product_attributes item assigned to the page.

                    I can't figure out why the options entered on the OUSM page are ignored. Is there an issue with the opening form action or hidden inputs?

                    Code:
                            <form method="post" action="&mvt:global:secure_sessionurl;">
                            <input type="hidden" name="Action" value="AUPM">
                            <input type="hidden" name="Screen" value="OSEL">
                            <input type="hidden" name="Attributes" value="Yes">
                            <input type="hidden" name="Store_Code" value="&mvte:global:Store_Code;">
                            <input type="hidden" name="Upsell_Product_Count" value="&mvte:global:Upsold_Product_Count;">

                    Comment


                      #11
                      Re: OUSM: Upsell Multiple Items with Attributes

                      I had to re-read this thread because I couldn't remember ever doing this....

                      Are you passing the Product_Code in your form? I don't see it in the code you posted. I often find the best way to troubleshoot these types of problems is by looking at the HTML that is created and not the SMT templates. This helps me catch any typos or issues with conditional statements.

                      Comment


                        #12
                        Re: OUSM: Upsell Multiple Items with Attributes

                        It looks like the product code is being passed with a hidden input just after the checkbox input:

                        The template code is:
                        <input type="hidden" name="Product[&mvt:upsold_product:index;]:code" value="&mvte:upsold_product:code;">
                        Which shows up as this when I check the HTML
                        <input type="hidden" name="Product[1]:code" value="X-05">

                        It seems like the product is being sent through, because on the UATM page, it only displays the products that were selected on the OUSM page (as it should if the attribute options were not selected.). Its just that the attribute options are not recognized.

                        Comment


                          #13
                          Re: OUSM: Upsell Multiple Items with Attributes

                          K, how do the attribute fields look in the form? Do they have the same index Product[1]:Attributes[1]:code ? Code and Value are both there?

                          Comment


                            #14
                            Re: OUSM: Upsell Multiple Items with Attributes

                            Here's what I'm seeing in the HTML for a radio button attribute. Product[1] and Attributes[2] are correct. Should it say 'code' instead of 'value'?
                            Code:
                            <input type="radio" value="max" class="inputRadio" id="Product[1]:Attributes[2]:value_max" name="Product[1]:Attributes[2]:value">
                            This is the template code for the unchecked (non-default) radio button, which is taken from the Product Attribute Template you posted a while back.
                            Code:
                            <input type="radio" name="Product[&mvt:upsold_product:index;]:Attributes[&mvt:attribute:index;]:value" id="Product[&mvt:upsold_product:index;]:Attributes[&mvt:attribute:index;]:value_&mvte:option:code;" class="inputRadio" value="&mvte:option:code;" />
                            Last edited by emdub; 06-11-13, 03:07 PM.

                            Comment


                              #15
                              Re: OUSM: Upsell Multiple Items with Attributes

                              It looks good to me. I don't see anything obviously wrong. Perhaps you could talk Miva Merchant support in to checking it out for you? Hard to troubleshoot with chunks of code.

                              Comment

                              Working...
                              X