Announcement

Collapse
No announcement yet.

product uri link from product code in an array

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

  • product uri link from product code in an array

    I am using this array:
    <mvt:foreach iterator="product" array="sub_products">
    Each product code is obtained via: &mvt:product:code;

    My code to obtain each uri product link is below, however, no luck getting the product uri link. Any suggestions?

    <mvt:foreach iterator="product" array="sub_products">
    <mvt:assign name="l.uri:product_id" value="l.settings:product:code" />
    <mvt:do file="g.Module_Feature_URI_DB" name="l.have_uri" value="URI_Load_Item_Canonical( l.uri, l.settings:canonical_uri )" />
    <mvt:if expr="l.have_uri">

    &mvt:canonical_uri:uri; //comment even &mvt:product:link; is a no go

    </mvt:if>

  • That function requires the product ID which is different from the product code. If it is available in the array you are using, you would want to pass it as <mvt:assign name="l.uri:product_id" value="l.settings:product:id" />. If it is not available, you will have to perform a product load and pull the ID.

    https://docs.miva.com/code-samples/load-canonical-uri
    Matt Zimmermann
    Director of UI/UX Standards and Theme Development
    / Miva, Inc.

    Comment


    • Thanks Matt! That did the trick.

      BTW My goal was to, using the readytheme carousel, pull random products (which is what that array is for) from a readytheme category and get the proper uri product links. Success!

      Comment


      • Originally posted by Strat1979 View Post
        Thanks Matt! That did the trick.

        BTW My goal was to, using the readytheme carousel, pull random products (which is what that array is for) from a readytheme category and get the proper uri product links. Success!
        Wait! What? You have been able to randomize a carousel? Ohhhh how I have begged for that. I'd be able to replace one more Toolkit function
        Leslie Kirk
        Miva Merchant 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


        • Sorry, but it is using the toolkit function ( like you, I know of no other way of doing it) but I think I have optimized the way of doing it in combination with miva script

          Comment

          Working...
          X

          This website uses cookies to identify visitors, track visitors to our website, store login session information and to remember your user preferences. By continuing to use this site you agree to our use of cookies. Learn More.

          This website uses cookies. By continuing to use this site you agree to our use of cookies. Learn More.

          Accept