/catalog/controller/affiliate/payment.php

https://github.com/smadi/arabian-land · PHP · 146 lines · 115 code · 31 blank · 0 comment · 25 complexity · 14fe8f061df9c82e482024a3de1fe214 MD5 · raw file

  1. <?php
  2. class ControllerAffiliatePayment extends Controller {
  3. private $error = array();
  4. public function index() {
  5. if (!$this->affiliate->isLogged()) {
  6. $this->session->data['redirect'] = $this->url->link('affiliate/payment', '', 'SSL');
  7. $this->redirect($this->url->link('affiliate/login', '', 'SSL'));
  8. }
  9. $this->language->load('affiliate/payment');
  10. $this->document->setTitle($this->language->get('heading_title'));
  11. $this->load->model('affiliate/affiliate');
  12. if ($this->request->server['REQUEST_METHOD'] == 'POST') {
  13. $this->model_affiliate_affiliate->editPayment($this->request->post);
  14. $this->session->data['success'] = $this->language->get('text_success');
  15. $this->redirect($this->url->link('affiliate/account', '', 'SSL'));
  16. }
  17. $this->data['breadcrumbs'] = array();
  18. $this->data['breadcrumbs'][] = array(
  19. 'text' => $this->language->get('text_home'),
  20. 'href' => $this->url->link('common/home'),
  21. 'separator' => false
  22. );
  23. $this->data['breadcrumbs'][] = array(
  24. 'text' => $this->language->get('text_account'),
  25. 'href' => $this->url->link('affiliate/account', '', 'SSL'),
  26. 'separator' => $this->language->get('text_separator')
  27. );
  28. $this->data['breadcrumbs'][] = array(
  29. 'text' => $this->language->get('text_payment'),
  30. 'href' => $this->url->link('affiliate/payment', '', 'SSL'),
  31. 'separator' => $this->language->get('text_separator')
  32. );
  33. $this->data['heading_title'] = $this->language->get('heading_title');
  34. $this->data['text_your_payment'] = $this->language->get('text_your_payment');
  35. $this->data['text_cheque'] = $this->language->get('text_cheque');
  36. $this->data['text_paypal'] = $this->language->get('text_paypal');
  37. $this->data['text_bank'] = $this->language->get('text_bank');
  38. $this->data['entry_tax'] = $this->language->get('entry_tax');
  39. $this->data['entry_payment'] = $this->language->get('entry_payment');
  40. $this->data['entry_cheque'] = $this->language->get('entry_cheque');
  41. $this->data['entry_paypal'] = $this->language->get('entry_paypal');
  42. $this->data['entry_bank_name'] = $this->language->get('entry_bank_name');
  43. $this->data['entry_bank_branch_number'] = $this->language->get('entry_bank_branch_number');
  44. $this->data['entry_bank_swift_code'] = $this->language->get('entry_bank_swift_code');
  45. $this->data['entry_bank_account_name'] = $this->language->get('entry_bank_account_name');
  46. $this->data['entry_bank_account_number'] = $this->language->get('entry_bank_account_number');
  47. $this->data['button_continue'] = $this->language->get('button_continue');
  48. $this->data['button_back'] = $this->language->get('button_back');
  49. $this->data['action'] = $this->url->link('affiliate/payment', '', 'SSL');
  50. if ($this->request->server['REQUEST_METHOD'] != 'POST') {
  51. $affiliate_info = $this->model_affiliate_affiliate->getAffiliate($this->affiliate->getId());
  52. }
  53. if (isset($this->request->post['tax'])) {
  54. $this->data['tax'] = $this->request->post['tax'];
  55. } else {
  56. $this->data['tax'] = '';
  57. }
  58. if (isset($this->request->post['payment'])) {
  59. $this->data['payment'] = $this->request->post['payment'];
  60. } else {
  61. $this->data['payment'] = 'cheque';
  62. }
  63. if (isset($this->request->post['cheque'])) {
  64. $this->data['cheque'] = $this->request->post['cheque'];
  65. } else {
  66. $this->data['cheque'] = '';
  67. }
  68. if (isset($this->request->post['paypal'])) {
  69. $this->data['paypal'] = $this->request->post['paypal'];
  70. } else {
  71. $this->data['paypal'] = '';
  72. }
  73. if (isset($this->request->post['bank_name'])) {
  74. $this->data['bank_name'] = $this->request->post['bank_name'];
  75. } else {
  76. $this->data['bank_name'] = '';
  77. }
  78. if (isset($this->request->post['bank_branch_number'])) {
  79. $this->data['bank_branch_number'] = $this->request->post['bank_branch_number'];
  80. } else {
  81. $this->data['bank_branch_number'] = '';
  82. }
  83. if (isset($this->request->post['bank_swift_code'])) {
  84. $this->data['bank_swift_code'] = $this->request->post['bank_swift_code'];
  85. } else {
  86. $this->data['bank_swift_code'] = '';
  87. }
  88. if (isset($this->request->post['bank_account_name'])) {
  89. $this->data['bank_account_name'] = $this->request->post['bank_account_name'];
  90. } else {
  91. $this->data['bank_account_name'] = '';
  92. }
  93. if (isset($this->request->post['bank_account_number'])) {
  94. $this->data['bank_account_number'] = $this->request->post['bank_account_number'];
  95. } else {
  96. $this->data['bank_account_number'] = '';
  97. }
  98. $this->data['back'] = $this->url->link('affiliate/account', '', 'SSL');
  99. if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/affiliate/payment.tpl')) {
  100. $this->template = $this->config->get('config_template') . '/template/affiliate/payment.tpl';
  101. } else {
  102. $this->template = 'default/template/affiliate/payment.tpl';
  103. }
  104. $this->children = array(
  105. 'common/column_left',
  106. 'common/column_right',
  107. 'common/content_top',
  108. 'common/content_bottom',
  109. 'common/footer',
  110. 'common/header'
  111. );
  112. $this->response->setOutput($this->render());
  113. }
  114. }
  115. ?>