Пример #1
0
 /**
  * @return Df_YandexMarket_Helper_Settings
  */
 private function getSettings()
 {
     /** @var Df_YandexMarket_Helper_Settings $result  */
     $result = df_cfg()->yandexMarket();
     df_assert($result instanceof Df_YandexMarket_Helper_Settings);
     return $result;
 }
Пример #2
0
/**
 * 2015-12-28
 * @param int|string|null|bool|IStore $store [optional]
 * @return string[]
 */
function df_country_codes_allowed($store = null)
{
    return df_csv_parse(df_cfg('general/country/allow', $store));
}
Пример #3
0
/**
 * 2016-03-14
 * @param O $order
 * @return string
 */
function df_order_shipping_title(O $order)
{
    /**
     * 2016-07-02
     * Метод @uses \Magento\Sales\Model\Order::getShippingMethod()
     * некорректно работает с параметром $asObject = true при отсутствии у заказа способа доставки
     * (такое может быть, в частности, когда заказ содержит только виртуальные товары):
     * list($carrierCode, $method) = explode('_', $shippingMethod, 2);
     * Здесь $shippingMethod равно null, что приводит к сбою
     * Notice: Undefined offset: 1 in app/code/Magento/Sales/Model/Order.php on line 1203
     * https://github.com/magento/magento2/blob/2.1.0/app/code/Magento/Sales/Model/Order.php#L1191-L1206
     * Поэтому сначала смотрим, имеется ли у заказа способ доставки,
     * вызывая @uses \Magento\Sales\Model\Order::getShippingMethod() с параметром $asObject = false:
     */
    /** @var string $result */
    $result = '';
    if ($order->getShippingMethod()) {
        /** @var string $code */
        $code = $order->getShippingMethod($asObject = true)['method'];
        if ($code) {
            $result = df_cfg(df_cc_path('carriers', $code, 'title'));
        }
    }
    return $result;
}
Пример #4
0
 /**
  * @param string|null $key [optional]
  * @param null|string|int|S|Store $s [optional]
  * @param mixed|callable $d [optional]
  * @return array|string|null|mixed
  */
 public function v($key = null, $s = null, $d = null)
 {
     return df_cfg($this->prefix() . '/' . ($key ?: df_caller_f()), $this->scope($s), $d);
 }
Пример #5
0
/**
 * 2016-07-04
 * «How to programmatically get the base currency's ISO code for a store?» https://mage2.pro/t/1841
 * @param null|string|int|ScopeA|Store|ConfigData|IConfigData|O|Q $scope [optional]
 * @return Currency
 */
function df_currency_base($scope = null)
{
    if ($scope instanceof O || $scope instanceof Q) {
        $scope = $scope->getStore();
    }
    /** @var string $code */
    $code = df_cfg(Currency::XML_PATH_CURRENCY_BASE, $scope);
    df_assert_string_not_empty($code);
    return df_currency($code);
}
Пример #6
0
/**
 * 2016-07-19
 * Портировал из Российской сборки Magento.
 * @param null|string|int|ScopeA|Store $scope [optional]
 * @return int[]
 */
function df_days_off($scope = null)
{
    return dfcf(function ($scope = null) {
        return df_csv_parse_int(str_replace('0', '7', df_cfg('general/locale/weekend', $scope)));
    }, func_get_args());
}