If you want to have your own template store, just follow these simple steps:
- Getting code
- Getting API wix.com keys
- Selecting your templates with prices, descriptions
- Publishing your site
Get our sample code from GitHub. You need to have git client for your computer. To get our template store you need to do
$ git clone https://github.com/wix/template-store-example.gitin command line or select "git clone" from your GUI utility. This will fetch it to your hard disk drive. Remember folder where it was downloaded, so that you can edit templates later.
Now go to api.wix.com and signup to get the keys. You'll get a pair of very long strings called public and secret key. Don't reveal your secret key to anyone and better don't check it in VCS.
Next do whatever you want to customize your template store - HTML templates are in app/views, JS/CSS assets are in app/assets.
Go to http://api.wix.com and add your linked WIX.com account. Once you did it and if you have at least one site, you'll see new "Templates" link in navigation menu. There will be a list of templates taken from your WIX accounts. Specify descriptions and prices, make sure "Include?" checkboxes are enabled and click "Generate" to get your templates file. Copy this file in your config folder and commit it like that:
$ git commit -m "Templates.yml added" config/templates.yml
$ git push heroku masterIn case you are familiar with Rails you can just deploy like you want, it's just a Rails app. Otherwise we recommend to use Heroku.
- For this just register and follow their instructions.
- After email confirmation you have to install heroku toolbelt - command line utility to link your code with Heroku account. Do
$ heroku loginand enter your credentials.
- Next go to the folder with template store and do
$ heroku apps:createinside.
Then once you changed templates and committed something just do
$ git push heroku masterto update/install your code on Heroku.
To populate your database with the list of selected template, you need to execute the following command:
$ RAILS_ENV=production rake db:seedin case you use Heroku do this instead:
$ heroku run rake db:seed RAILS_ENV=productionNow execute this in console replacing YOUR_SECRET_KEY and YOUR_PUBLIC_KEY with your real keys from api.wix.com:
$ heroku config:add WIX_SECRET_KEY=_YOUR_SECRET_KEY_
$ heroku config:add WIX_PUBLIC_KEY=_YOUR_PUBLIC_KEY_Same things should be done for setting your PayPal account:
$ heroku config:add PAYPAL_ACCOUNT=your_paypal_account@email.here
$ heroku config:add PAYPAL_SANDBOX=falseThis will update your Heroku application and restart it, so that in a minute you should have working template store!