カスタムmagento 1.9の拡張機能をmagento 2.2に移行しようとしています。私は多くの検索をしており、移行しようとしているユースケースに関する情報は見つけられません。私はもともと、拡張子が1.9の場合はthis tutorialでした。私はポート拡張を助けるツールがあると理解していますが、私はこのツールを私のために機能させることができないので、手動でこれをやろうとしています。Magento 1.9をMagento 2.2に移行する
カスタム配送料は、ショッピングカートを更新してカスタム送料を計算するたびに実行されます。目標は、ショッピングカートが開かれたり更新されるたびに、それが実行され、チェックアウトプロセスを通じて伝播する出荷コストを計算するように、Magento 2.2でこの拡張を再作成することです。
以下は、magento 1.9の拡張機能の概要です。これをMagento 2.2に翻訳する方法についてのアドバイスはありますか?
/app/etc/modules/Extensions_Shipper.xml
<?xml version="1.0"?>
<config>
<modules>
<Extensions_Shipper>
<active>true</active>
<codePool>local</codePool>
<depends>
<Mage_Shipping />
</depends>
</Extensions_Shipper>
</modules>
/app/code/local/Extensions/Shipper/etc/config.xml
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Extensions_Shipper>
<module>0.0.1</module>
</Extensions_Shipper>
</modules>
<global>
<models>
<extensions_shipper>
<class>Extensions_Shipper_Model</class>
</extensions_shipper>
</models>
</global>
<default>
<carriers>
<extensions_shipper>
<active>1</active>
<model>extensions_shipper/carrier</model>
<title>Shipping Options</title>
<sort_order>10</sort_order>
<sallowspecific>0</sallowspecific>
</extensions_shipper>
</carriers>
</default>
/app/code/local/Extensions/Shipper/Model/Carrier.php
<?php
class Extensions_Shipper_Model_Carrier extends Mage_Shipping_Model_Carrier_Abstract implements Mage_Shipping_Model_Carrier_Interface
{
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
{
//Are there magento 2.2 equivalence for the following?
$addressInfo = Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getData();
$result = Mage::getModel('shipping/rate_result');
$items = Mage::getSingleton('checkout/session')->getQuote()->getAllItems();
$currentItem = Mage::getModel('catalog/product')->load($items[$itemsArray[$i]]->getProduct()->getId());
Mage::getSingleton('core/session')->addNotice('some text');
//$result = some calculations for shipping rate
return $result;
}
public function getAllowedMethods()
{
return array();
}
}