TransWikia.com

Get matrixrate config programatically

Magento Asked by pevik on December 14, 2020

I need to get shipping price programatically. I thought I’d use something like this (inspiration):

$scopeConfig = $objectManager->get('MagentoFrameworkAppConfigScopeConfigInterface');
$activeCarriers = $objectManager->create('MagentoShippingModelConfig')->getActiveCarriers();

foreach($activeCarriers as $carrierCode => $carrierModel) {
    $options = array();

    if ($carrierMethods = $carrierModel->getAllowedMethods()) {
        foreach ($carrierMethods as $methodCode => $method) {
            $code = $carrierCode.'_'.$methodCode;
            $options[] = array('value'=>$code,'label'=>$method);
        }
        $carrierTitle = $scopeConfig->getValue('carriers/' . $carrierCode . '/title');
    }

    $methods[] = array('value' => $options, 'label' => $carrierTitle);
}

But that does not help much, because I know which shipping methods I’m using. I just need to know details of WebShopApps Matrix Rate which has been saved in webshopapps_matrixrate table. I.E. I need just the content of the SQL:

select * from webshopapps_matrixrate where website_id = ID;

I also see records with path = carriers/matrixrate/import in core_config_data, but that does not help much (value = 1590180257,matrixrates.csv,text/csv,/tmp/php7BEvw0,0,361).

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP