Giter VIP home page Giter VIP logo

creuset's Introduction

Build Status StyleCI

Creuset

Creuset is a powerful ecommerce platform built in Laravel. It is intended to use modern design patterns and have a structure that allows it to be flexible to the extent it could be easily extended or adapted.

Features

  • Testing using PHPUnit, including Laravel's built-in integration testing
  • Extensible taxonomies; currently used for categories and tags but can be expanded to others.
  • Repository design pattern with decorators for caching, logging etc.
  • Uses elixir for asset compilation, browserify.
  • Full-featured admin panel with Vue.js components, using AdminLTE theme.

Usage

  1. Clone the repo to your working directory
  2. Run composer install to install dependencies
  3. Set your environment variables, including database config. (see .env.example for examples)
  4. Serve it up and enjoy

Notes on environment variables

  • The cache driver should be one that supports cache tags (e.g. memcached, redis).
  • Cache time specifies the default number of minutes that a cache entry will be retained in the cache. This is so values like this are not hard-coded.
  • Not all config entries are in .env.example. Check individual config files for more options.

Contributing

Development is by Git Flow. To add a feature contribute create a branch from the dev branch called feature/<feature-name> and pull request back to the dev branch.

All the tests should pass before trying to merge. This is checked using TravisCI.

PSR-2 code style should be used throughout. This is auto-checked with StyleCI

Front End

Creuset uses npm modules with browserify for front-end scripts. Vue components are used and compiled with vueify. You should install the node dependencies with npm install before making changes.

Styles are compiled from SASS. Some bower dependencies are used (install them with bower install).

The whole lot can then be recompiled by running gulp.

creuset's People

Contributors

harry-workl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

mtomaizy

creuset's Issues

Migration order on install

a small install issue is that migrations wont run.
Because of the ordering of the migration files the users table is created before roles and the FK on users -> roles cant be created

[Illuminate\Database\QueryException]                                                                                                                                                                                              
SQLSTATE[HY000]: General error: 1005 Can't create table 'creuset.#sql-a63_fada5' (errno: 150) (SQL: alter table `users` add constraint users_role_id_foreign foreign key (`role_id`) references `roles` (`id`) on delete cascade)

Product attributes

Implement an attribute structure so products can have properties assigned to them (e.g. lampshade-size: large, medium, small etc). The structure should allow filtering products according to a property, and potentially allow creating variations based on attributes (e.g. creating a small, medium large etc variation of a t-shirt).

Use the terms table for taxonomies. E.g. an attribute might be represented by:

  • taxomony: lampshade-size
  • term: large

The termables table can then assign the attributes to a given product.

Zip validation check for stripe

As it stands, the user enters their billing address and proceeds to the checkout. If the address they entered fails the card check there is no easy way for them to go back and fix this.

Devise a method for a user to fix their billing address should it fail. I.e. use the order in the current session to pre-fill the checkout page.

Implement templating system

Devise a way of allowing custom templates and assets to be used on the front end without committing them to the repo. Themes should exist as separate packages and be registered via a service provider dependant on a config setting so they can be swapped in/out as required. The app should fall back to the standard templates should an external file not exist.

Media Resource

A basic resource for managing uploaded media showing the model each file was uploaded to along with CRUD operations.

Polymorphism or metatable for post types

Rather than have many fields in the posts table and just adding to it every time we need a new one, I see two options to get around this:

  1. Meta table

This involves having 1 extra table: a metas table with fields metable_id, metable_type, key, value. This would allow us to attach whatever key-value pairs we want to whichever model implements a MetableTrait. This would contain:

public function metas()
{
    return $this->morphMany('Meta', 'metable');
}

...among methods to retrieve, save etc meta records.

This is quite nice as it allows us to limit the number of tables needed and just have a bunch of extra fields as we like and introduce as many custom post types are we want without extra migrations.

Downside is that a database query is needed for every meta field required (although caching and eager-loading could be used to mitigate this).

  1. Polymorphism

We would make a separate model and table for every custom post type and make it morph to the parent post table. The posts table will need fields postable_id and postable_type to link the a post type to its parent Post.

E.g. A products table might have fields price, weight etc in addition to the standard post fields.

We would morph the Product model to Posts with

public function post()
{
    return $this->morphOne('Post', 'postable');
}
whilst the `Post` model can just have:

public function postable()  
{
    return $this->morphTo();
}

Then the api would be like

$product = Product::first();
$price = $product->price;
$content = $product->post->content; // this field is on the post model

To make a new product we'd need to new up both models:

// untested
$product = Product::create(['price' => 2500]);
$post = new Post(['title' => $title, 'content' => $content]);
$product->post()->save($post);

Ref: http://www.richardbagshaw.co.uk/laravel-user-types-and-polymorphic-relationships/

Brittle mailtracking test

The test it_completes_an_order_upon_payment in PaymentTest intermitantly fails due to the mailtracking class. This test results in 2 emails being sent and the assertions to check are sensitive to the order in which they are sent. Tried just checking all recipients but this hasn't helped.

Availability by country for shipping methods

Ability to restrict shipping methods by country. E.g. UK Shipping only for UK. Customer would choose this at the payment page once the shipping address is know.

UX for setting a shipping method would need to include or exclude country identifiers using a multi-select.

Comments

Hi there, I just wanted to say that this looks like it has real promise and I like the way it's starting to look! Complements to you, still a few bugs, but for a bleeding edge build it's looking nice.

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.