{"id":18564898,"url":"https://github.com/bdcrops/module-banglacourier","last_synced_at":"2025-05-15T18:34:55.431Z","repository":{"id":56950572,"uuid":"209784890","full_name":"bdcrops/module-banglacourier","owner":"bdcrops","description":"This module is used as Offline Shipping methods of  Magento 2 extensions.","archived":false,"fork":false,"pushed_at":"2019-10-16T07:45:27.000Z","size":124,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-26T12:09:49.868Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.bdcrops.com","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bdcrops.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-09-20T12:24:33.000Z","updated_at":"2019-10-16T07:45:29.000Z","dependencies_parsed_at":"2022-08-21T08:20:58.123Z","dependency_job_id":null,"html_url":"https://github.com/bdcrops/module-banglacourier","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bdcrops%2Fmodule-banglacourier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bdcrops%2Fmodule-banglacourier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bdcrops%2Fmodule-banglacourier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bdcrops%2Fmodule-banglacourier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bdcrops","download_url":"https://codeload.github.com/bdcrops/module-banglacourier/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239293948,"owners_count":19615043,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T22:16:42.133Z","updated_at":"2025-02-17T13:14:39.129Z","avatar_url":"https://github.com/bdcrops.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BDC_BanglaCourier\n\nThis module is used as Offline Shipping methods of  Magento 2 extensions.\nCustomize Checkout Add custom shipping carrier.\n\n\n\n## 1. How to install \u0026 upgrade BDC_BanglaCourier\n\n\n#### 1.1 Copy and paste\n\nIf you don't want to install via composer, you can use this way.\n\n- Download [the latest version here](https://github.com/bdcrops/module-banglacourier/archive/master.zip)\n- Extract `master.zip` file to `app/code/BDC/BanglaCourier` ; You should create a folder path `app/code/BDC/BanglaCourier` if not exist.\n- Go to Magento root folder and run upgrade command line to install `BDC_BanglaCourier`:\n\n#### 1.2. Install via composer\n\nWe recommend you to install BDC_BanglaCourier module via composer. It is easy to install, update and maintaince.Run the following command in Magento 2 root folder.\n```\ncomposer config repositories.module-banglacourier git\nhttps://github.com/bdcrops/module-banglacourier.git\n\ncomposer require bdcrops/module-banglacourier:~1.0.0\nphp bin/magento setup:upgrade\nphp bin/magento setup:static-content:deploy\n```\n#### 1.3 Upgrade    \n\n```\ncomposer update bdcrops/module-banglacourier\nphp bin/magento setup:upgrade\nphp bin/magento setup:static-content:deploy\n```\nRun compile if your store in Product mode:\n```\nphp bin/magento setup:di:compile\n```\n\n## 2 Manual Tutorial\n- Create app/code/BDC/BanglaCourier/registration.php\n```\n\u003c?php\n\\Magento\\Framework\\Component\\ComponentRegistrar::register(\n    \\Magento\\Framework\\Component\\ComponentRegistrar::MODULE,\n    'BDC_BanglaCourier',\n    __DIR__\n);\n\n```\n- create app/code/BDC/BanglaCourier/etc/module.xml\n```\n\u003c?xml version=\"1.0\"?\u003e\n\n\u003cconfig xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:magento:framework:Module/etc/module.xsd\"\u003e\n    \u003cmodule name=\"BDC_BanglaCourier\" setup_version=\"1.0.0\"/\u003e\n\u003c/config\u003e\n\n```\n- create app/code/BDC/BanglaCourier/etc/config.xml\n```\n\u003c?xml version=\"1.0\" ?\u003e\n\n\u003cconfig xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:magento:module:Magento_Store:etc/config.xsd\"\u003e\n\t\u003cdefault\u003e\n\t\t\u003ccarriers\u003e\n\t\t\t\u003cbanglacourier\u003e\n\t\t\t\t\u003cactive\u003e1\u003c/active\u003e\n\t\t\t\t\u003ctitle\u003eBangla Courier Shipping\u003c/title\u003e\n\t\t\t\t\u003csallowspecific\u003e0\u003c/sallowspecific\u003e\n\t\t\t\t\u003cshowmethod\u003e0\u003c/showmethod\u003e\n\t\t\t\t\u003cspecificerrmsg\u003e\u003c![CDATA[The Bangla Courier shipping method is not available. To use this shipping method, please contact us.]]\u003e\u003c/specificerrmsg\u003e\n\t\t\t\t\u003csort_order\u003e10\u003c/sort_order\u003e\n\t\t\t\t\u003cmodel\u003eBDC\\BanglaCourier\\Model\\Carrier\\BanglaCourier\u003c/model\u003e\n\n\t\t\t\t\u003c!-- The \"Untracked Bangla Mail\" specific options --\u003e\n\t\t\t\t\u003cbanglacourierstandard\u003e\n\t\t\t\t\t\u003ctitle\u003e\u003c![CDATA[BanglaCourier Standard]]\u003e\u003c/title\u003e\n\t\t\t\t\t\u003cshippingcost\u003e4.99\u003c/shippingcost\u003e\n\t\t\t\t\u003c/banglacourierstandard\u003e\n\n\t\t\t\t\u003c!-- The \"Parcel Force 48hr\" specific options --\u003e\n\t\t\t\t\u003cbanglacourier48hr\u003e\n\t\t\t\t\t\u003ctitle\u003e\u003c![CDATA[BanglaCourier 48h]]\u003e\u003c/title\u003e\n\t\t\t\t\t\u003cshippingcost\u003e9.99\u003c/shippingcost\u003e\n\t\t\t\t\u003c/banglacourier48hr\u003e\n\n\t\t\t\u003c/banglacourier\u003e\n\t\t\u003c/carriers\u003e\n\t\u003c/default\u003e\n\u003c/config\u003e\n\n```\n- create app/code/BDC/BanglaCourier/etc/adminhtml/system.xml\n```\n\u003c?xml version=\"1.0\" ?\u003e\n\u003cconfig xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:magento:module:Magento_Config:etc/system_file.xsd\"\u003e\n\t\u003csystem\u003e\n\t\t\u003csection id=\"carriers\"\u003e\n\t\t\t\u003cgroup id=\"banglacourier\" showInDefault=\"1\" showInStore=\"1\" showInWebsite=\"1\" sortOrder=\"1\" translate=\"label\"\u003e\n\t\t\t\t\u003clabel\u003eBangla Courier Shipping\u003c/label\u003e\n\t\t\t\t\u003c!-- General shipping carrier options --\u003e\n\t\t\t\t\u003cfield id=\"active\" showInDefault=\"1\" showInStore=\"1\" showInWebsite=\"1\" sortOrder=\"10\" translate=\"label\" type=\"select\"\u003e\n\t\t\t\t\t\u003clabel\u003eEnabled\u003c/label\u003e\n\t\t\t\t\t\u003csource_model\u003eMagento\\Config\\Model\\Config\\Source\\Yesno\u003c/source_model\u003e\n\t\t\t\t\u003c/field\u003e\n\n\t\t\t\t\u003cfield id=\"title\" showInDefault=\"1\" showInStore=\"1\" showInWebsite=\"1\" sortOrder=\"20\" translate=\"label\" type=\"text\"\u003e\n\t\t\t\t\t\u003clabel\u003eTitle\u003c/label\u003e\n\t\t\t\t\u003c/field\u003e\n\n\t\t\t\t\u003cfield id=\"sallowspecific\" showInDefault=\"1\" showInStore=\"1\" showInWebsite=\"1\" sortOrder=\"30\" translate=\"label\" type=\"select\"\u003e\n\t\t\t\t\t\u003clabel\u003eShip to Applicable Countries\u003c/label\u003e\n\t\t\t\t\t\u003cfrontend_class\u003eshipping-applicable-country\u003c/frontend_class\u003e\n\t\t\t\t\t\u003csource_model\u003eMagento\\Shipping\\Model\\Config\\Source\\Allspecificcountries\u003c/source_model\u003e\n\t\t\t\t\u003c/field\u003e\n\n\t\t\t\t\u003cfield id=\"specificcountry\" showInDefault=\"1\" showInStore=\"1\" showInWebsite=\"1\" sortOrder=\"40\" translate=\"label\" type=\"multiselect\"\u003e\n\t\t\t\t\t\u003clabel\u003eShip to Specific Countries\u003c/label\u003e\n\t\t\t\t\t\u003ccan_be_empty\u003e1\u003c/can_be_empty\u003e\n\t\t\t\t\t\u003csource_model\u003eMagento\\Directory\\Model\\Config\\Source\\Country\u003c/source_model\u003e\n\t\t\t\t\u003c/field\u003e\n\n\t\t\t\t\u003cfield id=\"showmethod\" translate=\"label\" type=\"select\" sortOrder=\"41\" showInDefault=\"1\" showInWebsite=\"1\" showInStore=\"0\"\u003e\n\t\t\t\t\t\u003clabel\u003eShow Method if Not Applicable\u003c/label\u003e\n\t\t\t\t\t\u003csource_model\u003eMagento\\Config\\Model\\Config\\Source\\Yesno\u003c/source_model\u003e\n\t\t\t\t\t\u003cfrontend_class\u003eshipping-skip-hide\u003c/frontend_class\u003e\n\t\t\t\t\u003c/field\u003e\n\n\t\t\t\t\u003cfield id=\"specificerrmsg\" showInDefault=\"1\" showInStore=\"1\" showInWebsite=\"1\" sortOrder=\"50\" translate=\"label\" type=\"textarea\"\u003e\n\t\t\t\t\t\u003clabel\u003eDisplayed Error Message\u003c/label\u003e\n\t\t\t\t\u003c/field\u003e\n\n\t\t\t\t\u003cfield id=\"sort_order\" showInDefault=\"1\" showInStore=\"1\" showInWebsite=\"1\" sortOrder=\"51\" translate=\"label\" type=\"text\"\u003e\n\t\t\t\t\t\u003clabel\u003eSort Order\u003c/label\u003e\n\t\t\t\t\t\u003cvalidate\u003evalidate-number validate-zero-or-greater\u003c/validate\u003e\n\t\t\t\t\u003c/field\u003e\n\n\t\t\t\t\u003c!-- The \"BanglaCourier Standard\" specific options --\u003e\n\t\t\t\t\u003cgroup id=\"banglacourierstandard\" showInDefault=\"1\" showInStore=\"1\" showInWebsite=\"1\" sortOrder=\"110\" translate=\"label\"\u003e\n\t\t\t\t\t\u003clabel\u003e\u003c![CDATA[The \"BanglaCourier Standard\" shipping method]]\u003e\u003c/label\u003e\n\t\t\t\t\t\u003cfieldset_css\u003ecomplex\u003c/fieldset_css\u003e\n\t\t\t\t\t\u003cfield id=\"title\" type=\"text\" sortOrder=\"10\" showInDefault=\"1\" showInWebsite=\"1\" showInStore=\"1\"\u003e\n\t\t\t\t\t\t\u003clabel\u003e\u003c![CDATA[Title]]\u003e\u003c/label\u003e\n\t\t\t\t\t\u003c/field\u003e\n\n\t\t\t\t\t\u003cfield id=\"shippingcost\" type=\"text\" sortOrder=\"20\" showInDefault=\"1\" showInWebsite=\"1\" showInStore=\"1\"\u003e\n\t\t\t\t\t\t\u003clabel\u003e\u003c![CDATA[Shipping Cost]]\u003e\u003c/label\u003e\n\t\t\t\t\t\t\u003cvalidate\u003evalidate-number validate-zero-or-greater\u003c/validate\u003e\n\t\t\t\t\t\u003c/field\u003e\n\t\t\t\t\u003c/group\u003e\n\n                \u003c!-- The  \"BanglaCourier 48h\" specific options --\u003e\n\t\t\t\t\u003cgroup id=\"banglacourier48hr\" showInDefault=\"1\" showInStore=\"1\" showInWebsite=\"1\" sortOrder=\"120\" translate=\"label\"\u003e\n\t\t\t\t\t\u003clabel\u003e\u003c![CDATA[The \"BanglaCourier 48h\" shipping method]]\u003e\u003c/label\u003e\n\t\t\t\t\t\u003cfieldset_css\u003ecomplex\u003c/fieldset_css\u003e\n\t\t\t\t\t\u003cfield id=\"title\" type=\"text\" sortOrder=\"10\" showInDefault=\"1\" showInWebsite=\"1\" showInStore=\"1\"\u003e\n\t\t\t\t\t\t\u003clabel\u003e\u003c![CDATA[Title]]\u003e\u003c/label\u003e\n\t\t\t\t\t\u003c/field\u003e\n\n\t\t\t\t\t\u003cfield id=\"shippingcost\" type=\"text\" sortOrder=\"20\" showInDefault=\"1\" showInWebsite=\"1\" showInStore=\"1\"\u003e\n\t\t\t\t\t\t\u003clabel\u003e\u003c![CDATA[Shipping Cost]]\u003e\u003c/label\u003e\n\t\t\t\t\t\t\u003cvalidate\u003evalidate-number validate-zero-or-greater\u003c/validate\u003e\n\t\t\t\t\t\u003c/field\u003e\n\t\t\t\t\u003c/group\u003e\n\n\t\t\t\u003c/group\u003e\n\t\t\u003c/section\u003e\n\t\u003c/system\u003e\n\u003c/config\u003e\n\n```\n- create app/code/BDC/BanglaCourier/Model/Carrier/BanglaCourier.php\n```\n\u003c?php\n\nnamespace BDC\\BanglaCourier\\Model\\Carrier;\n\nclass BanglaCourier extends \\Magento\\Shipping\\Model\\Carrier\\AbstractCarrier implements\n    \\Magento\\Shipping\\Model\\Carrier\\CarrierInterface {\n    const CARRIER_CODE = 'banglacourier';\n    const BANGLA_COURIER_STANDARD = 'banglacourierstandard';\n    const BANGLA_COURIER_48HR = 'banglacourier48hr';\n\n    protected $_code = self::CARRIER_CODE;\n    protected $_isFixed = true;\n    protected $_rateResultFactory;\n    protected $_rateMethodFactory;\n\n    /**\n     * Constructor\n     *\n     * @param \\Magento\\Framework\\App\\Config\\ScopeConfigInterface $scopeConfig\n     * @param \\Magento\\Quote\\Model\\Quote\\Address\\RateResult\\ErrorFactory $rateErrorFactory\n     * @param \\Psr\\Log\\LoggerInterface $logger\n     * @param \\Magento\\Shipping\\Model\\Rate\\ResultFactory $rateResultFactory\n     * @param \\Magento\\Quote\\Model\\Quote\\Address\\RateResult\\MethodFactory $rateMethodFactory\n     * @param array $data\n     */\n    public function __construct(\n        \\Magento\\Framework\\App\\Config\\ScopeConfigInterface $scopeConfig,\n        \\Magento\\Quote\\Model\\Quote\\Address\\RateResult\\ErrorFactory $rateErrorFactory,\n        \\Psr\\Log\\LoggerInterface $logger,\n        \\Magento\\Shipping\\Model\\Rate\\ResultFactory $rateResultFactory,\n        \\Magento\\Quote\\Model\\Quote\\Address\\RateResult\\MethodFactory $rateMethodFactory,\n        array $data = []\n    ){\n        $this-\u003e_rateResultFactory = $rateResultFactory;\n        $this-\u003e_rateMethodFactory = $rateMethodFactory;\n        parent::__construct($scopeConfig, $rateErrorFactory, $logger, $data);\n    }\n\n    /**\n     * {@inheritdoc}\n     */\n    public function collectRates(\\Magento\\Quote\\Model\\Quote\\Address\\RateRequest $request){\n        if (!$this-\u003egetConfigFlag('active')) {\n            return false;\n        }\n        // $request-\u003egetPackageWeight();\n        // $request-\u003egetPackageValue()\n\n        // Init result object\n        $result = $this-\u003e_rateResultFactory-\u003ecreate();\n        if ($request-\u003egetAllItems()) {\n            foreach ($request-\u003egetAllItems() as $item) {\n                if ($item-\u003egetProduct()-\u003eisVirtual() || $item-\u003egetParentItem()) {\n                    continue;\n                }\n                // todo: Any calculation/logic based on order items?\n            }\n        }\n\n        $method = $this-\u003e_rateMethodFactory-\u003ecreate();\n        $method-\u003esetCarrier($this-\u003e_code);\n        $method-\u003esetCarrierTitle($this-\u003egetConfigData('title'));\n        $method-\u003esetMethod(self::BANGLA_COURIER_STANDARD);\n        $method-\u003esetMethodTitle($this-\u003egetMethodTitle($method-\u003egetMethod()));\n        $method-\u003esetPrice($this-\u003egetMethodPrice($method-\u003egetMethod()));\n        $method-\u003esetCost($this-\u003egetMethodCost($method-\u003egetMethod()));\n        $method-\u003esetErrorMessage(__('The %1 method error message here.'));\n        $result-\u003eappend($method);\n\n        $method = $this-\u003e_rateMethodFactory-\u003ecreate();\n        $method-\u003esetCarrier($this-\u003e_code);\n        $method-\u003esetCarrierTitle($this-\u003egetConfigData('title'));\n        $method-\u003esetMethod(self::BANGLA_COURIER_48HR);\n        $method-\u003esetMethodTitle($this-\u003egetMethodTitle($method-\u003egetMethod()));\n        $method-\u003esetPrice($this-\u003egetMethodPrice($method-\u003egetMethod()));\n        $method-\u003esetCost($this-\u003egetMethodCost($method-\u003egetMethod()));\n        $method-\u003esetErrorMessage(__('The %1 method error message here.'));\n        $result-\u003eappend($method);\n\n        return $result;\n    }\n\n    /**\n     * This method is used in \\Magento\\Shipping\\Model\\Config\\Source\\Allmethods::toOptionArray()\n     *\n     * Which in turn is used with:\n     * (1) Sales/cart rule condition, see https://goo.gl/goUKzU.\n     * (2) Stores \u003e Configuration \u003e Sales \u003e Clean Checkout \u003e General \u003e Default Shipping Method, see https://goo.gl/66aopF\n     *\n     * @return array\n     */\n    public function getAllowedMethods(){\n        return [\n            self::BANGLA_COURIER_STANDARD =\u003e $this-\u003egetConfigData(self::BANGLA_COURIER_STANDARD . '/title'),\n            self::BANGLA_COURIER_48HR =\u003e $this-\u003egetConfigData(self::BANGLA_COURIER_48HR . '/title'),\n        ];\n    }\n\n\n    /**\n     * @param $method\n     * @return false|string\n     */\n    private function getMethodTitle($method){\n        return $this-\u003egetConfigData($method . '/title');\n    }\n\n    /**\n     * @param $method\n     * @return false|string\n     */\n    private function getMethodPrice($method){\n        return $this-\u003egetMethodCost($method);\n    }\n\n    /**\n     * @param $method\n     * @return false|string\n     */\n    private function getMethodCost($method){\n        return $this-\u003egetConfigData($method . '/shippingcost');\n    }\n}\n\n```\n\n\n\n- Admin Panel Sales \u0026 Shipping section Show as below:\n![](docs/BanglaCourierAdmin1.png)\n![](docs/BanglaCourierAdmin2.png)\n\n- The Order Summary section of the Review \u0026 Payments step should also reflect on the method\nselected in the Shipping step, as follows:\n\n![](docs/BanglaShippingChkout.png)\n\n\n## Ref\n- [Devdocs](https://devdocs.magento.com/guides/v2.3/howdoi/checkout/checkout-add-custom-carrier.html)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbdcrops%2Fmodule-banglacourier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbdcrops%2Fmodule-banglacourier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbdcrops%2Fmodule-banglacourier/lists"}