Shopizer核心代码

Save and retrieve configurations

It is possible to save and retrieve configurations using the code described below:

The code is saved in MerchantConfiguration entity which can be retrieved using the configuration key for retrieving a single row or using a module name if the configuration consist in a module. That second method can fetch multiple rows pertaining to a given module.

		
MerchantService mservice = (MerchantService)ServiceFactory.getService(ServiceFactory.MerchantService);
ConfigurationRequest configReq = new ConfigurationRequest(1,ConfigurationConstants.YOUR_KEY);
ConfigurationResponse configResp = mservice.getConfiguration(configReq);
		
MerchantConfiguration conf = configResp.getMerchantConfiguration(ConfigurationConstants.YOUR_KEY);
String value = conf.getConfigurationValue();
String value1 = conf.getConfigurationValue1();
String value2 = conf.getConfigurationValue2();

Here are the possible constructors for ConfigurationRequest

public ConfigurationRequest(int merchantid);//all configurations for a given merchantId
public ConfigurationRequest(int merchantid, String configurationkey);//a line of configuration for a 
given merchantid and configuration key
public ConfigurationRequest(int merchantid, boolean like, String configurationkey); will do a 'like' query to retrieve many 
rows.Like needs to be ste to true.

Adding a new currency

Shopizer is configured to support one currency per merchant. Supported currencies are displayed in a drop down list from sm-central merchant eition page. All currencies are supported but the sofwtare is currently defined with only a few currencies. It is quite simple to define a new currency.

In order to add a new currency, you will need to have those information

- Currency unicode (search for your currency unicode symbol on the web) - Currency value conversion with US $

Example for creating a new currency

INSERT INTO CURRENCIES VALUES(6, 'Yen', 'JPY', '\u00A5', '', '.', ',', '2', 85.345, '2010-01-01 00:00:00', 1);
 
 fields are
 - next currency id (look at current value in the database and increment to next value)
 - Currency name
 - Currency ISO code
 - Currency unicode
 - Currency display suffix
 - Decimal separator
 - Thousand separator
 - Number of digits after decimal
 - Value based on US currency
 - Date of creation
 - enabled | disables (1|0)

2) Custom currency module when requiring custom logic [SHOULD NOT BE USED]

in certain cases there are particularities associated with a currency requiring additional logic when displaying or calculating using the currency. If the currency requires additional logig then it is required to create a new java class that will reside in sm-core com.salesmanager.core.module.impl.application That class will implement com.salesmanager.core.module.model.CurrencyModule

interface CurrencyModule {
 
 public String getMeasure(BigDecimal measure, String currencycode) throws Exception;
 public BigDecimal getAmount(String amount) throws Exception; 
 public String getFormatedAmount(BigDecimal amount) throws Exception;
 public String getFormatedAmountWithCurrency(BigDecimal amount)throwsException;
 public String getCurrencySymbol();
 
}

Adding a new Language

This section describes the steps required to add a new language to the system. The new language will be available for the shopping web application and for the administration panel (central).

Textual information is available in the database with what regards to product and order management. A set of sql file contain the information that has to be inserted in the database before using the system. Other label and static information are defined in resource bundle files. Thos files need to be packaged and deployed with the application.

Let's take French for example ( the identifier for this language will be 2 ). In order to avoid language id duplication, send an eail to support@shopizer.com to have a new language id assigned.

1) Add a new language in LANGUAGES table

INSERT INTO LANGUAGES VALUES(2, 'French', 'fr', 'icon2.gif', 'french', 2);

The values are

TABLE LANGUAGES NEXT ID (identifier for french language)
Name of the language
Language ISO code name
icon for the language if avalable
Directory name for images
Sort order

This step will make the language available in the administration store edition page. If the merchant decides to support that language, then all data need to be available in the database to support that language

2) Add database language support

New lines have to be created in the database to support product, order, countries and province reference tables.

- Add a new Root category

