2017 © Pedro Peláez
 

magento2-module module-donationproduct

image

experius/module-donationproduct

  • Wednesday, May 23, 2018
  • by experius
  • Repository
  • 5 Watchers
  • 14 Stars
  • 49 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 2 Open issues
  • 12 Versions
  • 172 % Grown

The README.md

, (*1)

Magento 2 Module Experius DonationProduct (RC1.0)

  • Demo website: https://donationproduct.experius.nl
  • Magento Marketplace: https://marketplace.magento.com/experius-module-donationproduct.html

Installation

Add the module to your composer.json composer require experius/module-donationproduct "~1.0.0", (*2)

Run the Magento Setup Upgrade bin/magento setup:upgrade, (*3)

Install Sample Data (optional), (*4)

A number of international charities will be created for testing purposes, (*5)

(Oxfam, Greenpeace, Save the Children, Amnesty International, World Wildlife Fund), (*6)

bin/magento experius_donationproduct:sampledata:deploy, (*7)

Remove Sample Data (optional), (*8)

bin/magento experius_donationproduct:sampledata:remove, (*9)

Frontend

  • This module adds a new product type "Donation Product" to your Magento 2 installation.
  • A customer can add this donation product to the cart with a self chosen amount.

The donation products can be viewed on several standard locations in your Magento 2 webshop - Homepage - Sidebar - Cart - Checkout, (*10)

Off course it is possible to implement this block on any location by a Magento frontend developer. Or in a cms of category layout update via the Magento Admin. Xml example is provided in the 'Full Size Block' chapter., (*11)

When clicked on a charity of the customers choice a popup will open with the charities details and a add to cart button., (*12)

You can also create a regular category with all the donation products with a regular product detail page., (*13)

A "Donation Product" has a lot in common with a "Virtual Product". It has no stock, weight and doesn't need a shipping method or address to be set in the checkout., (*14)

Donation Popup

, (*15)

Product Page

, (*16)

Category Page

To view the donation products in a category (just like the screenshot below). Create a category in the Magento Admin and add the donation products to that category., (*17)

  • Categories can be added in Magento Admin > Catalog > Categories
  • After the category is made add the products to the Category via the 'Products in Category' tab.

, (*18)

Sidebar Block

This block wil be visible on every page wich has a layout with a sidebar implemented. It can be disabled in the settings. See settings chapter., (*19)

, (*20)

Full Size Block (Homepage)

The full size block is visible on the homepage. It can be disabled in the settings. See settings chapter., (*21)

, (*22)

  • A frontend Magento developer can implement this in custom position in you template by using the following xml.
  • You can also use the xml below to add the block to a cms page. For example your 404 page. Edit the cms page and add the xml to the 'Design' tab > 'Layout Update XML' field.
<referenceContainer name="content">
  <block class="Experius\DonationProduct\Block\Donation\ListProduct" name="donation.block" after="-" template="Experius_DonationProduct::donation.phtml"/>
</referenceContainer>  

Checkout Block

The checkout donation block is visible in the checkout totals block. It can be disabled in the settings. See settings chapter., (*23)

, (*24)

Cart Page

The cart page donation block is visible on the cart page. It can be disabled in the settings. See settings chapter., (*25)

, (*26)

Backend

Product Type

Add a new product with type 'Donation Product', (*27)

, (*28)

Edit Product

You can configure the minimum donation amount., (*29)

, (*30)

Report

Reports > Sales > Donations, (*31)

A report table is made to store every single "Donation Product" sale. You can make an export, sum up the amount per charity and transfer the money., (*32)

, (*33)

, (*34)

Settings

Stores > Settings > Configuration > Catalog > Donation Product, (*35)

There is a setting to enable or disable the complete module. There are settings to enable and disable the visibility of blocks on several locations in your webshop., (*36)

, (*37)

Uninstall

Follow the step below to uninstall the module., (*38)

  1. Login in to Magento
  2. Go to Catalog > Products. Filter on product type 'Donation Product'
  3. Delete all the Products with the type 'Donation Product'
  4. Go to System > Attributes > Product
  5. Search the attribute 'experius_donation_min_amount' (Minimal Donation Amount) and delete it
  6. Run the following in the command line bin/magento module:uninstall Experius_DonationProduct

FAQ

Can i combine the 'Donation product options' with 'Custom options / Customizable Options'?, (*39)

Although its not supported, it can be done! You have change the following template by overwriting it with your own custom template version. vendor/magento/module-catalog/view/frontend/templates/product/view/form.phtml. You probaly have to hide or remove a duplicate addtocart button, (*40)

The donation product uses the 'product_info_form_content' container. This is only rendered when no 'Custom options' are found., (*41)

<?php if (!$block->hasOptions()):?>
    <?= $block->getChildHtml('product_info_form_content') ?>
<?php else:?>
    <?php if ($_product->isSaleable() && $block->getOptionsContainer() == 'container1'):?>
        <?= $block->getChildChildHtml('options_container') ?>
    <?php endif;?>
<?php endif; ?>

If you want to render both 'Custom options' and 'Donation options'. Change the if statement., (*42)

<?php if (!$block->hasOptions() || $_product->getTypeId()=='donation'):?>
    <?= $block->getChildHtml('product_info_form_content') ?>
<?php else:?>
    <?php if ($_product->isSaleable() && $block->getOptionsContainer() == 'container1'):?>
        <?= $block->getChildChildHtml('options_container') ?>
    <?php endif;?>
<?php endif; ?>

The Versions

23/05 2018

dev-master

9999999-dev

  Sources   Download

proprietary

by Derrick Heesbeen

06/02 2018

1.1.1

1.1.1.0

  Sources   Download

proprietary

by Derrick Heesbeen

25/01 2018

1.1.0

1.1.0.0

  Sources   Download

proprietary

by Derrick Heesbeen

22/12 2017

1.0.6

1.0.6.0

  Sources   Download

proprietary

by Derrick Heesbeen

19/12 2017

1.0.5

1.0.5.0

  Sources   Download

proprietary

by Derrick Heesbeen

19/12 2017

dev-optionsvalidation

dev-optionsvalidation

  Sources   Download

proprietary

by Derrick Heesbeen

30/11 2017

1.0.2

1.0.2.0

  Sources   Download

proprietary

by Derrick Heesbeen

29/11 2017

1.0.1

1.0.1.0

  Sources   Download

proprietary

by Derrick Heesbeen

29/11 2017

1.0.0

1.0.0.0

  Sources   Download

proprietary

by Derrick Heesbeen

29/11 2017

dev-import

dev-import

  Sources   Download

proprietary

by Derrick Heesbeen

27/11 2017

dev-phpdocblocks-confighelper

dev-phpdocblocks-confighelper

  Sources   Download

proprietary

by Derrick Heesbeen

25/11 2017

0.0.1

0.0.1.0

  Sources   Download

proprietary

by Derrick Heesbeen