Description
google-shopping adds Google Shopping for Content API support, primarily for updating the Product API in batch mode. It provides support for ECA-based product updates as well as full reindexing which can be scheduled on regular basis. ECA support attempts to minimize the number of HTTP requests to Google with a global queue and buffering. Store-specific configuration is supported as only products associated to valid stores can be indexed. For performance, the system works closely with the existing Solr indexing now retooled as entity indexing. Access keys for configured merchant accounts are automatically fetched and re-cached as they expire while the client provides error-handling retries for robustness and problematic connections.
For further information visit https://developers.google.com/shopping-content/guides/quickstart.
Setup
This addon is included in our Enterprise Edition. Follow this instructions in order to download and install it into your existing ScipioERP instance. Ultimately run this command:
./git-addons pull google-shopping
Configuration
Accounts, performance and other settings can be configured in googleshopping.properties (config), which may be defined in any component, although overriding definitions require the correct component load order to work (hot-deploy is best). Further performance and client code may be configured in entityindexing.properties in any component for general entity indexing setters such as buffer sizes and HTTP connections.
A Google merchant account is required and must be configured in googleshopping.properties. A common merchantId for all stores can be set as google.shopping.default.merchantId, with store-specific definitions overriding any fields defined in the default profile.
The following properties must be configured in either the default or store profiles:
- *.merchantId
- *.content.service.account
- *.content.key.location
Key location may be set to the .json file provided by Google (unencrypted, content-api-key.json, containing a “private_key” json entry) or in encrypted pkcs12 if security practices require. It can be converted using a Linux Bash prompt as follows:
sed -rn 's/^."private_key"\s:\s"(.)".*$/\1/p' content-api-key.json | sed -r 's/\n/\n/g' > jsonkey.key openssl rsa -in jsonkey.key | openssl pkcs12 -password pass:notasecret -export -nocerts -name privatekey -out p12key.p12
These settings allow GoogleShoppingClient to request an access key from google, which is automatically done internally and cached, just before any indexing request, with a certain number of retries on failure (connect.maxRetries). Its local expiry time may be configured as *.content.accessToken.expireTime.
Localization is supported by defining the locales (language+country) to update remotely in googleshopping.properties. These must be specified explicitly – it is not currently possible for the system to determine these automatically primarily for performance reasons.
Full reindexing can be called manually by running the googleshoppingIndexAllProducts service under the /admin application or scheduling a job. Job data templates can be found in data/GoogleShoppingScheduledServiceData.xml.
Customization
Clients may extend java classes GoogleShoppingDocBuilder, GoogleShoppingFeedBuilder and override the population methods to generate their own document fields and feed entries. This is done by first overriding GoogleShoppingFactory which must be set as the *.factoryClass property in googleshopping.properties, with store-specific support.
If a product belongs to 2 stores, 2 different documents (expanded to more per locale) will be produced, one for each store. Note, however, that multi-store support is limited in other parts of the system and for simplicity this may not
be desired.
More information can be found in properties and Java class comments.