/** * @param bool $all - return all available or only enabled steps * @return array */ public function getCheckoutSettings($all = false) { $all_steps = (include wa('shop')->getConfig()->getAppPath('lib/config/data/checkout.php')); // @todo: event to get all available steps from plugins if ($all) { return $all_steps; } $file = wa('shop')->getConfig()->getConfigPath('checkout.php', true, 'shop'); if (file_exists($file) && is_array($steps = (include $file))) { foreach ($steps as $step_id => &$step) { if (is_array($step)) { $step = $step + $all_steps[$step_id]; } elseif ($step) { $step = $all_steps[$step_id]; } else { unset($steps[$step_id]); } } } else { $steps = $all_steps; } $plugin_model = new shopPluginModel(); if (!$plugin_model->countByField('type', 'shipping') && isset($steps['shipping'])) { unset($steps['shipping']); } if (!$plugin_model->countByField('type', 'payment') && isset($steps['payment'])) { unset($steps['payment']); } reset($steps); return $steps; }