Code Monkey home page Code Monkey logo

pims-opencart's Introduction

pims-opencart

CLI tool linking between pims and opencart

Features (unchecked are TODO)

  • Read pims export csv and display as yml
  • Read opencart mysql database and display data similar to yml of pims csv export
  • Validate opencart: list products without categories, without image (issue 1)
  • Reconcile quantities between pims csv and opencart mysql database (issue 2)
  • Reconcile categories and category products between pims export and opencart database (issue 3)

Installation

Download your computer architecture's corresponding binary from the releases.

e.g. for linux

dpkg --print-architecture
wget https://github.com/shadiakiki1986/pims-opencart/releases/download/0.0.1/pims-oc-amd64 # if above displays amd64
sudo chmod +x pims-oc-amd64
sudo mv pims-oc-amd64 /usr/sbin/pims-oc

Usage

  1. Read pims csv export: pims-oc read:pims pims.csv
  • pims.csv is the excel file of inventory by item exported from pims 2, and then saved as csv manually
  • Produces tabular output
  1. Read opencart database: pims-oc read:oc <DSN>
  • DSN is as exemplified on go mysql driver: e.g. user:password@/dbname
  • Produces tabular output
  • Includes field of warnings per product
  • To filter output for warnings only: pims-oc read:oc --warnings <DSN>
  1. Reconcile: pims-oc recon pims.csv <DSN>

opencart hosted on a2hosting

Alternatively, just export your opencart mysql database as documented here below and import it locally

Dev notes

Dependencies

Dependency mysql requires go version > 1.2 (note on ubuntu 12.04 you get go version 1)

Install dependencies

sudo apt-get install golang
mkdir ~/.go
export GOPATH=~/.go

# https://github.com/Go-SQL-Driver/MySQL/#usage
go get github.com/go-sql-driver/mysql

# https://github.com/urfave/cli#using-the-v2-branch
go get gopkg.in/urfave/cli.v2

# https://github.com/go-yaml/yaml
go get gopkg.in/yaml.v2

# https://github.com/gosuri/uitable
go get -v github.com/gosuri/uitable

creating a local copy of the db

  1. create an opencart empty db
sudo apt-get install mysql-server
mysql -u root -p -e 'CREATE DATABASE opencart'
mysql -u root -p opencart < test/create.sql
  1. export existing opencart database
  • Click on settings .. export
  • download store.sql
  • rename the table prefix from ocko to oc: sed -i "s/ocko_/oc_/g" test/store.sql
  1. import test/store.sql into the opencart db created
mysql -u root -p opencart < test/store.sql

Note on create.sql

wget https://raw.githubusercontent.com/opencart/opencart/master/upload/install/opencart.sql -O test/create.sql

Building binary

Copied from gosu

CGO_ENABLED=0 GOARCH=amd64 go build -v -ldflags '-d -s -w' -o bin/pims-oc-amd64
CGO_ENABLED=0 GOARCH=386 go build -v -ldflags '-d -s -w' -o bin/pims-oc-i386

where amd64 is from dpkg --print-architecture

pims-opencart's People

Contributors

shadiakiki1986 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

ip-cam

pims-opencart's Issues

yml output

ATM yml output is dropped .. bring back if needed

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.