Initial commit

This commit is contained in:
2019-11-20 07:44:43 +01:00
commit 5bf49c4a81
41188 changed files with 5459177 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
<?php
/*
* 2007-2012 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2012 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
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;

View File

@@ -0,0 +1,118 @@
<?php
/**
* installmentpayment.php, Allows you to set a percentage payment for orders
* @author Magavenue <contact@magavenue.com>
* @copyright Magavenue
* @license http://www.opensource.org/licenses/osl-3.0.php Open-source licence 3.0
* @category modules
*
* @note If you want to customize the module, contact us at contact@magavenue.com
*/
use PrestaShop\PrestaShop\Core\Payment\PaymentOption;
class InstallmentpaymentInstallmentpaymentModuleFrontController extends ModuleFrontController
{
public $ssl = true;
public function __construct()
{
parent::__construct();
}
public function initContent()
{
$this->display_column_left = false;
$this->display_column_right = false;
parent::initContent();
$id_order = Tools::getValue('select');
if (!Context::getContext()->customer->isLogged() && (int) $id_order > 0) {
Tools::redirect(
'index.php?controller=authentication&back=' . urlencode($this->context->link->getModuleLink('installmentpayment', 'installmentpayment', array('select' => $id_order)))
);
}
$order = new Order((int) $id_order);
$sql = 'SELECT * FROM `' . _DB_PREFIX_ . 'installmentpayment` WHERE id_cart=' . (int) $order->id_cart;
$installment = Db::getInstance()->getRow($sql);
if (isset($installment['rest']) && (float) $installment['rest'] > 0) {
$rest_paid = $installment['rest'];
} else {
Tools::redirect(
'index.php?controller=authentication&back=' . urlencode($this->context->link->getModuleLink('installmentpayment', 'installmentpayment', array('select' => $id_order)))
);
}
if ((int) $id_order > 0) {
Context::getContext()->cookie->__set('installmentpayment_id_order', $id_order);
}
$oldCart = new Cart($order->id_cart);
$cart = $oldCart->duplicate();
$this->context->cookie->id_cart = $cart['cart']->id;
$context = $this->context;
$context->cart = $cart['cart'];
$this->context->cookie->write();
$this->context->smarty->assign('hide_left_column', true);
$this->context->smarty->assign('hide_right_column', true);
if (Tools::substr(str_replace('.', '', _PS_VERSION_), 0, 2) == 16) {
if (Context::getContext()->customer->id) {
$cartdata = new Cart($order->id_cart);
$total = (float) $cartdata->getOrderTotalGross(true, Cart::BOTH);
$this->context->smarty->assign(array(
'reference' => $order->reference,
'total' => $total,
'HOOK_PAYMENT' => Hook::exec('displayPayment')
));
$this->setTemplate('order-payment-classic.tpl');
}
} else {
if (Context::getContext()->customer->id) {
$b = new PaymentOptionsFinder();
$data = $b->present();
$cartdata = new Cart($order->id_cart);
$total = (float) $cartdata->getOrderTotalGross(true, Cart::BOTH);
$id_defaultgroup = Db::getInstance()->executeS('SELECT id_default_group FROM ' . _DB_PREFIX_ . 'customer WHERE id_customer = ' . (int) Context::getContext()->customer->id);
if(is_array($id_defaultgroup))
{
$id_defaultgroup = $id_defaultgroup[0]['id_default_group'];
}
$sql = 'SELECT price FROM `' . _DB_PREFIX_ . 'installmentpayment_group` WHERE id_group=' . (int) $id_defaultgroup;
$dataprice = Db::getInstance()->getRow($sql);
if(!empty($data)){
$acompte = (float) $total - ($total * (100 - $dataprice['price']) / 100);
$percent = $dataprice['price'];
}
else
{
$acompte = (float) $total - ($total * (100 - Configuration::get('ACOMPTE_PERCENTAGE')) / 100);
$percent = Configuration::get('ACOMPTE_PERCENTAGE');
}
$presentedCart = $this->cart_presenter->present($this->context->cart);
$this->context->smarty->assign(array(
'reference' => $order->reference,
'payment_options' => $data,
'cart' => $presentedCart,
'selected_payment_option' => 1,
'show_final_summary' => Configuration::get('PS_FINAL_SUMMARY_ENABLED'),
'installmentpayment_type' => (int) Context::getContext()->cookie->installmentpayment_type,
'percent' => $percent,
'acompte_chose' => Configuration::get('ACOMPTE_CHOICE'),
'acompte' => $acompte,
));
$this->setTemplate('module:installmentpayment/views/templates/front/checkout.tpl');
}
}
}
public function setMedia() {
parent::setMedia();
$this->addCSS( _THEME_CSS_DIR_ . 'modules/stripe_official/views/css/front.css');
}
}