How to create payment/shipping

This page explain to you how to develop EasyShop a plugin

See more here to get how Joomla! create a plugin.

A Payment/Shipping plugin maybe have more than a method which listed from the back-end MainMenu/Components/EasyShop/Payment(Shipping) methods

Develop a Payment Plugin

All payment plugins will be located in group easyshoppayment. When the execute method is called, the $order and $payment properties have already been presented.

                    // Import and use EasyShop Payment Legacy
                    use ES\Plugin\Payment;

                    class PlgEasyshoppaymentMypayment extends Payment
                        // This method will be called when an order has created by customer
                        public function execute()
                            $orderAmount = $this->order->get('total_price');
                            $products    = $this->order->get('products');
                            $testMode    = $this->payment->params->get('test');
                            // ...

                        // This method will be called by a payment gateway (such as PayPal...)
                        public function callback()


Develop a Shipping Plugin

All shipping plugins will be located in group easyshopshipping.

                    // Import and use EasyShop Shipping Legacy
                    use ES\Plugin\Shipping;
                    use Joomla\Registry\Registry;

                    class PlgEasyshopshippingMyshipping extends Shipping
                        // This method will consider to register one or many shipping elements
                        public function onEasyshopShippingRegister()
                             * @var $cart   \ES\Cart
                             * @var $method \ES\Method
                            $cart     = easyshop('class.cart');
                            $method   = easyshop('class.method');
                            $subTotal = easyshop('state')->get('cart.subTotal'); // Get subTotal in cart

                            foreach ($method->getShippingMethods() as $shipping)
                                $params    = new Registry($shipping->params);
                                $minAmount = (float) $params->get('min_order_amount');

                                // Check some restrictions
                                if($subTotal >= $minAmount)
                                    $shipTotal              = (float) $params->get('shipping_flat_fee');
                                    $shippingMethod         = $shipping;
                                    $shippingMethod->total  = $shipTotal;
                                    $shippingMethod->params = $params;
                                    // Now this shipping method will be displayed in the checkout page

How to create params for Payment/Shipping method

Place your params fields in the manifest XML file inside easyshop/fields[@name="params"]/fieldset[@name]. This works for the both payment method and shipping method.

                    <extension version="3.0" type="plugin" group="easyshoppayment" method="upgrade">
                        <author>Peter parker</author>
                        <creationDate>October 2017</creationDate>
                        <copyright>Copyright (C) 2016 - 2017 All Rights Reserved.</copyright>
                        <authorEmail>This email address is being protected from spambots. You need JavaScript enabled to view it.</authorEmail>
                            <filename plugin="mypayment">mypayment.php</filename>
                                <fields name="params">
                                    <fieldset name="payment_setting">
                                                <option value="1">JYES</option>
                                                <option value="0">JNO</option>
     All rights reserved.

  • This email address is being protected from spambots. You need JavaScript enabled to view it.
HIRE US to develop your store.

© 2015 - 2020 All rights reserved. is not affiliated with or endorsed by the Joomla! Project or Open Source Matters. The Joomla!® name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.