Save
2275
.vscode/ftp-kr.sync.cache.json
vendored
@@ -19,7 +19,7 @@
|
||||
|
||||
<div class="blockreassurance_product">
|
||||
{foreach from=$blocks item=$block key=$key}
|
||||
<div{if $block['type_link'] !== $LINK_TYPE_NONE && !empty($block['link'])} style="cursor:pointer;" onclick="window.open('{$block['link']}')"{/if}>
|
||||
<div class="item-{$key}" {if $block['type_link'] !== $LINK_TYPE_NONE && !empty($block['link'])} style="cursor:pointer;" onclick="window.open('{$block['link']}')"{/if}>
|
||||
<span class="item-product">
|
||||
{if $block['icon'] != 'undefined'}
|
||||
{if $block['custom_icon']}
|
||||
@@ -33,7 +33,7 @@
|
||||
<p class="block-title" style="color:{$textColor};">{$block['title']}</p>
|
||||
{else}
|
||||
<span class="block-title" style="color:{$textColor};">{$block['title']}</span>
|
||||
<p style="color:{$textColor};">{$block['description'] nofilter}</p>
|
||||
<p class="block-description" style="color:{$textColor};">{$block['description'] nofilter}</p>
|
||||
{/if}
|
||||
</div>
|
||||
{/foreach}
|
||||
|
||||
BIN
modules/raty/alior-kalkulator-guzik-old.gif
Normal file
|
After Width: | Height: | Size: 6.0 KiB |
BIN
modules/raty/alior-kalkulator-guzik.gif
Normal file
|
After Width: | Height: | Size: 3.6 KiB |
BIN
modules/raty/alior.gif
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
13
modules/raty/config_pl.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<module>
|
||||
<name>raty</name>
|
||||
<displayName><![CDATA[Raty]]></displayName>
|
||||
<version><![CDATA[1.5.12]]></version>
|
||||
<description><![CDATA[Moduł do obsługi rat Alior Banku.]]></description>
|
||||
<author><![CDATA[Alior Bank]]></author>
|
||||
<tab><![CDATA[payments_gateways]]></tab>
|
||||
<confirmUninstall><![CDATA[Czy jesteś pewien aby odinstalować ten moduł?]]></confirmUninstall>
|
||||
<is_configurable>1</is_configurable>
|
||||
<need_instance>1</need_instance>
|
||||
<limited_countries></limited_countries>
|
||||
</module>
|
||||
11
modules/raty/controllers/front/index.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../../../../');
|
||||
exit;
|
||||
35
modules/raty/controllers/front/payment.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
class RatyPaymentModuleFrontController extends ModuleFrontController
|
||||
{
|
||||
public $ssl = true;
|
||||
public $display_column_left = false;
|
||||
|
||||
/**
|
||||
* @see FrontController::initContent()
|
||||
*/
|
||||
public function initContent()
|
||||
{
|
||||
parent::initContent();
|
||||
|
||||
$cart = $this->context->cart;
|
||||
|
||||
if (!$this->module->checkAmount($cart->getOrderTotal())) {
|
||||
Tools::redirect('index.php?controller=order');
|
||||
}
|
||||
|
||||
//print_r($cart);die;
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'nbProducts' => $cart->nbProducts(),
|
||||
'cust_currency' => $cart->id_currency,
|
||||
'currencies' => $this->module->getCurrency((int)$cart->id_currency),
|
||||
'total' => $cart->getOrderTotal(true, Cart::BOTH),
|
||||
'this_path' => $this->module->getPathUri(),
|
||||
'this_path_bw' => $this->module->getPathUri(),
|
||||
'this_path_ssl' => Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/'.$this->module->name.'/'
|
||||
));
|
||||
|
||||
$this->setTemplate('payment_execution.tpl');
|
||||
}
|
||||
}
|
||||
44
modules/raty/controllers/front/validation.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
class RatyValidationModuleFrontController extends ModuleFrontController
|
||||
{
|
||||
|
||||
/**
|
||||
* @see FrontController::postProcess()
|
||||
*/
|
||||
public function postProcess()
|
||||
{
|
||||
$cart = $this->context->cart;
|
||||
|
||||
$customer = new Customer($cart->id_customer);
|
||||
if ($cart->id_customer == 0 || $cart->id_address_delivery == 0 || $cart->id_address_invoice == 0 || !$this->module->active) {
|
||||
Tools::redirect('index.php?controller=order&step=1');
|
||||
}
|
||||
|
||||
// Check that this payment option is still available in case the customer changed his address just before the end of the checkout process
|
||||
$authorized = false;
|
||||
foreach (Module::getPaymentModules() as $module) {
|
||||
if ($module['name'] == 'raty') {
|
||||
$authorized = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$authorized) {
|
||||
die($this->module->l('Metoda płatności jest niedostępna.', 'validation'));
|
||||
}
|
||||
|
||||
$customer = new Customer($cart->id_customer);
|
||||
if (!Validate::isLoadedObject($customer)) {
|
||||
Tools::redirect('index.php?controller=order&step=1');
|
||||
}
|
||||
|
||||
$currency = $this->context->currency;
|
||||
$total = (float) $cart->getOrderTotal(true, Cart::BOTH);
|
||||
|
||||
|
||||
$mailVars = array();
|
||||
$this->module->validateOrder($cart->id, Configuration::get('PS_OS_RATY'), $total, $this->module->displayName, null, $mailVars, (int) $currency->id, false, $customer->secure_key);
|
||||
|
||||
Tools::redirect('index.php?controller=order-confirmation&id_cart='.$cart->id.'&id_module='.$this->module->id.'&id_order='.$this->module->currentOrder.'&key='.$customer->secure_key);
|
||||
}
|
||||
}
|
||||
11
modules/raty/controllers/index.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../../../');
|
||||
exit;
|
||||
11
modules/raty/index.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../../../../');
|
||||
exit;
|
||||
BIN
modules/raty/logo.png
Normal file
|
After Width: | Height: | Size: 9.5 KiB |
BIN
modules/raty/logo.webp
Normal file
|
After Width: | Height: | Size: 4.9 KiB |
37
modules/raty/map.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* Mapping between Alior's categories and store's categories
|
||||
* Alior Category => Store's categories IDs eg. 'TKC_AGDD' => [1, 19, 33],
|
||||
*/
|
||||
|
||||
return [
|
||||
'TKC_AGDD' => [],
|
||||
'TKC_AGDM' => [],
|
||||
'TKC_AKCAUTO' => [],
|
||||
'TKC_BIZUT' => [],
|
||||
'TKC_DZIECIE' => [],
|
||||
'TKC_EDU' => [],
|
||||
'TKC_FOTO' => [],
|
||||
'TKC_INSTRMUZ' => [],
|
||||
'TKC_KOMP' => [],
|
||||
'TKC_MATBUD' => [],
|
||||
'TKC_MEBLE' => [1,2,42,43,44,45,46,47,48,77,78,131,60,61,63,64,65,66,67,68,69,70,71,72,73,74,75,76,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,117,118,119,120,121,122,123,124,125,126,127,128,129,130,132,133,134,135,136,137,138,139,140,141,142,143,144,145,115,116],
|
||||
'TKC_MOTO' => [],
|
||||
'TKC_NARZ' => [],
|
||||
'TKC_ODZIEZ' => [],
|
||||
'TKC_OGRO' => [],
|
||||
'TKC_OGRZEW' => [],
|
||||
'TKC_OKDZW' => [],
|
||||
'TKC_OPAL' => [],
|
||||
'TKC_OPROGR' => [],
|
||||
'TKC_PAKIE' => [],
|
||||
'TKC_RTV' => [],
|
||||
'TKC_SPORTREH' => [],
|
||||
'TKC_SPRZKOM' => [],
|
||||
'TKC_SYSTEKO' => [],
|
||||
'TKC_SZTUK' => [],
|
||||
'TKC_TELE' => [],
|
||||
'TKC_UBEZ' => [],
|
||||
'TKC_USLUGI' => [],
|
||||
'default' => 'TKC_MEBLE'
|
||||
];
|
||||
13
modules/raty/payment.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
/* SSL Management */
|
||||
$useSSL = true;
|
||||
|
||||
require('../../config/config.inc.php');
|
||||
Tools::displayFileAsDeprecated();
|
||||
|
||||
// init front controller in order to use Tools::redirect
|
||||
$controller = new FrontController();
|
||||
$controller->init();
|
||||
|
||||
Tools::redirect(Context::getContext()->link->getModuleLink('Raty', 'payment'));
|
||||
13
modules/raty/raty.css
Normal file
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
To change this license header, choose License Headers in Project Properties.
|
||||
To change this template file, choose Tools | Templates
|
||||
and open the template in the editor.
|
||||
*/
|
||||
/*
|
||||
Created on : 2016-10-18, 11:12:27
|
||||
Author : Kamil
|
||||
*/
|
||||
|
||||
#module-raty-payment ul.step li a,#module-raty-payment ul.step li span,#module-raty-payment ul.step li.step_current span,#module-raty-payment ul.step li.step_current_end span{
|
||||
font-size: 16px !important;
|
||||
}
|
||||
793
modules/raty/raty.php
Normal file
@@ -0,0 +1,793 @@
|
||||
<?php
|
||||
use PrestaShop\PrestaShop\Core\Payment\PaymentOption;
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
class Raty extends PaymentModule
|
||||
{
|
||||
protected $_html = '';
|
||||
protected $_postErrors = array();
|
||||
public $details;
|
||||
public $owner;
|
||||
public $address;
|
||||
public $extra_mail_vars;
|
||||
public $paymentUrl;
|
||||
public $kalkulatorUrl;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->name = 'raty';
|
||||
$this->tab = 'payments_gateways';
|
||||
$this->version = '1.5.12';
|
||||
$this->author = 'Alior Bank';
|
||||
|
||||
$this->bootstrap = true;
|
||||
$this->is_eu_compatible = 1;
|
||||
$this->controllers = array('payment', 'validation');
|
||||
$this->is_eu_compatible = 1;
|
||||
$this->ps_versions_compliancy = array('min' => '1.7');
|
||||
|
||||
parent::__construct();
|
||||
|
||||
$this->displayName = $this->l('Raty');
|
||||
$this->description = $this->l('Moduł do obsługi rat Alior Banku.');
|
||||
$this->confirmUninstall = $this->l('Czy jesteś pewien aby odinstalować ten moduł?');
|
||||
$this->kalkulatorUrl = 'https://kalkulator.raty.aliorbank.pl/';
|
||||
$this->paymentUrl = 'https://raty.aliorbank.pl/directcreditsystem-frontend-consumerfinance-internet-standard/paymentprovider/';
|
||||
|
||||
if (!Configuration::get('RATY_NAME')) {
|
||||
$this->warning = $this->l('No name provided');
|
||||
}
|
||||
}
|
||||
|
||||
private function createOrderState()
|
||||
{
|
||||
// create new order status STATUSNAME
|
||||
$values_to_insert = [
|
||||
'invoice' => 0,
|
||||
'send_email' => 0,
|
||||
'module_name' => $this->name,
|
||||
'color' => 'RoyalBlue',
|
||||
'unremovable' => 0,
|
||||
'hidden' => 0,
|
||||
'logable' => 0,
|
||||
'delivery' => 0,
|
||||
'shipped' => 0,
|
||||
'paid' => 0,
|
||||
'deleted' => 0
|
||||
];
|
||||
|
||||
if (!Db::getInstance()->insert('order_state', $values_to_insert)) {
|
||||
return false;
|
||||
}
|
||||
$id_order_state = (int) Db::getInstance()->Insert_ID();
|
||||
$languages = Language::getLanguages(false);
|
||||
foreach ($languages as $language) {
|
||||
Db::getInstance()->insert('order_state_lang', [
|
||||
'id_order_state' => $id_order_state,
|
||||
'id_lang' => $language['id_lang'],
|
||||
'name' => 'Oczekiwanie na zatwierdzenie umowy ratalnej przez Alior Bank',
|
||||
'template' => ''
|
||||
]);
|
||||
}
|
||||
if (!@copy(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'alior.gif', _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'img' . DIRECTORY_SEPARATOR . 'os' . DIRECTORY_SEPARATOR . $id_order_state . '.gif')) {
|
||||
return false;
|
||||
}
|
||||
Configuration::updateValue('PS_OS_RATY', $id_order_state);
|
||||
unset($id_order_state);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function install()
|
||||
{
|
||||
if (Shop::isFeatureActive()) {
|
||||
Shop::setContext(Shop::CONTEXT_ALL);
|
||||
}
|
||||
|
||||
if (
|
||||
!parent::install()
|
||||
|| !$this->installSql()
|
||||
|| !$this->registerHook('displayHeader')
|
||||
|| !$this->registerHook('displayProductButtons')
|
||||
|| !$this->registerHook('displayShoppingCartFooter')
|
||||
|| !$this->registerHook('payment')
|
||||
|| !$this->registerHook('paymentOptions')
|
||||
|| !$this->registerHook('paymentReturn')
|
||||
|| !$this->registerHook('displayAdminProductsMainStepLeftColumnBottom')
|
||||
|| !$this->registerHook('displayBackOfficeCategory')
|
||||
|| !$this->registerHook('actionObjectProductUpdateBefore')
|
||||
|| !$this->registerHook('actionObjectCategoryAddBefore')
|
||||
|| !$this->registerHook('actionObjectCategoryUpdateBefore')
|
||||
|| !$this->createOrderState()
|
||||
|| !Configuration::updateValue('RATY_NAME', 'Raty')
|
||||
|| !Configuration::updateValue('RATY_PARTNERID', '1001')
|
||||
|| !Configuration::updateValue('RATY_SUBPARTNERID', '')
|
||||
|| !Configuration::updateValue('RATY_MCC', '')
|
||||
|| !Configuration::updateValue('RATY_STANDARD_PROMOTION', '')
|
||||
|| !Configuration::updateValue('RATY_CATEGORY_PROMOTION', '')
|
||||
|| !Configuration::updateValue('RATY_CATEGORY_PROMOTION_START', '')
|
||||
|| !Configuration::updateValue('RATY_CATEGORY_PROMOTION_END', '')
|
||||
|| !Configuration::updateValue('RATY_PRODUCT_PROMOTION', '')
|
||||
|| !Configuration::updateValue('RATY_PRODUCT_PROMOTION_START', '')
|
||||
|| !Configuration::updateValue('RATY_PRODUCT_PROMOTION_END', '')
|
||||
|| !Configuration::updateValue('RATY_MIN_VALUE', '0')
|
||||
|| !Configuration::updateValue('RATY_MAX_VALUE', '26920')
|
||||
|| !Configuration::updateValue('RATY_SALT', 'QWERSJR1234$$%')
|
||||
|| !Configuration::updateValue('RATY_TITLE', 'Raty - Alior Bank')
|
||||
|| !Configuration::updateValue('RATY_DESCRIPTION', '')
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function uninstall()
|
||||
{
|
||||
if (
|
||||
!parent::uninstall()
|
||||
|| !Configuration::deleteByName('RATY_NAME')
|
||||
|| !Configuration::deleteByName('RATY_PARTNERID')
|
||||
|| !Configuration::deleteByName('RATY_SUBPARTNERID')
|
||||
|| !Configuration::deleteByName('RATY_MCC')
|
||||
|| !Configuration::deleteByName('RATY_STANDARD_PROMOTION')
|
||||
|| !Configuration::deleteByName('RATY_CATEGORY_PROMOTION')
|
||||
|| !Configuration::deleteByName('RATY_CATEGORY_PROMOTION_START')
|
||||
|| !Configuration::deleteByName('RATY_CATEGORY_PROMOTION_END')
|
||||
|| !Configuration::deleteByName('RATY_PRODUCT_PROMOTION')
|
||||
|| !Configuration::deleteByName('RATY_PRODUCT_PROMOTION_START')
|
||||
|| !Configuration::deleteByName('RATY_PRODUCT_PROMOTION_END')
|
||||
|| !Configuration::deleteByName('RATY_MIN_VALUE')
|
||||
|| !Configuration::deleteByName('RATY_MAX_VALUE')
|
||||
|| !Configuration::deleteByName('RATY_SALT')
|
||||
|| !Configuration::deleteByName('RATY_TITLE')
|
||||
|| !Configuration::deleteByName('RATY_DESCRIPTION')
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function installSql() {
|
||||
$data = [
|
||||
'product' => 'alior_product_promotion',
|
||||
'product_shop' => 'alior_product_promotion',
|
||||
'category' => 'alior_category_promotion',
|
||||
'category_shop' => 'alior_category_promotion',
|
||||
];
|
||||
|
||||
foreach($data as $table => $column) {
|
||||
if(!$this->isColumnExists($table, $column)) {
|
||||
$sql = 'ALTER TABLE ' . _DB_PREFIX_ . $table . ' ADD ' . $column . ' INT NULL';
|
||||
$result = Db::getInstance()->execute($sql);
|
||||
|
||||
if(!$result) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private function isColumnExists($table, $column) {
|
||||
$db = Db::getInstance();
|
||||
$db->executeS("SELECT count(" . $column . ') FROM ' . _DB_PREFIX_ . $table);
|
||||
return $db->numRows() > 0;
|
||||
}
|
||||
|
||||
public function hookActionObjectProductUpdateBefore($params) {
|
||||
$product = $params['object'];
|
||||
if(!isset($_POST['alior_product_promotion'])) {
|
||||
$product->alior_product_promotion = 0;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
public function hookActionObjectCategoryUpdateBefore($params) {
|
||||
$category = $params['object'];
|
||||
$category->alior_category_promotion = 1;
|
||||
if(!isset($_POST['alior_category_promotion'])) {
|
||||
$category->alior_category_promotion = 0;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
public function hookActionObjectCategoryAddBefore($params) {
|
||||
$category = $params['object'];
|
||||
$category->alior_category_promotion = 1;
|
||||
if(!isset($_POST['alior_category_promotion'])) {
|
||||
$category->alior_category_promotion = 0;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
public function hookDisplayAdminProductsMainStepLeftColumnBottom($params) {
|
||||
$product = new Product($params['id_product']);
|
||||
$this->context->smarty->assign(array('alior_product_promotion' => $product->alior_product_promotion));
|
||||
return $this->display(__FILE__, 'views/templates/hook/updateproduct.tpl');
|
||||
}
|
||||
|
||||
public function hookDisplayBackOfficeCategory($params) {
|
||||
$id = (int)Tools::getValue('id_category');
|
||||
if(isset($params['request'])) {
|
||||
$id = $params['request']->get('categoryId');
|
||||
}
|
||||
$category = new Category($id);
|
||||
$this->context->smarty->assign(array('alior_category_promotion' => $category->alior_category_promotion));
|
||||
return $this->display(__FILE__, 'views/templates/hook/updatecategory.tpl');
|
||||
}
|
||||
|
||||
public function hookPaymentOptions($params)
|
||||
{
|
||||
if (!$this->active) {
|
||||
return;
|
||||
}
|
||||
if (!$this->checkCurrency($params['cart']) || !$this->checkAmount($params['cart']->getOrderTotal()) || !$this->getPromotion($params['cart']->getProducts())) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->context->smarty->assign(['raty_description' => Configuration::get('RATY_DESCRIPTION')]);
|
||||
|
||||
$offlineOption = new PaymentOption();
|
||||
$offlineOption->setCallToActionText(Configuration::get('RATY_TITLE'))
|
||||
->setAction($this->context->link->getModuleLink($this->name, 'validation', array(), true))
|
||||
->setAdditionalInformation($this->fetch('module:raty/views/templates/front/payment_infos.tpl'))
|
||||
->setLogo(Media::getMediaPath(_PS_MODULE_DIR_.$this->name.'/alior.gif'));
|
||||
|
||||
return [
|
||||
$offlineOption,
|
||||
];
|
||||
}
|
||||
|
||||
public function getContent()
|
||||
{
|
||||
$output = '';
|
||||
|
||||
if (Tools::isSubmit('submitRaty')) {
|
||||
$error = false;
|
||||
|
||||
if (!($raty_parentid = Tools::getValue('RATY_PARTNERID')) || empty($raty_parentid)) {
|
||||
$output .= $this->displayError($this->l('Musisz wypełnić pole \'Parent ID\'.'));
|
||||
$error = true;
|
||||
} elseif (!$error) {
|
||||
Configuration::updateValue('RATY_PARTNERID', $raty_parentid);
|
||||
}
|
||||
|
||||
Configuration::updateValue('RATY_SUBPARTNERID', Tools::getValue('RATY_SUBPARTNERID'));
|
||||
|
||||
if (!($raty_salt = Tools::getValue('RATY_SALT')) || empty($raty_salt)) {
|
||||
$output .= $this->displayError($this->l('Musisz wypełnić pole \'Salt\'.'));
|
||||
$error = true;
|
||||
} elseif (!$error) {
|
||||
Configuration::updateValue('RATY_SALT', $raty_salt);
|
||||
}
|
||||
|
||||
Configuration::updateValue('RATY_MCC', Tools::getValue('RATY_MCC'));
|
||||
Configuration::updateValue('RATY_STANDARD_PROMOTION', Tools::getValue('RATY_STANDARD_PROMOTION'));
|
||||
Configuration::updateValue('RATY_CATEGORY_PROMOTION', Tools::getValue('RATY_CATEGORY_PROMOTION'));
|
||||
Configuration::updateValue('RATY_CATEGORY_PROMOTION_START', Tools::getValue('RATY_CATEGORY_PROMOTION_START'));
|
||||
Configuration::updateValue('RATY_CATEGORY_PROMOTION_END', Tools::getValue('RATY_CATEGORY_PROMOTION_END'));
|
||||
Configuration::updateValue('RATY_PRODUCT_PROMOTION', Tools::getValue('RATY_PRODUCT_PROMOTION'));
|
||||
Configuration::updateValue('RATY_PRODUCT_PROMOTION_START', Tools::getValue('RATY_PRODUCT_PROMOTION_START'));
|
||||
Configuration::updateValue('RATY_PRODUCT_PROMOTION_END', Tools::getValue('RATY_PRODUCT_PROMOTION_END'));
|
||||
Configuration::updateValue('RATY_MIN_VALUE', $this->changeNumberFormat(Tools::getValue('RATY_MIN_VALUE')));
|
||||
Configuration::updateValue('RATY_MAX_VALUE', $this->changeNumberFormat(Tools::getValue('RATY_MAX_VALUE')));
|
||||
Configuration::updateValue('RATY_DESCRIPTION', Tools::getValue('RATY_DESCRIPTION'));
|
||||
Configuration::updateValue('RATY_TITLE', Tools::getValue('RATY_TITLE'));
|
||||
|
||||
if (!$error) {
|
||||
$output .= $this->displayConfirmation($this->l('Parametry uaktualnione.'));
|
||||
}
|
||||
}
|
||||
|
||||
return $output . $this->renderForm();
|
||||
}
|
||||
|
||||
public function hookDisplayProductButtons($params)
|
||||
{
|
||||
$product = $params['product'];
|
||||
if (empty($product->price_amount)){
|
||||
return;
|
||||
}
|
||||
$price = $product->price_amount;
|
||||
if (!$this->checkAmount($price)) {
|
||||
return;
|
||||
}
|
||||
$promotion = $this->getPromotion([$product]);
|
||||
if (!$promotion) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$this->isCached('productraty.tpl', $this->getCacheId($product->id))) {
|
||||
$promotion = str_replace('${sep}', '%2C', $promotion);
|
||||
|
||||
$this->smarty->assign(array(
|
||||
'this_path_raty' => $this->_path,
|
||||
'this_kalkulator' => $this->kalkulatorUrl .
|
||||
'init?supervisor=' . Configuration::get('RATY_PARTNERID') .
|
||||
'&promotionList='.$promotion.'&amount=',
|
||||
'this_cena' => $this->changeNumberFormat(round($price, 2))
|
||||
));
|
||||
}
|
||||
|
||||
return $this->display(__FILE__, 'productraty.tpl', $this->getCacheId($product->id));
|
||||
}
|
||||
|
||||
public function hookDisplayProductAdditionalInfo($params)
|
||||
{
|
||||
$product = $params['product'];
|
||||
if (empty($product->price_amount)){
|
||||
return;
|
||||
}
|
||||
$price = $product->price_amount;
|
||||
|
||||
if (!$this->checkAmount($price)) {
|
||||
return;
|
||||
}
|
||||
$promotion = $this->getPromotion([$product]);
|
||||
if (!$promotion) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$this->isCached('productraty.tpl', $this->getCacheId($product->id))) {
|
||||
$promotion = str_replace('${sep}', '%2C', $promotion);
|
||||
|
||||
$this->smarty->assign(array(
|
||||
'this_path_raty' => $this->_path,
|
||||
'this_kalkulator' => $this->kalkulatorUrl .
|
||||
'init?supervisor=' . Configuration::get('RATY_PARTNERID') .
|
||||
'&promotionList='.$promotion.'&amount=',
|
||||
'this_cena' => $this->changeNumberFormat(round($price, 2))
|
||||
));
|
||||
}
|
||||
|
||||
return $this->display(__FILE__, 'productraty.tpl', $this->getCacheId($product->id));
|
||||
}
|
||||
|
||||
public function hookDisplayShoppingCartFooter($params)
|
||||
{
|
||||
if (!$this->checkCurrency($params['cart']) || !$this->checkAmount($params['cart']->getOrderTotal())) {
|
||||
return;
|
||||
}
|
||||
$promotion = $this->getPromotion($params['cart']->getProducts());
|
||||
if(!$promotion){
|
||||
return;
|
||||
}
|
||||
|
||||
$promotion = str_replace('${sep}', '%2C', $promotion);
|
||||
$this->smarty->assign(array(
|
||||
'this_path_raty' => $this->_path,
|
||||
'this_kalkulator' => $this->kalkulatorUrl .
|
||||
'init?supervisor=' . Configuration::get('RATY_PARTNERID') .
|
||||
'&promotionList='.$promotion.'&amount=',
|
||||
'this_cena' => $this->changeNumberFormat($params['cart']->getOrderTotal()),
|
||||
));
|
||||
|
||||
return $this->display(__FILE__, 'raty_cart.tpl');
|
||||
}
|
||||
|
||||
public function hookDisplayHeader($params)
|
||||
{
|
||||
$this->context->controller->addCSS($this->_path . 'raty.css', 'all');
|
||||
}
|
||||
|
||||
public function hookPaymentReturn($params)
|
||||
{
|
||||
if (!$this->active) {
|
||||
return;
|
||||
}
|
||||
|
||||
$order = $params['order'];
|
||||
$state = $order->getCurrentState();
|
||||
|
||||
if (in_array($state, array(Configuration::get('PS_OS_RATY'), Configuration::get('PS_OS_OUTOFSTOCK'), Configuration::get('PS_OS_OUTOFSTOCK_UNPAID')))) {
|
||||
$customer = new Customer($order->id_customer);
|
||||
$firstName = $customer->firstname;
|
||||
$lastName = $customer->lastname;
|
||||
|
||||
$partnerId = Configuration::get('RATY_PARTNERID');
|
||||
$subpartnerId = Configuration::get('RATY_SUBPARTNERID');
|
||||
$mcc = Configuration::get('RATY_MCC');
|
||||
$promotion = $this->getPromotion($order->getProductsDetail());
|
||||
$salt = Configuration::get('RATY_SALT');
|
||||
$calculatedIncome = '';
|
||||
$limit = '';
|
||||
$transactionCode = $order->reference;
|
||||
$total = $this->getRounded($order->total_paid);
|
||||
|
||||
$date = date('Y-m-d');
|
||||
$time = date('H:i:s');
|
||||
$dateAndTime = $date . 'T' . $time;
|
||||
|
||||
$verificationCode = hash('sha256', $salt . $this->changeNumberFormat($total) .
|
||||
$transactionCode . $partnerId . $subpartnerId . $dateAndTime . $mcc . $firstName . $lastName . $limit . $calculatedIncome . $promotion);
|
||||
|
||||
$values = [
|
||||
'url' => $this->paymentUrl,
|
||||
'firstName' => $firstName,
|
||||
'lastName' => $lastName,
|
||||
'partnerId' => $partnerId,
|
||||
'subpartnerId' => $subpartnerId,
|
||||
'mcc' => $mcc,
|
||||
'limit' => $limit,
|
||||
'promotion' => $promotion,
|
||||
'calculatedIncome' => $calculatedIncome,
|
||||
'verificationCode' => $verificationCode,
|
||||
'transactionCode' => $transactionCode,
|
||||
'dateAndTime' => $dateAndTime,
|
||||
'amount' => $this->changeNumberFormat($total),
|
||||
'status' => 'ok',
|
||||
'articlesList' => base64_encode(json_encode($this->getAliorsArticlesListJson($order)))
|
||||
];
|
||||
|
||||
$this->context->smarty->assign($values);
|
||||
} else {
|
||||
$this->context->smarty->assign('status', 'failed');
|
||||
}
|
||||
|
||||
return $this->context->smarty->fetch('module:raty/views/templates/hook/payment_return.tpl');
|
||||
}
|
||||
|
||||
public function renderForm()
|
||||
{
|
||||
$fields_form = array(
|
||||
'form' => array(
|
||||
'legend' => array(
|
||||
'title' => $this->l('Ustawienia'),
|
||||
'icon' => 'icon-cogs'
|
||||
),
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('PartnerID'),
|
||||
'name' => 'RATY_PARTNERID',
|
||||
'class' => 'fixed-width-xxl',
|
||||
'desc' => $this->l('Kod partnera handlowego')
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('SubpartnerID'),
|
||||
'name' => 'RATY_SUBPARTNERID',
|
||||
'class' => 'fixed-width-xxl',
|
||||
'desc' => $this->l('Dodatkowy kod partnera handlowego.')
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('MCC'),
|
||||
'name' => 'RATY_MCC',
|
||||
'class' => 'fixed-width-xxl',
|
||||
'desc' => $this->l('Kod MCC.')
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Oferta standardowa'),
|
||||
'name' => 'RATY_STANDARD_PROMOTION',
|
||||
'class' => 'fixed-width-xxl',
|
||||
'desc' => $this->l('Kod oferty standardowej.')
|
||||
),
|
||||
array(
|
||||
'type' => 'html',
|
||||
'label' => $this->l('Oferta specjalna dla Kategorii'),
|
||||
'name' => 'RATY_CATEGORY_PROMOTION',
|
||||
'desc' => $this->l('Kod oferty specjalnej dla Kategorii.'),
|
||||
'html_content' =>
|
||||
'<div class="row">'
|
||||
. '<div>'
|
||||
. '<div class="col-lg-6 col-md-12 col-sm-12">'
|
||||
. '<input type="text" name="RATY_CATEGORY_PROMOTION" id="RATY_CATEGORY_PROMOTION" class="" value="' . Configuration::get('RATY_CATEGORY_PROMOTION') . '" style="width: 250px;">'
|
||||
. '</div>'
|
||||
. '<div class="col-lg-6 col-md-12 col-sm-12" style="padding-top: 0; display: flex;">'
|
||||
. '<span class="col-lg-3 control-label">Czas trwania:</span>'
|
||||
. '<div class="col-lg-9">'
|
||||
. '<input type="date" name="RATY_CATEGORY_PROMOTION_START" id="RATY_CATEGORY_PROMOTION_START" class="" value="' . Configuration::get('RATY_CATEGORY_PROMOTION_START') . '"> - '
|
||||
. '<input type="date" name="RATY_CATEGORY_PROMOTION_END" id="RATY_CATEGORY_PROMOTION_END" class="" value="' . Configuration::get('RATY_CATEGORY_PROMOTION_END') . '">'
|
||||
. '</div>'
|
||||
. '</div>'
|
||||
. '</div>'
|
||||
),
|
||||
array(
|
||||
'type' => 'html',
|
||||
'label' => $this->l('Oferta specjalna dla Produktu'),
|
||||
'name' => 'RATY_PRODUCT_PROMOTION',
|
||||
'desc' => $this->l('Kod oferty specjalnej dla Produktu.'),
|
||||
'html_content' =>
|
||||
'<div class="row">'
|
||||
. '<div>'
|
||||
. '<div class="col-lg-6 col-md-12 col-sm-12">'
|
||||
. '<input type="text" name="RATY_PRODUCT_PROMOTION" id="RATY_PRODUCT_PROMOTION" class="" value="' . Configuration::get('RATY_PRODUCT_PROMOTION') . '" style="width: 250px;">'
|
||||
. '</div>'
|
||||
. '<div class="col-lg-6 col-md-12 col-sm-12" style="padding-top: 0; display: flex;">'
|
||||
. '<span class="col-lg-3 control-label">Czas trwania:</span>'
|
||||
. '<div class="col-lg-9">'
|
||||
. '<input type="date" name="RATY_PRODUCT_PROMOTION_START" id="RATY_PRODUCT_PROMOTION_START" class="" value="' . Configuration::get('RATY_PRODUCT_PROMOTION_START') . '"> - '
|
||||
. '<input type="date" name="RATY_PRODUCT_PROMOTION_END" id="RATY_PRODUCT_PROMOTION_END" class="" value="' . Configuration::get('RATY_PRODUCT_PROMOTION_END') . '">'
|
||||
. '</div>'
|
||||
. '</div>'
|
||||
. '</div>'
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Minimalna wartość'),
|
||||
'name' => 'RATY_MIN_VALUE',
|
||||
'class' => 'fixed-width-xxl',
|
||||
'desc' => $this->l('Minimalna wartość od której dostępna jest sprzedaż ratalna.')
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Maksymalna wartość'),
|
||||
'name' => 'RATY_MAX_VALUE',
|
||||
'class' => 'fixed-width-xxl',
|
||||
'desc' => $this->l('Maksymalna wartość do której dostępna jest sprzedaż ratalna.')
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Salt'),
|
||||
'name' => 'RATY_SALT',
|
||||
'class' => 'fixed-width-xxl',
|
||||
'desc' => $this->l('Kod Salt odtrzymany od banku')
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Nazwa płatności'),
|
||||
'name' => 'RATY_TITLE',
|
||||
'class' => 'fixed-width-xxl',
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'label' => $this->l('Dodatkowy opis'),
|
||||
'name' => 'RATY_DESCRIPTION',
|
||||
'class' => 'fixed-width-xxl',
|
||||
),
|
||||
),
|
||||
'submit' => array(
|
||||
'title' => $this->l('Save'),
|
||||
)
|
||||
),
|
||||
);
|
||||
|
||||
$helper = new HelperForm();
|
||||
$helper->show_toolbar = false;
|
||||
$helper->table = $this->table;
|
||||
$lang = new Language((int) Configuration::get('PS_LANG_DEFAULT'));
|
||||
$helper->default_form_language = $lang->id;
|
||||
$helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
|
||||
$helper->identifier = $this->identifier;
|
||||
$helper->submit_action = 'submitRaty';
|
||||
$helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false) . '&configure=' . $this->name . '&tab_module=' . $this->tab . '&module_name=' . $this->name;
|
||||
$helper->token = Tools::getAdminTokenLite('AdminModules');
|
||||
$helper->tpl_vars = array(
|
||||
'fields_value' => $this->getConfigFieldsValues(),
|
||||
'languages' => $this->context->controller->getLanguages(),
|
||||
'id_language' => $this->context->language->id
|
||||
);
|
||||
|
||||
return $helper->generateForm(array($fields_form));
|
||||
}
|
||||
|
||||
public function checkCurrency($cart)
|
||||
{
|
||||
$currency_order = new Currency($cart->id_currency);
|
||||
$currencies_module = $this->getCurrency($cart->id_currency);
|
||||
if (is_array($currencies_module)) {
|
||||
foreach ($currencies_module as $currency_module) {
|
||||
if ($currency_order->id == $currency_module['id_currency']) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getConfigFieldsValues()
|
||||
{
|
||||
return array(
|
||||
'RATY_PARTNERID' => Tools::getValue('RATY_PARTNERID', Configuration::get('RATY_PARTNERID')),
|
||||
'RATY_SUBPARTNERID' => Tools::getValue('RATY_SUBPARTNERID', Configuration::get('RATY_SUBPARTNERID')),
|
||||
'RATY_MCC' => Tools::getValue('RATY_MCC', Configuration::get('RATY_MCC')),
|
||||
'RATY_STANDARD_PROMOTION' => Tools::getValue('RATY_STANDARD_PROMOTION', Configuration::get('RATY_STANDARD_PROMOTION')),
|
||||
'RATY_PRODUCT_PROMOTION' => Tools::getValue('RATY_PRODUCT_PROMOTION', Configuration::get('RATY_PRODUCT_PROMOTION')),
|
||||
'RATY_PRODUCT_PROMOTION_START' => Tools::getValue('RATY_PRODUCT_PROMOTION_START', Configuration::get('RATY_PRODUCT_PROMOTION_START')),
|
||||
'RATY_PRODUCT_PROMOTION_END' => Tools::getValue('RATY_PRODUCT_PROMOTION_END', Configuration::get('RATY_PRODUCT_PROMOTION_END')),
|
||||
'RATY_CATEGORY_PROMOTION' => Tools::getValue('RATY_CATEGORY_PROMOTION', Configuration::get('RATY_CATEGORY_PROMOTION')),
|
||||
'RATY_CATEGORY_PROMOTION_START' => Tools::getValue('RATY_CATEGORY_PROMOTION_START', Configuration::get('RATY_CATEGORY_PROMOTION_START')),
|
||||
'RATY_CATEGORY_PROMOTION_END' => Tools::getValue('RATY_CATEGORY_PROMOTION_END', Configuration::get('RATY_CATEGORY_PROMOTION_END')),
|
||||
'RATY_MIN_VALUE' => Tools::getValue('RATY_MIN_VALUE', $this->changeNumberFormat(Configuration::get('RATY_MIN_VALUE'))),
|
||||
'RATY_MAX_VALUE' => Tools::getValue('RATY_MAX_VALUE', $this->changeNumberFormat(Configuration::get('RATY_MAX_VALUE'))),
|
||||
'RATY_SALT' => Tools::getValue('RATY_SALT', Configuration::get('RATY_SALT')),
|
||||
'RATY_TITLE' => Tools::getValue('RATY_TITLE', Configuration::get('RATY_TITLE')),
|
||||
'RATY_DESCRIPTION' => Tools::getValue('RATY_DESCRIPTION', Configuration::get('RATY_DESCRIPTION')),
|
||||
);
|
||||
}
|
||||
|
||||
public function checkAmount($total)
|
||||
{
|
||||
$minValue = (float) $this->changeNumberFormat(Configuration::get('RATY_MIN_VALUE'));
|
||||
$maxValue = (float) $this->changeNumberFormat(Configuration::get('RATY_MAX_VALUE'));
|
||||
|
||||
if($minValue > 0 && $maxValue > 0) {
|
||||
return $total >= $minValue && $total <= $maxValue;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private function changeNumberFormat($value)
|
||||
{
|
||||
return number_format($value, 2, '.', '');
|
||||
}
|
||||
|
||||
private function getAliorsArticlesListJson($order)
|
||||
{
|
||||
$products = $order->getProductsDetail();
|
||||
$totalShippingCost = (float)$order->total_shipping;
|
||||
$totalDiscounts = (float)$order->total_discounts;
|
||||
$totalWrapping = (float)$order->total_wrapping;
|
||||
// @see https://stackoverflow.com/questions/42981409/php7-1-json-encode-float-issue
|
||||
// json_encode makes float values wrong. This is simple fix
|
||||
if (version_compare(phpversion(), '7.1', '>=')) {
|
||||
ini_set( 'serialize_precision', -1 );
|
||||
}
|
||||
|
||||
$json = ['articlesList' => []];
|
||||
foreach ($products as $prod) {
|
||||
if (!empty($prod['unit_price_tax_incl'])){
|
||||
$price = $prod['unit_price_tax_incl'];
|
||||
} else {
|
||||
$price = !empty($prod['product_price_wt']) ? $prod['product_price_wt'] : $prod['product_price'];
|
||||
}
|
||||
$json['articlesList'][] = [
|
||||
"category" => $this->getAliorsCategory($prod['id_category_default']),
|
||||
"name" => $this->clearName($prod['product_name']),
|
||||
"number" => (int)$prod['product_quantity'],
|
||||
"price" => $this->getRounded($price),
|
||||
];
|
||||
}
|
||||
if ($totalShippingCost){
|
||||
$json['articlesList'][] = [
|
||||
"category" => 'TKC_USLUGI', // from Alior's docs
|
||||
"name" => 'Shipping costs',
|
||||
"number" => 1,
|
||||
"price" => $this->getRounded($totalShippingCost),
|
||||
];
|
||||
}
|
||||
if ($totalDiscounts){
|
||||
$json['articlesList'][] = [
|
||||
"category" => 'TKC_RABAT', // from Alior's docs
|
||||
"name" => 'Discount',
|
||||
"number" => 1,
|
||||
"price" => $this->getRounded($totalDiscounts) * -1,
|
||||
];
|
||||
}
|
||||
if ($totalWrapping){
|
||||
$json['articlesList'][] = [
|
||||
"category" => 'TKC_USLUGI', // from Alior's docs
|
||||
"name" => 'Inne',
|
||||
"number" => 1,
|
||||
"price" => $this->getRounded($totalWrapping),
|
||||
];
|
||||
}
|
||||
|
||||
return $json;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns Alior's ID of category based on mapping (see map.php)
|
||||
* @return string
|
||||
*/
|
||||
private function getAliorsCategory($shopCategoryId)
|
||||
{
|
||||
$map = require(dirname(__FILE__) . '/map.php');
|
||||
if (empty($map)) {
|
||||
return '';
|
||||
}
|
||||
foreach ($map as $aliorId => $shopCats) {
|
||||
if (in_array($shopCategoryId, $shopCats)) {
|
||||
return $aliorId;
|
||||
}
|
||||
}
|
||||
|
||||
return !empty($map['default']) ? $map['default'] : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $price
|
||||
* @return |null
|
||||
*/
|
||||
private function getRounded($price) {
|
||||
$precision = method_exists('Context', 'getComputingPrecision')
|
||||
? Context::getContext()->getComputingPrecision()
|
||||
: _PS_PRICE_DISPLAY_PRECISION_;
|
||||
if (is_array($this->context->currency)) {
|
||||
return Tools::ps_round($price, (int)$this->context->currency['decimals'] * $precision);
|
||||
} elseif (is_object($this->context->currency)) {
|
||||
return Tools::ps_round($price, (int)$this->context->currency->decimals * $precision);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @return string
|
||||
*/
|
||||
private function clearName($name) {
|
||||
$name = str_replace('|', '', $name);
|
||||
return preg_replace('/[\x00-\x1F]/', '', $name);
|
||||
}
|
||||
|
||||
private function checkCategoryPromotion($product) {
|
||||
|
||||
$categories = Product::getProductCategories($product->id);
|
||||
|
||||
foreach($categories as $categoryId)
|
||||
{
|
||||
$category = new Category($categoryId);
|
||||
if($category->alior_category_promotion) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function formatDate($date, $expectedFormat = 'j-M-Y', $currentFormat = 'Y-m-d'){
|
||||
if(!$date){
|
||||
return 0;
|
||||
}
|
||||
$date = DateTime::createFromFormat($currentFormat, $date);
|
||||
return $date->format($expectedFormat);
|
||||
}
|
||||
|
||||
private function getPromotion($products) {
|
||||
$todayDate = date("Y/m/d");
|
||||
$promotionsType = [];
|
||||
$isProductPromotionValid = true;
|
||||
$isCategoryPromotionValid = true;
|
||||
|
||||
if(
|
||||
!Configuration::get('RATY_PRODUCT_PROMOTION_START') ||
|
||||
$this->formatDate(Configuration::get('RATY_PRODUCT_PROMOTION_START'), "Y/m/d", "Y-m-d") > $todayDate ||
|
||||
$this->formatDate(Configuration::get('RATY_PRODUCT_PROMOTION_END'), "Y/m/d", "Y-m-d") < $todayDate
|
||||
) {
|
||||
$isProductPromotionValid = false;
|
||||
}
|
||||
|
||||
if(
|
||||
!Configuration::get('RATY_CATEGORY_PROMOTION_START') ||
|
||||
$this->formatDate(Configuration::get('RATY_CATEGORY_PROMOTION_START'), "Y/m/d", "Y-m-d") > $todayDate ||
|
||||
$this->formatDate(Configuration::get('RATY_CATEGORY_PROMOTION_END'), "Y/m/d", "Y-m-d") < $todayDate
|
||||
) {
|
||||
$isCategoryPromotionValid = false;
|
||||
}
|
||||
|
||||
foreach($products as $product) {
|
||||
array_push($promotionsType, $this->getProductPromotion($product, $isProductPromotionValid, $isCategoryPromotionValid));
|
||||
}
|
||||
|
||||
$promotion = explode('${sep}', Configuration::get('RATY_' . $promotionsType[0] .'_PROMOTION'));
|
||||
if(count($promotionsType) > 1) {
|
||||
for($i = 1; $i < count($promotionsType); $i++) {
|
||||
$promotionType = explode('${sep}', Configuration::get('RATY_' . $promotionsType[$i] .'_PROMOTION'));
|
||||
$promotion = array_intersect($promotion, $promotionType);
|
||||
}
|
||||
}
|
||||
|
||||
return implode('${sep}', $promotion);
|
||||
}
|
||||
|
||||
private function getProductPromotion($product, $isProductPromotionValid, $isCategoryPromotionValid) {
|
||||
if(is_array($product)){
|
||||
$product = new Product($product['id_product']);
|
||||
}
|
||||
if($isProductPromotionValid && $product->alior_product_promotion) {
|
||||
return 'PRODUCT';
|
||||
}
|
||||
if($isCategoryPromotionValid && $this->checkCategoryPromotion($product)) {
|
||||
return 'CATEGORY';
|
||||
}
|
||||
return 'STANDARD';
|
||||
}
|
||||
}
|
||||
9
modules/raty/raty.tpl
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
<div id="raty">
|
||||
<form id="wniosek" method="post">
|
||||
<input type="text" name="imie" placeholder="Imię"/><br/>
|
||||
<input type="text" name="nazwisko" placeholder="nazwisko"/><br/>
|
||||
<input type="text" name="amount" placeholder="kwota"/>
|
||||
<button type="submit">Złóż</button>
|
||||
</form>
|
||||
</div>
|
||||
BIN
modules/raty/raty/alior-kalkulator-guzik.gif
Normal file
|
After Width: | Height: | Size: 6.0 KiB |
BIN
modules/raty/raty/alior.gif
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
13
modules/raty/raty/config_pl.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<module>
|
||||
<name>raty</name>
|
||||
<displayName><![CDATA[Raty]]></displayName>
|
||||
<version><![CDATA[1.0.0]]></version>
|
||||
<description><![CDATA[Moduł do obsługi rat Alior Banku.]]></description>
|
||||
<author><![CDATA[LogsHub.com]]></author>
|
||||
<tab><![CDATA[payments_gateways]]></tab>
|
||||
<confirmUninstall><![CDATA[Czy jesteś pewien aby odinstalować ten moduł?]]></confirmUninstall>
|
||||
<is_configurable>1</is_configurable>
|
||||
<need_instance>1</need_instance>
|
||||
<limited_countries></limited_countries>
|
||||
</module>
|
||||
11
modules/raty/raty/controllers/front/index.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../../../../');
|
||||
exit;
|
||||
35
modules/raty/raty/controllers/front/payment.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
class RatyPaymentModuleFrontController extends ModuleFrontController
|
||||
{
|
||||
public $ssl = true;
|
||||
public $display_column_left = false;
|
||||
|
||||
/**
|
||||
* @see FrontController::initContent()
|
||||
*/
|
||||
public function initContent()
|
||||
{
|
||||
parent::initContent();
|
||||
|
||||
$cart = $this->context->cart;
|
||||
|
||||
if (!$this->module->checkAmount($cart->getOrderTotal())) {
|
||||
Tools::redirect('index.php?controller=order');
|
||||
}
|
||||
|
||||
//print_r($cart);die;
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'nbProducts' => $cart->nbProducts(),
|
||||
'cust_currency' => $cart->id_currency,
|
||||
'currencies' => $this->module->getCurrency((int)$cart->id_currency),
|
||||
'total' => $cart->getOrderTotal(true, Cart::BOTH),
|
||||
'this_path' => $this->module->getPathUri(),
|
||||
'this_path_bw' => $this->module->getPathUri(),
|
||||
'this_path_ssl' => Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/'.$this->module->name.'/'
|
||||
));
|
||||
|
||||
$this->setTemplate('payment_execution.tpl');
|
||||
}
|
||||
}
|
||||
44
modules/raty/raty/controllers/front/validation.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
class RatyValidationModuleFrontController extends ModuleFrontController
|
||||
{
|
||||
|
||||
/**
|
||||
* @see FrontController::postProcess()
|
||||
*/
|
||||
public function postProcess()
|
||||
{
|
||||
$cart = $this->context->cart;
|
||||
|
||||
$customer = new Customer($cart->id_customer);
|
||||
if ($cart->id_customer == 0 || $cart->id_address_delivery == 0 || $cart->id_address_invoice == 0 || !$this->module->active) {
|
||||
Tools::redirect('index.php?controller=order&step=1');
|
||||
}
|
||||
|
||||
// Check that this payment option is still available in case the customer changed his address just before the end of the checkout process
|
||||
$authorized = false;
|
||||
foreach (Module::getPaymentModules() as $module) {
|
||||
if ($module['name'] == 'raty') {
|
||||
$authorized = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$authorized) {
|
||||
die($this->module->l('Metoda płatności jest niedostępna.', 'validation'));
|
||||
}
|
||||
|
||||
$customer = new Customer($cart->id_customer);
|
||||
if (!Validate::isLoadedObject($customer)) {
|
||||
Tools::redirect('index.php?controller=order&step=1');
|
||||
}
|
||||
|
||||
$currency = $this->context->currency;
|
||||
$total = (float) $cart->getOrderTotal(true, Cart::BOTH);
|
||||
|
||||
|
||||
$mailVars = array();
|
||||
$this->module->validateOrder($cart->id, Configuration::get('PS_OS_RATY'), $total, $this->module->displayName, null, $mailVars, (int) $currency->id, false, $customer->secure_key);
|
||||
|
||||
Tools::redirect('index.php?controller=order-confirmation&id_cart='.$cart->id.'&id_module='.$this->module->id.'&id_order='.$this->module->currentOrder.'&key='.$customer->secure_key);
|
||||
}
|
||||
}
|
||||
11
modules/raty/raty/controllers/index.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../../../');
|
||||
exit;
|
||||
11
modules/raty/raty/index.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../../../../');
|
||||
exit;
|
||||
BIN
modules/raty/raty/logo.png
Normal file
|
After Width: | Height: | Size: 9.5 KiB |
37
modules/raty/raty/map.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* Mapping between Alior's categories and store's categories
|
||||
* Alior Category => Store's categories IDs eg. 'TKC_AGDD' => [1, 19, 33],
|
||||
*/
|
||||
|
||||
return [
|
||||
'TKC_AGDD' => [],
|
||||
'TKC_AGDM' => [],
|
||||
'TKC_AKCAUTO' => [],
|
||||
'TKC_BIZUT' => [],
|
||||
'TKC_DZIECIE' => [],
|
||||
'TKC_EDU' => [],
|
||||
'TKC_FOTO' => [],
|
||||
'TKC_INSTRMUZ' => [],
|
||||
'TKC_KOMP' => [],
|
||||
'TKC_MATBUD' => [],
|
||||
'TKC_MEBLE' => [],
|
||||
'TKC_MOTO' => [],
|
||||
'TKC_NARZ' => [],
|
||||
'TKC_ODZIEZ' => [],
|
||||
'TKC_OGRO' => [],
|
||||
'TKC_OGRZEW' => [],
|
||||
'TKC_OKDZW' => [],
|
||||
'TKC_OPAL' => [],
|
||||
'TKC_OPROGR' => [],
|
||||
'TKC_PAKIE' => [],
|
||||
'TKC_RTV' => [],
|
||||
'TKC_SPORTREH' => [],
|
||||
'TKC_SPRZKOM' => [],
|
||||
'TKC_SYSTEKO' => [],
|
||||
'TKC_SZTUK' => [],
|
||||
'TKC_TELE' => [],
|
||||
'TKC_UBEZ' => [],
|
||||
'TKC_USLUGI' => [],
|
||||
'default' => 'TKC_AGDM'
|
||||
];
|
||||
13
modules/raty/raty/payment.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
/* SSL Management */
|
||||
$useSSL = true;
|
||||
|
||||
require('../../config/config.inc.php');
|
||||
Tools::displayFileAsDeprecated();
|
||||
|
||||
// init front controller in order to use Tools::redirect
|
||||
$controller = new FrontController();
|
||||
$controller->init();
|
||||
|
||||
Tools::redirect(Context::getContext()->link->getModuleLink('raty', 'payment'));
|
||||
13
modules/raty/raty/raty.css
Normal file
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
To change this license header, choose License Headers in Project Properties.
|
||||
To change this template file, choose Tools | Templates
|
||||
and open the template in the editor.
|
||||
*/
|
||||
/*
|
||||
Created on : 2016-10-18, 11:12:27
|
||||
Author : Kamil
|
||||
*/
|
||||
|
||||
#module-raty-payment ul.step li a,#module-raty-payment ul.step li span,#module-raty-payment ul.step li.step_current span,#module-raty-payment ul.step li.step_current_end span{
|
||||
font-size: 16px !important;
|
||||
}
|
||||
521
modules/raty/raty/raty.php
Normal file
@@ -0,0 +1,521 @@
|
||||
<?php
|
||||
use PrestaShop\PrestaShop\Core\Payment\PaymentOption;
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
class Raty extends PaymentModule
|
||||
{
|
||||
protected $_html = '';
|
||||
protected $_postErrors = array();
|
||||
public $details;
|
||||
public $owner;
|
||||
public $address;
|
||||
public $extra_mail_vars;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->name = 'raty';
|
||||
$this->tab = 'payments_gateways';
|
||||
$this->version = '1.4.4';
|
||||
$this->author = 'LogsHub.com';
|
||||
|
||||
$this->bootstrap = true;
|
||||
$this->is_eu_compatible = 1;
|
||||
$this->controllers = array('payment', 'validation');
|
||||
$this->is_eu_compatible = 1;
|
||||
$this->ps_versions_compliancy = array('min' => '1.7', 'max' => '1.7.6.99');
|
||||
|
||||
parent::__construct();
|
||||
|
||||
$this->displayName = $this->l('Raty');
|
||||
$this->description = $this->l('Moduł do obsługi rat Alior Banku.');
|
||||
$this->confirmUninstall = $this->l('Czy jesteś pewien aby odinstalować ten moduł?');
|
||||
|
||||
if (!Configuration::get('RATY_NAME')) {
|
||||
$this->warning = $this->l('No name provided');
|
||||
}
|
||||
}
|
||||
|
||||
private function createOrderState()
|
||||
{
|
||||
// create new order status STATUSNAME
|
||||
$values_to_insert = [
|
||||
'invoice' => 0,
|
||||
'send_email' => 0,
|
||||
'module_name' => $this->name,
|
||||
'color' => 'RoyalBlue',
|
||||
'unremovable' => 0,
|
||||
'hidden' => 0,
|
||||
'logable' => 0,
|
||||
'delivery' => 0,
|
||||
'shipped' => 0,
|
||||
'paid' => 0,
|
||||
'deleted' => 0
|
||||
];
|
||||
|
||||
if (!Db::getInstance()->insert('order_state', $values_to_insert)) {
|
||||
return false;
|
||||
}
|
||||
$id_order_state = (int) Db::getInstance()->Insert_ID();
|
||||
$languages = Language::getLanguages(false);
|
||||
foreach ($languages as $language) {
|
||||
Db::getInstance()->insert('order_state_lang', [
|
||||
'id_order_state' => $id_order_state,
|
||||
'id_lang' => $language['id_lang'],
|
||||
'name' => 'Oczekiwanie na zatwierdzenie umowy ratalnej przez Alior Bank',
|
||||
'template' => ''
|
||||
]);
|
||||
}
|
||||
if (!@copy(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'alior.gif', _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'img' . DIRECTORY_SEPARATOR . 'os' . DIRECTORY_SEPARATOR . $id_order_state . '.gif')) {
|
||||
return false;
|
||||
}
|
||||
Configuration::updateValue('PS_OS_RATY', $id_order_state);
|
||||
unset($id_order_state);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function install()
|
||||
{
|
||||
if (Shop::isFeatureActive()) {
|
||||
Shop::setContext(Shop::CONTEXT_ALL);
|
||||
}
|
||||
|
||||
if (!parent::install()
|
||||
||
|
||||
!$this->registerHook('displayHeader') ||
|
||||
!$this->registerHook('displayProductButtons') ||
|
||||
!$this->registerHook('displayShoppingCartFooter') ||
|
||||
!$this->registerHook('payment') ||
|
||||
!$this->registerHook('paymentOptions') ||
|
||||
!$this->registerHook('paymentReturn') ||
|
||||
!$this->createOrderState() ||
|
||||
!Configuration::updateValue('RATY_NAME', 'Raty') ||
|
||||
!Configuration::updateValue('RATY_URL', 'https://aliorbank.pl') ||
|
||||
!Configuration::updateValue('RATY_PARTNERID', '1001') ||
|
||||
!Configuration::updateValue('RATY_SUBPARTNERID', '') ||
|
||||
!Configuration::updateValue('RATY_MCC', '') ||
|
||||
!Configuration::updateValue('RATY_PROMOTION', '') ||
|
||||
!Configuration::updateValue('RATY_WARTOSC', '') ||
|
||||
!Configuration::updateValue('RATY_KALKULATOR', '') ||
|
||||
!Configuration::updateValue('RATY_SALT', 'QWERSJR1234$$%')
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function uninstall()
|
||||
{
|
||||
if (!parent::uninstall()||
|
||||
!Configuration::deleteByName('RATY_NAME') ||
|
||||
!Configuration::deleteByName('RATY_URL') ||
|
||||
!Configuration::deleteByName('RATY_PARTNERID') ||
|
||||
!Configuration::deleteByName('RATY_SUBPARTNERID') ||
|
||||
!Configuration::updateValue('RATY_MCC', '') ||
|
||||
!Configuration::updateValue('RATY_PROMOTION', '') ||
|
||||
!Configuration::updateValue('RATY_WARTOSC', '') ||
|
||||
!Configuration::updateValue('RATY_KALKULATOR', '') ||
|
||||
!Configuration::deleteByName('RATY_SALT')
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function hookPaymentOptions($params)
|
||||
{
|
||||
if (!$this->active) {
|
||||
return;
|
||||
}
|
||||
if (!$this->checkCurrency($params['cart']) || !$this->checkAmount($params['cart']->getOrderTotal())) {
|
||||
return;
|
||||
}
|
||||
|
||||
$offlineOption = new PaymentOption();
|
||||
$offlineOption->setCallToActionText($this->l('Raty - Alior Bank'))
|
||||
->setAction($this->context->link->getModuleLink($this->name, 'validation', array(), true))
|
||||
// ->setAdditionalInformation($this->context->smarty->fetch('module:paymentexample/views/templates/front/payment_infos.tpl'))
|
||||
->setLogo(Media::getMediaPath(_PS_MODULE_DIR_.$this->name.'/alior.gif'));
|
||||
|
||||
return [
|
||||
$offlineOption,
|
||||
];
|
||||
}
|
||||
|
||||
public function getContent()
|
||||
{
|
||||
$output = '';
|
||||
|
||||
if (Tools::isSubmit('submitRaty')) {
|
||||
$error = false;
|
||||
if (!($raty_url = Tools::getValue('RATY_URL')) || empty($raty_url)) {
|
||||
$output .= $this->displayError($this->l('Musisz wypełnić pole \'Adres URL\'.'));
|
||||
$error = true;
|
||||
} else {
|
||||
Configuration::updateValue('RATY_URL', $raty_url);
|
||||
}
|
||||
|
||||
if (!($raty_parentid = Tools::getValue('RATY_PARTNERID')) || empty($raty_parentid)) {
|
||||
$output .= $this->displayError($this->l('Musisz wypełnić pole \'Parent ID\'.'));
|
||||
$error = true;
|
||||
} elseif (!$error) {
|
||||
Configuration::updateValue('RATY_PARTNERID', $raty_parentid);
|
||||
}
|
||||
|
||||
Configuration::updateValue('RATY_SUBPARTNERID', Tools::getValue('RATY_SUBPARTNERID'));
|
||||
|
||||
if (!($raty_salt = Tools::getValue('RATY_SALT')) || empty($raty_salt)) {
|
||||
$output .= $this->displayError($this->l('Musisz wypełnić pole \'Salt\'.'));
|
||||
$error = true;
|
||||
} elseif (!$error) {
|
||||
Configuration::updateValue('RATY_SALT', $raty_salt);
|
||||
}
|
||||
|
||||
Configuration::updateValue('RATY_MCC', Tools::getValue('RATY_MCC'));
|
||||
Configuration::updateValue('RATY_PROMOTION', Tools::getValue('RATY_PROMOTION'));
|
||||
Configuration::updateValue('RATY_WARTOSC', $this->changeNumberFormat(Tools::getValue('RATY_WARTOSC')));
|
||||
Configuration::updateValue('RATY_KALKULATOR', Tools::getValue('RATY_KALKULATOR'));
|
||||
|
||||
|
||||
if (!$error) {
|
||||
$output .= $this->displayConfirmation($this->l('Parametry uaktualnione.'));
|
||||
}
|
||||
}
|
||||
|
||||
return $output . $this->renderForm();
|
||||
}
|
||||
|
||||
public function hookDisplayProductButtons($params)
|
||||
{
|
||||
if (empty($params['product']->price_amount)){
|
||||
return;
|
||||
}
|
||||
$price = $params['product']->price_amount;
|
||||
if (!$this->checkAmount($price)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$this->isCached('productraty.tpl', $this->getCacheId($params['product']->id))) {
|
||||
$promotion = Tools::getValue('RATY_PROMOTION', Configuration::get('RATY_PROMOTION'));
|
||||
$this->smarty->assign(array(
|
||||
'this_path' => $this->_path,
|
||||
'this_path_raty' => $this->_path,
|
||||
'this_path_ssl' => Tools::getShopDomainSsl(true, true) . __PS_BASE_URI__ . 'modules/' . $this->name . '/',
|
||||
'this_kalkulator' => Tools::getValue('RATY_KALKULATOR', Configuration::get('RATY_KALKULATOR')) .
|
||||
'?installmentNumber=21&offerCode='.$promotion.'&cartValue=',
|
||||
'this_cena' => $this->changeNumberFormat(round($price, 2))
|
||||
));
|
||||
}
|
||||
|
||||
return $this->display(__FILE__, 'productraty.tpl', $this->getCacheId($params['product']->id));
|
||||
}
|
||||
|
||||
public function hookDisplayShoppingCartFooter($params)
|
||||
{
|
||||
if (!$this->checkCurrency($params['cart']) || !$this->checkAmount($params['cart']->getOrderTotal())) {
|
||||
return;
|
||||
}
|
||||
$promotion = Tools::getValue('RATY_PROMOTION', Configuration::get('RATY_PROMOTION'));
|
||||
|
||||
$this->smarty->assign(array(
|
||||
'this_path' => $this->_path,
|
||||
'this_path_raty' => $this->_path,
|
||||
'this_path_ssl' => Tools::getShopDomainSsl(true, true) . __PS_BASE_URI__ . 'modules/' . $this->name . '/',
|
||||
'this_kalkulator' => Tools::getValue('RATY_KALKULATOR', Configuration::get('RATY_KALKULATOR')) .
|
||||
'?installmentNumber=21&offerCode='.$promotion.'&cartValue=',
|
||||
'this_cena' => $this->changeNumberFormat($params['cart']->getOrderTotal()),
|
||||
));
|
||||
|
||||
return $this->display(__FILE__, 'raty_cart.tpl', $this->getCacheId());
|
||||
}
|
||||
|
||||
public function hookDisplayHeader($params)
|
||||
{
|
||||
$this->context->controller->addCSS($this->_path . 'raty.css', 'all');
|
||||
}
|
||||
|
||||
public function hookPayment($params)
|
||||
{
|
||||
if (!$this->active) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$this->changeNumberFormat($this->checkAmount($params['cart']->getOrderTotal()))) {
|
||||
return;
|
||||
}
|
||||
$promotion = Tools::getValue('RATY_PROMOTION', Configuration::get('RATY_PROMOTION'));
|
||||
|
||||
$this->smarty->assign(array(
|
||||
'this_path' => $this->_path,
|
||||
'this_path_raty' => $this->_path,
|
||||
'this_path_ssl' => Tools::getShopDomainSsl(true, true) . __PS_BASE_URI__ . 'modules/' . $this->name . '/',
|
||||
'this_kalkulator' => Tools::getValue('RATY_KALKULATOR', Configuration::get('RATY_KALKULATOR')) .
|
||||
'?installmentNumber=21&offerCode='.$promotion.'&cartValue=',
|
||||
'this_cena' => $this->changeNumberFormat($params['cart']->getOrderTotal()),
|
||||
));
|
||||
return $this->display(__FILE__, 'payment.tpl');
|
||||
}
|
||||
|
||||
public function hookPaymentReturn($params)
|
||||
{
|
||||
if (!$this->active) {
|
||||
return;
|
||||
}
|
||||
|
||||
$state = $params['order']->getCurrentState();
|
||||
|
||||
if (in_array($state, array(Configuration::get('PS_OS_RATY'), Configuration::get('PS_OS_OUTOFSTOCK'), Configuration::get('PS_OS_OUTOFSTOCK_UNPAID')))) {
|
||||
$customer = new Customer($params['order']->id_customer);
|
||||
$firstName = $customer->firstname;
|
||||
$lastName = $customer->lastname;
|
||||
|
||||
$url = Tools::getValue('RATY_URL', Configuration::get('RATY_URL'));
|
||||
$partnerId = Tools::getValue('RATY_PARTNERID', Configuration::get('RATY_PARTNERID'));
|
||||
$subpartnerId = Tools::getValue('RATY_SUBPARTNERID', Configuration::get('RATY_SUBPARTNERID'));
|
||||
$mcc = Tools::getValue('RATY_MCC', Configuration::get('RATY_MCC'));
|
||||
$promotion = Tools::getValue('RATY_PROMOTION', Configuration::get('RATY_PROMOTION'));
|
||||
$salt = Tools::getValue('RATY_SALT', Configuration::get('RATY_SALT'));
|
||||
$calculatedIncome = '';
|
||||
$limit = '';
|
||||
$transactionCode = $params['order']->reference;
|
||||
$total = $params['order']->total_paid;
|
||||
|
||||
$date = date('Y-m-d');
|
||||
$time = date('H:i:s');
|
||||
$dateAndTime = $date . 'T' . $time;
|
||||
|
||||
$verificationCode = hash('sha256', $salt . $this->changeNumberFormat($total) .
|
||||
$transactionCode . $partnerId . $subpartnerId . $dateAndTime . $mcc . $firstName . $lastName . $limit . $calculatedIncome . $promotion);
|
||||
|
||||
$values = [
|
||||
'url' => $url,
|
||||
'firstName' => $firstName,
|
||||
'lastName' => $lastName,
|
||||
'amount' => $total,
|
||||
'partnerId' => $partnerId,
|
||||
'subpartnerId' => $subpartnerId,
|
||||
'mcc' => $mcc,
|
||||
'limit' => $limit,
|
||||
'promotion' => $promotion,
|
||||
'calculatedIncome' => $calculatedIncome,
|
||||
'verificationCode' => $verificationCode,
|
||||
'transactionCode' => $transactionCode,
|
||||
'dateAndTime' => $dateAndTime,
|
||||
'amount' => $this->changeNumberFormat($total),
|
||||
'status' => 'ok',
|
||||
'articlesList' => base64_encode(json_encode($this->getAliorsArticlesListJson(
|
||||
$params['order']->getProducts(),
|
||||
(float)$params['order']->total_shipping,
|
||||
(float)$params['order']->total_discounts
|
||||
))),
|
||||
];
|
||||
|
||||
$this->context->smarty->assign($values);
|
||||
} else {
|
||||
$this->context->smarty->assign('status', 'failed');
|
||||
}
|
||||
|
||||
return $this->context->smarty->fetch('module:raty/views/templates/hook/payment_return.tpl');
|
||||
}
|
||||
|
||||
public function renderForm()
|
||||
{
|
||||
$fields_form = array(
|
||||
'form' => array(
|
||||
'legend' => array(
|
||||
'title' => $this->l('Ustawienia'),
|
||||
'icon' => 'icon-cogs'
|
||||
),
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Adres URL'),
|
||||
'name' => 'RATY_URL',
|
||||
'class' => 'fixed-width-xxl',
|
||||
'desc' => $this->l('Adres URL banku.')
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('PartnerID'),
|
||||
'name' => 'RATY_PARTNERID',
|
||||
'class' => 'fixed-width-xxl',
|
||||
'desc' => $this->l('Kod partnera handlowego')
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('SubpartnerID'),
|
||||
'name' => 'RATY_SUBPARTNERID',
|
||||
'class' => 'fixed-width-xxl',
|
||||
'desc' => $this->l('Dodatkowy kod partnera handlowego.')
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('MCC'),
|
||||
'name' => 'RATY_MCC',
|
||||
'class' => 'fixed-width-xxl',
|
||||
'desc' => $this->l('Kod MCC.')
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Promocja'),
|
||||
'name' => 'RATY_PROMOTION',
|
||||
'class' => 'fixed-width-xxl',
|
||||
'desc' => $this->l('Kod promocji.')
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Wartość'),
|
||||
'name' => 'RATY_WARTOSC',
|
||||
'class' => 'fixed-width-xxl',
|
||||
'desc' => $this->l('Minimalna wartość od której dostępna jest sprzedaż ratalna.')
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('URL kalkulatora'),
|
||||
'name' => 'RATY_KALKULATOR',
|
||||
'class' => 'fixed-width-xxl',
|
||||
'desc' => $this->l('Link do obliczenia wysokości rat')
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Salt'),
|
||||
'name' => 'RATY_SALT',
|
||||
'class' => 'fixed-width-xxl',
|
||||
'desc' => $this->l('Kod Salt odtrzymany od banku')
|
||||
),
|
||||
),
|
||||
'submit' => array(
|
||||
'title' => $this->l('Save'),
|
||||
)
|
||||
),
|
||||
);
|
||||
|
||||
$helper = new HelperForm();
|
||||
$helper->show_toolbar = false;
|
||||
$helper->table = $this->table;
|
||||
$lang = new Language((int) Configuration::get('PS_LANG_DEFAULT'));
|
||||
$helper->default_form_language = $lang->id;
|
||||
$helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
|
||||
$helper->identifier = $this->identifier;
|
||||
$helper->submit_action = 'submitRaty';
|
||||
$helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false) . '&configure=' . $this->name . '&tab_module=' . $this->tab . '&module_name=' . $this->name;
|
||||
$helper->token = Tools::getAdminTokenLite('AdminModules');
|
||||
$helper->tpl_vars = array(
|
||||
'fields_value' => $this->getConfigFieldsValues(),
|
||||
'languages' => $this->context->controller->getLanguages(),
|
||||
'id_language' => $this->context->language->id
|
||||
);
|
||||
|
||||
return $helper->generateForm(array($fields_form));
|
||||
}
|
||||
|
||||
public function checkCurrency($cart)
|
||||
{
|
||||
$currency_order = new Currency($cart->id_currency);
|
||||
$currencies_module = $this->getCurrency($cart->id_currency);
|
||||
if (is_array($currencies_module)) {
|
||||
foreach ($currencies_module as $currency_module) {
|
||||
if ($currency_order->id == $currency_module['id_currency']) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getConfigFieldsValues()
|
||||
{
|
||||
return array(
|
||||
'RATY_URL' => Tools::getValue('RATY_URL', Configuration::get('RATY_URL')),
|
||||
'RATY_PARTNERID' => Tools::getValue('RATY_PARTNERID', Configuration::get('RATY_PARTNERID')),
|
||||
'RATY_SUBPARTNERID' => Tools::getValue('RATY_SUBPARTNERID', Configuration::get('RATY_SUBPARTNERID')),
|
||||
'RATY_MCC' => Tools::getValue('RATY_MCC', Configuration::get('RATY_MCC')),
|
||||
'RATY_PROMOTION' => Tools::getValue('RATY_PROMOTION', Configuration::get('RATY_PROMOTION')),
|
||||
'RATY_WARTOSC' => Tools::getValue('RATY_WARTOSC', $this->changeNumberFormat(Configuration::get('RATY_WARTOSC'))),
|
||||
'RATY_KALKULATOR' => Tools::getValue('RATY_KALKULATOR', Configuration::get('RATY_KALKULATOR')),
|
||||
'RATY_SALT' => Tools::getValue('RATY_SALT', Configuration::get('RATY_SALT')),
|
||||
);
|
||||
}
|
||||
|
||||
public function checkAmount($total)
|
||||
{
|
||||
$wartosc = (float) Tools::getValue('RATY_WARTOSC', $this->changeNumberFormat(Configuration::get('RATY_WARTOSC')));
|
||||
if ($wartosc > 0) {
|
||||
return $wartosc <= $total;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private function changeNumberFormat($value)
|
||||
{
|
||||
return number_format($value, 2, '.', '');
|
||||
}
|
||||
|
||||
private function getAliorsArticlesListJson(array $products, $totalShippingCost, $totalDiscounts)
|
||||
{
|
||||
$totalShippingCost = (float)$totalShippingCost;
|
||||
$totalDiscounts = (float)$totalDiscounts;
|
||||
// @see https://stackoverflow.com/questions/42981409/php7-1-json-encode-float-issue
|
||||
// json_encode makes float values wrong. This is simple fix
|
||||
if (version_compare(phpversion(), '7.1', '>=')) {
|
||||
ini_set( 'serialize_precision', -1 );
|
||||
}
|
||||
|
||||
$json = ['articlesList' => []];
|
||||
foreach ($products as $prod) {
|
||||
if (!empty($prod['unit_price_tax_incl'])){
|
||||
$price = $prod['unit_price_tax_incl'];
|
||||
} else {
|
||||
$price = !empty($prod['product_price_wt']) ? $prod['product_price_wt'] : $prod['product_price'];
|
||||
}
|
||||
$json['articlesList'][] = [
|
||||
"category" => $this->getAliorsCategory($prod['id_category_default']),
|
||||
"name" => $prod['product_name'],
|
||||
"number" => (int)$prod['product_quantity'],
|
||||
"price" => (float)$price,
|
||||
];
|
||||
}
|
||||
if ($totalShippingCost){
|
||||
$json['articlesList'][] = [
|
||||
"category" => 'TKC_USLUGI', // from Alior's docs
|
||||
"name" => 'Shipping costs',
|
||||
"number" => 1,
|
||||
"price" => $totalShippingCost,
|
||||
];
|
||||
}
|
||||
if ($totalDiscounts){
|
||||
$json['articlesList'][] = [
|
||||
"category" => 'TKC_RABAT', // from Alior's docs
|
||||
"name" => 'Discount',
|
||||
"number" => 1,
|
||||
"price" => $totalDiscounts * -1,
|
||||
];
|
||||
}
|
||||
|
||||
return $json;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns Alior's ID of category based on mapping (see map.php)
|
||||
* @return string
|
||||
*/
|
||||
private function getAliorsCategory($shopCategoryId)
|
||||
{
|
||||
$map = require(dirname(__FILE__) . '/map.php');
|
||||
if (empty($map)) {
|
||||
return '';
|
||||
}
|
||||
foreach ($map as $aliorId => $shopCats) {
|
||||
if (in_array($shopCategoryId, $shopCats)) {
|
||||
return $aliorId;
|
||||
}
|
||||
}
|
||||
|
||||
return !empty($map['default']) ? $map['default'] : '';
|
||||
}
|
||||
}
|
||||
9
modules/raty/raty/raty.tpl
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
<div id="raty">
|
||||
<form id="wniosek" method="post">
|
||||
<input type="text" name="imie" placeholder="Imię"/><br/>
|
||||
<input type="text" name="nazwisko" placeholder="nazwisko"/><br/>
|
||||
<input type="text" name="amount" placeholder="kwota"/>
|
||||
<button type="submit">Złóż</button>
|
||||
</form>
|
||||
</div>
|
||||
40
modules/raty/raty/validation.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
include(dirname(__FILE__).'/../../config/config.inc.php');
|
||||
Tools::displayFileAsDeprecated();
|
||||
|
||||
include(dirname(__FILE__).'/../../header.php');
|
||||
include(dirname(__FILE__).'/raty.php');
|
||||
|
||||
$context = Context::getContext();
|
||||
$cart = $context->cart;
|
||||
$raty = new Raty();
|
||||
|
||||
if ($cart->id_customer == 0 or $cart->id_address_delivery == 0 or $cart->id_address_invoice == 0 or !$raty->active) {
|
||||
Tools::redirect('index.php?controller=order&step=1');
|
||||
}
|
||||
|
||||
// Check that this payment option is still available in case the customer changed his address just before the end of the checkout process
|
||||
$authorized = false;
|
||||
foreach (Module::getPaymentModules() as $module) {
|
||||
if ($module['name'] == 'raty') {
|
||||
$authorized = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$authorized) {
|
||||
die($raty->l('This payment method is not available.', 'validation'));
|
||||
}
|
||||
|
||||
$customer = new Customer($cart->id_customer);
|
||||
|
||||
if (!Validate::isLoadedObject($customer)) {
|
||||
Tools::redirect('index.php?controller=order&step=1');
|
||||
}
|
||||
|
||||
$currency = $context->currency;
|
||||
$total = (float)$cart->getOrderTotal(true, Cart::BOTH);
|
||||
|
||||
$raty->validateOrder((int)$cart->id, $total, $raty->displayName, null, array(), (int)$currency->id, false, $customer->secure_key);
|
||||
|
||||
Tools::redirect('index.php?controller=order-confirmation&id_cart='.(int)($cart->id).'&id_module='.(int)($raty->id).'&id_order='.$raty->currentOrder.'&key='.$customer->secure_key);
|
||||
11
modules/raty/raty/views/index.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../../../../');
|
||||
exit;
|
||||
11
modules/raty/raty/views/templates/front/index.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../../../');
|
||||
exit;
|
||||
@@ -0,0 +1,39 @@
|
||||
{capture name=path}
|
||||
<a href="{$link->getPageLink('order', true, NULL, "step=3")|escape:'html':'UTF-8'}" title="{l s='Go back to the Checkout' mod='raty'}">{l s='Checkout' mod='raty'}</a><span class="navigation-pipe">{$navigationPipe}</span>{l s='Raty Alior Bank' mod='raty'}
|
||||
{/capture}
|
||||
|
||||
{include file="$tpl_dir./breadcrumb.tpl"}
|
||||
|
||||
<h2>{l s='Podsumowanie zamówienia' mod='raty'}</h2>
|
||||
|
||||
{assign var='current_step' value='payment'}
|
||||
{include file="$tpl_dir./order-steps.tpl"}
|
||||
|
||||
{if $nbProducts <= 0}
|
||||
<p class="warning">{l s='Twój koszyk jest pusty.' mod='raty'}</p>
|
||||
{else}
|
||||
|
||||
<h3>{l s='Raty Alior Bank' mod='raty'}</h3>
|
||||
<form action="{$link->getModuleLink('raty', 'validation', [], true)|escape:'html'}" method="post">
|
||||
<p>
|
||||
<img src="{$this_path_bw}logo.png" alt="{l s='Raty Alior Bank' mod='raty'}" width="86" height="49" style="float:left; margin: 0px 10px 5px 0px;" />
|
||||
{l s='Wybrałeś płatność poprzez raty Alior Banku.' mod='raty'}
|
||||
<br/><br />
|
||||
{l s='To jest Twoje skrócona informacja o zamówieniu:' mod='raty'}
|
||||
</p>
|
||||
<p style="margin-top:20px;">
|
||||
- {l s='Całkowita kwota do zapłaty' mod='raty'}
|
||||
<span id="amount" class="price">{displayPrice price=$total}</span>
|
||||
{if $use_taxes == 1}
|
||||
{l s='(zawiera VAT.)' mod='raty'}
|
||||
{/if}
|
||||
</p>
|
||||
<p>
|
||||
<b>{l s='Proszę potwierdź zamówienie klikając na "Potwierdzam zamówienie".' mod='raty'}</b>
|
||||
</p>
|
||||
<p class="cart_navigation" id="cart_navigation">
|
||||
<input type="submit" value="{l s='Potwierdzam zamówienie' mod='raty'}" class="exclusive_large" />
|
||||
<a href="{$link->getPageLink('order', true, NULL, "step=3")|escape:'html'}" class="button_large">{l s='Inne metody płatności' mod='raty'}</a>
|
||||
</p>
|
||||
</form>
|
||||
{/if}
|
||||
11
modules/raty/raty/views/templates/hook/index.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../../../../../');
|
||||
exit;
|
||||
9
modules/raty/raty/views/templates/hook/payment.tpl
Normal file
@@ -0,0 +1,9 @@
|
||||
<p class="payment_module" style="position:relative;">
|
||||
<a class="cheque" href="{$link->getModuleLink('raty', 'payment')|escape:'html'}" title="{l s='Zapłać poprzez Raty Alior Bank' mod='raty'}">
|
||||
<img src="{$this_path_raty}logo.png" alt="{l s='Zapłać poprzez raty Alior Bank' mod='raty'}" width="86" height="49"/>
|
||||
{l s='Zapłać poprzez raty Alior Bank' mod='raty'} <span>{l s='' mod='raty'}</span>
|
||||
</a>
|
||||
{if !empty($this_kalkulator)}
|
||||
<a href="{$this_kalkulator}{$this_cena}" target="_blank" style="border:none;background:none;right:20px;top:0px;z-index: 100;"><img src="{$this_path_raty}alior-kalkulator-guzik.gif" alt="{l s='Oblicz ratę' mod='raty'}" width="86" height="49"/></a>
|
||||
{/if}
|
||||
</p>
|
||||
26
modules/raty/raty/views/templates/hook/payment_return.tpl
Normal file
@@ -0,0 +1,26 @@
|
||||
{if $status == 'ok'}
|
||||
<form name='fr' action='{$url}' method='POST'>
|
||||
<input type='hidden' name='firstName' value='{$firstName}'/>
|
||||
<input type='hidden' name='lastName' value='{$lastName}'/>
|
||||
<input type='hidden' name='partnerId' value='{$partnerId}'/>
|
||||
<input type='hidden' name='subPartnerId' value='{$subpartnerId}'/>
|
||||
<input type='hidden' name='mcc' value='{$mcc}'>
|
||||
<input type='hidden' name='limit' value='{$limit}'/>
|
||||
<input type='hidden' name='promotion' value='{$promotion}'/>
|
||||
<input type='hidden' name='calculatedIncome' value='{$calculatedIncome}'/>
|
||||
<input type='hidden' name='verificationCode' value='{$verificationCode}'/>
|
||||
<input type='hidden' name='transactionCode' value='{$transactionCode}'/>
|
||||
<input type='hidden' name='dateAndTime' value='{$dateAndTime}'/>
|
||||
<input type='hidden' name='amount' value='{$amount}'/>
|
||||
<input type='hidden' name='articlesList' value='{$articlesList}'/>
|
||||
</form>
|
||||
|
||||
<script type='text/javascript'>
|
||||
document.fr.submit();
|
||||
</script>
|
||||
{else}
|
||||
<p class="warning">
|
||||
{l s='We noticed a problem with your order. If you think this is an error, feel free to contact our' mod='bankwire'}
|
||||
<a href="{$link->getPageLink('contact', true)|escape:'html'}">{l s='expert customer support team' mod='bankwire'}</a>.
|
||||
</p>
|
||||
{/if}
|
||||
6
modules/raty/raty/views/templates/hook/productraty.tpl
Normal file
@@ -0,0 +1,6 @@
|
||||
{if !empty($this_kalkulator)}
|
||||
<div id="oblicz-rate" class="single_raty">
|
||||
<a href="{$this_kalkulator}{$this_cena}" target="_blank"><img src="/img/alior-button.webp"/></a>
|
||||
</div>
|
||||
<br/>
|
||||
{/if}
|
||||
5
modules/raty/raty/views/templates/hook/raty_cart.tpl
Normal file
@@ -0,0 +1,5 @@
|
||||
{if !empty($this_kalkulator)}
|
||||
<div id="oblicz-rate" style="text-align:center;bottom:-4px;right: 400px">
|
||||
<a href="{$this_kalkulator}{$this_cena}" target="_blank"><img src="{$this_path_raty}/alior-kalkulator-guzik.gif"/></a>
|
||||
</div>
|
||||
{/if}
|
||||
11
modules/raty/raty/views/templates/index.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../../../');
|
||||
exit;
|
||||
0
modules/raty/translations/pl.php
Normal file
40
modules/raty/validation.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
include(dirname(__FILE__).'/../../config/config.inc.php');
|
||||
Tools::displayFileAsDeprecated();
|
||||
|
||||
include(dirname(__FILE__).'/../../header.php');
|
||||
include(dirname(__FILE__).'/raty.php');
|
||||
|
||||
$context = Context::getContext();
|
||||
$cart = $context->cart;
|
||||
$raty = new Raty();
|
||||
|
||||
if ($cart->id_customer == 0 or $cart->id_address_delivery == 0 or $cart->id_address_invoice == 0 or !$raty->active) {
|
||||
Tools::redirect('index.php?controller=order&step=1');
|
||||
}
|
||||
|
||||
// Check that this payment option is still available in case the customer changed his address just before the end of the checkout process
|
||||
$authorized = false;
|
||||
foreach (Module::getPaymentModules() as $module) {
|
||||
if ($module['name'] == 'raty') {
|
||||
$authorized = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$authorized) {
|
||||
die($raty->l('This payment method is not available.', 'validation'));
|
||||
}
|
||||
|
||||
$customer = new Customer($cart->id_customer);
|
||||
|
||||
if (!Validate::isLoadedObject($customer)) {
|
||||
Tools::redirect('index.php?controller=order&step=1');
|
||||
}
|
||||
|
||||
$currency = $context->currency;
|
||||
$total = (float)$cart->getOrderTotal(true, Cart::BOTH);
|
||||
|
||||
$raty->validateOrder((int)$cart->id, $total, $raty->displayName, null, array(), (int)$currency->id, false, $customer->secure_key);
|
||||
|
||||
Tools::redirect('index.php?controller=order-confirmation&id_cart='.(int)($cart->id).'&id_module='.(int)($raty->id).'&id_order='.$raty->currentOrder.'&key='.$customer->secure_key);
|
||||
11
modules/raty/views/index.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../../../../');
|
||||
exit;
|
||||
11
modules/raty/views/templates/front/index.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../../../');
|
||||
exit;
|
||||
39
modules/raty/views/templates/front/payment_execution.tpl
Normal file
@@ -0,0 +1,39 @@
|
||||
{capture name=path}
|
||||
<a href="{$link->getPageLink('order', true, NULL, "step=3")|escape:'html':'UTF-8'}" title="{l s='Go back to the Checkout' mod='raty'}">{l s='Checkout' mod='raty'}</a><span class="navigation-pipe">{$navigationPipe}</span>{l s='Raty Alior Bank' mod='raty'}
|
||||
{/capture}
|
||||
|
||||
{include file="$tpl_dir./breadcrumb.tpl"}
|
||||
|
||||
<h2>{l s='Podsumowanie zamówienia' mod='raty'}</h2>
|
||||
|
||||
{assign var='current_step' value='payment'}
|
||||
{include file="$tpl_dir./order-steps.tpl"}
|
||||
|
||||
{if $nbProducts <= 0}
|
||||
<p class="warning">{l s='Twój koszyk jest pusty.' mod='raty'}</p>
|
||||
{else}
|
||||
|
||||
<h3>{l s='Raty Alior Bank' mod='raty'}</h3>
|
||||
<form action="{$link->getModuleLink('raty', 'validation', [], true)|escape:'html'}" method="post">
|
||||
<p>
|
||||
<img src="{$this_path_bw}logo.png" alt="{l s='Raty Alior Bank' mod='raty'}" width="86" height="49" style="float:left; margin: 0px 10px 5px 0px;" />
|
||||
{l s='Wybrałeś płatność poprzez raty Alior Banku.' mod='raty'}
|
||||
<br/><br />
|
||||
{l s='To jest Twoje skrócona informacja o zamówieniu:' mod='raty'}
|
||||
</p>
|
||||
<p style="margin-top:20px;">
|
||||
- {l s='Całkowita kwota do zapłaty' mod='raty'}
|
||||
<span id="amount" class="price">{displayPrice price=$total}</span>
|
||||
{if $use_taxes == 1}
|
||||
{l s='(zawiera VAT.)' mod='raty'}
|
||||
{/if}
|
||||
</p>
|
||||
<p>
|
||||
<b>{l s='Proszę potwierdź zamówienie klikając na "Potwierdzam zamówienie".' mod='raty'}</b>
|
||||
</p>
|
||||
<p class="cart_navigation" id="cart_navigation">
|
||||
<input type="submit" value="{l s='Potwierdzam zamówienie' mod='raty'}" class="exclusive_large" />
|
||||
<a href="{$link->getPageLink('order', true, NULL, "step=3")|escape:'html'}" class="button_large">{l s='Inne metody płatności' mod='raty'}</a>
|
||||
</p>
|
||||
</form>
|
||||
{/if}
|
||||
1
modules/raty/views/templates/front/payment_infos.tpl
Normal file
@@ -0,0 +1 @@
|
||||
<p>{$raty_description}</p>
|
||||
11
modules/raty/views/templates/hook/index.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../../../../../');
|
||||
exit;
|
||||
7
modules/raty/views/templates/hook/payment.tpl
Normal file
@@ -0,0 +1,7 @@
|
||||
<p class="payment_module" style="position:relative;">
|
||||
<a class="cheque" href="{$link->getModuleLink('raty', 'payment')|escape:'html'}" title="{l s='Zapłać poprzez Raty Alior Bank' mod='raty'}">
|
||||
<img src="{$this_path_raty}logo.png" alt="{l s='Zapłać poprzez raty Alior Bank' mod='raty'}" width="86" height="49"/>
|
||||
{l s='Zapłać poprzez raty Alior Bank' mod='raty'} <span>{l s='' mod='raty'}</span>
|
||||
</a>
|
||||
<a href="{$this_kalkulator}{$this_cena}" target="_blank" style="border:none;background:none;right:20px;top:0px;z-index: 100;"><img src="{$this_path_raty}alior-kalkulator-guzik.gif" alt="{l s='Oblicz ratę' mod='raty'}" width="86" height="49"/></a>
|
||||
</p>
|
||||
26
modules/raty/views/templates/hook/payment_return.tpl
Normal file
@@ -0,0 +1,26 @@
|
||||
{if $status == 'ok'}
|
||||
<form name='fr' action='{$url}' method='POST'>
|
||||
<input type='hidden' name='firstName' value='{$firstName}'/>
|
||||
<input type='hidden' name='lastName' value='{$lastName}'/>
|
||||
<input type='hidden' name='partnerId' value='{$partnerId}'/>
|
||||
<input type='hidden' name='subPartnerId' value='{$subpartnerId}'/>
|
||||
<input type='hidden' name='mcc' value='{$mcc}'>
|
||||
<input type='hidden' name='limit' value='{$limit}'/>
|
||||
<input type='hidden' name='promotion' value='{$promotion}'/>
|
||||
<input type='hidden' name='calculatedIncome' value='{$calculatedIncome}'/>
|
||||
<input type='hidden' name='verificationCode' value='{$verificationCode}'/>
|
||||
<input type='hidden' name='transactionCode' value='{$transactionCode}'/>
|
||||
<input type='hidden' name='dateAndTime' value='{$dateAndTime}'/>
|
||||
<input type='hidden' name='amount' value='{$amount}'/>
|
||||
<input type='hidden' name='articlesList' value='{$articlesList}'/>
|
||||
</form>
|
||||
|
||||
<script type='text/javascript'>
|
||||
document.fr.submit();
|
||||
</script>
|
||||
{else}
|
||||
<p class="warning">
|
||||
{l s='We noticed a problem with your order. If you think this is an error, feel free to contact our' mod='bankwire'}
|
||||
<a href="{$link->getPageLink('contact', true)|escape:'html'}">{l s='expert customer support team' mod='bankwire'}</a>.
|
||||
</p>
|
||||
{/if}
|
||||
17
modules/raty/views/templates/hook/productraty.tpl
Normal file
@@ -0,0 +1,17 @@
|
||||
<script>
|
||||
function getPrice() {
|
||||
let price = '{$this_cena}';
|
||||
let priceObj = document.querySelectorAll('.product-prices .current-price');
|
||||
if (priceObj.length > 0) {
|
||||
price = priceObj[priceObj.length - 1].textContent;
|
||||
}
|
||||
return parseFloat(price.replace(',', '.').replace(/[^\d.]/g, ""));
|
||||
}
|
||||
</script>
|
||||
<br/>
|
||||
<div id="oblicz-rate">
|
||||
<a onclick="window.open('{$this_kalkulator}' + getPrice())" target="_blank">
|
||||
<img src="{$this_path_raty}/alior-kalkulator-guzik.gif"/>
|
||||
</a>
|
||||
</div>
|
||||
<br/>
|
||||
16
modules/raty/views/templates/hook/raty_cart.tpl
Normal file
@@ -0,0 +1,16 @@
|
||||
|
||||
<script>
|
||||
function getPrice() {
|
||||
let price = '{$this_cena}';
|
||||
let priceObj = document.querySelectorAll('.cart-total .value');
|
||||
if (priceObj.length > 0) {
|
||||
price = priceObj[priceObj.length - 1].textContent;
|
||||
}
|
||||
return parseFloat(price.replace(',', '.').replace(/[^\d.]/g, ""));
|
||||
}
|
||||
</script>
|
||||
<div id="oblicz-rate" style="text-align:center;bottom:-4px;right: 400px">
|
||||
<a onclick="window.open('{$this_kalkulator}' + getPrice())" target="_blank">
|
||||
<img src="{$this_path_raty}/alior-kalkulator-guzik.gif"/>
|
||||
</a>
|
||||
</div>
|
||||
26
modules/raty/views/templates/hook/updatecategory.tpl
Normal file
@@ -0,0 +1,26 @@
|
||||
<script>
|
||||
function check(event) {
|
||||
let checkbox = document.getElementById('alior_category_promotion');
|
||||
value = event.target.checked ? 1 : 0;
|
||||
checkbox.value = value;
|
||||
}
|
||||
</script>
|
||||
<div class="form-group row">
|
||||
<label class="form-control-label">
|
||||
Raty Alior
|
||||
</label>
|
||||
<div class="col-sm pt-2">
|
||||
<label>
|
||||
<input type="checkbox" id="alior_category_promotion" name="alior_category_promotion" onclick="check(event)"/>
|
||||
Włącz ofertę specjalną dla tej kategorii
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
let checkbox = document.getElementById('alior_category_promotion');
|
||||
checkbox.value = {$alior_category_promotion}
|
||||
checkbox.checked = false;
|
||||
if(checkbox.value === '1') {
|
||||
checkbox.checked = true;
|
||||
}
|
||||
</script>
|
||||
27
modules/raty/views/templates/hook/updateproduct.tpl
Normal file
@@ -0,0 +1,27 @@
|
||||
<script>
|
||||
function check(event) {
|
||||
let checkbox = document.getElementById('alior_product_promotion');
|
||||
value = event.target.checked ? 1 : 0;
|
||||
checkbox.value = value;
|
||||
}
|
||||
</script>
|
||||
<div id="caraty-product-promotion">
|
||||
<h2>Raty Alior</h2>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<label>
|
||||
<input type="checkbox" id="alior_product_promotion" name="alior_product_promotion" onclick="check(event)"/>
|
||||
Włącz ofertę specjalną dla tego produktu
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
let checkbox = document.getElementById('alior_product_promotion');
|
||||
checkbox.value = {$alior_product_promotion}
|
||||
checkbox.checked = false;
|
||||
if(checkbox.value === '1') {
|
||||
checkbox.checked = true;
|
||||
}
|
||||
</script>
|
||||
11
modules/raty/views/templates/index.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../../../');
|
||||
exit;
|
||||
@@ -2,6 +2,10 @@ body > main {
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
html {
|
||||
scroll-padding-top: 150px;
|
||||
}
|
||||
|
||||
body {
|
||||
font-size: 15px;
|
||||
line-height: 1.5;
|
||||
@@ -270,6 +274,12 @@ a {
|
||||
fill: #e6cb6f;
|
||||
}
|
||||
|
||||
body#product {
|
||||
overflow-x: hidden;
|
||||
}
|
||||
body#product > main {
|
||||
overflow: initial;
|
||||
}
|
||||
body#product #content ul.product-flags {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
@@ -445,7 +455,6 @@ body#product .product-info-box .product-info-box-right .product-information .pro
|
||||
body#product .product-info-box .product-info-box-right .product-information .product-actions .product-variants {
|
||||
margin: 16px 0;
|
||||
border-top: 1px solid #ddd;
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
body#product .product-info-box .product-info-box-right .product-information .product-actions .product-variants .product-variants-item {
|
||||
position: relative;
|
||||
@@ -682,8 +691,6 @@ body#product .product-info-box .product-info-box-right .product-information .pro
|
||||
}
|
||||
body#product .product-info-box .product-info-box-right .product-information .product-actions .product-additional-info {
|
||||
display: none;
|
||||
}
|
||||
body#product .product-info-box .product-info-box-right .product-information .product-actions .product-additional-info {
|
||||
margin: 30px 0;
|
||||
}
|
||||
body#product .product-info-box .product-info-box-right .product-information .blockreassurance_product {
|
||||
@@ -696,6 +703,7 @@ body#product .product-info-box .product-info-box-right .product-information .blo
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
color: #462d26;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
@@ -721,9 +729,44 @@ body#product .product-info-box .product-info-box-right .product-information .blo
|
||||
font-weight: 700;
|
||||
margin: 0;
|
||||
}
|
||||
body#product .product-info-box .product-info-box-right .product-information .blockreassurance_product .item-1 .block-description {
|
||||
text-decoration: underline;
|
||||
cursor: pointer;
|
||||
}
|
||||
body#product .product-info-box .product-info-box-right .product-information .blockreassurance_product .block-raty {
|
||||
width: 100%;
|
||||
display: none;
|
||||
}
|
||||
body#product .product-info-box .product-info-box-right .product-information .blockreassurance_product .block-raty .block-raty--wrapper {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
padding-top: 20px;
|
||||
}
|
||||
body#product .product-info-box .product-info-box-right .product-information #description-nav {
|
||||
padding: 32px 24px;
|
||||
margin: 0;
|
||||
list-style: none;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
body#product .product-info-box .product-info-box-right .product-information #description-nav li:not(:last-child) {
|
||||
padding-right: 24px;
|
||||
margin-right: 24px;
|
||||
border-right: 1px solid rgba(17, 14, 12, 0.1019607843);
|
||||
}
|
||||
body#product .product-info-box .product-info-box-right .product-information #description-nav li a {
|
||||
color: #462d26;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
font-family: "Inter", sans-serif;
|
||||
}
|
||||
body#product .product-description-box {
|
||||
position: relative;
|
||||
margin-bottom: 100px;
|
||||
padding-top: 60px;
|
||||
padding-bottom: 60px;
|
||||
}
|
||||
body#product .product-description-box::before {
|
||||
content: "";
|
||||
@@ -735,6 +778,83 @@ body#product .product-description-box::before {
|
||||
transform: translateX(-50%);
|
||||
background: #ffffff;
|
||||
}
|
||||
body#product .product-description-box .c-row {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
-moz-column-gap: 60px;
|
||||
column-gap: 60px;
|
||||
}
|
||||
body#product .product-description-box .c-row .c-col {
|
||||
width: calc(50% - 30px);
|
||||
}
|
||||
@media (max-width: 767px) {
|
||||
body#product .product-description-box .c-row .c-col {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
@media (max-width: 767px) {
|
||||
body#product .product-description-box .c-row .c-col-2 {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
body#product .product-description-box .c-row .c-col-2 .product-description-box-img {
|
||||
position: sticky;
|
||||
top: 150px;
|
||||
}
|
||||
body#product .product-description-box .c-row .c-col-2 .product-description-box-img img {
|
||||
width: 100%;
|
||||
max-width: -moz-fit-content;
|
||||
max-width: fit-content;
|
||||
}
|
||||
body#product .product-description-box ul.product-accordion-box {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
list-style: none;
|
||||
}
|
||||
body#product .product-description-box ul.product-accordion-box li.accordion-item.active .accordion-item-header img {
|
||||
transform: scale(-1);
|
||||
}
|
||||
body#product .product-description-box ul.product-accordion-box li.accordion-item .accordion-item-header {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
-moz-column-gap: 30px;
|
||||
column-gap: 30px;
|
||||
padding: 16px 0;
|
||||
border-bottom: 1px solid rgba(17, 14, 12, 0.1019607843);
|
||||
cursor: pointer;
|
||||
}
|
||||
body#product .product-description-box ul.product-accordion-box li.accordion-item .accordion-item-header h3 {
|
||||
color: #462d26;
|
||||
font-size: 24px;
|
||||
font-weight: 600;
|
||||
font-family: "Inter", sans-serif;
|
||||
margin: 0;
|
||||
}
|
||||
body#product .product-description-box ul.product-accordion-box li.accordion-item .accordion-item-header img {
|
||||
transition: all 0.3s ease-in-out;
|
||||
}
|
||||
body#product .product-description-box ul.product-accordion-box li.accordion-item .accordion-item-body .accordion-item-body--wrapper {
|
||||
padding-top: 24px;
|
||||
padding-bottom: 64px;
|
||||
}
|
||||
body#product .product-description-box ul.product-accordion-box li.accordion-item .accordion-item-body .accordion-item-body--wrapper * {
|
||||
color: #000;
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
font-family: "Inter", sans-serif;
|
||||
line-height: 1.4;
|
||||
}
|
||||
body#product .product-description-box ul.product-accordion-box li.accordion-item .accordion-item-body .accordion-item-body--wrapper * strong {
|
||||
font-weight: 700;
|
||||
}
|
||||
body#product .product-description-box ul.product-accordion-box li.accordion-item .accordion-item-body .accordion-item-body--wrapper img {
|
||||
max-width: -moz-fit-content;
|
||||
max-width: fit-content;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
body#product .tabs {
|
||||
border-radius: 10px;
|
||||
}
|
||||
@@ -1733,15 +1853,17 @@ body#category #content-wrapper section#main div {
|
||||
column-gap: 80px;
|
||||
position: relative;
|
||||
}
|
||||
.footer-box-other-info > .elementor-container > .elementor-row::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: -60px;
|
||||
bottom: -60px;
|
||||
left: 50%;
|
||||
width: 1px;
|
||||
transform: translateX(-50%);
|
||||
background: rgba(170, 138, 94, 0.25);
|
||||
@media (min-width: 1025px) {
|
||||
.footer-box-other-info > .elementor-container > .elementor-row::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: -60px;
|
||||
bottom: -60px;
|
||||
left: 50%;
|
||||
width: 1px;
|
||||
transform: translateX(-50%);
|
||||
background: rgba(170, 138, 94, 0.25);
|
||||
}
|
||||
}
|
||||
|
||||
nav.pagination .page-list {
|
||||
@@ -2140,4 +2262,16 @@ body#authentication section#main #content .register-form form footer.form-footer
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin: 30px 0 0 0;
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.newsletter-form form.elementor-email-subscription .elementor-field-type-subscribe {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
row-gap: 16px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.newsletter-form form.elementor-email-subscription .elementor-field-type-subscribe button {
|
||||
width: 100%;
|
||||
}
|
||||
}/*# sourceMappingURL=custom.css.map */
|
||||
@@ -11,6 +11,10 @@ body > main {
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
html {
|
||||
scroll-padding-top: 150px;
|
||||
}
|
||||
|
||||
body {
|
||||
font-size: 15px;
|
||||
line-height: 1.5;
|
||||
@@ -382,6 +386,12 @@ a {
|
||||
|
||||
//* Single Product
|
||||
body#product {
|
||||
overflow-x: hidden;
|
||||
|
||||
> main {
|
||||
overflow: initial;
|
||||
}
|
||||
|
||||
#content {
|
||||
ul.product-flags {
|
||||
display: flex;
|
||||
@@ -601,7 +611,7 @@ body#product {
|
||||
.product-variants {
|
||||
margin: 16px 0;
|
||||
border-top: 1px solid #ddd;
|
||||
border-bottom: 1px solid #ddd;
|
||||
// border-bottom: 1px solid #ddd;
|
||||
|
||||
.product-variants-item {
|
||||
position: relative;
|
||||
@@ -898,9 +908,6 @@ body#product {
|
||||
|
||||
.product-additional-info {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.product-additional-info {
|
||||
margin: 30px 0;
|
||||
}
|
||||
}
|
||||
@@ -915,6 +922,7 @@ body#product {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
|
||||
color: #462d26;
|
||||
font-size: 14px;
|
||||
@@ -946,6 +954,50 @@ body#product {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.item-1 {
|
||||
.block-description {
|
||||
text-decoration: underline;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
.block-raty {
|
||||
width: 100%;
|
||||
display: none;
|
||||
|
||||
.block-raty--wrapper {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
padding-top: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#description-nav {
|
||||
padding: 32px 24px;
|
||||
margin: 0;
|
||||
list-style: none;
|
||||
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
|
||||
li {
|
||||
&:not(:last-child) {
|
||||
padding-right: 24px;
|
||||
margin-right: 24px;
|
||||
border-right: 1px solid #110e0c1a;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #462d26;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
font-family: $fInter;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -954,6 +1006,8 @@ body#product {
|
||||
.product-description-box {
|
||||
position: relative;
|
||||
margin-bottom: 100px;
|
||||
padding-top: 60px;
|
||||
padding-bottom: 60px;
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
@@ -965,6 +1019,98 @@ body#product {
|
||||
transform: translateX(-50%);
|
||||
background: #ffffff;
|
||||
}
|
||||
|
||||
.c-row {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
column-gap: 60px;
|
||||
|
||||
.c-col {
|
||||
width: calc(50% - 30px);
|
||||
|
||||
@media (max-width: 767px) {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.c-col-2 {
|
||||
@media (max-width: 767px) {
|
||||
display: none;
|
||||
}
|
||||
.product-description-box-img {
|
||||
position: sticky;
|
||||
top: 150px;
|
||||
|
||||
img {
|
||||
width: 100%;
|
||||
max-width: fit-content;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ul.product-accordion-box {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
list-style: none;
|
||||
|
||||
li.accordion-item {
|
||||
&.active {
|
||||
.accordion-item-header {
|
||||
img {
|
||||
transform: scale(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.accordion-item-header {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
column-gap: 30px;
|
||||
padding: 16px 0;
|
||||
border-bottom: 1px solid #110e0c1a;
|
||||
cursor: pointer;
|
||||
|
||||
h3 {
|
||||
color: #462d26;
|
||||
font-size: 24px;
|
||||
font-weight: 600;
|
||||
font-family: $fInter;
|
||||
margin: 0;
|
||||
}
|
||||
img {
|
||||
transition: all 0.3s ease-in-out;
|
||||
}
|
||||
}
|
||||
|
||||
.accordion-item-body {
|
||||
.accordion-item-body--wrapper {
|
||||
padding-top: 24px;
|
||||
padding-bottom: 64px;
|
||||
|
||||
* {
|
||||
color: #000;
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
font-family: $fInter;
|
||||
line-height: 1.4;
|
||||
|
||||
strong {
|
||||
font-weight: 700;
|
||||
}
|
||||
}
|
||||
|
||||
img {
|
||||
max-width: fit-content;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.tabs {
|
||||
@@ -2310,15 +2456,17 @@ body#category {
|
||||
column-gap: 80px;
|
||||
position: relative;
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: -60px;
|
||||
bottom: -60px;
|
||||
left: 50%;
|
||||
width: 1px;
|
||||
transform: translateX(-50%);
|
||||
background: rgba(#aa8a5e, 0.25);
|
||||
@media (min-width: 1025px) {
|
||||
&::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: -60px;
|
||||
bottom: -60px;
|
||||
left: 50%;
|
||||
width: 1px;
|
||||
transform: translateX(-50%);
|
||||
background: rgba(#aa8a5e, 0.25);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2822,3 +2970,20 @@ body#authentication {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.newsletter-form {
|
||||
form.elementor-email-subscription {
|
||||
.elementor-field-type-subscribe {
|
||||
@media (max-width: 767px) {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
row-gap: 16px;
|
||||
flex-wrap: wrap;
|
||||
|
||||
button {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,3 +44,73 @@ jQuery(document).ready(function ($) {
|
||||
$(this).parent().siblings('.form-control-select-custom').slideToggle();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
jQuery(document).ready(function ($) {
|
||||
if ($("#product").length) {
|
||||
const additionalInfo = $(".product-additional-info");
|
||||
|
||||
if (additionalInfo.length) {
|
||||
const elementsToCopy = [];
|
||||
|
||||
const selectors = [
|
||||
".single_raty",
|
||||
"#oblicz-rate",
|
||||
"#caraty"
|
||||
];
|
||||
|
||||
selectors.forEach(selector => {
|
||||
const element = additionalInfo.find(selector);
|
||||
if (element.length) {
|
||||
elementsToCopy.push(element.clone());
|
||||
}
|
||||
});
|
||||
|
||||
if (elementsToCopy.length) {
|
||||
const item1 = $(".blockreassurance_product .item-1");
|
||||
|
||||
if (item1.length) {
|
||||
const blockRaty = $('<div class="block-raty"><div class="block-raty--wrapper"></div></div>');
|
||||
const wrapper = blockRaty.find('.block-raty--wrapper');
|
||||
|
||||
elementsToCopy.forEach(element => {
|
||||
wrapper.append(element);
|
||||
});
|
||||
|
||||
item1.append(blockRaty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$(".blockreassurance_product .item-1 .block-description").on("click", function () {
|
||||
const blockRaty = $(".blockreassurance_product .item-1 .block-raty");
|
||||
if (blockRaty.length) {
|
||||
blockRaty.slideToggle();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
jQuery(document).ready(function ($) {
|
||||
if ($("#product").length) {
|
||||
$(".accordion-item").addClass("active");
|
||||
$(".accordion-item-body").show();
|
||||
|
||||
$(".accordion-item-header").click(function(){
|
||||
$(".accordion-item-body").slideUp();
|
||||
$(".accordion-item").removeClass("active");
|
||||
|
||||
if ($(this).next(".accordion-item-body").is(":hidden")) {
|
||||
$(this).next(".accordion-item-body").slideDown();
|
||||
$(this).parent().addClass("active");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$(".product-description-box .product-description-box-img").css(
|
||||
"top",
|
||||
$("#header-panel-box").height() + 64
|
||||
)
|
||||
|
||||
}
|
||||
})
|
||||
@@ -1,8 +1,13 @@
|
||||
<div class="js-product-details tab-pane fade{if !$product.description} in active{/if}"
|
||||
{* <div class="js-product-details tab-pane fade{if !$product.description} in active{/if}"
|
||||
id="product-details"
|
||||
data-product="{$product.embedded_attributes|json_encode}"
|
||||
role="tabpanel"
|
||||
>
|
||||
> *}
|
||||
<div class="js-product-details tab-pane {if !$product.description} in active{/if}"
|
||||
id="product-details"
|
||||
data-product="{$product.embedded_attributes|json_encode}"
|
||||
role="tabpanel"
|
||||
>
|
||||
{block name='product_reference'}
|
||||
{if isset($product_manufacturer->id)}
|
||||
<div class="product-manufacturer">
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
<meta content="{$product.url}">
|
||||
|
||||
<div class="row product-container js-product-container product-info-box">
|
||||
<div class="col-md-6 px-0 product-info-box-left">
|
||||
<div class="col-md-6 pl-0 product-info-box-left">
|
||||
{block name='page_content_container'}
|
||||
<section class="page-content" id="content">
|
||||
{block name='page_content'}
|
||||
@@ -137,14 +137,137 @@
|
||||
{block name='product_refresh'}{/block}
|
||||
</form>
|
||||
{/block}
|
||||
|
||||
</div>
|
||||
|
||||
<ol id="description-nav">
|
||||
{if $product.description}
|
||||
<li class="nav-item">
|
||||
<a href="#product-description">{l s='Description' d='Shop.Theme.Catalog'}</a>
|
||||
</li>
|
||||
{/if}
|
||||
<li class="nav-item">
|
||||
<a href="#product-details">{l s='Product Details' d='Shop.Theme.Catalog'}</a>
|
||||
</li>
|
||||
{if $product.attachments}
|
||||
<li class="nav-item">
|
||||
<a href="#product-attachments">{l s='Attachments' d='Shop.Theme.Catalog'}</a>
|
||||
</li>
|
||||
{/if}
|
||||
{foreach from=$product.extraContent item=extra key=extraKey}
|
||||
<li class="nav-item">
|
||||
<a href="#product-extra-content-{$extraKey}">{$extra.title}</a>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row product-container js-product-container product-description-box">
|
||||
<div class="col-xs-12">
|
||||
<div class="c-row">
|
||||
<div class="c-col c-col-1">
|
||||
{block name='product_description_accordion'}
|
||||
<ul class="product-accordion-box">
|
||||
{if $product.description}
|
||||
<li class="accordion-item" id="product-description">
|
||||
<div class="accordion-item-header">
|
||||
<h3>{l s='Description' d='Shop.Theme.Catalog'}</h3>
|
||||
<img src="/img/cms/icons/arrow-down-brown.svg" alt="">
|
||||
</div>
|
||||
<div class="accordion-item-body">
|
||||
<div class="accordion-item-body--wrapper">
|
||||
<div class="product-description">{$product.description nofilter}</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
{/if}
|
||||
<li class="accordion-item" id="product-details">
|
||||
<div class="accordion-item-header">
|
||||
<h3>{l s='Product Details' d='Shop.Theme.Catalog'}</h3>
|
||||
<img src="/img/cms/icons/arrow-down-brown.svg" alt="">
|
||||
</div>
|
||||
<div class="accordion-item-body">
|
||||
<div class="accordion-item-body--wrapper">
|
||||
{include file='catalog/_partials/product-details.tpl'}
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
{if $product.attachments}
|
||||
<li class="accordion-item" id="product-attachments">
|
||||
<div class="accordion-item-header">
|
||||
<h3>{l s='Attachments' d='Shop.Theme.Catalog'}</h3>
|
||||
<img src="/img/cms/icons/arrow-down-brown.svg" alt="">
|
||||
</div>
|
||||
<div class="accordion-item-body">
|
||||
<div class="accordion-item-body--wrapper">
|
||||
<section class="product-attachments">
|
||||
<p class="h5 text-uppercase">{l s='Download' d='Shop.Theme.Actions'}</p>
|
||||
{foreach from=$product.attachments item=attachment}
|
||||
<div class="attachment">
|
||||
<h4><a
|
||||
href="{url entity='attachment' params=['id_attachment' => $attachment.id_attachment]}">{$attachment.name}</a>
|
||||
</h4>
|
||||
<p>{$attachment.description}</p>
|
||||
<a href="{url entity='attachment' params=['id_attachment' => $attachment.id_attachment]}">
|
||||
{l s='Download' d='Shop.Theme.Actions'} ({$attachment.file_size_formatted})
|
||||
</a>
|
||||
</div>
|
||||
{/foreach}
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
{/if}
|
||||
{foreach from=$product.extraContent item=extra key=extraKey}
|
||||
<li class="accordion-item" id="product-extra-content-{$extraKey}">
|
||||
<div class="accordion-item-header">
|
||||
<h3>{$extra.title}</h3>
|
||||
<img src="/img/cms/icons/arrow-down-brown.svg" alt="">
|
||||
</div>
|
||||
<div class="accordion-item-body">
|
||||
<div class="accordion-item-body--wrapper">
|
||||
{$extra.content nofilter}
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
{/block}
|
||||
</div>
|
||||
<div class="c-col c-col-2">
|
||||
<div class="product-description-box-img">
|
||||
{if isset($product.images[1]) && $product.images[1].id_image}
|
||||
<img
|
||||
src="{$link->getImageLink($product.link_rewrite, $product.images[1].id_image)}"
|
||||
loading="lazy"
|
||||
{if !empty($product.images[1].legend)}
|
||||
alt="{$product.images[1].legend}"
|
||||
title="{$product.images[1].legend}"
|
||||
{else}
|
||||
alt="{$product.name}"
|
||||
{/if}
|
||||
/>
|
||||
{elseif isset($product.images[0]) && $product.images[0].id_image}
|
||||
<img
|
||||
src="{$link->getImageLink($product.link_rewrite, $product.images[0].id_image)}"
|
||||
loading="lazy"
|
||||
{if !empty($product.images[0].legend)}
|
||||
alt="{$product.images[0].legend}"
|
||||
title="{$product.images[0].legend}"
|
||||
{else}
|
||||
alt="{$product.name}"
|
||||
{/if}
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{* <div class="row product-container js-product-container product-description-box">
|
||||
<div class="col-xs-12">
|
||||
{block name='product_tabs'}
|
||||
<div class="tabs">
|
||||
@@ -218,7 +341,7 @@
|
||||
</div>
|
||||
{/block}
|
||||
</div>
|
||||
</div>
|
||||
</div> *}
|
||||
|
||||
{block name='product_accessories'}
|
||||
{if $accessories}
|
||||
|
||||