The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Slovo::Plugin::Prodan - Make and manage sales in your Slovo-based site

SYNOPSIS

  # In slovo.conf
  load_plugins => [
    #...
    'Themes::Malka',
    {
      Prodan => {
        migrate => 1,
        econt   => {
          shop_id                 => $ENV{SLOVO_PRODAN_SHOP_ID},
          private_key             => $ENV{SLOVO_PRODAN_PRIVATE_KEY},
          shippment_calc_url      => 'https://delivery.econt.com/customer_info.php',
          crupdate_order_endpoint =>
            'https://delivery.econt.com/services/OrdersService.updateOrder.json',
          create_awb_endpoint =>
            'https://delivery.econt.com/services/OrdersService.createAWB.json'
        }}
    },
  ],

DESCRIPTION

The word про̀дан (прода̀жба) in Bulgarian means sale. Roots are found in Old Common Slavic (Old Bulgarian) <проданьѥ>. Here is an exerpt from Codex Suprasliensis(331.27) where this word was witnessed: <сꙑнъ божии. вол҄еѭ на сьпасьнѫѭ страсть съ вами придетъ. и на <продании станетъ. искѹпѹѭштааго животворьноѭ кръвьѭ. своеѭ миръ.>>

<Slovo::Plugin::Prodan> is a <Mojolicious::Plugin> that extends a Slovo-based site and turns it into an online shop.

FEATURES

In its first edition of <Slovo::Plugin::Prodan> we implemented the following features:

A jQuery and localStorage based shopping cart. Two static files contain the implementation and they can be inflated as usual. The files are </css/cart.css> and </js/cart.js>. You should inflate these files into your public forlder <domove/example.com/public> for the domain on which you will use it. Even not inflated these will be referred from any page of the site. The site layout <layouts/site.html.ep> includes automatically these two static files if this plugin is loaded.

To add a product to your cart and make an order, you need a button, containing the product data. For example:

    <button class="primary sharer button add-to-cart"
        title="книжно издание" data-sku="9786199169001" 
        data-title="Житие на света Петка Българска от свети патриарх Евтимий"
        data-weight="0.5" data-price="7.00"><img
        src="/css/malka/book-open-page-variant-outline.svg">
        <img src="/img/cart-plus-white.svg"></button>

See "A template..." below.

A "Pay on delivery" integration with Bulgarian currier <Econt (in Bulgarian)>.
Products - a products SQL table to populate your pages with products. You create a page with several articles (celini) in it. These celini will be the pages for the products. You prepare a YAML file with products. Each product <alias> property must match exactly the celina <alias> and <data_type> on wich this product will be placed. See <t/products.yaml> and<t/update_products.yaml> for examples.
A template for displaying products within a <celina>. You can modify this template as you wish to display other types of products - not just books as it is now. See <partials/_kniga.html.ep> inlined in this file. It of course can be inflated using <Slovo::Command::Author::inflate>. The template produces the HTML from the products table, including the button mentioned above already.

TODO MAYBE

Invoices - generate an invoice in PDF via headless LibreOffice instance on your server.
Merchants - a merchants SQL table with Open API to manage and automatically populate invoices.
Other "Pay on Delivery" providers. Feel free to contibute yours.
Other types of Payments and/or Online Payment Providers like online POS Terminals etc.

METHODS

The usual method is implemented.

register

Prepends the class to renderer and static classes. Adds some REST API routes, configures the deliverer.

EMBEDDED FILES

    @@ css/cart.css
    @@ js/cart.js
    @@ img/arrow-collapse-all.svg
    @@ img/cart-arrow-right.svg
    @@ img/cart.svg
    @@ img/cart-check.svg
    @@ img/cart-off.svg
    @@ img/cart-minus.svg
    @@ img/cart-plus-white.svg
    @@ img/cart-plus.svg
    @@ img/cart-remove.svg
    @@ img/econt.svg
    @@ partials/_kniga.html.ep
    @@ resources/data/prodan_migrations.sql

SEE ALSO

Slovo::Command::prodan::products, Slovo, "Stash and templates" in Mojolicious::Guides::Tutorial, "renderer" in Mojolicious, Mojolicious::Renderer, "Bundling assets with plugins" in Mojolicious::Guides::Rendering, Slovo::Command::Author::inflate

AUTHOR

    Красимир Беров
    CPAN ID: BEROV
    berov на cpan точка org
    http://слово.бг

CONTRIBUTORS

Ordered by time of first commit.

  • Your Name

  • Someone Else

  • Another Contributor

COPYRIGHT

This is free software, licensed under:

  The Artistic License 2.0 (GPL Compatible)

The full text of the license can be found in the LICENSE file included with this module.

This distribution contains icons from https://materialdesignicons.com/ and may contain other free software which belongs to their respective authors.