INSERT INTO CATEGORIES_DESCRIPTION (CATEGORIES_ID, LANGUAGE_ID, CATEGORIES_NAME, CATEGORIES_DESCRIPTION) VALUES
(0, 2, 'Racine', 'Root category');

CATEGORIES_ID will always equal 0, the only new fields will be the LANGUAGE_ID (2 in this case) and the CATEGORIES_NAME

- Add ORDERS_STATUS

INSERT INTO ORDERS_STATUS VALUES(1, 2, 'En attente');
INSERT INTO ORDERS_STATUS VALUES(2, 2, 'En traitement');
INSERT INTO ORDERS_STATUS VALUES(3, 2, 'Livré');
INSERT INTO ORDERS_STATUS VALUES(4, 2, 'Mise à  jour');
INSERT INTO ORDERS_STATUS VALUES(5, 2, 'Remboursé');
INSERT INTO ORDERS_STATUS VALUES(20, 2, 'Facturé');
INSERT INTO ORDERS_STATUS VALUES(104, 2, 'En terme');
INSERT INTO ORDERS_STATUS VALUES(105, 2, 'Fin du terme');
INSERT INTO ORDERS_STATUS VALUES(106, 2, 'Annulé');
INSERT INTO ORDERS_STATUS VALUES(107, 2, 'En problème');

The first value is ORDERS_STATUS next id. The second field is the language and the third one is the status

Status need translation for

Pending
Processing
Delivered
Update
Refund
Invoiced
In term
End of term
Canceled
Process problem

- Add default option color and size description

insert into PRODUCTS_OPTIONS_DESCRIPTION (
PRODUCTS_OPTIONS_ID,
LANGUAGE_ID,
PRODUCTS_OPTIONS_NAME,
PRODUCTS_OPTIONS_COMMENT
) values 
(1,2,'Couleur','');

insert into PRODUCTS_OPTIONS_DESCRIPTION (
PRODUCTS_OPTIONS_ID,
LANGUAGE_ID,
PRODUCTS_OPTIONS_NAME,
PRODUCTS_OPTIONS_COMMENT
) values 
(2,2,'Grandeur','');

- Add default option color and size values description

