= 1, Installation. =
install a blank woocommerce site. On centos machines all that's needed is:
{{{
yum install wordpress
}}}
go to the woocommerce site and sign up for a new account. Once you have the download link do the following:
{{{
cd /usr/share/wordpress/wp-content/plugins
wget -O woocommerce.zip
unzip woocommerce.zip
rm woocommerce.zip
}}}
depending on network , may need to install the following plugin to enable woocommerce to pull images from control.
https://github.com/UCF/WP-Allowed-Hosts
need to add the the images url to the allowed host. You also need to add the Webhook host here if different (comma separated)
= 2, Configuration. =
1, setup control to use woocommerce
* coaad->page 2->"Online Store" set to 'W' stand for woocommerce. ignore all the other webshop related option in the same page its not needed in woocommerce
* gencont->E-Commerce->"Location for webshop 1" set to the location that interface with woocommerce.
* smaad->add a sales person then put it in brctrl->webshop location 1->online->"Online Store Salesperson"
* draad->add a customer then put it in brctrl->webshop location 1->online->"Default Online Store Customer"
* also fill in the "Online Transaction are orders of sales" and "Till number for online store payment" option in the same page.
* put the woocommerce url with out any tailling '/' in to brctrl->webshop location 1->online->"Online Store Data source"
* note that "Online Store URL" is not needed for woocmmerce but you can saftly copy it from "Online Store Data source"
* "Online Image URL" is needed , it shoule be a URL allow read of child files from woocommerce site that link to $CCDIR/(comp_code)/images/ This time make sure to put the trailing slash.
* igrore "Online Store login name" and "Online Store login password" as they are not needed for woocommerce for detail see nest section
* enter a " number of second before time out " if needed.
* Magento related options on the same page can be ignored.
2, add woocommerce api key to grand control access.
* first login to woocommerce site as admin then click the left hand side menu
* woocommerce->setting
* then click the
* Advanced -> REST API
* then click the "Add Key" button.
* set the permission to Read/Write
* then click the "Generate API Key" button it will bring you to a "Key Details" page.
* open a file in $CCDIR/(company code)/woocomtoken/(branch code).token
* copy the the "Consumer key" field from the "Key Details" page into the token file.
* then add a ':' after the consumer key
* after that copy the "Consumer secret" field from the "Key Details" page into the token file after the ':'
* so the whole file look like the following
* consumer_key:consumer_secret
* note that there are not end of line char.
* save the file.
* in the woocommerce wordpress->settigs->permalinks->choose post_name and save.
* woocomerce->settings->generals->enable tax
* woocommerce->settings->tax->Prices entered with tax (set to Y)
* appearance->customize->woocommerce->product catalog. In "category display" set to "show subcategories".
= 3, Dumping Data. =
making sure online id on different master is clean
clean debtor online_id drcidrep
clean cat onine_id catrep->E (note left the "set show online" field blank it will not touch it on the stock record)
copy a clean dblog.dat to company
run binl
{{{
fdb2log -c37 -a23 -a22 -a47
}}}
37 is for stcont 23 is for branch 22 for colour and 47 for size. woocommerce api allow update colour size and taxs informations
then run binl
{{{
fdb2log -Bbrcode -a8 -a9
}}}
-B for only the stock and category in internet location , also note that 8 is for cateogry which come before 9 for stock.
then run binl
{{{
log2woocom -C
}}}
note that -C is important it mean creating a new shop i will blank out any online_id in control before creation of records. after that the online shop should be populated.
If you get nothing inside woocommerce, check the tax in WooCommerce->settings->tax. You should see Code xx rates. If these are missing, check the allowed hosts setting. Would also help to turn on debugging in Wordpress:
in the wp-config.php, uncomment/add the following 2 lines:
{{{
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
}}}
You will find woocommerce logs in
{{{
/wp-content/uploads/wc-logs
}}}
= 4, Receiving Orders. =
woocommerce have web hook ability, control will utilise this to import order from woocomerce so it will appear seamlessly and instantly.
* create a NODEID for the importing and conset it to the company and the internet location.
* place /u/ccr.15/std/binl/wcorder.cgi in a cgi directory that can access from woocommerce
* first login to woocommerce site as admin then click the left hand side menu
* woocommerce->setting
* then click the
* Advanced->Webhooks
* chick the "Add Webhook" button
* in the next page
* give the webhook a name
* set status as "Active"
* set topic as "Order Created"
* set the Delivery URL as the URL to the wcorder.cgi, with the NODEID as the QUERY_STRING
example:
https://www.company.com/cgi-bin/wcorder.cgi?INTERNETDEV
after that every time order created in woocommerce will get imported into control instantly.
= 5, On Going =
log2woocom needed to be constant running
to debug set evn var WOOCOM_TRACE_XML = 1
to retrieve an existing order that didnt come in.
curl -k https://server/wp-json/wc/v2/orders/533 -u$(cat /u/ccr.15/COMP/woocomtoken/WARE.token) | /binl/wcorder.cgi