bebeboutik/modules/paymentinfo/manage.php
Thibault UBUNTU f15662e826 paypal suite
2016-05-02 15:30:12 +02:00

55 lines
1.4 KiB
PHP

<?php
$useSSL = TRUE;
require_once(dirname(__FILE__).'/../../config/config.inc.php');
require_once(dirname(__FILE__).'/../../init.php');
$controller->preProcess();
if (!$cookie->isLogged())
Tools::redirect('authentication.php?back=modules/paymentinfo/manage.php');
include(dirname(__FILE__).'/../../header.php');
// DELTE ACCOUNT PAYPAL
if (Tools::getValue('delete_agreement')) {
$id_paypal_agreement = Tools::getValue('delete_agreement');
$id_customer_test = Db::getInstance()->getValue('
SELECT `id_customer`
FROM `'._DB_PREFIX_.'paypal_customer_agreement`
WHERE `id_paypal_agreement`= '.(int) $id_paypal_agreement.'
');
if(empty($id_customer_test)) {
return false;
}
if($id_customer_test != $cookie->id_customer) {
return false;
}
// DELETE
Db::getInstance()->execute('
DELETE FROM `'._DB_PREFIX_.'paypal_customer_agreement`
WHERE `id_paypal_agreement`= '.(int) $id_paypal_agreement
);
$smarty->assign(array(
'delete' => true,
));
}
// account paypal
$paypal_accounts = Db::getInstance()->executes('
SELECT `id_paypal_agreement`, `email`, `name`, `city`, `date_add`
FROM `'._DB_PREFIX_.'paypal_customer_agreement`
WHERE `id_customer`= '.(int) $cookie->id_customer.'
');
$smarty->assign(array(
'paypal_accounts' => $paypal_accounts,
));
// @TODO account cb
echo Module::display(dirname(__FILE__).'/paymentinfo.php', 'paymentinfo.tpl');
include(dirname(__FILE__).'/../../footer.php');