fix conflict

This commit is contained in:
Marion Muszynski 2016-06-06 17:42:00 +02:00
commit 7065edffe4
18 changed files with 2274 additions and 1300 deletions

View File

@ -3,32 +3,56 @@ require_once(dirname(__FILE__).'/../config/config.inc.php');
require_once(dirname(__FILE__).'/init.php');
if($cookie->isLoggedBack() && $cart = Tools::getValue('id_cart')) {
$address = Db::getInstance()->ExecuteS('SELECT * FROM ps_socolissimo_delivery_info WHERE id_cart = '.pSQL(intval(Tools::getValue('id_cart'))));
if(count($address) > 0) {
$address = $address[0];
$address = Db::getInstance()->getRow('
SELECT *
FROM `'._DB_PREFIX_.'socolissimo_delivery_info`
WHERE id_cart = '.pSQL(intval(Tools::getValue('id_cart'))).'
');
if($address) {
if(Tools::getValue('getPR')
&& ($h_xcoords = (float) Tools::getValue('h_xcoords'))
&& ($h_ycoords = (float) Tools::getValue('h_ycoords'))) {
$pr_list = array();
// ± 10km radius
header('Content-Type: text/json');
echo json_encode(Db::getInstance()->ExecuteS('
SELECT *
FROM `'._DB_PREFIX_.'lapostews_pr`
WHERE `ycoords` >= '.(float) $h_ycoords.' - 0.02
AND `ycoords` <= '.(float) $h_ycoords.' + 0.02
AND `xcoords` >= '.(float) $h_xcoords.' - 0.01
AND `xcoords` <= '.(float) $h_xcoords.' + 0.01
'));
exit;
}
if(isset($_POST['submitSC'])) {
Db::getInstance()->Execute('UPDATE ps_socolissimo_delivery_info SET
delivery_mode = "'.pSQL(Tools::getValue('delivery_mode', '')).'",
prname = "'.pSQL(Tools::getValue('prname', '')).'",
prfirstname = "'.pSQL(Tools::getValue('prfirstname', '')).'",
cecompanyname = "'.pSQL(Tools::getValue('cecompanyname', '')).'",
prcompladress = "'.pSQL(Tools::getValue('prcompladress', '')).'",
pradress1 = "'.pSQL(Tools::getValue('pradress1', '')).'",
pradress2 = "'.pSQL(Tools::getValue('pradress2', '')).'",
pradress3 = "'.pSQL(Tools::getValue('pradress3', '')).'",
pradress4 = "'.pSQL(Tools::getValue('pradress4', '')).'",
przipcode = "'.pSQL(Tools::getValue('przipcode', '')).'",
prtown = "'.pSQL(Tools::getValue('prtown', '')).'",
cephonenumber = "'.pSQL(Tools::getValue('cephonenumber', '')).'",
ceemail = "'.pSQL(Tools::getValue('ceemail', '')).'",
cedeliveryinformation = "'.pSQL(Tools::getValue('cedeliveryinformation', '')).'",
cedoorcode1 = "'.pSQL(Tools::getValue('cedoorcode1', '')).'",
cedoorcode2 = "'.pSQL(Tools::getValue('cedoorcode2', '')).'",
prid = "'.pSQL(Tools::getValue('prid', '')).'"
WHERE id_cart = '.pSQL(intval(Tools::getValue('id_cart'))));
}
Db::getInstance()->Execute('UPDATE ps_socolissimo_delivery_info SET
delivery_mode = "'.pSQL(Tools::getValue('delivery_mode', '')).'",
prname = "'.pSQL(Tools::getValue('prname', '')).'",
prfirstname = "'.pSQL(Tools::getValue('prfirstname', '')).'",
cecompanyname = "'.pSQL(Tools::getValue('cecompanyname', '')).'",
cename = "'.pSQL(Tools::getValue('cename', '')).'",
cefirstname = "'.pSQL(Tools::getValue('cefirstname', '')).'",
prcompladress = "'.pSQL(Tools::getValue('prcompladress', '')).'",
pradress1 = "'.pSQL(Tools::getValue('pradress1', '')).'",
pradress2 = "'.pSQL(Tools::getValue('pradress2', '')).'",
pradress3 = "'.pSQL(Tools::getValue('pradress3', '')).'",
pradress4 = "'.pSQL(Tools::getValue('pradress4', '')).'",
przipcode = "'.pSQL(Tools::getValue('przipcode', '')).'",
prtown = "'.pSQL(Tools::getValue('prtown', '')).'",
cephonenumber = "'.pSQL(Tools::getValue('cephonenumber', '')).'",
ceemail = "'.pSQL(Tools::getValue('ceemail', '')).'",
cedeliveryinformation = "'.pSQL(Tools::getValue('cedeliveryinformation', '')).'",
cedoorcode1 = "'.pSQL(Tools::getValue('cedoorcode1', '')).'",
cedoorcode2 = "'.pSQL(Tools::getValue('cedoorcode2', '')).'",
prid = "'.pSQL(Tools::getValue('prid', '')).'"
WHERE id_cart = '.pSQL(intval(Tools::getValue('id_cart'))));
}
?>
<!doctype html>
<html><head>
<meta charset="utf-8" />
<style type="text/css">
body {
overflow: auto;
@ -46,15 +70,60 @@ fieldset {
width: 200px;
}
p {
overflow: auto;
overflow: auto;
}
#map_canvas {
width: 470px;
height: 300px;
display: inline-block;
}
h1 {
clear: both;
font-size: 16px;
padding-top: 20px;
}
#pr_list {
width: 200px;
height: 300px;
overflow-y: auto;
display: inline-block;
margin-left: 10px;
}
#pr_chooser {
clear: both;
}
#pr_chooser ul {
list-style: outside none;
margin: 0px;
padding: 0px;
}
#pr_chooser li {
cursor: pointer;
font-size: 12px;
margin: 10px 10px 10px 0px;
padding: 10px;
}
#pr_chooser li:hover {
background: #ccddee;
}
.maplink {
color: #1122ff;
cursor: pointer;
}
.maplink:hover {
text-decoration: underline;
}
</style>
</head><body onunload="window.opener.location.reload(true);" onload="<?php if(isset($_POST['submitSC'])) { ?>window.close();<?php } ?>">
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
<script type="text/javascript" src="/js/jquery/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="/js/jquery/jquery.ui.map.js"></script>
<script type="text/javascript" src="/js/jquery/jquery.ui.map.services.js"></script>
</head><body onunload="<?php if(isset($_POST['submitSC'])) {?>window.opener.location.reload(true);<?php } ?>" onload="<?php if(isset($_POST['submitSC'])) { ?>window.close();<?php } ?>">
<form action="" method="post">
<fieldset>
<p>
<label>Mode de livraison</label>
<select name="delivery_mode" style="width: 177px;">
<select autocomplete="off" name="delivery_mode" style="width: 177px;">
<?php
$modes = array('DOM' => 'Livraison à domicile (DOM)', 'BPR' => 'Livraison en Bureau de Poste (BPR)',
'A2P' => 'Livraison Commerce de proximité (A2P)', 'MRL' => 'Livraison Commerce de proximité (MRL)', 'CMT' => 'Livraison Commerce (CMT)',
@ -67,77 +136,336 @@ p {
</select>
</p>
<p>
<label>Nom</label>
<input type="text" name="prname" value="<?php echo $address['prname']; ?>" />
</p>
<p>
<label>Prénom</label>
<input type="text" name="prfirstname" value="<?php echo $address['prfirstname']; ?>" />
</p>
<p>
<label>Téléphone</label>
<input type="text" name="cephonenumber" value="<?php echo $address['cephonenumber']; ?>" />
</p>
<p>
<label>Email</label>
<input type="text" name="ceemail" value="<?php echo $address['ceemail']; ?>" />
</p>
<p>
<label>Entreprise</label>
<input type="text" name="cecompanyname" value="<?php echo $address['cecompanyname']; ?>" />
</p>
<label>Nom</label>
<input autocomplete="off" type="text" name="prname" value="<?php echo addslashes($address['prname']); ?>" />
</p>
<p>
<label>Prénom</label>
<input autocomplete="off" type="text" name="prfirstname" value="<?php echo addslashes($address['prfirstname']); ?>" />
</p>
<p>
<label>Téléphone</label>
<input autocomplete="off" type="text" name="cephonenumber" value="<?php echo addslashes($address['cephonenumber']); ?>" />
</p>
<p>
<label>Email</label>
<input autocomplete="off" type="text" name="ceemail" value="<?php echo addslashes($address['ceemail']); ?>" />
</p>
<p>
<label>Nom destinataire</label>
<input autocomplete="off" type="text" name="cename" value="<?php echo addslashes($address['cename']); ?>" />
</p>
<p>
<label>Prénom destinataire</label>
<input autocomplete="off" type="text" name="cefirstname" value="<?php echo addslashes($address['cefirstname']); ?>" />
</p>
<p>
<label>Entreprise</label>
<input autocomplete="off" type="text" name="cecompanyname" value="<?php echo addslashes($address['cecompanyname']); ?>" />
</p>
</fieldset>
<fieldset>
<p>
<label>Adresse 1</label>
<input type="text" name="pradress1" value="<?php echo $address['pradress1']; ?>" />
</p>
<p>
<label>Adresse 2</label>
<input type="text" name="pradress2" value="<?php echo $address['pradress2']; ?>" />
</p>
<p>
<label>Adresse 3</label>
<input type="text" name="pradress3" value="<?php echo $address['pradress3']; ?>" />
</p>
<p>
<label>Adresse 4</label>
<input type="text" name="pradress4" value="<?php echo $address['pradress4']; ?>" />
</p>
<p>
<label>Code postal</label>
<input type="text" name="przipcode" value="<?php echo $address['przipcode']; ?>" />
</p>
<p>
<label>Ville</label>
<input type="text" name="prtown" value="<?php echo $address['prtown']; ?>" />
</p>
<label>Adresse 1</label>
<input autocomplete="off" type="text" name="pradress1" value="<?php echo addslashes($address['pradress1']); ?>" />
</p>
<p>
<label>Adresse 2</label>
<input autocomplete="off" type="text" name="pradress2" value="<?php echo addslashes($address['pradress2']); ?>" />
</p>
<p>
<label>Adresse 3</label>
<input autocomplete="off" type="text" name="pradress3" value="<?php echo addslashes($address['pradress3']); ?>" />
</p>
<p>
<label>Adresse 4</label>
<input autocomplete="off" type="text" name="pradress4" value="<?php echo addslashes($address['pradress4']); ?>" />
</p>
<p>
<label>Code postal</label>
<input autocomplete="off" type="text" name="przipcode" value="<?php echo addslashes($address['przipcode']); ?>" />
</p>
<p>
<label>Ville</label>
<input autocomplete="off" type="text" name="prtown" value="<?php echo addslashes($address['prtown']); ?>" />
</p>
</fieldset>
<fieldset>
<p>
<label>Complément d'adresse</label>
<input type="text" name="prcompladress" value="<?php echo $address['prcompladress']; ?>" />
</p>
<p>
<label>Informations sur la livraison</label>
<textarea><?php echo $address['cedeliveryinformation']; ?></textarea>
</p>
<p>
<label>Code porte 1</label>
<input type="text" name="cedoorcode1" value="<?php echo $address['cedoorcode1']; ?>" />
</p>
<p>
<label>Code porte 2</label>
<input type="text" name="cedoorcode2" value="<?php echo $address['cedoorcode2']; ?>" />
</p>
<p>
<label>ID point retrait</label>
<input type="text" name="prid" value="<?php echo $address['prid']; ?>" />
</p>
<p>
<label>Complément d'adresse</label>
<input autocomplete="off" type="text" name="prcompladress" value="<?php echo addslashes($address['prcompladress']); ?>" />
</p>
<p>
<label>Informations sur la livraison</label>
<textarea><?php echo $address['cedeliveryinformation']; ?></textarea>
</p>
<p>
<label>Code porte 1</label>
<input autocomplete="off" type="text" name="cedoorcode1" value="<?php echo addslashes($address['cedoorcode1']); ?>" />
</p>
<p>
<label>Code porte 2</label>
<input autocomplete="off" type="text" name="cedoorcode2" value="<?php echo addslashes($address['cedoorcode2']); ?>" />
</p>
<p>
<label>ID point retrait</label>
<input autocomplete="off" type="text" name="prid" value="<?php echo addslashes($address['prid']); ?>" />
</p>
<p><input type="submit" value="Envoyer" name="submitSC" /></p>
</fieldset>
</form>
<?php
echo '
<script type="text/javascript">
<!--
markers = [];
-->
</script>
<div id="pr_chooser"><h1>Livraison hors domicile - Recherche d\'un point de retrait</h1>
<div id="map_canvas"></div><div id="pr_list"><ul></ul></div>
<script type="text/javascript">
<!--
function updateForm(delivery_mode, name, address1, address2, address3, address4, postcode, city, prid) {
$("select[name=delivery_mode]").val("");
$("input[name=prname]").val("");
$("input[name=prfirstname]").val("");
$("input[name=pradress1]").val("");
$("input[name=pradress2]").val("");
$("input[name=pradress3]").val("");
$("input[name=pradress4]").val("");
$("input[name=przipcode]").val("");
$("input[name=prtown]").val("");
$("input[name=prid]").val("");
$("input[name=prcompladress]").val("");
$("input[name=cedoorcode1]").val("");
$("input[name=cedoorcode2]").val("");
$("select[name=delivery_mode]").val(delivery_mode);
$("input[name=prname]").val(name);
$("input[name=pradress1]").val(address3);
$("input[name=pradress2]").val(address4);
$("input[name=pradress3]").val(address1);
$("input[name=pradress4]").val(address2);
$("input[name=przipcode]").val(postcode);
$("input[name=prtown]").val(city);
$("input[name=prid]").val(prid);
}
$.deparam = jq_deparam = function( params, coerce ) {
var obj = {},
coerce_types = { "true": !0, "false": !1, "null": null };
// Iterate over all name=value pairs.
$.each( params.replace( /\+/g, " " ).split( "&" ), function(j,v){
var param = v.split( "=" ),
key = decodeURIComponent( param[0] ),
val,
cur = obj,
i = 0,
// If key is more complex than "foo", like "a[]" or "a[b][c]", split it
// into its component parts.
keys = key.split( "][" ),
keys_last = keys.length - 1;
// If the first keys part contains [ and the last ends with ], then []
// are correctly balanced.
if ( /\[/.test( keys[0] ) && /\]$/.test( keys[ keys_last ] ) ) {
// Remove the trailing ] from the last keys part.
keys[ keys_last ] = keys[ keys_last ].replace( /\]$/, "" );
// Split first keys part into two parts on the [ and add them back onto
// the beginning of the keys array.
keys = keys.shift().split("[").concat( keys );
keys_last = keys.length - 1;
} else {
// Basic "foo" style key.
keys_last = 0;
}
// Are we dealing with a name=value pair, or just a name?
if ( param.length === 2 ) {
val = decodeURIComponent( param[1] );
// Coerce values.
if ( coerce ) {
val = val && !isNaN(val) ? +val // number
: val === "undefined" ? undefined // undefined
: coerce_types[val] !== undefined ? coerce_types[val] // true, false, null
: val; // string
}
if ( keys_last ) {
// Complex key, build deep object structure based on a few rules:
// * The "cur" pointer starts at the object top-level.
// * [] = array push (n is set to array length), [n] = array if n is
// numeric, otherwise object.
// * If at the last keys part, set the value.
// * For each keys part, if the current level is undefined create an
// object or array based on the type of the next keys part.
// * Move the "cur" pointer to the next level.
// * Rinse & repeat.
for ( ; i <= keys_last; i++ ) {
key = keys[i] === "" ? cur.length : keys[i];
cur = cur[key] = i < keys_last
? cur[key] || ( keys[i+1] && isNaN( keys[i+1] ) ? {} : [] )
: val;
}
} else {
// Simple key, even simpler rules, since only scalars and shallow
// arrays are allowed.
if ( $.isArray( obj[key] ) ) {
// val is already an array, so push on the next value.
obj[key].push( val );
} else if ( obj[key] !== undefined ) {
// val isn"t an array, but since a second value has been specified,
// convert val into an array.
obj[key] = [ obj[key], val ];
} else {
// val is a scalar.
obj[key] = val;
}
}
} else if ( key ) {
// No value was defined, so set something meaningful.
obj[key] = coerce
? undefined
: "";
}
});
return obj;
};
// Method: jQuery.deparam.querystring
//
// Parse the query string from a URL or the current window.location,
// deserializing it into an object, optionally coercing numbers, booleans,
// null and undefined values.
//
// Usage:
//
// > jQuery.deparam.querystring( [ url ] [, coerce ] );
//
// Arguments:
//
// url - (String) An optional params string or URL containing query string
// params to be parsed. If url is omitted, the current window.location
// is used.
// coerce - (Boolean) If true, coerces any numbers or true, false, null, and
// undefined to their actual value. Defaults to false if omitted.
//
// Returns:
//
// (Object) An object representing the deserialized params string.
// Method: jQuery.deparam.fragment
//
// Parse the fragment (hash) from a URL or the current window.location,
// deserializing it into an object, optionally coercing numbers, booleans,
// null and undefined values.
//
// Usage:
//
// > jQuery.deparam.fragment( [ url ] [, coerce ] );
//
// Arguments:
//
// url - (String) An optional params string or URL containing fragment (hash)
// params to be parsed. If url is omitted, the current window.location
// is used.
// coerce - (Boolean) If true, coerces any numbers or true, false, null, and
// undefined to their actual value. Defaults to false if omitted.
//
// Returns:
//
// (Object) An object representing the deserialized params string.
function jq_deparam_sub( is_fragment, url_or_params, coerce ) {
if ( url_or_params === undefined || typeof url_or_params === "boolean" ) {
// url_or_params not specified.
coerce = url_or_params;
url_or_params = jq_param[ is_fragment ? str_fragment : str_querystring ]();
} else {
url_or_params = is_string( url_or_params )
? url_or_params.replace( is_fragment ? re_trim_fragment : re_trim_querystring, "" )
: url_or_params;
}
return jq_deparam( url_or_params, coerce );
};
$(document).ready(function() {
delivery_modes = {};
$("select[name=delivery_mode] option").each(function(id, el) {
delivery_modes[$(el).attr("value")] = $(el).text();
});
$("#map_canvas").gmap('.($pr_coords? '{ "center": "'.(float) $pr_coords['xcoords'].','.(float) $pr_coords['ycoords'].'" }': '').').bind("init", function(ev, map) {';
$current_address = htmlentities(preg_replace('/(, ){2,}/', ', ', preg_replace('/(, ){2,}/', ', ', implode(', ', array($address['pradress3'], $address['pradress4'], $address['pradress1'], $address['pradress2']))).', '.$address['przipcode'].' '.$address['prtown'].', FRANCE'));
echo '
$("#map_canvas").gmap("search", {"address": "'.$current_address.'"}, function(results, status) {
if ( status === "OK" ) {
var lat = null;
var lng = null;
if(results[0].geometry.location.H) {
lat = results[0].geometry.location.H;
lng = results[0].geometry.location.L;
} else if(results[0].geometry.location.G) {
lat = results[0].geometry.location.G;
lng = results[0].geometry.location.K;
} else {
var loc = results[0].geometry.location.toString().replace("(", "").replace(")", "").replace(" ", "").split(",");
lat = loc[0];
lng = loc[1];
}
$("#map_canvas").gmap("addMarker", {"icon": "http://static.privatesportshop.com/img/admin/marker_home.png", "idpr": "pr_home", "position": lat + "," + lng, "bounds": true}).click(function() {
$("#map_canvas").gmap("openInfoWindow", {"content": "Adresse actuelle"}, this);
});
$.getJSON("scaddressedit.php?id_cart='.(int) Tools::getValue('id_cart').'&getPR=1&h_xcoords=" + lat + "&h_ycoords=" + lng, function(data) {
if(data) {
for(var i=0; i < data.length; i++) {
var prtext = [delivery_modes[data[i].type], data[i].name, data[i].address1, data[i].address2, data[i].address3, data[i].address4, data[i].postcode + " " + data[i].city].filter(function(x) { return x != ""; }).join("<br />");
var prtext_action = "<br /><a class=\"maplink\" onclick=\"$(\'#pr_list li[data-index=" + i + "]\').trigger(\'click\'); return false;\">Sélectionner</a>";
markers.push($("#map_canvas").gmap("addMarker", { "id": "pr_" + data[i].id_pr, "position": data[i].xcoords + "," + data[i].ycoords, "bounds": true, "content": prtext + prtext_action }));
markers[markers.length - 1].click(function() {
$("#map_canvas").gmap("openInfoWindow", {"content": $(this).attr("content")}, this);
});
var litem = $("<li />").attr("data-index", i).attr("data-content", $.param(data[i])).html(prtext).click(function() {
var data = $.deparam($(this).attr("data-content"));
$.each(markers, function(id, el) {
if(el[0].id == "pr_" + data.id_pr) {
google.maps.event.trigger(el[0], "click");
}
});
$("#map_canvas").gmap("option", "center", markers[parseInt($(this).attr("data-index"))][0].getPosition());
updateForm(data.type, data.name, data.address1, data.address2, data.address3, data.address4, data.postcode, data.city, data.id_pr);
});
$("#pr_list ul").append(litem);
}
}
});
}
});
});
});
-->
</script>
</div>';
?>
</body></html>
<?php
}

File diff suppressed because it is too large Load Diff

View File

@ -226,27 +226,55 @@ class ImageCore extends ObjectModel
$imageOld = new Image($row['id_image']);
$imageNew = clone $imageOld;
$imageNew->id_product = (int)($id_product_new);
// A new id is generated for the cloned image when calling add()
if ($imageNew->add())
{
$new_path = $imageNew->getPathForCreation();
foreach ($imagesTypes AS $imageType)
{
if (file_exists(_PS_PROD_IMG_DIR_.$imageOld->getExistingImgPath().'-'.$imageType['name'].'.jpg'))
{
if (!Configuration::get('PS_LEGACY_IMAGES'))
$imageNew->createImgFolder();
copy(_PS_PROD_IMG_DIR_.$imageOld->getExistingImgPath().'-'.$imageType['name'].'.jpg',
$new_path.'-'.$imageType['name'].'.jpg');
}
}
if (file_exists(_PS_PROD_IMG_DIR_.$imageOld->getExistingImgPath().'.jpg'))
copy(_PS_PROD_IMG_DIR_.$imageOld->getExistingImgPath().'.jpg', $new_path.'.jpg');
if($imageNew->add()) {
$new_path = $imageNew->getPathForCreation();
self::replaceAttributeImageAssociationId($combinationImages, (int)($imageOld->id), (int)($imageNew->id));
if(file_exists(_PS_PROD_IMG_DIR_.$imageOld->getExistingImgPath().'.jpg')) {
copy(_PS_PROD_IMG_DIR_.$imageOld->getExistingImgPath().'.jpg', $new_path.'.jpg');
}
foreach($imagesTypes AS $imageType) {
if(file_exists(_PS_PROD_IMG_DIR_.$imageOld->getExistingImgPath().'-'.$imageType['name'].'.jpg')) {
if(!Configuration::get('PS_LEGACY_IMAGES')) {
$imageNew->createImgFolder();
}
copy(_PS_PROD_IMG_DIR_.$imageOld->getExistingImgPath().'-'.$imageType['name'].'.jpg', $new_path.'-'.$imageType['name'].'.jpg');
} else {
if(!Configuration::get('PS_LEGACY_IMAGES')) {
$imageNew->createImgFolder();
}
imageResize($new_path.'.jpg', _PS_PROD_IMG_DIR_.$imageNew->getExistingImgPath().'-'.$imageType['name'].'.jpg', (int) $imageType['width'], (int) $imageType['height']);
}
}
self::replaceAttributeImageAssociationId($combinationImages, (int)($imageOld->id), (int)($imageNew->id));
} else {
return FALSE;
}
else
return false;
// // A new id is generated for the cloned image when calling add()
// if ($imageNew->add())
// {
// $new_path = $imageNew->getPathForCreation();
// foreach ($imagesTypes AS $imageType)
// {
// if (file_exists(_PS_PROD_IMG_DIR_.$imageOld->getExistingImgPath().'-'.$imageType['name'].'.jpg'))
// {
// if (!Configuration::get('PS_LEGACY_IMAGES'))
// $imageNew->createImgFolder();
// copy(_PS_PROD_IMG_DIR_.$imageOld->getExistingImgPath().'-'.$imageType['name'].'.jpg',
// $new_path.'-'.$imageType['name'].'.jpg');
// }
// }
// if (file_exists(_PS_PROD_IMG_DIR_.$imageOld->getExistingImgPath().'.jpg'))
// copy(_PS_PROD_IMG_DIR_.$imageOld->getExistingImgPath().'.jpg', $new_path.'.jpg');
// self::replaceAttributeImageAssociationId($combinationImages, (int)($imageOld->id), (int)($imageNew->id));
// }
// else
// return false;
}
return self::duplicateAttributeImageAssociations($combinationImages);
}

371
js/jquery/jquery.ui.map.js vendored Normal file
View File

@ -0,0 +1,371 @@
/*!
* jQuery FN Google Map 3.0-rc
* http://code.google.com/p/jquery-ui-map/
* Copyright (c) 2010 - 2012 Johan Säll Larsson
* Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
*/
( function($) {
/**
* @param name:string
* @param prototype:object
*/
$.a = function(name, prototype) {
var namespace = name.split('.')[0];
name = name.split('.')[1];
$[namespace] = $[namespace] || {};
$[namespace][name] = function(options, element) {
if ( arguments.length ) {
this._setup(options, element);
}
};
$[namespace][name].prototype = $.extend({
'namespace': namespace,
'pluginName': name
}, prototype);
$.fn[name] = function(options) {
var isMethodCall = typeof options === "string",
args = Array.prototype.slice.call(arguments, 1),
returnValue = this;
if ( isMethodCall && options.substring(0, 1) === '_' ) {
return returnValue;
}
this.each(function() {
var instance = $.data(this, name);
if (!instance) {
instance = $.data(this, name, new $[namespace][name](options, this));
}
if (isMethodCall) {
var value = instance[options].apply(instance, args);
if ( options === 'get' || value != null ) {
returnValue = value;
}
}
});
return returnValue;
};
};
$.a('ui.gmap', {
/**
* Map options
* @see http://code.google.com/intl/sv-SE/apis/maps/documentation/javascript/reference.html#MapOptions
*/
options: {
mapTypeId: 'roadmap',
zoom: 5
},
/**
* Get or set options
* @param key:string
* @param options:object
* @return object
*/
option: function(key, options) {
if (options) {
this.options[key] = options;
this.get('map').set(key, options);
return;
}
return this.options[key];
},
/**
* Setup plugin basics,
* @param options:object
* @param element:node
*/
_setup: function(options, element) {
this.el = element;
options = options || {};
jQuery.extend(this.options, options, { 'center': this._latLng(options.center) });
this._create();
if ( this._init ) { this._init(); }
},
/**
* Instanciate the Google Maps object
*/
_create: function() {
var self = this;
this.instance = { 'map': new google.maps.Map(self.el, self.options), 'markers': [], 'overlays': [], 'services': [] };
google.maps.event.addListenerOnce(self.instance.map, 'bounds_changed', function() { $(self.el).trigger('init', self.instance.map); });
self._call(self.options.callback, self.instance.map);
},
/**
* Adds a latitude longitude pair to the bounds.
* @param position:google.maps.LatLng/string
*/
addBounds: function(position) {
var bounds = this.get('bounds', new google.maps.LatLngBounds());
bounds.extend(this._latLng(position));
this.get('map').fitBounds(bounds);
},
/**
* Helper function to check if a LatLng is within the viewport
* @param marker:google.maps.Marker
*/
inViewport: function(marker) {
var bounds = this.get('map').getBounds();
return (bounds) ? bounds.contains(marker.getPosition()) : false;
},
/**
* Adds a custom control to the map
* @param panel:jquery/node/string
* @param position:google.maps.ControlPosition
* @see http://code.google.com/intl/sv-SE/apis/maps/documentation/javascript/reference.html#ControlPosition
*/
addControl: function(panel, position) {
this.get('map').controls[position].push(this._unwrap(panel));
},
/**
* Adds a Marker to the map
* @param markerOptions:google.maps.MarkerOptions
* @param callback:function(map:google.maps.Map, marker:google.maps.Marker) (optional)
* @return $(google.maps.Marker)
* @see http://code.google.com/intl/sv-SE/apis/maps/documentation/javascript/reference.html#MarkerOptions
*/
addMarker: function(markerOptions, callback) {
markerOptions.map = this.get('map');
markerOptions.position = this._latLng(markerOptions.position);
var marker = new (markerOptions.marker || google.maps.Marker)(markerOptions);
var markers = this.get('markers');
if ( marker.id ) {
markers[marker.id] = marker;
} else {
markers.push(marker);
}
if ( marker.bounds ) {
this.addBounds(marker.getPosition());
}
this._call(callback, markerOptions.map, marker);
return $(marker);
},
/**
* Clears by type
* @param ctx:string e.g. 'markers', 'overlays', 'services'
*/
clear: function(ctx) {
this._c(this.get(ctx));
this.set(ctx, []);
},
_c: function(obj) {
for ( var property in obj ) {
if ( obj.hasOwnProperty(property) ) {
if ( obj[property] instanceof google.maps.MVCObject ) {
google.maps.event.clearInstanceListeners(obj[property]);
if ( obj[property].setMap ) {
obj[property].setMap(null);
}
} else if ( obj[property] instanceof Array ) {
this._c(obj[property]);
}
obj[property] = null;
}
}
},
/**
* Returns the objects with a specific property and value, e.g. 'category', 'tags'
* @param ctx:string in what context, e.g. 'markers'
* @param options:object property:string the property to search within, value:string, operator:string (optional) (AND/OR)
* @param callback:function(marker:google.maps.Marker, isFound:boolean)
*/
find: function(ctx, options, callback) {
var obj = this.get(ctx);
options.value = $.isArray(options.value) ? options.value : [options.value];
for ( var property in obj ) {
if ( obj.hasOwnProperty(property) ) {
var isFound = false;
for ( var value in options.value ) {
if ( $.inArray(options.value[value], obj[property][options.property]) > -1 ) {
isFound = true;
} else {
if ( options.operator && options.operator === 'AND' ) {
isFound = false;
break;
}
}
}
callback(obj[property], isFound);
}
}
},
/**
* Returns an instance property by key. Has the ability to set an object if the property does not exist
* @param key:string
* @param value:object(optional)
*/
get: function(key, value) {
var instance = this.instance;
if ( !instance[key] ) {
if ( key.indexOf('>') > -1 ) {
var e = key.replace(/ /g, '').split('>');
for ( var i = 0; i < e.length; i++ ) {
if ( !instance[e[i]] ) {
if (value) {
instance[e[i]] = ( (i + 1) < e.length ) ? [] : value;
} else {
return null;
}
}
instance = instance[e[i]];
}
return instance;
} else if ( value && !instance[key] ) {
this.set(key, value);
}
}
return instance[key];
},
/**
* Triggers an InfoWindow to open
* @param infoWindowOptions:google.maps.InfoWindowOptions
* @param marker:google.maps.Marker (optional)
* @param callback:function (optional)
* @see http://code.google.com/intl/sv-SE/apis/maps/documentation/javascript/reference.html#InfoWindowOptions
*/
openInfoWindow: function(infoWindowOptions, marker, callback) {
var iw = this.get('iw', infoWindowOptions.infoWindow || new google.maps.InfoWindow);
iw.setOptions(infoWindowOptions);
iw.open(this.get('map'), this._unwrap(marker));
this._call(callback, iw);
},
/**
* Triggers an InfoWindow to close
*/
closeInfoWindow: function() {
if ( this.get('iw') != null ) {
this.get('iw').close();
}
},
/**
* Sets an instance property
* @param key:string
* @param value:object
*/
set: function(key, value) {
this.instance[key] = value;
},
/**
* Refreshes the map
*/
refresh: function() {
var map = this.get('map');
var latLng = map.getCenter();
$(map).triggerEvent('resize');
map.setCenter(latLng);
},
/**
* Destroys the plugin.
*/
destroy: function() {
this.clear('markers');
this.clear('services')
this.clear('overlays')
this._c(this.instance);
jQuery.removeData(this.el, this.name);
},
/**
* Helper method for calling a function
* @param callback
*/
_call: function(callback) {
if ( callback && $.isFunction(callback) ) {
callback.apply(this, Array.prototype.slice.call(arguments, 1));
}
},
/**
* Helper method for google.maps.Latlng
* @param latLng:string/google.maps.LatLng
*/
_latLng: function(latLng) {
if ( !latLng ) {
return new google.maps.LatLng(0.0, 0.0);
}
if ( latLng instanceof google.maps.LatLng ) {
return latLng;
} else {
latLng = latLng.replace(/ /g,'').split(',');
return new google.maps.LatLng(latLng[0], latLng[1]);
}
},
/**
* Helper method for unwrapping jQuery/DOM/string elements
* @param obj:string/node/jQuery
*/
_unwrap: function(obj) {
return (!obj) ? null : ( (obj instanceof jQuery) ? obj[0] : ((obj instanceof Object) ? obj : $('#'+obj)[0]) )
}
});
jQuery.fn.extend( {
triggerEvent: function(eventType) {
google.maps.event.trigger(this[0], eventType);
return this;
},
addEventListener: function(eventType, eventDataOrCallback, eventCallback) {
if ( google.maps && this[0] instanceof google.maps.MVCObject ) {
google.maps.event.addListener(this[0], eventType, eventDataOrCallback);
} else {
if (eventCallback) {
this.bind(eventType, eventDataOrCallback, eventCallback);
} else {
this.bind(eventType, eventDataOrCallback);
}
}
return this;
},
removeEventListener: function(eventType) {
if ( google.maps && this[0] instanceof google.maps.MVCObject ) {
if (eventType) {
google.maps.event.clearListeners(this[0], eventType);
} else {
google.maps.event.clearInstanceListeners(this[0]);
}
} else {
this.unbind(eventType);
}
return this;
}
});
jQuery.each(('click rightclick dblclick mouseover mouseout drag dragend').split(' '), function(i, name) {
jQuery.fn[name] = function(a, b) {
return this.addEventListener(name, a, b);
}
});
} (jQuery) );

View File

@ -0,0 +1,63 @@
/*!
* jQuery UI Google Map 3.0-rc
* http://code.google.com/p/jquery-ui-map/
* Copyright (c) 2010 - 2012 Johan Säll Larsson
* Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
*
* Depends:
* jquery.ui.map.js
*/
( function($) {
$.extend($.ui.gmap.prototype, {
/**
* Computes directions between two or more places.
* @param directionsRequest:google.maps.DirectionsRequest
* @param directionsRendererOptions:google.maps.DirectionsRendererOptions (optional)
* @param callback:function(result:google.maps.DirectionsResult, status:google.maps.DirectionsStatus)
* @see http://code.google.com/intl/sv-SE/apis/maps/documentation/javascript/reference.html#DirectionsRequest
* @see http://code.google.com/intl/sv-SE/apis/maps/documentation/javascript/reference.html#DirectionsRendererOptions
* @see http://code.google.com/intl/sv-SE/apis/maps/documentation/javascript/reference.html#DirectionsResult
*/
displayDirections: function(directionsRequest, directionsRendererOptions, callback) {
var self = this;
var directionService = this.get('services > DirectionsService', new google.maps.DirectionsService());
var directionRenderer = this.get('services > DirectionsRenderer', new google.maps.DirectionsRenderer());
if ( directionsRendererOptions ) {
directionRenderer.setOptions(directionsRendererOptions);
}
directionService.route(directionsRequest, function(results, status) {
if ( status === 'OK' ) {
directionRenderer.setDirections(results);
directionRenderer.setMap(self.get('map'));
} else {
directionRenderer.setMap(null);
}
callback(results, status);
});
},
/**
* Displays the panorama for a given LatLng or panorama ID.
* @param panel:jQuery/String/Node
* @param streetViewPanoramaOptions:google.maps.StreetViewPanoramaOptions (optional)
* @see http://code.google.com/intl/sv-SE/apis/maps/documentation/javascript/reference.html#StreetViewPanoramaOptions
*/
displayStreetView: function(panel, streetViewPanoramaOptions) {
this.get('map').setStreetView(this.get('services > StreetViewPanorama', new google.maps.StreetViewPanorama(this._unwrap(panel), streetViewPanoramaOptions)));
},
/**
* A service for converting between an address and a LatLng.
* @param geocoderRequest:google.maps.GeocoderRequest
* @param callback:function(result:google.maps.GeocoderResult, status:google.maps.GeocoderStatus),
* @see http://code.google.com/intl/sv-SE/apis/maps/documentation/javascript/reference.html#GeocoderResult
*/
search: function(geocoderRequest, callback) {
this.get('services > Geocoder', new google.maps.Geocoder()).geocode(geocoderRequest, callback);
}
});
} (jQuery) );

View File

@ -111,7 +111,7 @@ class BlockBestSellers extends Module
if(!$this->isCached('blockbestsellers_'.(int) $cookie->id_lang.'.tpl', $cache_id)) {
$currency = new Currency((int)($params['cookie']->id_currency));
$bestsellers = ProductSale::getBestSalesVp((int)($params['cookie']->id_lang), 0, 5);
$bestsellers = ProductSale::getBestSalesVp((int)($params['cookie']->id_lang), 0, 5, NULL, NULL, 10);
if (!$bestsellers AND !Configuration::get('PS_BLOCK_BESTSELLERS_DISPLAY'))
return;
$best_sellers = array();
@ -152,7 +152,7 @@ class BlockBestSellers extends Module
if(!$this->isCached('blockbestsellers_cart_'.(int) $id_lang.'.tpl', $cache_id)) {
$currency = new Currency((int)($params['cookie']->id_currency));
$bestsellers = ProductSale::getBestSalesVp((int)($params['cookie']->id_lang), 0, 3);
$bestsellers = ProductSale::getBestSalesVp((int)($params['cookie']->id_lang), 0, 3, NULL, NULL, 10);
if (!$bestsellers AND !Configuration::get('PS_BLOCK_BESTSELLERS_DISPLAY'))
return;
@ -195,7 +195,7 @@ class BlockBestSellers extends Module
if(!$this->isCached('blockbestsellers_home_'.(int) $cookie->id_lang.'.tpl', $cache_id)) {
$currency = new Currency((int)($params['cookie']->id_currency));
$bestsellers = ProductSale::getBestSalesVp((int)($params['cookie']->id_lang), 0, 5);
$bestsellers = ProductSale::getBestSalesVp((int)($params['cookie']->id_lang), 0, 5, NULL, NULL, 10);
if (!$bestsellers AND !Configuration::get('PS_BLOCK_BESTSELLERS_DISPLAY'))
return;
$best_sellers = array();

View File

@ -2,6 +2,7 @@
include_once(_PS_ROOT_DIR_.'/modules/privatesales/Sale.php');
class AdminPrivateSalesSales extends AdminTab {
private $imagelist;
public function __construct() {

View File

@ -1306,14 +1306,6 @@ class soflexibilite extends CarrierModule
$soDelivery->city = $address_invoice->city;
$soDelivery->country = Country::getIsoById((int)$address_invoice->id_country);
}*/
$address_delivery = new Address((int)$params['cart']->id_address_delivery);
if (Validate::isLoadedObject($address_delivery)) {
$soDelivery->address1 = $address_delivery->address1;
$soDelivery->address2 = $address_delivery->address2;
$soDelivery->postcode = $address_delivery->postcode;
$soDelivery->city = $address_delivery->city;
$soDelivery->country = Country::getIsoById((int)$address_delivery->id_country);
}
// OCARAT modif update for customizations
if ($this->ps15x) {
@ -1430,13 +1422,15 @@ class soflexibilite extends CarrierModule
require_once dirname(__FILE__).'/classes/SoFlexibiliteWebService.php';
// Customer Name
$address = Db::getInstance()->ExecuteS('SELECT * FROM ps_socolissimo_delivery_info WHERE id_cart = '.pSQL((int)$order->id_cart));
/*$address = Db::getInstance()->ExecuteS('SELECT * FROM ps_socolissimo_delivery_info WHERE id_cart = '.pSQL((int)$order->id_cart));
if(count($address) > 0) {
$address = $address[0];
}
if (!empty($address['prname']) && !empty($address['prname'])) {
$fullname = sprintf('%s %s', $address['prfirstname'], $address['prname']);
} elseif (!empty($soDelivery->firstname) && !empty($soDelivery->lastname)) {
} else*/
if (!empty($soDelivery->firstname) && !empty($soDelivery->lastname)) {
$fullname = sprintf('%s %s', $soDelivery->firstname, $soDelivery->lastname);
} else {
$fullname = sprintf('%s %s', $customer_address->firstname, $customer_address->lastname);
@ -1482,7 +1476,8 @@ class soflexibilite extends CarrierModule
'name' => $fullname,
'libelle' => in_array($soDelivery->type, array('DOM', 'DOS', 'BOM', 'BOS')) ? '' : $soDelivery->libelle,
'prid' => $soDelivery->id_point ? sprintf('%06s', $soDelivery->id_point) : null,
'company' => $soDelivery->company ? $soDelivery->company : $customer_address->company,
/*'company' => $soDelivery->company ? $soDelivery->company : $customer_address->company,*/
'company' => $soDelivery->company,
'prname' => isset($relay_informations->nom) ? $relay_informations->nom : '',
'address1' => isset($relay_informations->adresse1) ? $relay_informations->adresse1 : (
in_array($soDelivery->type, array('DOM', 'DOS', 'BOM', 'BOS')) ?
@ -1498,7 +1493,7 @@ class soflexibilite extends CarrierModule
'city' => isset($relay_informations->localite) ? $relay_informations->localite : $soDelivery->city,
'country' => isset($relay_informations->libellePays) ? $relay_informations->libellePays : (
Tools::strlen($soDelivery->country) == 2 ?
Country::getNameById($this->context->employee->id_lang, Country::getByIso($soDelivery->country)) :
Country::getNameById($this->context->employee->id_lang, strtolower($soDelivery->country) == 'fr'? 8: Country::getByIso($soDelivery->country)) :
$soDelivery->country
),
'iso_country' => isset($relay_informations->codePays) ? $relay_informations->codePays : $soDelivery->country,

View File

@ -5,10 +5,15 @@ class AdminStatsLogistic extends AdminTab {
$this->table = 'stats_logistic';
$this->lang = false;
$this->date_begin = date('Y-m-d');
$this->date_end = date('Y-m-d');
$this->date_stock = date('Y-m-d');
$this->date_export_begin = date('Y-m-d');
$this->date_export_end = date('Y-m-d');
$this->date_expe_begin = date('Y-m-d');
$this->date_expe_end = date('Y-m-d');
if (!empty($_GET['date_begin'])) {
$this->date_begin = $_GET['date_begin'];
@ -193,7 +198,6 @@ class AdminStatsLogistic extends AdminTab {
}
}
if ($result) {
//echo "<pre>";var_dump($result);echo "</pre>";die();
$fname = 'export-remb-'.$this->date_export_begin.'-'.$this->date_export_end.'.csv';
foreach(glob(dirname(__FILE__).'/*.csv') as $filename) {
if ($fname == $filename) {
@ -208,6 +212,28 @@ class AdminStatsLogistic extends AdminTab {
} else {
echo '<p class="conf">'.$this->l('No sale found.').'</p>';
}
} elseif (Tools::getValue('submitExportExp')) {
$this->date_expe_begin = Tools::getValue('date_expe_begin', $this->date_expe_begin);
$this->date_expe_end = Tools::getValue('date_expe_end', $this->date_expe_end);
$details = $this->getShippingDetails();
if ($details) {
foreach ($details as $key => &$row) {
$sale_info = $this->getSaleInfo((int)$row['id_sale']);
$row['sale_title'] = $sale_info['title'];
}
$fname = 'export-expe-'.$this->date_expe_begin.'-'.$this->date_expe_end.'.csv';
foreach(glob(dirname(__FILE__).'/*.csv') as $filename) {
if ($fname == $filename) {
unlink($filename);
}
}
$this->exportExpeCSV($details, $fname);
echo '<p class="conf">'.$this->l('Export complete.').' <a onclick="window.open(this.href); return false;" href="http://'.$_SERVER['HTTP_HOST'].__PS_BASE_URI__.'modules/stats_logistic/'.$fname.'">'.$this->l('Click here to download the file').'</a></p>';
} else {
echo '<p class="conf">'.$this->l('No result for these dates.').'</p>';
}
}
}
@ -305,6 +331,7 @@ class AdminStatsLogistic extends AdminTab {
$poles[3]['name'] = 'Pôle 4 : Postes complementaires';
$poles[4]['name'] = 'Pôle 5 : Multi';
$poles[5]['name'] = 'Pôle 6 : Autre';
$total_quantity = 0;
foreach ($stats as $key => $stat) {
if (!isset($stat['id_employee'])) {
continue;
@ -349,7 +376,7 @@ class AdminStatsLogistic extends AdminTab {
$total_quantity += $stat['quantity'];
}
$total_colis = $this->getTotalColis();
$total_quantity = 0;
echo '
<h2 style="margin-top:15px">Stats de la logistique</h2>
<table class="table" style="width:100%; margin-top:15px">
@ -453,21 +480,41 @@ class AdminStatsLogistic extends AdminTab {
}
echo '<tbody>
</table>';
if( $cookie->id_employee == 1) {
echo '<br><br><h2 style="margin-top:15px">Export Remboursemments</h2>
echo '<br><br><h2 style="margin-top:15px">Export Remboursements</h2>
<fieldset>
<p>Exporter le détail des ventes dont la date de début est comprise entre : </p>
<form method="POST" action="'.$currentIndex.'" >'
.'<span class="form-group">'
.'<label style="float: none;" class="control-label" for="date_export_begin">Date de début :</label>'
.'<input type="date" name="date_export_begin" value="'.pSQl($this->date_export_begin).'" id="date_export_begin" class="form-control" />'
.'</span>'
.'<span class="form-group">'
.'<label style="float: none;" class="control-label" for="date_export_end">Date de fin :</label>'
.'<input type="date" name="date_export_end" value="'.pSQl($this->date_export_end).'" id="date_export_end" class="form-control" />'
.'</span>'
.'<input type="hidden" name="token" value="'.Tools::getAdminTokenLite(__CLASS__).'" />'
.'<input type="hidden" name="tab" value="'.__CLASS__.'" />'
.'<input type="submit" class="button" name="submitExport" value="Exporter les Remboursements" />'
.'</form>
</fieldset>';
if ($cookie->id_employee == 1 || $cookie->id_employee == 2 || $cookie->id_employee == 7) {
echo '<br><br><h2 style="margin-top:15px">Export Expeditions La Poste</h2>
<fieldset>
<p>Exporter le détail des expeditions dont la date est comprise entre : </p>
<form method="POST" action="'.$currentIndex.'" >'
.'<span class="form-group">'
.'<label style="float: none;" class="control-label" for="date_export_begin">Date de début :</label>'
.'<input type="date" name="date_export_begin" value="'.pSQl($this->date_export_begin).'" id="date_export_begin" class="form-control" />'
.'<input type="date" name="date_expe_begin" value="'.pSQl($this->date_expe_begin).'" id="date_expe_begin" class="form-control" />'
.'</span>'
.'<span class="form-group">'
.'<label style="float: none;" class="control-label" for="date_export_end">Date de fin :</label>'
.'<input type="date" name="date_export_end" value="'.pSQl($this->date_export_end).'" id="date_export_end" class="form-control" />'
.'<input type="date" name="date_expe_end" value="'.pSQl($this->date_expe_end).'" id="date_expe_end" class="form-control" />'
.'</span>'
.'<input type="hidden" name="token" value="'.Tools::getAdminTokenLite(__CLASS__).'" />'
.'<input type="hidden" name="tab" value="'.__CLASS__.'" />'
.'<input type="submit" class="button" name="submitExport" value="Exporter les Remboursemments" />'
.'<input type="submit" class="button" name="submitExportExp" value="Exporter les Expéditions" />'
.'</form>
</fieldset>'
;
@ -544,6 +591,19 @@ class AdminStatsLogistic extends AdminTab {
');
}
public function getShippingDetails() {
return Db::getInstance()->ExecuteS('
SELECT pws.`id_order_detail`, pws.`shipping_number`, pws.`date_add`, pws.`quantity`, e.`email` AS `poste`, od.`id_order`, od.`product_id`, od.`product_attribute_id`, od.`product_name`, psc.`id_sale`, od.`product_quantity`,
ROUND(((od.`product_price` * (1 - od.`reduction_percent` / 100) - od.`reduction_amount`) * (1 - od.`group_reduction` / 100) * (1 + od.`tax_rate` / 100)), 6) AS `price`
FROM `'._DB_PREFIX_.'lapostews` pws
LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON (od.`id_order_detail` = pws.`id_order_detail`)
LEFT JOIN `'._DB_PREFIX_.'employee` e ON (e.`id_employee` = pws.`id_employee`)
LEFT JOIN `'._DB_PREFIX_.'product_ps_cache` psc ON (psc.`id_product` = od.`product_id`)
WHERE pws.`date_add` BETWEEN "'.pSQL($this->date_expe_begin).'" AND "'.pSQL($this->date_expe_end).'"
ORDER BY pws.`date_add` ASC
');
}
public function getSales() {
return Db::getInstance()->ExecuteS('
SELECT p.`id_sale`, p.`date_start`, l.`name` as title
@ -555,6 +615,17 @@ class AdminStatsLogistic extends AdminTab {
');
}
public function getSaleInfo($id_sale) {
return Db::getInstance()->getRow('
SELECT p.`date_start`, l.`name` as title
FROM `'._DB_PREFIX_.'privatesale` p
LEFT JOIN `ps_privatesale_category` c ON (c.`id_sale` = p.`id_sale`)
LEFT JOIN `ps_category_lang` l ON (l.`id_category` = p.`id_category`)
WHERE p.`id_sale` = '.(int)$id_sale.'
AND l.`id_lang` = '. (int) Context::getContext()->language->id.'
');
}
public function getProducts($id_sale) {
$product_ids = array();
foreach(Db::getInstance()->ExecuteS('
@ -567,6 +638,38 @@ class AdminStatsLogistic extends AdminTab {
return $product_ids;
}
public function exportExpeCSV ($items, $filename) {
$fp = fopen(dirname(__FILE__).'/'.$filename, 'w');
$delim = ';';
$row_definition = array(
'shipping_number' => 'N. de suivi',
'date_add' => 'date d\'expe',
'poste' => 'Poste d\'expe',
'id_order' => 'id_order',
'id_sale' => 'id_sale',
'sale_title' => 'sale_title',
'product_id' => 'id_product',
'product_name' => 'product_name',
'price' => 'product_price',
'product_quantity' => 'Quantite envoyee',
);
$data=array();
foreach ($row_definition as $col) {
$data[] = $col;
}
fputcsv ($fp,$data,$delim);
foreach ($items as $item) {
$data = array();
foreach ($row_definition as $key => $col) {
$data[] = (isset($item[$key]) ? $item[$key] : '');
}
fputcsv ($fp,array_map('utf8_decode',array_values($data)),$delim);
}
fclose($fp);
}
public function exportCSV ($result, $filename) {
//$fp = fopen("php://output", 'w');
$fp = fopen(dirname(__FILE__).'/'.$filename, 'w');

View File

@ -0,0 +1,47 @@
<?php
class AttributeGroup extends AttributeGroupCore
{
/**
* @Override
* On vient directement recup que les attributeCombinaisons avec l'id_attribute = 0
*/
public static function cleanDeadCombinations()
{
$attributeCombinations = Db::getInstance()->ExecuteS('
SELECT pac.`id_attribute`, pa.`id_product_attribute`
FROM `'._DB_PREFIX_.'product_attribute` pa LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON (pa.`id_product_attribute` = pac.`id_product_attribute`)
WHERE pac.`id_attribute`=0
');
$toRemove = array();
foreach ($attributeCombinations AS $attributeCombination)
if ((int)($attributeCombination['id_attribute']) == 0)
$toRemove[] = (int)($attributeCombination['id_product_attribute']);
if (!empty($toRemove) AND Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'product_attribute` WHERE `id_product_attribute` IN ('.implode(', ', $toRemove).')') === false)
return false;
return true;
}
public function delete()
{
/* Select children in order to find linked combinations */
$attributeIds = Db::getInstance()->ExecuteS('SELECT `id_attribute` FROM `'._DB_PREFIX_.'attribute` WHERE `id_attribute_group` = '.(int)($this->id));
if ($attributeIds === false)
return false;
/* Removing attributes to the found combinations */
$toRemove = array();
foreach ($attributeIds AS $attribute)
$toRemove[] = (int)($attribute['id_attribute']);
if (!empty($toRemove) AND Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'product_attribute_combination` WHERE `id_attribute` IN ('.implode(', ', $toRemove).')') === false)
return false;
/* Remove combinations if they do not possess attributes anymore */
if (!self::cleanDeadCombinations())
return false;
/* Also delete related attributes */
if (Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'attribute_lang` WHERE `id_attribute` IN (SELECT id_attribute FROM `'._DB_PREFIX_.'attribute` WHERE `id_attribute_group` = '.(int)($this->id).')') === false OR Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'attribute` WHERE `id_attribute_group` = '.(int)($this->id)) === false)
return false;
$return = parent::delete();
if($return)
Module::hookExec('afterDeleteAttributeGroup', array('id_attribute_group' => $this->id));
return $return;
}
}

View File

@ -445,7 +445,7 @@ class FrontController extends FrontControllerCore {
public function setMedia() {
global $cookie;
Tools::addCSS(_THEME_CSS_DIR_.'style.css?v=30');
Tools::addCSS(_THEME_CSS_DIR_.'style.css?v=31');
Tools::addJS(array(_PS_JS_DIR_.'scripts.js'));
if(Tools::isSubmit('live_edit') AND Tools::getValue('ad') AND (Tools::getValue('liveToken') == sha1(Tools::getValue('ad')._COOKIE_KEY_))) {

View File

@ -2,69 +2,69 @@
class Product extends ProductCore
{
public $description_more;
public $description_delivery;
public $videos;
public $description_delivery;
public $videos;
/**
* @Override
*/
protected $fieldsValidateLang = array(
'meta_description' => 'isGenericName', 'meta_keywords' => 'isGenericName',
'meta_title' => 'isGenericName', 'link_rewrite' => 'isLinkRewrite', 'name' => 'isCatalogName',
'description' => 'isString', 'description_short' => 'isString', 'available_now' => 'isGenericName', 'available_later' => 'IsGenericName',
'description_more' => 'isString','videos' => 'isString', 'description_delivery' => 'isString');
/**
* @Override
*/
protected $fieldsValidateLang = array(
'meta_description' => 'isGenericName', 'meta_keywords' => 'isGenericName',
'meta_title' => 'isGenericName', 'link_rewrite' => 'isLinkRewrite', 'name' => 'isCatalogName',
'description' => 'isString', 'description_short' => 'isString', 'available_now' => 'isGenericName', 'available_later' => 'IsGenericName',
'description_more' => 'isString','videos' => 'isString', 'description_delivery' => 'isString');
/**
* @Override
* Check then return multilingual fields for database interaction
*
* @return array Multilingual fields
*/
public function getTranslationsFieldsChild()
{
self::validateFieldsLang();
/**
* @Override
* Check then return multilingual fields for database interaction
*
* @return array Multilingual fields
*/
public function getTranslationsFieldsChild()
{
self::validateFieldsLang();
$fieldsArray = array('meta_description', 'meta_keywords', 'meta_title', 'link_rewrite', 'name', 'available_now', 'available_later');
$fields = array();
$languages = Language::getLanguages(false);
$defaultLanguage = Configuration::get('PS_LANG_DEFAULT');
foreach ($languages as $language)
{
$fields[$language['id_lang']]['id_lang'] = $language['id_lang'];
$fields[$language['id_lang']][$this->identifier] = (int)($this->id);
$fields[$language['id_lang']]['description'] = (isset($this->description[$language['id_lang']])) ? pSQL($this->description[$language['id_lang']], true) : '';
$fields[$language['id_lang']]['description_short'] = (isset($this->description_short[$language['id_lang']])) ? pSQL($this->description_short[$language['id_lang']], true) : '';
$fields[$language['id_lang']]['description_more'] = (isset($this->description_more[$language['id_lang']])) ? pSQL($this->description_more[$language['id_lang']], true) : '';
$fields[$language['id_lang']]['videos'] = (isset($this->videos[$language['id_lang']])) ? pSQL($this->videos[$language['id_lang']], true) : '';
$fields[$language['id_lang']]['description_delivery'] = (isset($this->description_delivery[$language['id_lang']])) ? pSQL($this->description_delivery[$language['id_lang']], true) : '';
foreach ($fieldsArray as $field)
{
if (!Validate::isTableOrIdentifier($field))
die(Tools::displayError());
$fieldsArray = array('meta_description', 'meta_keywords', 'meta_title', 'link_rewrite', 'name', 'available_now', 'available_later');
$fields = array();
$languages = Language::getLanguages(false);
$defaultLanguage = Configuration::get('PS_LANG_DEFAULT');
foreach ($languages as $language)
{
$fields[$language['id_lang']]['id_lang'] = $language['id_lang'];
$fields[$language['id_lang']][$this->identifier] = (int)($this->id);
$fields[$language['id_lang']]['description'] = (isset($this->description[$language['id_lang']])) ? pSQL($this->description[$language['id_lang']], true) : '';
$fields[$language['id_lang']]['description_short'] = (isset($this->description_short[$language['id_lang']])) ? pSQL($this->description_short[$language['id_lang']], true) : '';
$fields[$language['id_lang']]['description_more'] = (isset($this->description_more[$language['id_lang']])) ? pSQL($this->description_more[$language['id_lang']], true) : '';
$fields[$language['id_lang']]['videos'] = (isset($this->videos[$language['id_lang']])) ? pSQL($this->videos[$language['id_lang']], true) : '';
$fields[$language['id_lang']]['description_delivery'] = (isset($this->description_delivery[$language['id_lang']])) ? pSQL($this->description_delivery[$language['id_lang']], true) : '';
foreach ($fieldsArray as $field)
{
if (!Validate::isTableOrIdentifier($field))
die(Tools::displayError());
/* Check fields validity */
if (isset($this->{$field}[$language['id_lang']]) AND !empty($this->{$field}[$language['id_lang']]))
$fields[$language['id_lang']][$field] = pSQL($this->{$field}[$language['id_lang']]);
elseif (in_array($field, $this->fieldsRequiredLang))
{
if ($this->{$field} != '')
$fields[$language['id_lang']][$field] = pSQL($this->{$field}[$defaultLanguage]);
}
else
$fields[$language['id_lang']][$field] = '';
}
}
return $fields;
}
/* Check fields validity */
if (isset($this->{$field}[$language['id_lang']]) AND !empty($this->{$field}[$language['id_lang']]))
$fields[$language['id_lang']][$field] = pSQL($this->{$field}[$language['id_lang']]);
elseif (in_array($field, $this->fieldsRequiredLang))
{
if ($this->{$field} != '')
$fields[$language['id_lang']][$field] = pSQL($this->{$field}[$defaultLanguage]);
}
else
$fields[$language['id_lang']][$field] = '';
}
}
return $fields;
}
public function getCustomFields() {
$customs_data = Db::getInstance()->getRow('
SELECT `nc8`, `id_country`
FROM `'._DB_PREFIX_.'product_customs`
WHERE id_product = '.(int)$this->id
);
return $customs_data;
}
public function getCustomFields() {
$customs_data = Db::getInstance()->getRow('
SELECT `nc8`, `id_country`
FROM `'._DB_PREFIX_.'product_customs`
WHERE id_product = '.(int)$this->id
);
return $customs_data;
}
/**
* @Override

View File

@ -1,7 +1,7 @@
<?php
class ProductSale extends ProductSaleCore
{
public static function getBestSalesVp($id_lang, $pageNumber = 0, $nbProducts = 10, $orderBy=NULL, $orderWay=NULL)
public static function getBestSalesVp($id_lang, $pageNumber = 0, $nbProducts = 10, $orderBy=NULL, $orderWay=NULL, $filterPrice=NULL)
{
$id_category_vp = self::_getIdCategoryPrivateSales();
// $id_category_vp = array_unique($id_category_vp);
@ -60,6 +60,9 @@ class ProductSale extends ProductSaleCore
continue;
$data = Product::getProductsProperties($id_lang, $sale_product, false);
if (isset($filterPrice) && is_int($filterPrice) && $data[0]['price']<$filterPrice) {
continue;
}
$result[] = $data[0];
unset($categories);
}

View File

@ -168,12 +168,12 @@ class ParentOrderController extends ParentOrderControllerCore {
// distinction "at home" et "out of home"
$carriers_ah = array();
$carriers_ooh = array();
// $config_carrier_ooh = array(88,89); // prod
$config_carrier_ooh = array(47,48); // dev
$config_carrier_ooh = array(88,89); // prod
// $config_carrier_ooh = array(47,48); // dev
// $config_carrier_ooh = array(40,45); // local
foreach ($carriers as $carrier) {
// if($shipping_only_athome && $carrier['id_carrier'] != 87) { // prod
if($shipping_only_athome && $carrier['id_carrier'] != 45) { // dev
if($shipping_only_athome && $carrier['id_carrier'] != 87) { // prod
// if($shipping_only_athome && $carrier['id_carrier'] != 45) { // dev
// if($shipping_only_athome && $carrier['id_carrier'] != 38) { // local
continue;
}

View File

@ -6415,6 +6415,22 @@ table#carrierTable tbody td {
padding: 0px 1px;
}
.paypal_account {
background: #fff none repeat scroll 0 0;
border: 1px solid #ccc;
margin: 10px 0 5px;
padding: 15px;
overflow: auto;
}
.paypal_account input[type="radio"] {
float: left;
margin-right: 7px;
position: relative;
top: 3px;
}
.paypal_account label {
float: left;
}
@keyframes slideInDown {
0% {

View File

@ -282,6 +282,9 @@ $_LANG['order-address_da9d6ec2998a07c31ec9eb93c9f254ed'] = 'Votre adresse de fac
$_LANG['order-address_8a8c9edb5531fa2f822295d1830d090f'] = 'Votre adresse de livraison';
$_LANG['order-address_06933067aafd48425d67bcb01bba5cb6'] = 'Mettre à jour';
$_LANG['order-address_284b47b0bb63ae2df3b29f0e691d6fcf'] = 'Adresses';
$_LANG['order-address_4ce81305b7edb043d0a7a5c75cab17d0'] = 'Il y a';
$_LANG['order-address_cb5e100e5a9a3e7f6d1fd97512215282'] = 'une erreur';
$_LANG['order-address_61a328f9db2de8db14231b3259a65b37'] = 'La livraison dans les DOM-TOM n\'est pas disponible, nous vous prions de nous en excuser';
$_LANG['order-address_d0748d2df4aed77bd7591b3ac6c52c83'] = 'Choisissez une adresse de livraison :';
$_LANG['order-address_ec211f7c20af43e742bf2570c3cb84f9'] = 'Ajouter';
$_LANG['order-address_b15e1100a6196acba01ef7aaa5b2a9e5'] = 'Ajoutez une nouvelle adresse';
@ -303,12 +306,14 @@ $_LANG['order-carrier_e085dcd05d73bdd5afe338e5b6e42a18'] = 'Choisissez votre mod
$_LANG['order-carrier_c8c4080207cd4f02548c8cb6285bd16b'] = 'Aucun transporteur nécessaire pour cette commande';
$_LANG['order-carrier_0fce1189b263c211a8239fb0e9df004d'] = 'J\'accepte de recevoir ma commande dans un emballage recyclé';
$_LANG['order-carrier_8f90815af11493295587f91f571c2f95'] = 'Il n\'y a pas de transporteur disponible qui délivre à cette adresse.';
$_LANG['order-carrier_b744007f56f155926b4584feb2570e14'] = 'À domicile';
$_LANG['order-carrier_914419aa32f04011357d3b604a86d7eb'] = 'Transporteur';
$_LANG['order-carrier_a82be0f551b8708bc08eb33cd9ded0cf'] = 'Informations';
$_LANG['order-carrier_3601146c4e948c32b6424d2c0a7f0118'] = 'Prix';
$_LANG['order-carrier_4cd4c5ff8d8913c314f7c26f32f6cf96'] = 'Délai de livraison affiché durant la commande';
$_LANG['order-carrier_21034ae6d01a83e702839a72ba8a77b0'] = 'HT';
$_LANG['order-carrier_1f87346a16cf80c372065de3c54c86d9'] = 'TTC';
$_LANG['order-carrier_c5a800585db893dfa5e05bfd4f328243'] = 'En point relais';
$_LANG['order-carrier_0d9175fe89fb80d815e7d03698b6e83a'] = 'Cadeau';
$_LANG['order-carrier_ea3bd794dfeb4537c194ee43899516ed'] = 'Je souhaite que ma commande soit emballée dans un papier-cadeau.';
$_LANG['order-carrier_5c2dfd55fea1f5c6adef500fcb6403b4'] = 'Supp. de';

View File

@ -4753,6 +4753,7 @@ body#addresses #center_column p.footer_links a.button.back_account {
#address_ac strong {
padding: 0px 1px;
}
body#product #primary_block #more_info_block .sheets ul li,
body#product #primary_block #more_info_block .sheets p {
margin-bottom: 5px;
@ -4766,3 +4767,14 @@ body#product .flex-control-nav.flex-control-paging{
body#product #best-sellers_block_product{
display: none;
}
#cookiescontent { padding: 10px; font-size: 12px; }
h4.subtitle {
color: #e36ea2;
margin-bottom: 10px;
font-weight: normal;
}
.table_skin {}
.table_skin td { font-size: 12px; }
.table_skin a { color: #666666 }

View File

@ -41,6 +41,7 @@ $_LANG['addresses_06933067aafd48425d67bcb01bba5cb6'] = 'Mettre à jour';
$_LANG['addresses_729a51874fe901b092899e9e8b31c97a'] = 'Êtes-vous sûr ?';
$_LANG['addresses_f2a6c498fb90ee345d997f888fce3b18'] = 'Supprimer';
$_LANG['addresses_b32dd33df738183cb85ab8ea714f8026'] = 'Aucune adresse disponible.';
$_LANG['addresses_3c7d34ae915c6664189dab2aebb02307'] = 'Ajouter une adresse';
$_LANG['addresses_122e15ccab4135a2786937a24b11e5e9'] = 'Retour à mon compte';
$_LANG['authentication_99dea78007133396a7b8ed70578ac6ae'] = 'Identifiant';
$_LANG['authentication_bffe9a3c9a7e00ba00a11749e022d911'] = 'Entrez';
@ -299,6 +300,8 @@ $_LANG['order-carrier_b4e59f3a4554655a099738382ebedbff'] = 'Vous pouvez ajouter
$_LANG['order-carrier_dd1f775e443ff3b9a89270713580a51b'] = 'Précédent';
$_LANG['order-carrier_10ac3d04253ef7e1ddc73e6091c0cd55'] = 'Suivant';
$_LANG['order-carrier_bd5b551d1757a856d9f2d01dc7850080'] = 'Laissez un message';
$_LANG['order-carrier_b744007f56f155926b4584feb2570e14'] = 'À domicile';
$_LANG['order-carrier_c5a800585db893dfa5e05bfd4f328243'] = 'En point relais';
$_LANG['order-carrier_617096c86d35478132502be00e12e016'] = 'Si vous souhaitez ajouter un commentaire sur votre commande, merci d\'écrire ci-dessous.';
$_LANG['order-confirmation_fb077ecba55e5552916bde26d8b9e794'] = 'Confirmation de commande';
$_LANG['order-confirmation_8b1a9953c4611296a827abf8c47804d7'] = 'Bonjour';