Shop/Methods

Shop/Methods

Methods

(static) shop/changeLayout(shopId, newLayout) → {Number}

Change the layout for all workflows so you can use a custom one

Source:
Parameters:
Name Type Description
shopId String

the shop's ID

newLayout String

new layout to use

Returns:

mongo update result

Type
Number

(static) shop/createShop(shopAdminUserId, partialShopData) → {String}

Source:
Parameters:
Name Type Description
shopAdminUserId String

optionally create shop for provided userId

partialShopData Object

optionally provide a subset of shop data which will be merged with properties from the primary shop in order to create a document which meets the Shops schema requirements.

Returns:

return shopId

Type
String

(static) shop/createTag(tagName, isTopLevel) → {String}

creates new tag

Source:
Since:
  • 0.14.0
Parameters:
Name Type Description
tagName String

new tag name

isTopLevel Boolean

if true -- new tag will be created on top of tags tree

Returns:

with created tag _id

Type
String

(static) shop/fetchCurrencyRate() → {undefined}

fetch the latest currency rates from https://openexchangerates.org usage: Meteor.call("shop/fetchCurrencyRate")

Source:
Fires:
  • Collections.Shops#event:update
Returns:
Type
undefined

(static) shop/flushCurrencyRate() → {undefined}

It removes exchange rates that are too old usage: Meteor.call("shop/flushCurrencyRate")

Source:

Method calls by cron job

Fires:
  • Collections.Shops#event:update
Returns:
Type
undefined

(static) shop/getBaseLanguage() → {String}

Return the shop's base language ISO code

Source:
Returns:

ISO lang code

Type
String

(static) shop/getCurrencyRates(currency) → {Number|Object}

It returns the current exchange rate against the shop currency usage: Meteor.call("shop/getCurrencyRates","USD")

Source:
Parameters:
Name Type Description
currency String

code

Returns:

currency conversion rate

Type
Number | Object

(static) shop/getLocale() → {Object}

determine user's countryCode and return locale object determine local currency and conversion rate from shop currency

Source:
Returns:

returns user location and locale

Type
Object

(static) shop/getWorkflow(name) → {Array}

gets the current shop workflows

Source:
Parameters:
Name Type Description
name String

workflow name

Returns:

returns workflow array

Type
Array

(static) shop/hideHeaderTag(tagId) → {String}

Source:
Parameters:
Name Type Description
tagId String

method to remove tag navigation tags

Returns:

returns remove result

Type
String

(static) shop/locateAddress(latitude, longitude) → {Object}

determine user's full location for autopopulating addresses

Source:
Parameters:
Name Type Description
latitude Number

latitude

longitude Number

longitude

Returns:

returns address

Type
Object

(static) shop/removeHeaderTag(tagId, currentTagId) → {String}

Source:
Parameters:
Name Type Description
tagId String

method to remove tag navigation tags

currentTagId String

currentTagId

Returns:

returns remove result

Type
String

(static) shop/resetShopId() → {undefined}

a way for the client to notifiy the server that the shop has changed. We could has provided #setShopId, however, the server has all the information it needs to determine this on its own, and allowing the client to set shopId could be a security risk

Source:
Returns:
Type
undefined

(static) shop/togglePackage(packageId, enabled) → {Number}

enable/disable Reaction package

Source:
Parameters:
Name Type Description
packageId String

package _id

enabled Boolean

current package enabled state

Returns:

mongo update result

Type
Number

(static) shop/updateBrandAssets(asset) → {Int}

Source:
Parameters:
Name Type Description
asset Object

brand asset {mediaId: "", type, ""}

Returns:

returns update result

Type
Int

(static) shop/updateCurrencyConfiguration(currency, enabled) → {Number}

enable / disable a currency

Source:
Parameters:
Name Type Description
currency String

currency name | "all" to bulk enable / disable

enabled Boolean

true / false

Returns:

returns mongo update result

Type
Number

(static) shop/updateHeaderTags(tagName, tagId, currentTagId) → {Boolean}

method to insert or update tag with hierarchy

Source:
Parameters:
Name Type Description
tagName String

will insert, tagName + tagId will update existing

tagId String

tagId to update

currentTagId String

currentTagId will update related/hierarchy

Returns:

return true/false after insert

Type
Boolean

(static) shop/updateLanguageConfiguration(language, enabled) → {Array}

enable / disable a language

Source:
Parameters:
Name Type Description
language String

language name | "all" to bulk enable / disable

enabled Boolean

true / false

Returns:

returns workflow array

Type
Array

(static) shop/updateShopExternalServices(details) → {undefined}

we need to rerun fetch exchange rates job on every form submit, that's why we update autoform type to "method-update"

Source:
To Do:
  • This method fires Packages collection, so maybe someday it could be moved to another file

On submit OpenExchangeRatesForm handler

Parameters:
Name Type Description
details Object

An object with _id and modifier props

Fires:
  • Collections.Packages#event:update
Returns:
Type
undefined