Announcement

Collapse
No announcement yet.

Response of ProductVariantList_Load_Product (mvt version) lacks dimensions object

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

    Response of ProductVariantList_Load_Product (mvt version) lacks dimensions object

    In the Miva json api there is this function ProductVariantList_Load_Product (https://docs.miva.com/json-api/funct...t_load_product)

    which returns all the variants of a product including the combinations of attributes each variant is associated with (dimensions object)

    https://prnt.sc/w9mo2a

    I’m trying to use this function inside Miva templates but seems like the mvt version of the same function (https://docs.miva.com/code-samples/l...-for-a-product) doesn’t include the combinations of attributes.

    Because of that I have to loop then through all the variants and pull the attributes by separate calls.
    Code:
    <mvt:do file="g.Module_Library_DB" name="l.success" value="ProductVariantList_Load_Product( l.settings:product:id, l.settings:variants )" />
    <mvt:foreach iterator="variant" array="variants">
    <mvt:do file="g.Module_Library_DB" name="l.success" value="ProductVariantList_Load_Variant( l.settings:product:id, l.settings:variant:variant_id, l.settings:variant:attributes )" />
    </mvt:foreach>
    Now this is causing troubles as we have products with hundreds of variants and the server response time (TTFB) for those is up to 40 seconds.

    I figured out that it is caused exactly by multiple calls of ProductVariantList_Load_Variant inside the foreach loop.

    So the question is how I do pull all variants of a product including the combinations of attributes each variant is associated with by a single function call from inside a Miva template?
Working...
X