From c6c5ad32ca5b006ec981049e49ce9d082f78ba08 Mon Sep 17 00:00:00 2001
From: Marion Muszynski
Date: Wed, 28 Jun 2017 15:00:53 +0200
Subject: [PATCH 1/4] fix delete customer
---
adm/tabs/AdminCustomers.php | 59 +++++++++++++++++++------------------
1 file changed, 31 insertions(+), 28 deletions(-)
diff --git a/adm/tabs/AdminCustomers.php b/adm/tabs/AdminCustomers.php
index 50d8ffa2..618a3753 100755
--- a/adm/tabs/AdminCustomers.php
+++ b/adm/tabs/AdminCustomers.php
@@ -1,6 +1,6 @@
delete = true;
$this->deleted = true;
$this->requiredDatabase = true;
-
+
$this->_select = '
IFNULL(ci.`version`, "fr") AS `version`
';
@@ -78,11 +78,11 @@ class AdminCustomers extends AdminTab
parent::__construct();
}
-
+
public function postProcess()
{
global $currentIndex;
-
+
if (Tools::isSubmit('submitDel'.$this->table) OR Tools::isSubmit('delete'.$this->table))
{
$deleteForm = '
@@ -108,11 +108,11 @@ class AdminCustomers extends AdminTab
';
}
-
+
if (Tools::getValue('submitAdd'.$this->table))
{
$groupList = Tools::getValue('groupBox');
-
+
/* Checking fields validity */
$this->validateRules();
if (!sizeof($this->_errors))
@@ -128,7 +128,7 @@ class AdminCustomers extends AdminTab
if (Validate::isLoadedObject($object))
{
$customer_email = strval(Tools::getValue('email'));
-
+
// check if e-mail already used
if ($customer_email != $object->email)
{
@@ -137,14 +137,14 @@ class AdminCustomers extends AdminTab
if ($customer->id)
$this->_errors[] = Tools::displayError('An account already exists for this e-mail address:').' '.$customer_email;
}
-
+
if (!is_array($groupList) OR sizeof($groupList) == 0)
$this->_errors[] = Tools::displayError('Customer must be in at least one group.');
else
if (!in_array(Tools::getValue('id_default_group'), $groupList))
$this->_errors[] = Tools::displayError('Default customer group must be selected in group box.');
-
- // Updating customer use credits
+
+ // Updating customer use credits
$sql = 'SELECT id_customer FROM `'._DB_PREFIX_.'customer_credits` WHERE id_customer = ' .$object->id;
if(Db::getInstance()->getValue($sql)){
// already present
@@ -157,7 +157,7 @@ class AdminCustomers extends AdminTab
Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'customer_credits` VALUES ('. $object->id . ')');
}
}
-
+
// Updating customer's group
if (!sizeof($this->_errors))
{
@@ -207,6 +207,7 @@ class AdminCustomers extends AdminTab
case 'real':
$this->deleted = false;
Discount::deleteByIdCustomer((int)(Tools::getValue('id_customer')));
+ Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'customer_thread` SET `id_customer` = 0 WHERE `id_customer` = '.(int)(Tools::getValue('id_customer')));
break;
case 'deleted':
$this->deleted = true;
@@ -226,8 +227,10 @@ class AdminCustomers extends AdminTab
{
case 'real':
$this->deleted = false;
- foreach (Tools::getValue('customerBox') as $id_customer)
+ foreach (Tools::getValue('customerBox') as $id_customer){
+ Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'customer_thread` SET `id_customer` = 0 WHERE `id_customer` = '.(int)$id_customer);
Discount::deleteByIdCustomer((int)($id_customer));
+ }
break;
case 'deleted':
$this->deleted = true;
@@ -266,7 +269,7 @@ class AdminCustomers extends AdminTab
$update = Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'customer` SET newsletter = '.($customer->newsletter ? 0 : 1).' WHERE `id_customer` = '.(int)($customer->id));
if (!$update)
$this->_errors[] = Tools::displayError('An error occurred while updating customer.');
- Tools::redirectAdmin($currentIndex.'&token='.$this->token);
+ Tools::redirectAdmin($currentIndex.'&token='.$this->token);
}elseif (Tools::isSubmit('changeOptinVal') AND Tools::getValue('id_customer'))
{
@@ -279,7 +282,7 @@ class AdminCustomers extends AdminTab
$this->_errors[] = Tools::displayError('An error occurred while updating customer.');
Tools::redirectAdmin($currentIndex.'&token='.$this->token);
}
-
+
return parent::postProcess();
}
@@ -351,7 +354,7 @@ class AdminCustomers extends AdminTab
echo '
';
-
+
echo '
+ {if !$virtual_cart && $giftAllowed && $cart->gift == 1}
+
+ {/if}
+{/if}
+
{if $site_version == 'es'}
{l s='Pago seguro, datos encriptados'}
{/if}
From 40fe9a97b850e4545db728b1994d660f43051620 Mon Sep 17 00:00:00 2001
From: Marion Muszynski
Date: Mon, 3 Jul 2017 10:15:21 +0200
Subject: [PATCH 4/4] fix css
---
themes/site/css/style.css | 51 ++++++++++++++++++++++++++++++++--
themes/site/js/cart-summary.js | 6 ++--
themes/site/shopping-cart.tpl | 2 +-
3 files changed, 52 insertions(+), 7 deletions(-)
diff --git a/themes/site/css/style.css b/themes/site/css/style.css
index a696ec3e..9366ead6 100755
--- a/themes/site/css/style.css
+++ b/themes/site/css/style.css
@@ -7285,13 +7285,58 @@ table#carrierTable tbody td {
z-index: 800;
}
+#order #center_column #gift_div textarea {
+ margin-bottom: 5px;
+}
#my_gift{
- text-align: center;
- margin-bottom: 10px;
+ text-align: center;
+ margin-bottom: 10px;
+ border: 1px solid #BDC2C9;
+ padding: 5px;
+ background-color: #F1F2F4;
+ position: relative;
}
.my_gift{
- color: #514c8c;
+ font-size: 16px;
+ color: #514c8c;
+ font-weight: normal;
+ text-shadow: 0px 1px 0px #ffffff;
+ line-height: 1.5em;
+ text-transform: none;
+ margin-bottom: 10px;
+ font-family: georgia, times new roman, serif;
+ font-style: italic;
+}
+.remove_message_gift{
+ background: #e26ea2;
+ color: #fff;
+ position: absolute;
+ top: 5px;
+ right: 5px;
+ padding: 2px 7px;
+ -moz-border-radius: 50%;
+ -webkit-border-radius: 50%;
+ border-radius: 50%;
+ cursor: pointer;
+}
+#cart_add_gift_message,
+#cart_remove_gift_message{
+ text-align: center;
+ text-transform: none;
+ border: 0px;
+ color: #ffffff;
+ padding: 5px 10px;
+ text-decoration: none;
+ font-weight: normal;
+ background: #504d8b;
+ -moz-border-radius: 20px;
+ -webkit-border-radius: 20px;
+ border-radius: 20px;
+ font-family: georgia, times new roman, serif;
+ font-style: italic;
+ font-size: 13px;
}
#cart_remove_gift_message{
float:right;
+ background: #e26ea2;
}
\ No newline at end of file
diff --git a/themes/site/js/cart-summary.js b/themes/site/js/cart-summary.js
index 0aeb8f75..8ac8b697 100755
--- a/themes/site/js/cart-summary.js
+++ b/themes/site/js/cart-summary.js
@@ -33,8 +33,9 @@ $(document).ready(function()
$('.cart_quantity_down').unbind('click').click(function(){ downQuantity($(this).attr('id').replace('cart_quantity_down_', '')); return false; });
$('.cart_quantity_delete' ).unbind('click').click(function(){ deletProductFromSummary($(this).attr('id')); return false; });
$('.cart_quantity_input').typeWatch({ highlight: true, wait: 600, captureLength: 0, callback: updateQty });
- $('#cart_add_gift_message').unbind('click').click(function(){ console.log('add'); giftMessage(true); return false; });
- $('#cart_remove_gift_message').unbind('click').click(function(){ console.log('remove'); giftMessage(false); return false; });
+ $('#cart_add_gift_message').unbind('click').click(function(){giftMessage(true); return false; });
+ $('#cart_remove_gift_message').unbind('click').click(function(){giftMessage(false); return false; });
+ $('.remove_message_gift').unbind('click').click(function(){giftMessage(false); return false; });
}
});
@@ -506,7 +507,6 @@ function giftMessage(add){
}
else
{
- console.log(jsonData);
if(jsonData.action == "add_message") {
message = escape($('#gift_message').val())
$('#my_gift_message').html($('#gift_message').val().replace(/\n/g, "
"));
diff --git a/themes/site/shopping-cart.tpl b/themes/site/shopping-cart.tpl
index 1c7c8672..873db872 100755
--- a/themes/site/shopping-cart.tpl
+++ b/themes/site/shopping-cart.tpl
@@ -318,10 +318,10 @@
{if $giftAllowed}
gift == 0} style="display:none;" {/if}>
+ X
{l s='My message : '}
{nl2br($cart->gift_message)|escape:'UTF-8'}
- {l s='Gift'}
gift == 1}checked="checked"{/if} onclick="$('#gift_div').toggle('slow');" />