INSERT INTO PRODUCTS_OPTIONS_VALUES_DESC (PRODUCTS_OPTIONS_VALUES_ID, LANGUAGE_ID, PRODUCTS_OPTIONS_VALUES_NAME) VALUES (1, 2, 'Noir');
INSERT INTO PRODUCTS_OPTIONS_VALUES_DESC (PRODUCTS_OPTIONS_VALUES_ID, LANGUAGE_ID, PRODUCTS_OPTIONS_VALUES_NAME) VALUES (2, 2, 'Blanc');
INSERT INTO PRODUCTS_OPTIONS_VALUES_DESC (PRODUCTS_OPTIONS_VALUES_ID, LANGUAGE_ID, PRODUCTS_OPTIONS_VALUES_NAME) VALUES (3, 2, 'Rouge');
INSERT INTO PRODUCTS_OPTIONS_VALUES_DESC (PRODUCTS_OPTIONS_VALUES_ID, LANGUAGE_ID, PRODUCTS_OPTIONS_VALUES_NAME) VALUES (4, 2, 'Brun');
INSERT INTO PRODUCTS_OPTIONS_VALUES_DESC (PRODUCTS_OPTIONS_VALUES_ID, LANGUAGE_ID, PRODUCTS_OPTIONS_VALUES_NAME) VALUES (5, 2, 'Orange');
INSERT INTO PRODUCTS_OPTIONS_VALUES_DESC (PRODUCTS_OPTIONS_VALUES_ID, LANGUAGE_ID, PRODUCTS_OPTIONS_VALUES_NAME) VALUES (6, 2, 'Bleu');
INSERT INTO PRODUCTS_OPTIONS_VALUES_DESC (PRODUCTS_OPTIONS_VALUES_ID, LANGUAGE_ID, PRODUCTS_OPTIONS_VALUES_NAME) VALUES (7, 2, 'Gris');
INSERT INTO PRODUCTS_OPTIONS_VALUES_DESC (PRODUCTS_OPTIONS_VALUES_ID, LANGUAGE_ID, PRODUCTS_OPTIONS_VALUES_NAME) VALUES (8, 2, 'Mauve');
INSERT INTO PRODUCTS_OPTIONS_VALUES_DESC (PRODUCTS_OPTIONS_VALUES_ID, LANGUAGE_ID, PRODUCTS_OPTIONS_VALUES_NAME) VALUES (9, 2, 'Vert');
INSERT INTO PRODUCTS_OPTIONS_VALUES_DESC (PRODUCTS_OPTIONS_VALUES_ID, LANGUAGE_ID, PRODUCTS_OPTIONS_VALUES_NAME) VALUES (10, 2, 'Jaune');
INSERT INTO PRODUCTS_OPTIONS_VALUES_DESC (PRODUCTS_OPTIONS_VALUES_ID, LANGUAGE_ID, PRODUCTS_OPTIONS_VALUES_NAME) VALUES (11, 2, 'Rose');
INSERT INTO PRODUCTS_OPTIONS_VALUES_DESC (PRODUCTS_OPTIONS_VALUES_ID, LANGUAGE_ID, PRODUCTS_OPTIONS_VALUES_NAME) VALUES (12, 2, 'Beige');
INSERT INTO PRODUCTS_OPTIONS_VALUES_DESC (PRODUCTS_OPTIONS_VALUES_ID, LANGUAGE_ID, PRODUCTS_OPTIONS_VALUES_NAME) VALUES (13, 2, 'Très petit (XS)');
INSERT INTO PRODUCTS_OPTIONS_VALUES_DESC (PRODUCTS_OPTIONS_VALUES_ID, LANGUAGE_ID, PRODUCTS_OPTIONS_VALUES_NAME) VALUES (14, 2, 'Petit (S)');
INSERT INTO PRODUCTS_OPTIONS_VALUES_DESC (PRODUCTS_OPTIONS_VALUES_ID, LANGUAGE_ID, PRODUCTS_OPTIONS_VALUES_NAME) VALUES (15, 2, 'Moyen (M)');
INSERT INTO PRODUCTS_OPTIONS_VALUES_DESC (PRODUCTS_OPTIONS_VALUES_ID, LANGUAGE_ID, PRODUCTS_OPTIONS_VALUES_NAME) VALUES (16, 2, 'Grand (L)');
INSERT INTO PRODUCTS_OPTIONS_VALUES_DESC (PRODUCTS_OPTIONS_VALUES_ID, LANGUAGE_ID, PRODUCTS_OPTIONS_VALUES_NAME) VALUES (17, 2, 'Très grand (XL)');
INSERT INTO PRODUCTS_OPTIONS_VALUES_DESC (PRODUCTS_OPTIONS_VALUES_ID, LANGUAGE_ID, PRODUCTS_OPTIONS_VALUES_NAME) VALUES (18, 2, 'X très grand (XXL)');

Here is a list of colr required with their PRODUCTS_OPTIONS_VALUES_ID

1, 'Black'
2, 'White'
3, 'Red'
4, 'Brown'
5, 'Orange'
6, 'Blue'
7, 'Grey'
8, 'Purple'
9, 'Green'
10, 'Yellow'
11, 'Pink'
12, 'Beige'
13, 'Extra small (XS)'
14, 'Small (S)'
15, 'Medium (M)'
16, 'Large (L)'
17, 'Extra large (XL)'
18, 'X extra large (XXL)'

3) Create new language resource bundles

Most of the resource bundles are located in <SHOPIZER>/sm-core/conf/resources

Resource bundles comply with java specifications. You can have more details on resource bundles here http://java.sun.com/developer/technicalArticles/Intl/ResourceBundles/

All french resource bundles haved to be prefixed with _fr (_<language iso code>)

Shopping templates specific resource bundles are located in <SHOPIZER>/sm-shop/conf/resources

Shopping templates administration resource bundles are located in <SHOPIZER>/sm-central/conf/resources

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值