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>

    #2
    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

    Miva Web Developer
    Alchemy Web Development
    https://www.alchemywebdev.com
    Site Development - Maintenance - Consultation

    Miva Certified Developer
    Miva Professional Developer

    https://www.dev4web.net | Twitter

    Comment


      #3
      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


        #4
        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 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


          #5
          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