Announcement

Collapse
No announcement yet.

new custom fields

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

    new custom fields

    Ok so I sadly haven't truly played with the new way to do cutom fields but I find the documentation lacking.

    I have created a new custom field with a checkbox. How the heck do I get it to show on the product page if checked?

    Docs say something about if you are still in whirligig mode the checkbox displays... well I'm not so now what?
    Mark Hood
    Vermont Gear

    #2
    Re: new custom fields

    Two things need to be done. You will need to add the conditional for the new custom field into your Product Display Layout. It will be something similar to this:

    Code:
    <mvt:if expr="NOT ISNULL l.settings:product:customfield_values:customfields:smtitle">
    &mvt:customfield_names:customfields:smtitle;:
    <b>&mvt:product:customfield_values:customfields:smtitle;</b><br>
    </mvt:if>
    Then you need to assign it to the page in the Custom Fields box just below the Product Display Layout field. In theory after these two steps it should display after you populate the custom product field for the product.
    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


      #3
      Re: new custom fields

      A good trick when you're not sure about the custom field code, is temporarily revert your product display template back to the original version, hit recall, then assign said custom field to the page and hit update, then go back to viewing the advanced mode for the template, and locate the new code that was inserted for you. Of course if you don't have a dev site, you could create a dummy product template with the pages area and use that for things like this.

      Hope that makes sense.
      Ted Hust
      AarcMediaGroup.com

      Celebrating 13 Years of Outstanding Service & Support
      Miva Merchant Design

      Comment


        #4
        Re: new custom fields

        The method above works, however that still uses the "legacy" custom field template code. This was one of the problems we wanted to solve with the old custom fields. Because the syntax is so long, we end up doing exactly as above. Reverting the product page template back to default, have Miva generate the code for us and use it in our original template. While this works, it can be frustrating to keeping doing this. It is also worth noting that this way of accessing custom fields only prints the custom field name and value. It does not create the UI elements to accept input for that custom field.


        The new custom fields takes a little different approach. We introduced 16 functions that follow a similar structure so they are easier to remember. They allow you to read and write custom field values (and names too) from any page.


        All the UI elements are left of to the developer to create manually, which has always been the case with custom fields. (although I can see a use case where we provide item tags which print the UI elements as well. I would be interested to see if this would be useful to people)


        Here is the code to read in a custom product field and display the correct UI on the product page:


        Code:
        <mvt:item name="customfields" param="Read_Product_Code(l.settings:product:code,'mycheckbox', g.mycheckbox)" />
        
        
        Checkbox Value: &mvt:global:mycheckbox;
        <br><br>
        
        
        <mvt:if expr="NOT ISNULL g.mycheckbox">
        	<input type="checkbox" name="vehicle" value="Yes" checked>Yes
        <mvt:else>
        	<input type="checkbox" name="vehicle" value="Yes">Yes
        </mvt:if>

        For a checkbox, if it is not checked it will have a value of NULL. If it is checked, it will have whatever value given to the checkbox input.


        The code above only reads in the value and displays the correct UI. If you then want to accept the customers input for that field and save it back into the custom field, you also need to write the value on the immediate page this form gets submitted to. Say for example this code was in the add to cart form and that form took the customer to the basket page you would add this code to BASK:


        Code:
        <mvt:item name="customfields" param="Write_Product_Code(g.Product_Code,'mycheckbox', g.vehicle)" />

        Here is a list of all the functions:
        http://www.mivamerchant.com/videos/a...-documentation


        We have 8 new videos coming out in the next couple months on how to work with the new custom fields along with code samples and examples which should help.
        Brennan Heyde
        VP Product
        Miva, Inc.
        [email protected]
        https://www.miva.com

        Comment


          #5
          Re: new custom fields

          Will this also work to display Custom Customer Fields? Or are those still an admin only display?

          I'd like to include them in a Customer Created email.
          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: new custom fields

            All the custom fields (category, customer, product, basket - custom order fields work anywhere you have access to an order number) can be read or written on any page in Miva including emails, and batch reports using these functions:

            http://www.mivamerchant.com/videos/a...-documentation

            You should not need to assign the custom field item because the module automatically registers itself as an extension of the store item and the shipment item which collectively cover all admin pages. If you create a new page then you either need the store item above assigned or can just assign the custom fields item. Both will work.
            Brennan Heyde
            VP Product
            Miva, Inc.
            [email protected]
            https://www.miva.com

            Comment


              #7
              Re: new custom fields

              That's an awful lot of steps just to display a custom field.
              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