Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save steveosoule/a9cf2c3ced240a7c8043a50033eeed04 to your computer and use it in GitHub Desktop.

Select an option

Save steveosoule/a9cf2c3ced240a7c8043a50033eeed04 to your computer and use it in GitHub Desktop.
Miva - Load Variant Data From Order Items (with Extra Common Component Field)
<mvt:comment>
<!-- Determine Order To Load -->
</mvt:comment>
<mvt:if expr="g.order_id GT 0">
<mvt:assign name="l.order_id" value="int(trim(g.order_id))" />
<mvt:else>
<mvt:assign name="l.order_id" value="200000785" />
</mvt:if>
<mvt:comment>
<!-- Load Order, Order Items, and Order Item Variant Parts -->
</mvt:comment>
<mvt:do file="g.Module_Library_DB" name="l.success" value="Order_Load_ID( l.order_id, l.order )" />
<mvt:do file="g.Module_Library_DB" name="l.order:item_count" value="OrderItemList_Load_Order( l.order:id, l.order:items )" />
<mvt:do file="g.Module_Feature_TUI_UT" name="l.success" value="CommonComponentFields_Initialize_OrderItems_WithParts( l.order:items, l.order:item_count )" />
<mvt:comment>
<!-- Output Data to Page -->
</mvt:comment>
<mvt:assign name="l.result" value="miva_output_header( 'Content-Type', 'application/json' )" />
<mvt:do file="g.Module_JSON" name="l.success" value="JSON_Output( l.order )" />
{
"order": {
"batch_id": 0,
"bill_addr": "123 Event Lane",
"bill_addr1": "123 Event Lane",
"bill_addr2": "",
"bill_city": "San Diego",
"bill_cntry": "US",
"bill_comp": "Miva Merchant",
"bill_email": "[email protected]",
"bill_fax": "",
"bill_fname": "Test",
"bill_lname": "Order",
"bill_phone": "555-555-55555",
"bill_state": "CA",
"bill_zip": 92127,
"bord_count": 0,
"cust_id": 1,
"dt_instock": 0,
"id": 200000785,
"item_count": 1,
"items": [{
"base_price": 830,
"code": "30mm-camera-bundle",
"discount_count": 1,
"discounts": [{
"descrip": "10\u0025 Product Discount \u0028\u003C 9 qty.\u0029",
"discount": 83,
"display": 1,
"formatted_discount": "$83.00",
"line_id": 129776,
"order_id": 200000785,
"pgrp_id": 56,
"priority": 0
}],
"dt_instock": 0,
"formatted_base_price": "$830.00",
"formatted_dt_instock": "",
"formatted_price": "$747.00",
"formatted_retail": "$830.00",
"formatted_status": "Pending",
"formatted_subtotal": "$747.00",
"formatted_subtotal_base_price": "$830.00",
"formatted_subtotal_retail": "$830.00",
"group_id": 129776,
"line_id": 129776,
"name": "30mm Camera Bundle",
"option_count": 0,
"options": "",
"order_id": 200000785,
"part_count": 4,
"parts": [{
"active": 0,
"agrpcount": 0,
"cancat_id": 0,
"catcount": 4,
"code": "camera-lens-cap",
"cost": 1,
"descrip": "",
"disp_order": 158,
"dt_created": 1504800547,
"dt_updated": 1612975899,
"id": 27827,
"image": "",
"inv_active": 0,
"name": "Lens Cap",
"original_active": 0,
"page_id": 0,
"page_title": "",
"pgrpcount": 0,
"price": 5,
"quantity": 1,
"sku": "",
"taxable": 1,
"thumbnail": "graphics\/00000001\/lens-cap.jpg",
"total_quantity": 1,
"weight": "0.01"
}, {
"active": 1,
"agrpcount": 0,
"cancat_id": 7726,
"catcount": 5,
"code": "35mm-lens",
"cost": 150,
"descrip": "",
"disp_order": 27821,
"dt_created": 1504800547,
"dt_updated": 1537405744,
"id": 27820,
"image": "",
"inv_active": 0,
"name": "35mm Lens",
"original_active": 1,
"page_id": 0,
"page_title": "",
"pgrpcount": 0,
"price": 250,
"quantity": 1,
"sku": "",
"taxable": 1,
"thumbnail": "graphics\/00000001\/35mm-lens.jpg",
"total_quantity": 1,
"weight": 1
}, {
"active": 1,
"agrpcount": 0,
"cancat_id": 0,
"catcount": 3,
"code": "camera-bag",
"cost": 30,
"descrip": "",
"disp_order": 27827,
"dt_created": 1504800547,
"dt_updated": 1504896041,
"id": 27826,
"image": "",
"inv_active": 1,
"inv_available": 115,
"inv_instock": 120,
"inv_level": "in",
"inv_long": "Camera Bag is in-stock and available for immediate delivery",
"inv_low_level": 0,
"inv_low_track": 0,
"inv_out_level": 5,
"inv_out_track": 1,
"inv_short": "In Stock \u0028global\u0029",
"name": "Camera Bag",
"original_active": 1,
"page_id": 0,
"page_title": "",
"pgrpcount": 0,
"price": 75,
"quantity": 1,
"sku": "",
"taxable": 1,
"thumbnail": "",
"total_quantity": 1,
"weight": 2
}, {
"active": 1,
"agrpcount": 0,
"cancat_id": 0,
"catcount": 4,
"code": "camera-body",
"cost": 300,
"descrip": "",
"disp_order": 27837,
"dt_created": 1504800547,
"dt_updated": 1586210357,
"id": 27824,
"image": "",
"inv_active": 1,
"inv_available": 8,
"inv_instock": 8,
"inv_level": "in",
"inv_long": "Camera Body is in-stock and available for immediate delivery",
"inv_low_level": 0,
"inv_low_track": 0,
"inv_out_level": 0,
"inv_out_track": 1,
"inv_short": "In Stock \u0028global\u0029",
"name": "Camera Body",
"original_active": 1,
"page_id": 0,
"page_title": "",
"pgrpcount": 0,
"price": 500,
"quantity": 1,
"sku": "",
"taxable": 1,
"thumbnail": "graphics\/00000001\/nikon-d7200-body.jpg",
"total_quantity": 1,
"weight": 2
}],
"price": 747,
"product": {
"active": 1,
"agrpcount": 0,
"cancat_id": 0,
"catcount": 3,
"code": "30mm-camera-bundle",
"cost": "499.99",
"descrip": "",
"disp_order": 27832,
"dt_created": 1504800547,
"dt_updated": 1504894380,
"id": 27831,
"image": "",
"inv_active": 0,
"name": "30mm Camera Bundle",
"original_active": 1,
"page_id": 0,
"page_title": "",
"pgrpcount": 0,
"price": "999.99",
"sku": "",
"taxable": 1,
"thumbnail": "",
"weight": 10
},
"product_id": 27831,
"quantity": 1,
"retail": 830,
"rma_id": 0,
"shpmnt_id": 0,
"sku": "",
"status": 0,
"subscrp_id": 0,
"subterm_id": 0,
"subtotal": 747,
"subtotal_base_price": 830,
"subtotal_retail": 830,
"tax": 0,
"taxable": 1,
"upsold": 0,
"variant_id": 0,
"weight": "5.01"
}],
"net_capt": 0,
"note_count": 1,
"orderdate": 1649435511,
"orderpayment_id": 149,
"original_cust_id": 1,
"pay_data": ":check_number\u003D123456",
"pay_id": 100,
"pay_secdat": "",
"pay_secid": 0,
"pay_seckey": "",
"pay_status": 0,
"pend_count": 1,
"processed": 0,
"ship_addr": "123 Event Lane",
"ship_addr1": "123 Event Lane",
"ship_addr2": "",
"ship_city": "San Diego",
"ship_cntry": "US",
"ship_comp": "Miva Merchant",
"ship_data": "Another Free Shipping",
"ship_email": "[email protected]",
"ship_fax": "",
"ship_fname": "Test",
"ship_id": 117,
"ship_lname": "Order",
"ship_phone": "555-555-55555",
"ship_res": 0,
"ship_state": "CA",
"ship_zip": 92127,
"source": "shopper",
"source_id": 1,
"status": 0,
"stk_status": 0,
"total": 747,
"total_auth": 747,
"total_capt": 0,
"total_rfnd": 0,
"total_ship": 0,
"total_tax": 0
},
"order_id": 200000785
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment