Перейти к содержимому


Купить в кредит, Купить в рассрочку от Tinkoff (В зависимости от модификации)


  • Авторизуйтесь для ответа в теме
В этой теме нет ответов

#1 metry

metry

    Активный участник

  • Модераторы
  • 884 сообщений

Отправлено 21 Март 2022 - 18:02

Необходимо создать новый вариант оплаты "Мой способ оплаты" и назвать его, например, "Купить в кредит", далее в админ панели - Сайт - Редактор шаблонов - шаблон "Товар" найдите код:


<input type="hidden" name="form[goods_mod_id]" value="{GOODS_MOD_ID}" class="goodsDataMainModificationId" />
<button type="submit" class="add-cart button" title="Положить &laquo;{GOODS_NAME}&raquo; в корзину"/>В корзину</button>
<button type="submit" class="add-cart quick button" title="Положить &laquo;{GOODS_NAME}&raquo; в корзину"/>Быстрый заказ</button>

заменить на:

<input type="hidden" name="form[goods_mod_id]" value="{GOODS_MOD_ID}" class="goodsDataMainModificationId" />
<button type="submit" class="add-cart button" title="Положить &laquo;{GOODS_NAME}&raquo; в корзину"/>В корзину</button>
<button type="submit" class="add-cart quick button" title="Положить &laquo;{GOODS_NAME}&raquo; в корзину"/>Быстрый заказ</button>
<div class="TinkoffPayment">

<script>
function showCredit(){
let GOODS_PRICE = $('.goodsDataMainModificationPriceNow').first().find('.price .num').text().replace(/\s/g, '');
let GOODS_QUANTITY = $('[name="form[goods_mod_quantity]"]').val();
tinkoff.create(
{
sum: GOODS_PRICE * GOODS_QUANTITY,
items: [{name: '{GOODS_NAME}', price: GOODS_PRICE * GOODS_QUANTITY, quantity: GOODS_QUANTITY}],
demoFlow: 'sms',
promoCode: 'default',
shopId: 'test_online',
showcaseId: 'test_online',
});
}
</script>
<script>
function showInstallment(){
let GOODS_PRICE = $('.goodsDataMainModificationPriceNow').first().find('.price .num').text().replace(/\s/g, '');
let GOODS_QUANTITY = $('[name="form[goods_mod_quantity]"]').val();
tinkoff.create(
{
sum: GOODS_PRICE * GOODS_QUANTITY,
items: [{name: '{GOODS_NAME}', price: GOODS_PRICE * GOODS_QUANTITY, quantity: GOODS_QUANTITY}],
demoFlow: 'sms',
promoCode: 'installment_0_0_6_5',
shopId: 'test_online',
showcaseId: 'test_online',
});
}
</script>

<div class="credit" >
<button class="TINKOFF_BTN_YELLOW TINKOFF_SIZE_M one" type="button" onclick="showCredit()">Купить в кредит</button>
<button class="TINKOFF_BTN_YELLOW TINKOFF_SIZE_M" type="button" onclick="showInstallment()">Купить в рассрочку</button>
</div>

<script src="https://forma.tinkoff.ru/static/onlineScript.js"></script>

<style>
.credit{margin:1px 0px; width: 100%; display: flex;}
.TINKOFF_SIZE_L {min-height: 64px;font-size: 15px; line-height: 24px;width: 50%;}
.TINKOFF_BTN_YELLOW.TINKOFF_SIZE_M {border-radius: 0px;min-width: 183px;}
.TINKOFF_BTN_YELLOW.TINKOFF_SIZE_M.one{border-right: 1px solid #fff; margin-right: 10px; min-width: 153px;}

@media all and (max-width: 481px) {
.TINKOFF_SIZE_L {min-height: 20px;font-size: 14px; line-height: 20px;width: 100%;}
.credit {width: 100%;display: block; float:left;}
.TINKOFF_BTN_YELLOW.TINKOFF_SIZE_M.one{border-right: 1px solid #fff;margin-bottom: 1px;}
}
</style>
</div>

— в последнем вставленном коде вместо test_online свое задайте значение ShopId и ShowcaseId . Уникальный идентификатор магазина shopId выдается магазину при подключении персональным менеджером банка . Более подробную информацию о привлечении виджета можно найти здесь .

Результат: credit.png


Далее необходимо открыть шаблон "Просмотр заказа" и найдите :

{% IF ORDER_PAYMENT_STEP_ENABLE %}
	 <!-- Здесь джаз дополнительные данные, необходимые для заполнения клиентом -->
	 {PAYMENT_FORM_TBODY}
{% КОНЕЦ %}
<!-- END методы оплаты онлайн -->
</table>

после него вставьте:

{% IF ORDER_PAYMENT_ID = 492980 %}
<script src="https://forma.tinkoff.ru/static/onlineScript.js"></script>

	 <div class="credit table-box" >
	 <div class="one">
			 <button
			 type="button"
			 class="TINKOFF_BTN_YELLOW TINKOFF_SIZE_L one"
			 onclick="tinkoff.create(
			 {
					 sum: {ORDER_SUM},
					 items: [ {% FOR order_lines %} { name: '{order_lines.NAME}', price: {order_lines.LINE_SUM}, quantity: {order_lines.QUANTITY} } , {%ENDFOR%}],
					 demoFlow: 'sms',
					 promoCode: 'default',
					 shopId: 'test_online',
					 showcaseId: 'test_online',
			 },
			 {view: 'modal'}
			 )"
			 >Оплатить в кредит</button>
	 </div>
	 <div class="two">
		 <button
		 type="button"
		 class="TINKOFF_BTN_YELLOW TINKOFF_SIZE_L"
		 onclick="tinkoff.create(
		 {
			 sum: {ORDER_SUM},
			 items: [ {% FOR order_lines %} { name: '{order_lines.NAME}', price: {order_lines.LINE_SUM}, quantity: {order_lines.QUANTITY} } , {%ENDFOR%}],
			 demoFlow: 'sms',
			 promoCode: 'installment_0_0_6_5',
			 shopId: 'test_online',
			 showcaseId: 'test_online',
		 },
		 {view: 'modal'}
		 )"
		 >Оплатить в рассрочку</button>
	 </div>
	 </div>
	
	 <style>
		 .credit.table-box div {width: 50%; }
		 .credit.table-box div.one {text-align: end; margin-right: 5px;}
		 .credit.table-box div.two {text-align: start; margin-left: 5px;}
		 .credit.table-box { display: flex; flex-direction: row;flex-wrap: nowrap; justify-content: center; align-items: center; align-content: center;}
		
		 @media all and (max-width: 481px) {
		 .credit.table-box { display: flex; flex-direction: column;}
		 .credit.table-box div.one {text-align: end; margin-bottom: 10px;}
		 .credit.table-box div {width: 100%; text-align: center; }
		 .credit.table-box div.one {text-align: center; margin-right: 0px;}
		 .credit.table-box div.two {text-align: center; margin-left: 0px;}
		 }
	
	 </style>
	
{% ENDIF %}


- в вставленном коде число 492980 это идентификатор платежа. Данный идентификатор Вам необходимо заменить на свой. Его можно посмотреть в Админ панели - Настройки - Оплата - Выбрать пункт как в подъеме "купить в кредит" в конце адресной строки будет ваш идентификатор.




Количество пользователей, читающих эту тему: 0

0 пользователей, 0 гостей, 0 анонимных