Announcement

Collapse
No announcement yet.

OUSM: Upsell Multiple Items with Attributes

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

    #16
    Re: OUSM: Upsell Multiple Items with Attributes

    I just looked into this in a support ticket, and I wanted to offer up the solution in case current or future merchants run into the same challenge.

    Here are the steps necessary to allow the customer to select attributes on the multiple upsale page and thus skipping the UATM screen.

    1) On the OUSM page template, open the Product Attribute Template element.

    2) Verify that the code for attribute templates is near the top of the foreach loop (might not be there by default in older stores). If it isn't there, you'll need to add it. It will look like this by default:

    Code:
    <mvt:if expr="l.settings:attribute:template_code NE 0">
      <input type="hidden" name="Product_Attributes[&mvt:attribute:index;]:template_code" value="&mvte:attribute:template_code;" />
    </mvt:if>
    3) You now need to replace every instance of this string:
    Code:
    name="Product_Attributes[&mvt:attribute:index;]:

    And make them instead look like this:
    Code:
    name="Product[&mvt:upsold_product:index;]:Attributes[&mvt:attribute:index;]:
    You can use a code/text editor with find/replace capability to speed this step up, but be careful if you use MS Word as it adds slanted quote characters which will break the page instead of the HTML-friendly quote characters. Some of the lines will have spaces in them as well so proofread the code afterward to make sure the find/replace didn't miss anything. ~8-12 lines should be updated in total.

    4) Double check that all of the prompts, labels and inputs have had the code updated as outlined in steps 2 & 3 and then click Update

    5) Go back to the Page tab, find and delete this line:
    Code:
    <input type="hidden" name="Attributes" value="Yes" />

    6) Make sure this line is in the foreach loop for the products (This will render the attributes themselves, so place it where you can make it look pretty):
    Code:
    <mvt:item name="product_attributes" param="upsold_product:id" />
    That should do it. Give it a checkout test afterward to verify. Good luck and feel free to post or email questions if you have any.
    Last edited by KNewbrough; 06-13-13, 10:03 AM.
    Kyle Newbrough
    Technical Support / Web Developer
    Miva Merchant

    Comment


      #17
      Re: OUSM: Upsell Multiple Items with Attributes

      Thanks figuring this out, Kyle!

      For me, it was #2 that was the key to getting things running. This was missing from my Product Attribute Template on the OUSM page:
      Code:
      <mvt:if expr="l.settings:attribute:template_code NE 0"> 
      <input type="hidden" name="Product_Attributes[&mvt:attribute:index;]:template_code" value="&mvte:attribute:template_code;" /> 
      </mvt:if>

      Comment


        #18
        Re: OUSM: Upsell Multiple Items with Attributes

        Good post Kyle. We only use a single format for our attributes, so I don't often code for all of the feature won't ever use.

        Comment


          #19
          Hello all

          i am struggling with getting attributes to work on the OUSM page.
          They show up just perfect
          But when I select anything it still puts up the Missing Required Attributes page

          There must be something I am missing. If someone could help like Kyle or Brandon - it would be fantastic.
          Thanks very much
          Sam

          My code below

          <input type="hidden" name="Product[&mvt:upsold_product:index;]:Attribute_Count" value="&mvte:global:Product_Attribute_Count;" />
          <mvt:foreach iterator="attribute" array="attributes">
          <table cellpadding="0" cellspacing="0" border="0">
          <mvt:if expr="l.settings:attribute:template_code NE 0">
          <input type="hidden" name="Product_Attributes[&mvt:attribute:index;]:template_code" value="&mvte:attribute:template_code;" />
          </mvt:if>

          <input type="hidden" name="Product[&mvt:upsold_product:index;]:Attributes[&mvt:attribute:index;]:code" value="&mvte:attribute:code;">


          <mvt:if expr = "l.settings:attribute:type EQ 'checkbox'">
          <tr>
          <td align="left" valign="top"><mvt:if expr = "g.Product_Attributes[l.settings:attribute:index]:value">
          <input type="checkbox" name="Product[&mvt:upsold_product:index;]:Attributes[&mvt:attribute:index;]:value" value="Yes" checked>
          <mvt:else>
          <input type="checkbox" name="Product[&mvt:upsold_product:index;]:Attributes[&mvt:attribute:index;]:value" value="Yes">
          </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"> <b>&mvt:attribute:prompt;</b>
          <mvt:else>
          <b>&mvt:attribute:prompt;</b> </mvt:if>
          </mvt:if>
          </td>
          </tr>
          <mvt:else>
          <tr>
          <td align="left" valign="top">
          <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"> <b>&mvt:attribute:prompt;</b>
          <mvt:else>
          <b>&mvt:attribute:prompt;</b> </mvt:if>
          </mvt:if></td>
          </tr>
          <tr>
          <mvt:if expr="l.settings:attribute:type EQ 'text'">
          <td align="left" valign="top">
          <input type="text" name="Product[&mvt:upsold_product:index;]:Attributes[&mvt:attribute:index;]:value" value="&mvte:attribute:value;" size=40></td>
          <mvt:elseif expr="l.settings:attribute:type EQ 'memo'">
          <td align="left" valign="top">
          <textarea name="Product[&mvt:upsold_product:index;]:Attributes[&mvt:attribute:index;]:value" rows=10 cols=58 wrap="on">&mvte:attribute:value;</textarea>
          </td>
          <mvt:elseif expr="l.settings:attribute:type EQ 'radio'">
          <td align="left" valign="top"><table border=0>
          <tr>
          <mvt:foreach iterator="option" array="attribute:options">
          <td valign="top" align="center" width="60">
          <mvt:if expr="( ( g.Product_Attributes[l.settings:attribute:index]:value EQ 0 ) AND ( l.settings:option:id EQ l.settings:attribute:default_id ) ) OR
          ( g.Product_Attributes[l.settings:attribute:index]:value EQ l.settings:option:code )">
          <input type="radio" name="Product[&mvt:upsold_product:index;]:Attributes[&mvt:attribute:index;]:value" value="&mvte:option:code;" checked="checked">
          <br clear="all">
          <mvt:else>
          <input type="radio" name="Product[&mvt:upsold_product:index;]:Attributes[&mvt:attribute:index;]:value" value="&mvte:option:code;">

          <br clear="all">
          </mvt:if>
          <mvt:if expr="l.settings:option:image"> <img style="height:40px;" src="&mvte:option:image;" alt="&mvte:option:prompt;" title="&mvte:option:prompt;"> <br clear="all">
          <mvt:comment> ADDING CAPTION TO COLORS </mvt:comment>
          <div style="font-size:11px;">&mvte:option:prompt; </div>
          <mvt:else>
          <div style="font-size:11px;">&mvte:option:prompt;</div>
          </mvt:if>
          </td>
          <mvt:if expr="(pos2 MOD 6) EQ 0">
          </tr>
          <tr>
          </mvt:if>
          </mvt:foreach>
          </tr>
          </table></td>
          <mvt:elseif expr="( l.settings:attribute:type EQ 'select' ) OR ( l.settings:attribute:type EQ 'swatch-select' )">
          <td align="left" valign="top"><select name="Product[&mvt:upsold_product:index;]:Attributes[&mvt:attribute:index;]:value">

          <mvt:foreach iterator="option" array="attribute:options"> <img src="&mvte:option:image;" alt="&mvte:option:prompt;" title="&mvte:option:prompt;" class="swatches" /> </mvt:foreach>

          <!-- trying to separate dropdown -->
          <br>



          <mvt:foreach iterator="option" array="attribute:options">
          <mvt:if expr="( ( g.Product_Attributes[l.settings:attribute:index]:value EQ 0 ) AND ( l.settings:option:id EQ l.settings:attribute:default_id ) ) OR ( g.Product_Attributes[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; Add &mvte:option:price;</option>
          </mvt:if>
          </mvt:foreach>
          </select></td>
          </mvt:if>
          </tr>
          </mvt:if>
          </table>
          </mvt:foreach>

          Comment


            #20
            Forgive me, but I need to ask, you seem to be "struggling: with coding for MM5.5. Is there something specific to MM5.5 that you need and that's why you are not attempting this with MM9?
            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


              #21
              Sorry - I was just following this thread - it is in MM9. Shoudl I repost it there?
              Sam

              Comment


                #22
                Originally posted by samgold View Post
                Sorry - I was just following this thread - it is in MM9. Shoudl I repost it there?
                Sam
                Yes please
                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