esaticsas/interservice

Interservice, Interservicios s.a.s 的运输方式

安装次数: 1

依赖关系: 0

建议者: 0

安全性: 0

星标: 0

关注者: 1

分支: 0

开放性问题: 0

类型:magento2-module

1.0.0 2022-12-12 15:30 UTC

This package is auto-updated.

Last update: 2024-09-12 19:22:25 UTC


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