- Knowledge Base
- Modules & Features
- Scripting Documentation
-
Getting Started
- Setting Up Your Test Site
- Step 1: Warehouse Configuration
- Step 2: Hardware Configuration
- Step 3: Setting Up Shopping Carts, Integrations, and EDI
- Step 4: Dashboard and Navigation
- Step 5: Item Configuration
- Step 6: Smart Filters & User Reports
- Step 7: Mobile Floor Apps
- Step 8: How To Receive and Put Away
- Step 9: Inventory Management
- Step 10: Warehouse Documents and Printing
- Step 11: Navigating Orders
- Step 12: Order Fulfillment / Picking
- Step 13: Packing and Shipping
-
Tutorials
-
Troubleshooting
-
Use Cases
-
Videos
-
Modules & Features
-
Glossary
-
Connect to Support
-
Infoplus Community Forum
Rate Shopping Fastest and Cheapest Example Script
This is an example of a script you can use in Infoplus to ask Rate Shopping to search for the fastest and/or cheapest shipping options.
Navigate to the script table in Infoplus to add a new script that will automate your rate shopping to always search for the fastest or cheapest option for shipping.
This script can be used to rate shop a variety of days by changing this parameter:
if (days <= "3")
Make this change underneath the Start Parameter Check portion of the script code. Each day parameter will be its own script. For example, the 3-Day script will be a different script than 1-Day and each script will have its own Rate Shop Carrier like the examples below.
There are a variety of Data Points that can be used within the Rate Shop call:
- deliveryDays - delivery days returned by the service
- deliveryDate - date for delivery returned by the service
- deliveryDateGuaranteed - indicates if delivery window is guaranteed (true) or not (false)
- chargedRate - how much the package was/would-be actually charged at
Example Script:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// To customize Infoplus Rate Shopping you can define the following functions for customizing different pieces of the integration: | |
// customizePreRateShopCall - Customize the Parcel Accounts and Carriers that will be used during rate shop. | |
// customizePostRateShopCall - Customize the rate that will be selected from the rate shop. | |
// | |
// In the customizePostRateShopCall function, the following variables will be available: | |
// | |
// manifestRateList - The available rates returned from Rate Shop that can be used for the Order. | |
// selectedRate - The selected rate that will be returned from Rate Shop and used for the Order. | |
// | |
// In each of the functions, the following global variables will be available: | |
// | |
// orderNo - The Order No of Order we are making the manifest call for it can be used to get the Infoplus API Order model if needed. | |
// lobId - The Line of Business Id of Order we are making the manifest call for. | |
// | |
// utils - object with the following methods: | |
// .getOriginalParcelAccountList - returns the original Parcel Account list being passed into Rate Shop. | |
// .getOriginalCarrierList - returns the original Carrier list being passed into Rate Shop. | |
// .getOutputParcelAccountList - sets the Parcel Account list that will be used to Rate Shop. | |
// .getOutputCarrierList - sets the Carrier list that will be used to Rate Shop. | |
// .abort(reason) - stop the import or export process, for the specified reason. | |
// | |
// infoplusApi - object which provides access to the Infoplus API, specifically, with the following methods: | |
// .search(type, filter, pageNo, limit, orderBy) - run a search query in the Infoplus API. | |
// .getById(type, id) - get the record of the specified type identified by the id. | |
// .getTags(type, id) - get the tags from Infoplus for the specified record. | |
// .constructModel(type) - used to construct an API model object of the given type. | |
// - See the https://developer.infopluscommerce.com/ for more details. | |
// | |
// Example: | |
//////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
// customizePreRateShopCall | |
// | |
// this script will: | |
// add an additional Parcel Account to be consider for Rate Shopping | |
// | |
//////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
function customizePreRateShopCall() | |
{ | |
utils.log("Starting customizePreRateShopCall for Order: " + orderNo); | |
////////////////////////////////////////////////////////// | |
// Use the Infoplus API to look up a new Parcel Account // | |
// that we want to use for this order and then add it // | |
////////////////////////////////////////////////////////// | |
var outputParcelAccountList = utils.originalParcelAccountList; | |
utils.setOutputParcelAccountList(outputParcelAccountList); | |
var outputCarrierList = utils.originalCarrierList; | |
utils.setOutputCarrierList(outputCarrierList); | |
} | |
//////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
// customizePostRateShopCall | |
// | |
// this script will: | |
// This script first checks for the day parameter and then cycles through the cheapest within that day parameter. It is designed to choose the fastest + cheapest rate. | |
// | |
// | |
//////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
function customizePostRateShopCall() | |
{ | |
utils.log("Starting customizePostRateShopCall for Order: " + orderNo); | |
utils.log("Currently selected rate: " + selectedRate.service); | |
var cheapestCost = null; | |
for(i = 0; i < manifestRateList.size(); i++) | |
{ | |
var carrier = manifestRateList.get(i).service; | |
var days = manifestRateList.get(i).deliveryDays; | |
utils.log("Service: " + carrier + " | Days: " + days + " | Cost: " + manifestRateList.get(i).chargedRate); | |
// Start day parameter check | |
if (days <= "3") | |
{ | |
if (cheapestCost == null) | |
{ | |
cheapestCost = manifestRateList.get(i); | |
} | |
else if(cheapestCost > manifestRateList.get(i).selectedRate) | |
{ | |
cheapestCost = manifestRateList.get(i); | |
} | |
} | |
} | |
selectedRate = cheapestCost; | |
utils.log("Rate selected: " + cheapestCost.service); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// To customize Infoplus Rate Shopping you can define the following functions for customizing different pieces of the integration: | |
// customizePreRateShopCall - Customize the Parcel Accounts and Carriers that will be used during rate shop. | |
// customizePostRateShopCall - Customize the rate that will be selected from the rate shop. | |
// | |
// In the customizePostRateShopCall function, the following variables will be available: | |
// | |
// manifestRateList - The available rates returned from Rate Shop that can be used for the Order. | |
// selectedRate - The selected rate that will be returned from Rate Shop and used for the Order. | |
// | |
// In each of the functions, the following global variables will be available: | |
// | |
// orderNo - The Order No of Order we are making the manifest call for it can be used to get the Infoplus API Order model if needed. | |
// lobId - The Line of Business Id of Order we are making the manifest call for. | |
// | |
// utils - object with the following methods: | |
// .getOriginalParcelAccountList - returns the original Parcel Account list being passed into Rate Shop. | |
// .getOriginalCarrierList - returns the original Carrier list being passed into Rate Shop. | |
// .getOutputParcelAccountList - sets the Parcel Account list that will be used to Rate Shop. | |
// .getOutputCarrierList - sets the Carrier list that will be used to Rate Shop. | |
// .abort(reason) - stop the import or export process, for the specified reason. | |
// | |
// infoplusApi - object which provides access to the Infoplus API, specifically, with the following methods: | |
// .search(type, filter, pageNo, limit, orderBy) - run a search query in the Infoplus API. | |
// .getById(type, id) - get the record of the specified type identified by the id. | |
// .getTags(type, id) - get the tags from Infoplus for the specified record. | |
// .constructModel(type) - used to construct an API model object of the given type. | |
// - See the https://developer.infopluscommerce.com/ for more details. | |
// | |
// Example: | |
//////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
// customizePreRateShopCall | |
// | |
// this script will: | |
// add an additional Parcel Account to be consider for Rate Shopping | |
// | |
//////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
function customizePreRateShopCall() | |
{ | |
utils.log("Starting customizePreRateShopCall for Order: " + orderNo); | |
////////////////////////////////////////////////////////// | |
// Use the Infoplus API to look up a new Parcel Account // | |
// that we want to use for this order and then add it // | |
////////////////////////////////////////////////////////// | |
var outputParcelAccountList = utils.originalParcelAccountList; | |
utils.setOutputParcelAccountList(outputParcelAccountList); | |
var outputCarrierList = utils.originalCarrierList; | |
utils.setOutputCarrierList(outputCarrierList); | |
} | |
//////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
// customizePostRateShopCall | |
// | |
// this script will: | |
// This script first checks for the day parameter and then cycles through the cheapest within that day parameter. It is designed to choose the fastest + cheapest rate. | |
// | |
// | |
//////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
function customizePostRateShopCall() | |
{ | |
utils.log("Starting customizePostRateShopCall for Order: " + orderNo); | |
utils.log("Currently selected rate: " + selectedRate.service); | |
var cheapestCost = null; | |
for(i = 0; i < manifestRateList.size(); i++) | |
{ | |
var carrier = manifestRateList.get(i).service; | |
var days = manifestRateList.get(i).deliveryDays; | |
utils.log("Service: " + carrier + " | Days: " + days + " | Cost: " + manifestRateList.get(i).chargedRate); | |
// Start day parameter check | |
if (days <= "3") | |
{ | |
if (cheapestCost == null) | |
{ | |
cheapestCost = manifestRateList.get(i); | |
} | |
else if(cheapestCost > manifestRateList.get(i).selectedRate) | |
{ | |
cheapestCost = manifestRateList.get(i); | |
} | |
} | |
} | |
selectedRate = cheapestCost; | |
utils.log("Rate selected: " + cheapestCost.service); | |
} |