Giter Club home page Giter Club logo

shuup-shipping-simulator's Introduction

Build Status Coverage Status License

Shuup Shipping Simulator

A plugin for Shuup to simulate shipping methods in product detail page. Some customers want to see how much a product will cost with shipping and also how long it would take to arrive at home.

The plugin checks the URL to render its content, it means it will only work inside the ProductDetailView page.

How it works

The plugin will render a form to collect the customer address information, that will be used to create an instance of MutableAddress. The plugin will send a POST request to the ShippingSimulatorView which is responsible for receiving the Shipping Simulator form and the product info.

Inside the ShippingSimulatorView a temporary Basket is created with the MutableAdrress, the product and the quantity set. The Basket has already methods to return available shipping methods from a source (in this case we use our temp basket). The view then iterate over all available shipping methods and call its get_total_cost() and get_shipping_time() methods. The results are formatted and put inside a list which is returned by the ShippingSimulatorView as a JsonResponse.

The plugin receives the JSON response and present to the customer, simply as that.

Compatibility

Usage

First, configure the settings of your Django project and set Shipping simulator class through SHIPPING_SIMULATOR_CLASS_SPEC config. The default value is shuup_shipping_simulator.simulators:PostalCodeShippingSimulator.

Second, edit product detail page usig Xtheme and add Shipping simulator plugin where you want and it's done.

Customizing

You can create your own shipping simulator. Simply subclass ShippingSimulatorBase and override the necessary methods and custom form.

Contributing

Feel free to contribute. Fork and send a PR! :)

Tests

To run tests, just run py.test shuup-shipping-simulator_tests inside your virtualenv (with this module and Shuup installed).

Copyright

Copyright (C) 2016 by Rockho Team

License

Shuup Shipping Simulator is published under the GNU Affero General Public License, version 3 (AGPLv3) (see the LICENSE file).

shuup-shipping-simulator's People

Contributors

chessbr avatar

Watchers

James Cloos avatar

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.