////////////////////////////////
		SERVER SIDE
////////////////////////////////

Open ecommerceapp.php and edit these values to suit your needs:

AES_KEY - security key that you must enter here and in your phone. Length must be 16, 24, or 32 characters!

MAIN_LANGUAGE_ID - language id that you want to be used to display data 
	(hint: open phpMyAdmin and look into your languages table to find out languages id of language you want)

MAIN_LANGUAGE_DIRETORY - language directory that you want to be used (currenty sending E-mail to customer uses this)
	(hint: open phpMyAdmin and look into your languages table to find out languages directory of language you want)

MAIN_CURRENCY_CODE - currency code which will be used to display prices
	(hint: open phpMyAdmin and look into your currencies table to find out which currency code to use)

MAIN_CURRENCY_VALUE - currency value which will be used to calculate prices
	(hint: open phpMyAdmin and look into your currencies table to find out currency value for currency code) 

FTP_IMAGES_UPLOAD_DIR - path to images directory
	(hint: use FTP client like FileZilla to find out your images path)

ADMIN_DIR - name of admin directory


Example of these definitons are:

define('AES_KEY', '1234567890123456'); // Example of security key which has 16 characters
									   // DO NOT USE THIS DEFAULT KEY!!! Choose your own!

define('MAIN_LANGUAGE_ID', '1'); // By default installation of Zen Cart first language is english
define('MAIN_LANGUAGE_DIRECTORY', 'english'); // With default Zen Cart you get english

define('MAIN_CURRENCY_CODE', 'USD'); // Default installation of Zen Cart puts USD as main currency
define('MAIN_CURRENCY_VALUE', '1.0'); // so there is USD in currencies tables which is value 1.0

define('FTP_IMAGES_UPLOAD_DIR', '/catalog/images/'); // path is based based on FTP user starting directory
													 // values can be: '/catalog/images/', '/images/' or
													 // something like '/var/www/catalog/images/'
													 // so use FTP client like FileZilla to find out what 
													 // is your images path based on FTP user working directory

define('ADMIN_DIR', 'admin'); // By default Zen Cart has admin directory


If you want to configure statistics for orders configure definition below.

STATISTICS_ORDER_STATUSES - orders which are included in statistics based on orders status.

Example of this definition is:

define('STATISTICS_ORDER_STATUSES', ''); // empty means to include all order statuses					
										 // if you want for example to use orders only which are in
										 // status delivered, then look into orders_status table 
										 // for delivered orders_status_id, which is 3 by default in 
										 // Zen Cart and use it like:
										 // define('STATISTICS_ORDER_STATUSES', '3');
										 // if you want to use more that one, for example status
										 // processing (id = 2) and delivered (id = 3), then
										 // put it in definition delimited with comma, like this:
										 // define('STATISTICS_ORDER_STATUSES', '2,3');

Some payment modules produce "empty" orders (orders which does not have items and/or totals), 
so if you do not want to see them set definition below to true.

EXCLUDE_EMPTY_ORDERS - exclude empty orders from latest orders in app

Example of this definition is:

define('EXCLUDE_EMPTY_ORDERS', true); // or define('EXCLUDE_EMPTY_ORDERS', false); 

Since v1.2 app has barcode scanner feature, which lets you find product by scanning its barcode with camera.
Also you are able to set products barcode (manually or capturing with camera) in app.
If you do not have barcode field in products table, you must add it in order to use this feature.
This SQL adds products_barcode field in products table: ALTER TABLE  `products` ADD  `products_barcode` VARCHAR( 18 ) NULL

PRODUCTS_BARCODE_FIELD - name of products barcode field

Example of this definition is:

define('PRODUCTS_BARCODE_FIELD', 'products_barcode'); // leave empty if you do not want to use this feature
													  // like this: define('PRODUCTS_BARCODE_FIELD', '');

Since v1.1 app support multiple product images. Currently only Ultra Pics add-on is supported.
Ultra Pics puts these extra image valus in products table:
products_image_med, products_image_lrg,
products_image_sm_1, products_image_xl_1, 
products_image_sm_2, products_image_xl_2,
products_image_sm_3, products_image_xl_3, 
products_image_sm_4, products_image_xl_4,
products_image_sm_5, products_image_xl_5, 
products_image_sm_6, products_image_xl_6 

If you want app to be able to access (and change) those values, configure definition below.

EXTRA_IMAGES - name of the extra images solution. Use 'none' for no extra images, or 'limited' for Ultra Pics

Example of this definition is:

define('EXTRA_IMAGES', 'limited');

To help you manage multiple images, there is built-in automatic resizing feature.

FORCE_DEF_DIM - forces default image (products_image or Small Image) to autoresize image to DEF_DIM while uploading. Values can be true or false
DEF_DIM - dimension of default image, if you put here '100', then 100x100 is maximum image size.

FORCE_MED_DIM - forces med image (products_image_med or Product Image) to autoresize image to MED_DIM while uploading. Valus can be true or false
MED_DIM - dimension of med image, if you put here '300', then 300x300 is maximum image size.

