Skip to content

izi-ecommerce/izi-stores

Repository files navigation

IZI stores

image

Coverage

This is an extension for django-izi that adds support for stores. It provides:

  • A store locator page using Google maps for geocoding. It also supports using the browser's location to show the nearest stores.
  • Store detail pages including opening hours
  • Store groups
  • A dashboard for managing stores

It's highly extensible and can be used as a foundation for building sophisticated stores functionality within IZI sites.

Screenshots

Customer-facing pages:

image

image

Dashboard pages:

image

image

Dependencies

GeoDjango is used so a spatial database is required. We recommend PostGIS. Django's docs include some installation instructions although it is renowned for being tricky.

Spatialite is another option although it can be tricky to set up. On Ubuntu, you can do the following:

$ sudo apt-get install spatialite-bin libspatialite3 libgeos++-dev libgdal-dev libproj0

The pysqlite python package is also required although it doesn't support C extensions by default. To work-around this, there are two options:

  1. Download the package, edit setup.cfg to enable C extensions and install:
$ pip install pysqlite --no-install
$ vim $VIRTUAL_ENV/build/pysqlite/setup.cfg
$ pip install pysqlite
  1. Use a custom branch:
$ pip install git+git://github.com/tinio/pysqlite.git@extension-enabled#egg=pysqlite

Installation

First, ensure you are using a spatial database and have django-izi installed.

Install package:

then add stores to INSTALLED_APPS. Now update your root urls.py:

from django.views.i18n import javascript_catalog
from izi.app import shop
from stores.app import application as stores_app
from stores.dashboard.app import application as dashboard_app

urls = [
    # basic configuration for IZI
    url(r'', shop.urls),

    # adds URLs for the dashboard store manager
    url(r'^dashboard/stores/', dashboard_app.urls),

    # adds URLs for overview and detail pages
    url(r'^stores/', stores_app.urls),

    # adds internationalization URLs
    (r'^jsi18n/$', javascript_catalog, name="javascript-catalogue"),
]

You also need to download the GeoIP data files and set GEOIP_PATH to point to the appropriate directory.

Settings

  • STORES_GEOGRAPHIC_SRID (default: 3577). This is used for distance calculations. See http://spatialreference.org for more details.
  • STORES_GEODETIC_SRID (default: 4326).
  • STORES_MAX_SEARCH_DISTANCE (default: None). This filters stores in queries by distance. Units can be set using distance object:
from django.contrib.gis.measure import D
# Maximal distance of 150 miles
STORES_MAX_SEARCH_DISTANCE = D(mi=150)
# Maximal distance of 150 kilometers
STORES_MAX_SEARCH_DISTANCE = D(km=150)

Contributing

There is sandbox site within the repo which is a sample IZI project that uses the stores extension. Set this up with:

$ make sandbox

then fetch the GeoIP files with:

$ make geoip

This loads a fixture which provides a superuser to test the dashboard with:

email: superuser@example.com
username: superuser
password: testing

Run tests with:

$ pytest

License

django-izi-stores is released under the permissive New BSD license.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published