Announcement

Collapse
No announcement yet.

Toolkit sproduct question - custom fields

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

    Toolkit sproduct question - custom fields

    Hi,

    Is it possible using the sproduct function to pull data from custom fields? I am using the code below on my FAQ screen and would like to also pull in some info from the custom fields of certain products to save myself from having to update information when we have changes.

    <mvt:item name="toolkit" param="sproduct_find|productfound|POSTAGESTD|" />
    &mvte:key_product:formatted_price;

    Trying to pull in from custom field "SizeQtyBlurb"

    Any help would be greatly appreciated!

    Mike

    #2
    Originally posted by mstella1 View Post
    Hi,

    Is it possible using the sproduct function to pull data from custom fields? I am using the code below on my FAQ screen and would like to also pull in some info from the custom fields of certain products to save myself from having to update information when we have changes.

    <mvt:item name="toolkit" param="sproduct_find|productfound|POSTAGESTD|" />
    &mvte:key_product:formatted_price;

    Trying to pull in from custom field "SizeQtyBlurb"

    Any help would be greatly appreciated!

    Mike
    Hey Mike, I moved away from the Toolkit functions kicking and screaming but I realized that it's way past it's EOL and is no longer supported. Could you try something like this?

    Code:
     <mvt:item name="customfields" param="Read_Product_ID(l.settings:product:id, 'notes', l.settings:product:notes)" />
    <mvt:if expr="NOT ISNULL l.settings:product:notes">
    
    &mvt:product:notes;
    I realize this snippet is "out of context" since it did reside inside of a product loop. Your question also might get better answers in the Store Morph forum (even if you stick with the Toolkit).
    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
      Thank you, I will repost there and I guess I should really start working on replacing toolkit code sooner rather than later.

      Comment


        #4
        Here are some code snippets for common toolkit functions that can be replaced by native template code:

        https://docs.miva.com/template-langu...ement-examples

        The sproduct_find just loads the core product data for a product. To also load the custom fields the function leslie posted is the correct one. You just need to pass in the correct product id/code:

        Here would be an example in your case:


        Code:
        <mvt:item name="customfields" param="Read_Product_Code('POSTAGESTD', 'SizeQtyBlurb', l.settings:product:SizeQtyBlurb)" />
        <mvt:if expr="NOT ISNULL l.settings:product:SizeQtyBlurb">
        &mvte:product:SizeQtyBlurb;
        </mvt:if>
        You also need to ensue the customfields item is assigned to use that function.
        Brennan Heyde
        VP Product
        Miva, Inc.
        [email protected]
        https://www.miva.com

        Comment


          #5
          That worked perfect thank you and the references are helpful.

          Sorry one last question in regards to that same product. I also need to display the formatted price and replace this toolkit code as well. I don't see the reference to sproduct in there.

          <mvt:item name="toolkit" param="sproduct_find|productfound|POSTAGESTD|" />
          &mvte:key_product:formatted_price;

          Comment


            #6
            Ok I got it to display the price and can just add the dollar sign at the beginning so this works - thanks again!

            <mvt:do name="l.return" file="g.Module_Library_DB" value="Product_Load_Code('POSTAGESTD', l.settings:product)" />
            &mvte:product:price;

            Comment


              #7
              I guess I do need to figure out how to format this in currency. The following drops the 0 if it is something like this $1.10 and displays as $1.1

              Any suggestions for the below code?

              <mvt:do name="l.return" file="g.Module_Library_DB" value="Product_Load_Code('POSTAGESTD', l.settings:product)" />
              &mvte:product:price;

              Thanks!

              Comment

              Working...
              X