esaticsas / interservice
Interservice, Interservicios s.a.s 的运输方式
1.0.0
2022-12-12 15:30 UTC
Requires
- php: ~7.3.0||~7.4.0
- ext-json: *
- ext-soap: *
- esatic/dropdowncity: ^1.0
- magento/framework: 103.0.*
- magento/module-backend: 102.0.*
- magento/module-catalog: 104.0.*
- magento/module-catalog-inventory: 100.4.*
- magento/module-config: 101.2.*
- magento/module-directory: 100.4.*
- magento/module-quote: 101.2.*
- magento/module-sales: 103.0.*
- magento/module-shipping: 100.4.*
- magento/module-store: 101.1.*
README
- Interservice / Interservicios 的运输方式
要求
- Magento 2.x
- php 7.3, 7.4
- Composer
安装
composer require esaticsas/interservice
启用模块
bin/magento module:enable Eadesigndev_Eacore bin/magento module:enable Eadesigndev_RomCity bin/magento module:enable Esaticsas_DropdownCity bin/magento module:enable Esaticsas_Interservice bin/magento setup:upgrade bin/magento setup:di:compile bin/magento cache:clean bin/magento cache:flush
配置
- 要安装此扩展,请使用 composer,然后转到 Admin → Store → Configuration → Sales → Shipping Methods → Interservice / Interservicios
使用您自定义模块的城市下拉菜单
- 覆盖 GetCityCodes
<?php namespace YourVendor\YourModule\Model; class GetCityCode implements \Esaticsas\Interservice\Model\GetCityCodeInterface{ /** * Get city code for use in shipping method * @param string $regionId * @param string $city the city name for search * @return string|null * @throws \Exception if the city has not been found */ public function execute(string $regionId, string $city): ?string{ //Here return your city code return '1234567'; } }
- 在 etc/di.xml 中添加实现
<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <preference for="Esaticsas\Interservice\Model\GetCityCodeInterface" type="YourVendor\YourModule\Model\GetCityCode"/> </config>
- 最后
bin/magento setup:di:compile