Back to Opencart

File catalog\model\checkout\payment_method.php

docs/api/source-catalog.model.checkout.payment_method.html

4.1.0.34.6 KB
Original Source

Namespaces

Classes

| 1: | <?php | | 2: | namespace Opencart\Catalog\Model\Checkout; | | 3: | /** | | 4: | * Class PaymentMethod | | 5: | * | | 6: | * @package Opencart\Catalog\Model\Checkout | | 7: | */ | | 8: | class PaymentMethod extends \Opencart\System\Engine\Controller { | | 9: | /** | | 10: | * Get Methods | | 11: | * | | 12: | * @param array<string, mixed> $payment_address | | 13: | * | | 14: | * @return array<string, mixed> | | 15: | */ | | 16: | public function getMethods(array $payment_address = []): array { | | 17: | $method_data = []; | | 18: | | | 19: | $this->load->model('setting/extension'); | | 20: | | | 21: | $results = $this->model_setting_extension->getExtensionsByType('payment'); | | 22: | | | 23: | foreach ($results as $result) { | | 24: | if ($this->config->get('payment_' . $result['code'] . '_status')) { | | 25: | $this->load->model('extension/' . $result['extension'] . '/payment/' . $result['code']); | | 26: | | | 27: | if (is_callable([$this->{'model_extension_' . $result['extension'] . '_payment_' . $result['code']}, 'getMethods'])) { | | 28: | $payment_methods = $this->{'model_extension_' . $result['extension'] . '_payment_' . $result['code']}->getMethods($payment_address); | | 29: | | | 30: | if ($payment_methods) { | | 31: | $method_data[$result['code']] = $payment_methods; | | 32: | } | | 33: | } | | 34: | } | | 35: | } | | 36: | | | 37: | $sort_order = []; | | 38: | | | 39: | foreach ($method_data as $key => $value) { | | 40: | $sort_order[$key] = $value['sort_order']; | | 41: | } | | 42: | | | 43: | array_multisort($sort_order, SORT_ASC, $method_data); | | 44: | | | 45: | return $method_data; | | 46: | } | | 47: | } | | 48: | |

OpenCart API API documentation generated by ApiGen dev-master