AUTORESIZE_XL_TO_SM - if you set this definition to true while uploading one of the XL images, for example products_image_xl_1, then automatically
						additional image for products_image_sm_1 is being created using uploading image and resizing dimension AUTORESIZE_SM_DIM
AUTORESIZE_SM_DIM - dimension of autoresizing sm image, if you put here '300', then 300x300 is maximum image size. If you upload sm image manually
					these parameter does not apply to image, and for sm image is being put original upload image.  

Example of these definitions are:

define('FORCE_DEF_DIM', true); // Use autoresize feature of default (Small) image
define('DEF_DIM', '100'); // Autoresize default image dimension

define('FORCE_MED_DIM', true); // Use autoresize feature of med (Product) image
define('MED_DIM', '300'); // Autoresize med image dimension

define('AUTORESIZE_XL_TO_SM', true); // Use autoresize feature XL to SM image
define('AUTORESIZE_SM_DIM', '300'); // Autoresize sm image dimension


Also since v1.1 app supports notifying customer when status has changed by E-mail. 
Original 'ecommerceapp_utils.php' sends E-mail to customer like default Zen Cart does.
If you would like to customize E-mail, then open 'ecommerceapp_utils.php' and on line 584 you should see variable $message that is used for E-mail body.
Change that variable if you want different E-mail body. Below on line 602 you can see that zen_mail is being called and that 'EMAIL_TEXT_SUBJECT' is 
being used for E-mail subject. So if you want to use different E-mail subject change that function parameter.
If you are wondering where is your Zen Cart code for sending mail, then open 'admin/orders.php' and on line 108 you should find $message variable
that is also used for E-mail, and on line 126 there is also called zen_mail function, and you can see which parameters are being passed to function.
Note that in 'ecommerceapp_utils.php' $order_info array is being used to find customer name and E-mail address, and in 'admin/orders.php' $check_status
array is being used for that. 

PRODUCTS_QUANTITY_LOW_ALERTS_VALUES - quantity levels used for alerts

Since v1.4 app supports product alerts which are based on product availability and quantity.
There are 3 levels of quantity alert: Lowest, Very Low and Low. They are represented in app
with different icons and also they represent different group if you group products by alerts.
You can set these levels to suit your need as such:

define('PRODUCTS_QUANTITY_LOW_ALERTS_VALUES', '0,3,5'); // First number 0 represents Lowest quantity level.
														// So if product quantity is less or equal to 0,
														// then is flagged with quantity Lowest alert.
														// Second number 3 represents Very Low quantity level.
														// Again if product is less or equal to 3, and is not
														// flagged with previous Lowest quantity level,
														// then it is flagged with quantity Very Low alert.
														// Third number 5 represents Low quantity level.
														// If product quanity is less or equal to 5, and is not
														// flagged with Lowest or Very Low, then it is flagged
														// with quantity Low alert.

define('PRODUCTS_QUANTITY_LOW_ALERTS_VALUES', '1,5,10'); // Another example of usage with different quantity level alerts.



Save changes to ecommerceapp.php file.


Upload all 3 files (using FTP client like FileZilla): 
	ecommerceapp.php (edited, not the original), 
	ecommerceapp_aes.php,
	ecommerceapp_utils.php
to your store catalog directory (the one which contains account.php, account_edit.php, account_history.php...)

Upload ecommerceapp_json.php to your store catalog directory if PHP version is less than 5.2.0.


////////////////////////////////
			PHONE
////////////////////////////////

Open eCommerce Manager app and on Orders tab press menu button. Choose Stores.
Add new store and configure it by long press on store name and choose Settings.
Configure settings.

Store name must be unique (max 30 characters long).
Theme is recommended to be unique, but it is not manditory.

Interface url should be: 
	http://www.your-store.com/catalog/ecommerceapp.php
of if your catalog directory is root directory then use something like these:
	http://www.your-store.com/ecommerceapp.php

AES key is security key that you choosen before in ecommereapp.php. 
If you recall example from above where we put:
	define('AES_KEY', '1234567890123456'); 
in ecommerceapp.php, then here we should write just 1234567890123456.

FTP settings you must enter if you want to be able to upload images to your catalog.
(feature change product image requires this)
For host put something like ftp.your-store.com or ip address, and username and password
use from user that has write access to your images directory.

Cache - Keep order for is used to set how long should order stay in phones local database.
This option prevents orders not to overpopulate phones memory. Note that even if you set keep order 
for 1 day, order that has date purchase 2 days ago and is updated today (date last modified is today)
will be shown, because then date last modified is used in comparison with keep order for option.

Allow notifications - every 15 minutes app can check for new orders and product quantity alerts.


Since v1.5 app has local caching feature, which means that your store data is locally on your
phone. Because of that app needs couple of seconds to start (load data from phones database to memory).
First time when you open orders/products tab initial syncing takes place, which may take a while. But every
other time syncing is very fast. Also due to that there is no more partial retrieving of data.
You can see that when you wish to open some sub-view. For example if you open single product view, 
it comes instantly. In general you should see much better performaces.


Hope this installation did not get you headache.
Enjoy!


Alen Kralj,
KIS Software 
(http://kis-software.blogspot.com/)






