Announcement

Collapse
No announcement yet.

ReadyTheme Item with variable

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

  • ids
    replied
    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

    Leave a comment:


  • Bruce - PhosphorMedia
    replied
    Probably to some degree, but more important, that code will never have to change, and its cleaner and supported.

    Leave a comment:


  • Strat1979
    replied
    Thanks Bruce. Works like a charm.

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

    Leave a comment:


  • Bruce - PhosphorMedia
    replied
    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"/>

    Leave a comment:


  • Strat1979
    replied
    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>

    Leave a comment:


  • Matt Zimmermann
    replied
    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>

    Leave a comment:


  • Strat1979
    replied
    Yes. Everything is all set.
    Works when hard-coded but not when using a variable.

    Leave a comment:


  • Matt Zimmermann
    replied
    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?

    Leave a comment:


  • Strat1979
    replied
    Thanks.
    Tried it as well as just g.nrandom, however, no go on all of them.

    Leave a comment:


  • ids
    replied
    &mvte:global:nrandom;

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

    &mvt:global:nrandom;

    Scott

    Leave a comment:


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

    Leave a comment:


  • ids
    replied
    Is Toolkit enabled on the page you're running this?

    Leave a comment:


  • Strat1979
    started a topic ReadyTheme Item with variable

    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


Working...
X