Slovo::Plugin::Prodan - Make and manage sales in your Slovo-based site
# In slovo.conf load_plugins => [ #... 'Themes::Malka', { Prodan => { migrate => 1, consents => { gdpr_url => '/ѿносно/условия.bg.html', phone_url => $ENV{SLOVO_PRODAN_PHONE_URL}, delivery_prices_url => '/ѿносно/цени-доставки.bg.html', }, 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' }} }, #... ],
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.
In this edition of Slovo::Plugin::Prodan we implement the following features:
A jQuery and localStorage based shopping cart. Two static files contain the implementation and they can be inflated. 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.
/css/cart.css
/js/cart.js
domove/example.com/public
layouts/site.html.ep
# Inflate new static files from Slovo::Plugin::Prodan bin/slovo inflate --class Slovo::Plugin::Prodan -p --path domove/xn--b1arjbl.xn--90ae/public
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 web-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. See Slovo::Command::prodan::products on how to add and update products.
alias
data_type
t/products.yaml
t/update_products.yaml
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's __DATA__ section. 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.
celina
partials/_kniga.html.ep
__DATA__
# Add the template form Prodan bin/slovo inflate --class Slovo::Plugin::Prodan \ -t --path domove/xn--b1arjbl.xn--90ae/templates/themes/malka
A section in the Prodan configuration for different settings - only urls for now. $app->config('consents') may contain any settings needed for the client side of the plugin not related dierctly to integration with deliverers or payment providers.
$app->config('consents')
A GDPR and cookies consent alert in the footer which upon click leads to the page (celina) where all conditions on using the site can be described. When the user clicks on the link to the Consent page a flag in localStorage is put so the alert is not shown any more. This flag disappears if the user clears any site data and the alert will appear again if the user vists the site again. The Consent celina is created automatically in the localhost domain as an example. Search for gdpr_consent in the source of this module to see how it is implemented.
localStorage
gdpr_consent
Settings:
Keys Default Values -------------------------------------------- gdpr_url '/ѿносно/условия.bg.html' ihost punycode_decode(ed) current host
This is just a setting for this plugin - delivery_prices_url. Defaults to '/ѿносно/цени-доставка.bg.html'. This is a place where the prices for delivery are described. The link is displayed at the bottom of the shopping cart widget. It is created automatically for localhost as the gdpr_url
delivery_prices_url
gdpr_url
Currently displayed as a link in the _footer_right.html.ep template.
The usual method is implemented.
Prepends the class to renderer and static classes. Adds some REST API routes, configures the deliverer.
@@ 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/_footer_right.html.ep @@ partials/_consents.html.ep @@ partials/_kniga.html.ep @@ resources/data/prodan_migrations.sql
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
Красимир Беров CPAN ID: BEROV berov на cpan точка org http://слово.бг
Ordered by time of first commit.
Your Name
Someone Else
Another Contributor
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.
To install Slovo::Plugin::Prodan, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Slovo::Plugin::Prodan
CPAN shell
perl -MCPAN -e shell install Slovo::Plugin::Prodan
For more information on module installation, please visit the detailed CPAN module installation guide.