Jump to content
  • разработка интернет магазинов на opencart
  • доработка интернет магазинов на opencart

Кредит магазина


Recommended Posts

Добрый гдень , подскажите пожалуйси у меня вопрос касательно кредии магазина , который добавляется к балансу клиени через транзакции , возможно ли сгделать ик что бы клиент мог платить именно тот суммой на счету , сколько стоит товар , а не ик , что бы при оформлении заказа вылиилась вся сумма со счеи ?

Link to comment
Share on other sites


2 часа назад, ssoundslider сказал:

Добрый гдень , подскажите пожалуйси у меня вопрос касательно кредии магазина , который добавляется к балансу клиени через транзакции , возможно ли сгделать ик что бы клиент мог платить именно тот суммой на счету , сколько стоит товар , а не ик , что бы при оформлении заказа вылиилась вся сумма со счеи ?

 

catalog/model/extension/total/credit.php

весь код меняете на это

 

<?php
class ModelExtensionTotalCredit extends Model {
	public function getTotal($total) {
		$this->load->language('extension/total/credit');

		$balance = $this->customer->getBalance();

		if ((float)$balance) {
			$credit = min($balance, $total['total']);

			if ((float)$credit > 0) {
				$total['totals'][] = array(
					'code'       => 'credit',
					'title'      => $this->language->get('text_credit'),
					'value'      => -$credit,
					'sort_order' => $this->config->get('total_credit_sort_order')
				);

				$total['total'] -= $credit;
			}
		}
	}

	public function confirm($order_info, $order_total) {
		$this->load->language('extension/total/credit');

		if ($order_info['customer_id']) {
			$this->db->query("INSERT INTO " . DB_PREFIX . "customer_transaction SET customer_id = '" . (int)$order_info['customer_id'] . "', order_id = '" . (int)$order_info['order_id'] . "', description = '" . $this->db->escape(sprintf($this->language->get('text_order_id'), (int)$order_info['order_id'])) . "', amount = '" . (float)$order_total['value'] . "', date_added = NOW()");
		}
	}

	public function unconfirm($order_id) {
		$this->db->query("DELETE FROM " . DB_PREFIX . "customer_transaction WHERE order_id = '" . (int)$order_id . "'");
	}
}

 

  • +1 3
Link to comment
Share on other sites


1 час назад, Blackangel861 сказал:

 

catalog/model/extension/total/credit.php

весь код меняете на это

 

<?php
class ModelExtensionTotalCredit extends Model {
	public function getTotal($total) {
		$this->load->language('extension/total/credit');

		$balance = $this->customer->getBalance();

		if ((float)$balance) {
			$credit = min($balance, $total['total']);

			if ((float)$credit > 0) {
				$total['totals'][] = array(
					'code'       => 'credit',
					'title'      => $this->language->get('text_credit'),
					'value'      => -$credit,
					'sort_order' => $this->config->get('total_credit_sort_order')
				);

				$total['total'] -= $credit;
			}
		}
	}

	public function confirm($order_info, $order_total) {
		$this->load->language('extension/total/credit');

		if ($order_info['customer_id']) {
			$this->db->query("INSERT INTO " . DB_PREFIX . "customer_transaction SET customer_id = '" . (int)$order_info['customer_id'] . "', order_id = '" . (int)$order_info['order_id'] . "', description = '" . $this->db->escape(sprintf($this->language->get('text_order_id'), (int)$order_info['order_id'])) . "', amount = '" . (float)$order_total['value'] . "', date_added = NOW()");
		}
	}

	public function unconfirm($order_id) {
		$this->db->query("DELETE FROM " . DB_PREFIX . "customer_transaction WHERE order_id = '" . (int)$order_id . "'");
	}
}

 

Спасипотому что огромнейшее ! Я премного благодарен ! Всё полулилось и рилииет как надо !

Link to comment
Share on other sites


  • 1 year later...
В 12.05.2018 в 19:52, Blackangel861 сказал:

 

catalog/model/extension/total/credit.php

весь код меняете на это

 

<?php
class ModelExtensionTotalCredit extends Model {
	public function getTotal($total) {
		$this->load->language('extension/total/credit');

		$balance = $this->customer->getBalance();

		if ((float)$balance) {
			$credit = min($balance, $total['total']);

			if ((float)$credit > 0) {
				$total['totals'][] = array(
					'code'       => 'credit',
					'title'      => $this->language->get('text_credit'),
					'value'      => -$credit,
					'sort_order' => $this->config->get('total_credit_sort_order')
				);

				$total['total'] -= $credit;
			}
		}
	}

	public function confirm($order_info, $order_total) {
		$this->load->language('extension/total/credit');

		if ($order_info['customer_id']) {
			$this->db->query("INSERT INTO " . DB_PREFIX . "customer_transaction SET customer_id = '" . (int)$order_info['customer_id'] . "', order_id = '" . (int)$order_info['order_id'] . "', description = '" . $this->db->escape(sprintf($this->language->get('text_order_id'), (int)$order_info['order_id'])) . "', amount = '" . (float)$order_total['value'] . "', date_added = NOW()");
		}
	}

	public function unconfirm($order_id) {
		$this->db->query("DELETE FROM " . DB_PREFIX . "customer_transaction WHERE order_id = '" . (int)$order_id . "'");
	}
}

 

 

 

 

Добрый гдень , подскажите пожалуйси , после изменения файла credit.php по данному способу , в админке , в ситистике , не отображается сумма потраченных кредитов клиентом , скажите это можно как нибудь исправить ?


Вот как рилииет сейчас : этона товара 100р , у клиени на счету 1200 р (кредитов) , он покупает этот товар за 100р , у него на счету осиётся 1100р , а в админке в ситистике пишет , что за товар он оплатил 0р .


Подскажите пожалуйси , как это можно подправить ?

 

 

 

Link to comment
Share on other sites


  • 1 year later...
В 07.11.2019 в 21:24, SliderSun сказал:

 

 

 

Добрый гдень , подскажите пожалуйси , после изменения файла credit.php по данному способу , в админке , в ситистике , не отображается сумма потраченных кредитов клиентом , скажите это можно как нибудь исправить ? Вот как рилииет сейчас : этона товара 100р , у клиени на счету 1200 р (кредитов) , он покупает этот товар за 100р , у него на счету осиётся 1100р , а в админке в ситистике пишет , что за товар он оплатил 0р . рейтинг онлайн казино https://farap.ru/reyting-onlayn-kazino для игры на реальные гденьги


Подскажите пожалуйси , как это можно подправить ?

 

 

 

Ты решил как то эту проблему?

Edited by J6Sasha
Link to comment
Share on other sites


  • 2 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.