Announcement

Collapse
No announcement yet.

ReadyTheme Item with variable

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

    ReadyTheme Item with variable

    Hi,

    I am trying to get this <mvt item> to work with a variable:

    <mvt:item name="readytheme" param="productlisting( 'js-carousel-1' )" />

    EXAMPLE:

    <mvt:item name="toolkit" param="random|nrandom|4" />
    <mvt:if expr="g.nrandom GT 0">
    <mvt:item name="readytheme" param="productlisting( 'js-carousel-&mvte:global:nrandom;' )" />
    <br>
    </mvt:if>

    However, no luck. It seems the &mvte:global:nrandom; part of the equation isn't being 'picked up" by Miva although there is a value for it and my script file is set to allow js-carousel-1 through 4.
    I also tried &mvta:global:nrandom; however, same result.

    Thanks



    #2
    Is Toolkit enabled on the page you're running this?
    Need to offer Shipping Insurance?
    Interactive Design Solutions https://www.myids.net
    MivaMerchant Business Partner | Certified MivaMerchant Web Developer
    Competitive Rates, Custom Modules and Integrations, Store Integration
    AutoBaskets|Advanced Waitlist Integration|Ask about Shipping Insurance Integration
    My T-shirt Collection is mostly MivaCon T-shirts!!

    Comment


      #3
      Yes.
      In fact, I have &mvte:global:nrandom; on the page to make sure a value is there & it is.

      Comment


        #4
        &mvte:global:nrandom;

        If nrandom is a number, you shouldn't need to encode it. Try this maybe?

        &mvt:global:nrandom;

        Scott
        Need to offer Shipping Insurance?
        Interactive Design Solutions https://www.myids.net
        MivaMerchant Business Partner | Certified MivaMerchant Web Developer
        Competitive Rates, Custom Modules and Integrations, Store Integration
        AutoBaskets|Advanced Waitlist Integration|Ask about Shipping Insurance Integration
        My T-shirt Collection is mostly MivaCon T-shirts!!

        Comment


          #5
          Thanks.
          Tried it as well as just g.nrandom, however, no go on all of them.

          Comment


            #6
            Strat1979 - To confirm, under ReadyTheme -> Product Listings, you have product listings with the codes of js-carousel-1, js-carousel-2, js-carousel-3, and js-carousel-4?
            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


              #7
              Yes. Everything is all set.
              Works when hard-coded but not when using a variable.

              Comment


                #8
                This is untested, by try this code:
                Code:
                <mvt:item name="toolkit" param="random|nrandom|4" />
                <mvt:if expr="g.nrandom GT 0">
                    <mvt:assign name="l.settings:random_list" value="'js-carousel-' $ g.nrandom" />
                    <mvt:item name="readytheme" param="productlisting(l.settings:random_list)" />
                    <br>
                </mvt:if>
                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


                  #9
                  Thanks for the input Matt. Most appreciated.
                  Couldn't get that code to work, however, it opened my eyes to get to this code which does work:

                  <mvt:item name="toolkit" param="random|nrandom|4" />
                  <mvt:if expr="g.nrandom GT 0">
                  <mvt:assign name="l.settings:random_list" value=" 'js-carousel-' " />
                  <mvt:assign name="l.settings:number" value="nrandom" />
                  <mvt:item name="toolkit" param="concat|newstring|l.all_settings:random_list |l.all_settings:number" />
                  <mvt:item name="readytheme" param="productlisting(newstring)" />
                  <br>
                  </mvt:if>

                  Comment


                    #10
                    FYI: Toolkit is not needed for any of this:

                    <mvt:assign name="g.someRandomNumber" value="random(4)"/>
                    <mvt:assign name="g.someCatentatedString" value="l.settings:some:variable$ 'Some Literial' $l.settings:anotherString"/>
                    Bruce Golub
                    Phosphor Media - "Your Success is our Business"

                    Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
                    phosphormedia.com

                    Comment


                      #11
                      Thanks Bruce. Works like a charm.

                      BTW I presume that mivascipt is more efficient than toolkit. Is that correct?

                      Comment


                        #12
                        Probably to some degree, but more important, that code will never have to change, and its cleaner and supported.
                        Bruce Golub
                        Phosphor Media - "Your Success is our Business"

                        Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
                        phosphormedia.com

                        Comment


                          #13
                          Originally posted by Strat1979 View Post
                          Thanks for the input Matt. Most appreciated.
                          Couldn't get that code to work, however, it opened my eyes to get to this code which does work:

                          <mvt:item name="toolkit" param="random|nrandom|4" />
                          <mvt:if expr="g.nrandom GT 0">
                          <mvt:assign name="l.settings:random_list" value=" 'js-carousel-' " />
                          <mvt:assign name="l.settings:number" value="nrandom" />
                          <mvt:item name="toolkit" param="concat|newstring|l.all_settings:random_list |l.all_settings:number" />
                          <mvt:item name="readytheme" param="productlisting(newstring)" />
                          <br>
                          </mvt:if>
                          Appears to me that the reason your varable "newstring" and Bruce's method worked while Matt's did not was because the variable used in place of a literal name needs to be a global variable.

                          Scott
                          Need to offer Shipping Insurance?
                          Interactive Design Solutions https://www.myids.net
                          MivaMerchant Business Partner | Certified MivaMerchant Web Developer
                          Competitive Rates, Custom Modules and Integrations, Store Integration
                          AutoBaskets|Advanced Waitlist Integration|Ask about Shipping Insurance Integration
                          My T-shirt Collection is mostly MivaCon T-shirts!!

                          Comment

                          Working...
                          X