We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • I am trying to use MIDX for an ecommerce site, to add a selection list of sizes/prices (e.g. small - €10, medium - €15, large - €20)

    I created 2 template variables : "product-sizelist-size" and "product-sizelist-price". Both without template access.

    I created another tv "product-sizelist" with template access to my product template and migx input type, using the following code:

    Form Tabs:

    [
    {"caption":"Sizes", "fields": [
        {"field":"size","caption":"Size","inputTV":"product-sizelist-size"},
        {"field":"price","caption":"Price","inputTV":"product-sizelist-price"}
    ]}
    ]


    Grid Columns:
    [
    {"header": "Size", "width": "50", "sortable": "true", "dataIndex": "size"},
    {"header": "Price", "width": "50", "sortable": "false", "dataIndex": "price"}
    ]
    


    In the product template, the call is inserted via a template variable (as a product may or may not have a multi-size price list - some products have a single price, so the tv "product-price-type" selects a chunk of code - either a single price line or the MIGX call).

    The MIGX call is in this part of the form:

    <label class="label_left">select product size</label>
    <select name="size">
        [[!getImageList? 
          &tvname=`product-sizelist`
          &tpl=`@CODE:<option value="[[+product-sizelist-size]]{p:[[+product-sizelist-price]]}">[[+product-sizelist-size]]</option></li>`
        ]]
    </select>




    Please note that I am using FoxyCart (in case you're wondering about the option value code). Everything is working fine except that the prices and sizes don't display. The code generates the correct number of option lines (ie. I entered 3 lines of size/price info in my test product and it outputs 3 blank lines in the drop-down list in the front-end), just does not pull in the size and price.

    Any help appreciated.


    [ed. note: intandem last edited this post 11 years, 6 months ago.]
    • Ah, just figured it out myself. I need to use the field names in the MIGX call, not the tv names:

      <label class="label_left">select product size</label>
      <select name="size">
          [[!getImageList? 
            &tvname=`product-sizelist`
            &tpl=`@CODE:<option value="[[+size]]{p:[[+price]]}">[[+size]]</option></li>`
          ]]
      </select>