Announcement

Collapse
No announcement yet.

Right tool for the job? MVT or MivaScript

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

    Right tool for the job? MVT or MivaScript

    I'm trying to take a category, and get all of it's assigned products. Then use that list of products as a key to trigger the display of a banner on the product page.

    Is this beyond the scope of MVT and I should be looking at MivaScript?

    #2
    It should be pretty straight forward using mvt. What is the banner based on? Is it based on the product being displayed or is there something in the list of products that you will be basing it on?
    M.A.D.* since 1997

    http://www.scotsscripts.com

    *miva application developers

    Comment


      #3
      You can do this within Miva Template code (MVT). Take a look at the docs.miva.com and in the developer's section run through the API. Just like in mivascript/module, you'd need to load the specific category info, then make a call to load the assigned products to that CTGY. Your trigger will likely be miva_max_array GT 0. Then you could start to load each of those product's data.

      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


        #4
        Originally posted by Scot - ScotsScripts.com View Post
        What is the banner based on? Is it based on the product being displayed or is there something in the list of products that you will be basing it on?
        The banner is to highlight a manufacturer discount, so there are specific codes for specific lines (categories) and the products there in. Thus my test is the existence of the product within the category.

        Comment


          #5
          Originally posted by ids View Post
          You can do this within Miva Template code (MVT). Take a look at the docs.miva.com and in the developer's section run through the API. Just like in mivascript/module, you'd need to load the specific category info, then make a call to load the assigned products to that CTGY. Your trigger will likely be miva_max_array GT 0. Then you could start to load each of those product's data.

          Scott
          I'll dig in a bit more there! Thanks for pointing me in the right direction!

          Comment


            #6
            Yea, you'll want to use:


            <mvt:do name="l.result" file="g.Module_Library_DB" value="Category_Load_Code( 'category_code', l.settings:current_category )" />
            <mvt:do name="l.result" file="g.Module_Library_DB" value="Runtime_ProductList_Load_Offset_Category( l.settings:current_category:id, g.Offset, 100, g.NextOffset, l.settings:products )" />

            <mvt:foreach iterator="product" array="products">
            &mvt:product:code;<br>
            </mvt:foreach>

            and do your tests in the foreach loop
            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


              #7
              Originally posted by Bruce - PhosphorMedia View Post
              Yea, you'll want to use:

              <mvt:do name="l.result" file="g.Module_Library_DB" value="Category_Load_Code( 'category_code', l.settings:current_category )" /> ...
              OK. So if I understand this correctly. I instance mvt:do - and then reference the desired MivaScript function (see https://docs.miva.com/mivascript)?
              Then take the l.var_name_to_be_chosen and perform actions against the named variable?

              Comment


                #8
                Yes, but in this case, the variable is an array FYI. Easiest way to process it is with a foreach though there are other array functions available.
                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


                  #9
                  Thank you all for your help! I'm wrapping up a different project and will edit this post when I have some results. ;)

                  Comment

                  Working...
                  X