Shop - Installation and setup
Installation
- Add shop plugin (ssh://git@develop.outlast.hu:7999/ofw/plugin-shop.git) to plugins/shop submodule directory.
In Sourcetree: right click on Submodules in project tree and choose Add Submodule… option. - In /site/index.php add the plugin to the project. To do this, add the shop plugin to the next line
$zajconf['plugin_apps'] = array('_project');
.
The result will be$zajconf['plugin_apps'] = array('shop');
. - You need to add
outlast
anduser
plugins (ssh://git@develop.outlast.hu:7999/ofw/plugin-outlast.git and ssh://git@develop.outlast.hu:7999/ofw/plugin-user.git). To add the plugins, follow the steps above. In /site/index.php shop plugin has to be before the outlast plugin, e.g.$zajconf['plugin_apps'] = array('shop', 'outlast', 'user');
- A MySQL database is necessary for the shop plugin. You can check your MySQL settings or create a new one in /site/index.php. After this step you have to update your database (/update/database).
- Add
$this->zajlib->shop->start()
to yourdefault.ctl.php / __load()
method - At this point, you can try /admin url. If everything is fine, you’ll be asked to add a new user. Add a new user and log in. If something is wrong, first check if jquery is enabled – open /site/index.php and check line
$zajconf['system_apps'] = array('_jquery', '_global');
. - After successful login, you will be redirected to add a new shop. Add a new shop and save. If you are not redirected, go to /admin/settings/shop/
- If there is an error about transaction.hu_HU.lang.ini, create a file called transaction.hu_HU.lang.ini in /plugins/_project/lang/ directory.
- As the last step, add a new currency, status and country in Settings and you have a shop up and running. It’s important to check at least one of the checkboxes for every new status!
Enable friendly URLs
SEO and user-friendly URLs are used throughout the shop to display products, categories, and other items. As typical for OFW, friendly URLs are routed through the __error()
method, typically of the default controller. Here’s an example:
Set up templates
As you can see the shop has it’s own error method handler. This will search through everything and display the proper page if it finds the content. You’ll need the following templates in your view folder:
- shop/category.html
- shop/category_grid.html (optional)
- shop/product.html
- shop/search.html
- shop/search_grid.html
Take a look Searching and Listing Products
You can also take a look at the examples currently in the shop plugin for a starting point. Then use the shop connections and data and the shop filters and tags documentation to set up the templates with everything you need.
Set up the ordering process
Here are the steps for setting up the rodering process:
- Add shopping cart functionality and customize as needed
- Create a checkout page
- Enable supported payment gateways
- Create a confirmation page and add tracking
- Create a confirmation email
Setting up the cron job
You need to set up an automatically running script at http://example.com/shop/autorun/
for each shop. On Linux, this is most easily done via cron. It should run every few minutes for busy shops, but at least once every 15 minutes or so.
What does the automatic script do?
- disables products no longer in stock
- verifies transactions (if transaction plugin is enabled)
- updates automatically calculated prices (based on ECB exchange rates)