//// Merge -> revision 8290
This commit is contained in:
@@ -787,7 +787,7 @@ class AdminOrders extends AdminTab
|
||||
.($product['product_supplier_reference'] ? $this->l('Ref Supplier:').' '.$product['product_supplier_reference'] : '')
|
||||
.'</a></td>
|
||||
<td align="center">'.Tools::displayPrice($product_price, $currency, false).'</td>
|
||||
<td align="center" class="productQuantity">'.((int)($product['product_quantity']) - $product['customizationQuantityTotal']).'</td>
|
||||
<td align="center" class="productQuantity" '.($quantity > 1 ? 'style="font-weight:700;font-size:1.1em;color:red"' : '').'>'.(int)$quantity.'</td>
|
||||
'.($order->hasBeenPaid() ? '<td align="center" class="productQuantity">'.(int)($product['product_quantity_refunded']).'</td>' : '').'
|
||||
'.($order->hasBeenDelivered() ? '<td align="center" class="productQuantity">'.(int)($product['product_quantity_return']).'</td>' : '').'
|
||||
<td align="center" class="productQuantity">'.$productObj->getStock($product['product_attribute_id']).'</td>
|
||||
|
||||
@@ -71,6 +71,7 @@ class AdminPPreferences extends AdminPreferences
|
||||
'PS_PRODUCT_PICTURE_WIDTH' => array('title' => $this->l('Product pictures width:'), 'desc' => $this->l('The maximum width of pictures uploadable by customers'), 'validation' => 'isUnsignedId', 'required' => true, 'cast' => 'intval', 'type' => 'text', 'visibility' => Shop::CONTEXT_ALL),
|
||||
'PS_PRODUCT_PICTURE_HEIGHT' => array('title' => $this->l('Product pictures height:'), 'desc' => $this->l('The maximum height of pictures uploadable by customers'), 'validation' => 'isUnsignedId', 'required' => true, 'cast' => 'intval', 'type' => 'text', 'visibility' => Shop::CONTEXT_ALL),
|
||||
'PS_LEGACY_IMAGES' => array('title' => $this->l('Use the legacy image filesystem:'), 'desc' => $this->l('This should be set to yes unless you successfully moved images in Preferences > Images tab'), 'validation' => 'isBool', 'cast' => 'intval', 'required' => true, 'type' => 'bool', 'visibility' => Shop::CONTEXT_ALL),
|
||||
'PS_QTY_DISCOUNT_ON_COMBINATION' => array('title' => $this->l('Quantity discounts based on:'), 'desc' => $this->l('The way of calculate quantity discounts'), 'cast' => 'intval', 'show' => true, 'required' => true, 'type' => 'radio', 'validation' => 'isBool', 'choices' => array(0 => $this->l('Products'), 1 => $this->l('Combinations')))
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -54,8 +54,8 @@ class AdminStores extends AdminTab
|
||||
|
||||
$this->fieldsDisplay = array(
|
||||
'id_store' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
|
||||
'country' => array('title' => $this->l('Country'), 'width' => 100),
|
||||
'state' => array('title' => $this->l('State'), 'width' => 100),
|
||||
'country' => array('title' => $this->l('Country'), 'width' => 100, 'filter_key' => 'cl!name'),
|
||||
'state' => array('title' => $this->l('State'), 'width' => 100, 'filter_key' => 'st!name'),
|
||||
'city' => array('title' => $this->l('City'), 'width' => 100),
|
||||
'postcode' => array('title' => $this->l('Zip code'), 'width' => 50),
|
||||
'name' => array('title' => $this->l('Name'), 'width' => 120, 'filter_key' => 'a!name'),
|
||||
@@ -115,8 +115,9 @@ class AdminStores extends AdminTab
|
||||
if ((int)($country->contains_states) AND !$id_state)
|
||||
$this->_errors[] = Tools::displayError('An address located in a country containing states must have a state selected.');
|
||||
|
||||
$latitude = (int)(Tools::getValue('latitude'));
|
||||
$longitude = (int)(Tools::getValue('longitude'));
|
||||
$latitude = (float)(Tools::getValue('latitude'));
|
||||
$longitude = (float)(Tools::getValue('longitude'));
|
||||
|
||||
if(empty($latitude) OR empty($longitude))
|
||||
$this->_errors[] = Tools::displayError('Latitude and longitude are required.');
|
||||
|
||||
|
||||
@@ -1128,9 +1128,10 @@ class AdminUpgrade extends AdminPreferences
|
||||
{
|
||||
static $apacheModuleList = null;
|
||||
|
||||
if (!is_array($apacheModuleList))
|
||||
if (!is_array($apacheModuleList) AND function_exists('apache_get_modules'))
|
||||
{
|
||||
$apacheModuleList = apache_get_modules();
|
||||
|
||||
}
|
||||
// we need strpos (example can be evasive20
|
||||
foreach($apacheModuleList as $module)
|
||||
if (strpos($name, $module)!==false)
|
||||
|
||||
Vendored
+1
@@ -142,6 +142,7 @@
|
||||
'ModuleGridEngine' => 'override/classes/ModuleGridEngine.php',
|
||||
'MySQLCore' => 'classes/MySQL.php',
|
||||
'MySQL' => 'override/classes/MySQL.php',
|
||||
'Notification' => 'classes/Notification.php',
|
||||
'ObjectModelCore' => 'classes/ObjectModel.php',
|
||||
'ObjectModel' => 'override/classes/ObjectModel.php',
|
||||
'OrderCore' => 'classes/Order.php',
|
||||
|
||||
@@ -1151,7 +1151,10 @@ class CartCore extends ObjectModel
|
||||
$tmp = $shipping;
|
||||
|
||||
if ($shipping <= $tmp)
|
||||
{
|
||||
$id_carrier = (int)($row['id_carrier']);
|
||||
$tmp = $shipping;
|
||||
}
|
||||
}
|
||||
else // by price
|
||||
{
|
||||
@@ -1161,10 +1164,13 @@ class CartCore extends ObjectModel
|
||||
$tmp = $shipping;
|
||||
|
||||
if ($shipping <= $tmp)
|
||||
{
|
||||
$id_carrier = (int)($row['id_carrier']);
|
||||
$tmp = $shipping;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($id_carrier))
|
||||
$id_carrier = Configuration::get('PS_CARRIER_DEFAULT');
|
||||
|
||||
@@ -78,6 +78,8 @@ class HelperCore
|
||||
$html .= 'var selectedCat = "'.implode(',', $selected_cat).'"';
|
||||
else
|
||||
$html .= 'var selectedCat = "'.implode(',', array_keys($selected_cat)).'"';
|
||||
} else {
|
||||
$html .= 'var selectedCat = ""';
|
||||
}
|
||||
$html .= '
|
||||
var selectedLabel = \''.$trads['selected'].'\';
|
||||
|
||||
@@ -360,14 +360,14 @@ class ManufacturerCore extends ObjectModel
|
||||
$ids = array();
|
||||
foreach ($id_addresses as $id)
|
||||
$ids[] = (int)$id['id'];
|
||||
$result1 = (Db::getInstance()->ExecuteS('
|
||||
$result1 = (Db::getInstance()->Execute('
|
||||
UPDATE `'._DB_PREFIX_.'address`
|
||||
SET id_manufacturer = 0
|
||||
WHERE id_manufacturer = '.(int)$this->id.'
|
||||
AND deleted = 0') !== false);
|
||||
$result2 = true;
|
||||
if (count($ids))
|
||||
$result2 = (Db::getInstance()->ExecuteS('
|
||||
$result2 = (Db::getInstance()->Execute('
|
||||
UPDATE `'._DB_PREFIX_.'address`
|
||||
SET id_customer = 0, id_supplier = 0, id_manufacturer = '.(int)$this->id.'
|
||||
WHERE id_address IN('.implode(',', $ids).')
|
||||
|
||||
+4
-1
@@ -427,7 +427,10 @@ class OrderCore extends ObjectModel
|
||||
if ($this->_taxCalculationMethod == PS_TAX_EXC)
|
||||
$row['product_price'] = ($row['product_price'] - $row['product_price'] * ($row['reduction_percent'] * 0.01));
|
||||
else
|
||||
$row['product_price_wt'] = Tools::ps_round(($row['product_price_wt'] - $row['product_price_wt'] * ($row['reduction_percent'] * 0.01)), 2);
|
||||
{
|
||||
$reduction = Tools::ps_round($row['product_price_wt'] * ($row['reduction_percent'] * 0.01), 2);
|
||||
$row['product_price_wt'] = Tools::ps_round(($row['product_price_wt'] - $reduction), 2);
|
||||
}
|
||||
}
|
||||
|
||||
if ($row['reduction_amount'] != 0)
|
||||
|
||||
+23
-10
@@ -249,7 +249,7 @@ class ProductCore extends ObjectModel
|
||||
'cache_has_attachments' => 'isBool'
|
||||
);
|
||||
protected $fieldsRequiredLang = array('link_rewrite', 'name');
|
||||
/* Description short is limited to 400 chars (but can be configured in Preferences Tab), but without html, so it can't be generic */
|
||||
/* Description short is limited to 800 chars (but can be configured in Preferences Tab), but without html, so it can't be generic */
|
||||
protected $fieldsSizeLang = array('meta_description' => 255, 'meta_keywords' => 255,
|
||||
'meta_title' => 128, 'link_rewrite' => 128, 'name' => 128, 'available_now' => 255, 'available_later' => 255);
|
||||
protected $fieldsValidateLang = array(
|
||||
@@ -550,14 +550,14 @@ class ProductCore extends ObjectModel
|
||||
{
|
||||
$limit = (int)Configuration::get('PS_PRODUCT_SHORT_DESC_LIMIT');
|
||||
if ($limit <= 0)
|
||||
$limit = 400;
|
||||
$limit = 800;
|
||||
if (!is_array($this->description_short))
|
||||
$this->description_short = array();
|
||||
foreach ($this->description_short as $k => $value)
|
||||
if (Tools::strlen(strip_tags($value)) > $limit)
|
||||
{
|
||||
if ($die) die (Tools::displayError().' ('.get_class($this).'->description: length > '.$limit.' for language '.$k.')');
|
||||
return $errorReturn ? get_class($this).'->'.Tools::displayError('description: length >').' '.$limit.' '.Tools::displayError('for language').' '.$k : false;
|
||||
if ($die) die (Tools::displayError().' ('.get_class($this).'->description_short: length > '.$limit.' for language '.$k.')');
|
||||
return $errorReturn ? get_class($this).'->'.Tools::displayError('description_short: length >').' '.$limit.' '.Tools::displayError('for language').' '.$k : false;
|
||||
}
|
||||
return parent::validateFieldsLang($die, $errorReturn);
|
||||
}
|
||||
@@ -1676,13 +1676,26 @@ class ProductCore extends ObjectModel
|
||||
$cart_quantity = 0;
|
||||
if ((int)($id_cart))
|
||||
{
|
||||
if (!isset(self::$_cart_quantity[(int)($id_cart).'_'.(int)($id_product)]) OR self::$_cart_quantity[(int)($id_cart).'_'.(int)($id_product)] != (int)($quantity))
|
||||
self::$_cart_quantity[(int)($id_cart).'_'.(int)($id_product)] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
$condition = '';
|
||||
$cache_name = (int)($id_cart).'_'.(int)($id_product);
|
||||
|
||||
if(Configuration::get('PS_QTY_DISCOUNT_ON_COMBINATION'))
|
||||
{
|
||||
$cache_name = (int)($id_cart).'_'.(int)($id_product).'_'.(int)($id_product_attribute);
|
||||
$condition = ' AND `id_product_attribute` = '.(int)($id_product_attribute);
|
||||
}
|
||||
|
||||
if (!isset(self::$_cart_quantity[$cache_name]) OR self::$_cart_quantity[$cache_name] != (int)($quantity))
|
||||
{
|
||||
self::$_cart_quantity[$cache_name] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
SELECT SUM(`quantity`)
|
||||
FROM `'._DB_PREFIX_.'cart_product`
|
||||
WHERE `id_product` = '.(int)($id_product).' AND `id_cart` = '.(int)($id_cart)
|
||||
WHERE `id_product` = '.(int)($id_product).'
|
||||
AND `id_cart` = '.(int)($id_cart).' '.$condition
|
||||
);
|
||||
$cart_quantity = self::$_cart_quantity[(int)($id_cart).'_'.(int)($id_product)];
|
||||
|
||||
$cart_quantity = self::$_cart_quantity[$cache_name];
|
||||
}
|
||||
}
|
||||
$quantity = ($id_cart AND $cart_quantity) ? $cart_quantity : $quantity;
|
||||
$id_currency = (int)(Validate::isLoadedObject($context->currency) ? $context->currency->id : Configuration::get('PS_CURRENCY_DEFAULT'));
|
||||
@@ -3402,10 +3415,10 @@ class ProductCore extends ObjectModel
|
||||
*/
|
||||
public function setCoverWs($id_image)
|
||||
{
|
||||
Db::getInstance()->ExecuteS('UPDATE `'._DB_PREFIX_.'image`
|
||||
Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'image`
|
||||
SET `cover` = 0 WHERE `id_product` = '.(int)($this->id).'
|
||||
');
|
||||
Db::getInstance()->ExecuteS('UPDATE `'._DB_PREFIX_.'image`
|
||||
Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'image`
|
||||
SET `cover` = 1 WHERE `id_product` = '.(int)($this->id).' AND `id_image` = '.(int)$id_image);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -94,7 +94,8 @@ class ProductDownloadCore extends ObjectModel
|
||||
public function delete($deleteFile=false)
|
||||
{
|
||||
if ($deleteFile)
|
||||
$this->deleteFile();
|
||||
return $this->deleteFile();
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getFields()
|
||||
|
||||
@@ -138,7 +138,7 @@ class SpecificPriceCore extends ObjectModel
|
||||
AND
|
||||
(`to` = \'0000-00-00 00:00:00\' OR \''.$now.'\' <= `to`)
|
||||
)
|
||||
ORDER BY `score` DESC, `from_quantity` DESC');
|
||||
ORDER BY `from_quantity` DESC, `score` DESC, `from_quantity` DESC');
|
||||
}
|
||||
return self::$_specificPriceCache[$key];
|
||||
}
|
||||
@@ -192,19 +192,20 @@ class SpecificPriceCore extends ObjectModel
|
||||
AND
|
||||
(`to` = \'0000-00-00 00:00:00\' OR \''.$now.'\' <= `to`)
|
||||
)
|
||||
ORDER BY `score` DESC, `from_quantity` DESC
|
||||
ORDER BY `from_quantity` DESC, `score` DESC
|
||||
');
|
||||
|
||||
$targeted_prices = array();
|
||||
$max_score = NULL;
|
||||
$last_quantity = NULL;
|
||||
|
||||
foreach($res as $specific_price)
|
||||
{
|
||||
if (!isset($max_score))
|
||||
$max_score = $specific_price['score'];
|
||||
else if ($max_score != $specific_price['score'])
|
||||
if (!isset($last_quantity))
|
||||
$last_quantity = $specific_price['from_quantity'];
|
||||
else if ($last_quantity == $specific_price['from_quantity'])
|
||||
break;
|
||||
|
||||
$last_quantity = $specific_price['from_quantity'];
|
||||
if ($specific_price['from_quantity'] > 1)
|
||||
$targeted_prices[] = $specific_price;
|
||||
}
|
||||
|
||||
+7
-7
@@ -1162,15 +1162,19 @@ class ToolsCore
|
||||
return self::$file_exists_cache[$filename];
|
||||
}
|
||||
|
||||
public static function file_get_contents($url, $useIncludePath = false, $streamContext = NULL)
|
||||
public static function file_get_contents($url, $useIncludePath = false, $streamContext = NULL, $curlTimeOut = 5)
|
||||
{
|
||||
if ($streamContext == NULL)
|
||||
$streamContext = stream_context_create(array('http' => array('timeout' => 5)));
|
||||
|
||||
if (in_array(ini_get('allow_url_fopen'), array('On', 'on', '1')))
|
||||
return file_get_contents($url, $useIncludePath, $streamContext);
|
||||
else if (function_exists('curl_init'))
|
||||
return @file_get_contents($url, $useIncludePath, $streamContext);
|
||||
elseif (function_exists('curl_init') && in_array(ini_get('allow_url_fopen'), array('On', 'on', '1')))
|
||||
{
|
||||
$curl = curl_init();
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($curl, CURLOPT_URL, $url);
|
||||
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, $curlTimeOut);
|
||||
$content = curl_exec($curl);
|
||||
curl_close($curl);
|
||||
return $content;
|
||||
@@ -1182,11 +1186,7 @@ class ToolsCore
|
||||
public static function simplexml_load_file($url, $class_name = null)
|
||||
{
|
||||
if (in_array(ini_get('allow_url_fopen'), array('On', 'on', '1')))
|
||||
return simplexml_load_file($url, $class_name);
|
||||
elseif (function_exists('curl_init'))
|
||||
{
|
||||
return simplexml_load_string(Tools::file_get_contents($url), $class_name);
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
+17
-1
@@ -366,7 +366,7 @@ class ValidateCore
|
||||
*/
|
||||
public static function isCleanHtml($html)
|
||||
{
|
||||
$jsEvent = 'onmousedown|onmousemove|onmmouseup|onmouseover|onmouseout|onload|onunload|onfocus|onblur|onchange|onsubmit|ondblclick|onclick|onkeydown|onkeyup|onkeypress|onmouseenter|onmouseleave';
|
||||
$jsEvent = 'onmousedown|onmousemove|onmmouseup|onmouseover|onmouseout|onload|onunload|onfocus|onblur|onchange|onsubmit|ondblclick|onclick|onkeydown|onkeyup|onkeypress|onmouseenter|onmouseleave|onerror';
|
||||
return (!preg_match('/<[ \t\n]*script/i', $html) && !preg_match('/<?.*('.$jsEvent.')[ \t\n]*=/i', $html) && !preg_match('/.*script\:/i', $html));
|
||||
}
|
||||
|
||||
@@ -675,6 +675,22 @@ class ValidateCore
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function isMySQLEngine($engine)
|
||||
{
|
||||
return (in_array($engine, array('InnoDB', 'MyISAM')));
|
||||
}
|
||||
|
||||
public static function isUnixName($data)
|
||||
{
|
||||
return preg_match('/^[a-z0-9_-]+$/ui', $data);
|
||||
}
|
||||
|
||||
public static function isTablePrefix($data)
|
||||
{
|
||||
// Even if "-" is theorically allowed, it will be considered a syntax error if you do not add backquotes (`) around the table name
|
||||
return preg_match('/^[a-z0-9_]+$/ui', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for standard name file validity
|
||||
*
|
||||
|
||||
@@ -25,8 +25,6 @@
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
include_once("../classes/Validate.php");
|
||||
|
||||
class LanguageManager
|
||||
{
|
||||
private $url_xml;
|
||||
@@ -72,8 +70,12 @@ class LanguageManager
|
||||
return $this->lang;
|
||||
}
|
||||
|
||||
/** get the http_accept_language isocode (if exists),
|
||||
* and use it to find the corresponding prestashop id_lang
|
||||
* otherwise, return 0.
|
||||
* @return int id_lang to use
|
||||
*/
|
||||
private function getIdByHAL(){
|
||||
|
||||
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE']))
|
||||
{
|
||||
$FirstHAL = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
|
||||
@@ -86,14 +88,16 @@ class LanguageManager
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
/** set lang property with param $_GET['language'] if present,
|
||||
* or by $_SERVER['HTTP_ACCEPT_LANGUAGE'] otherwise
|
||||
*/
|
||||
private function setLanguage()
|
||||
{
|
||||
if( isset($_GET['language']) AND Validate::isInt($_GET['language']))
|
||||
$id_lang = (int)($_GET['language']);
|
||||
if (!isset($id_lang))
|
||||
if ( !empty($_GET['language']))
|
||||
$id_lang = (int)($_GET['language'])>0 ? $_GET['language'] : 0;
|
||||
if (empty($id_lang))
|
||||
$id_lang = ($this->getIdByHAL());
|
||||
$this->lang = $this->xml_file->lang[(int)($id_lang)];
|
||||
}
|
||||
@@ -102,4 +106,4 @@ class LanguageManager
|
||||
{
|
||||
return ($this->lang == NULL) ? false : dirname(__FILE__).$this->lang['trad_file'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,28 +40,26 @@ class ToolsInstall
|
||||
{
|
||||
// Don't include theses files if classes are already defined
|
||||
if (!class_exists('Validate', false))
|
||||
include_once(INSTALL_PATH.'/../classes/Validate.php');
|
||||
require_once(INSTALL_PATH.'/../classes/Validate.php');
|
||||
|
||||
if (!class_exists('Db', false))
|
||||
include_once(INSTALL_PATH.'/../classes/Db.php');
|
||||
require_once(INSTALL_PATH.'/../classes/Db.php');
|
||||
|
||||
if (!class_exists('MySQL', false))
|
||||
include_once(INSTALL_PATH.'/../classes/MySQL.php');
|
||||
require_once(INSTALL_PATH.'/../classes/MySQL.php');
|
||||
|
||||
if($posted)
|
||||
{
|
||||
// Check POST data...
|
||||
$data_check = array(
|
||||
!isset($_GET['server']) OR empty($_GET['server']),
|
||||
!Validate::isMailName($_GET['server']),
|
||||
!isset($_GET['type']) OR empty($_GET['type']),
|
||||
!Validate::isMailName($_GET['type']),
|
||||
!isset($_GET['name']) OR empty($_GET['name']),
|
||||
!Validate::isMailName($_GET['name']),
|
||||
!isset($_GET['login']) OR empty($_GET['login']),
|
||||
!Validate::isMailName($_GET['login']),
|
||||
!isset($_GET['password'])
|
||||
!isset($_GET['server']) OR empty($_GET['server']) OR !Validate::isUrl($_GET['server']),
|
||||
!isset($_GET['engine']) OR empty($_GET['engine']) OR !Validate::isMySQLEngine($_GET['engine']),
|
||||
!isset($_GET['name']) OR empty($_GET['name']) OR !Validate::isUnixName($_GET['name']),
|
||||
!isset($_GET['login']) OR empty($_GET['login']) OR !Validate::isUnixName($_GET['login']),
|
||||
!isset($_GET['password']),
|
||||
!isset($_GET['tablePrefix']) OR !Validate::isTablePrefix($_GET['tablePrefix']),
|
||||
);
|
||||
|
||||
foreach ($data_check AS $data)
|
||||
if ($data)
|
||||
return 8;
|
||||
@@ -100,9 +98,9 @@ class ToolsInstall
|
||||
|
||||
public static function sendMail($smtpChecked, $smtpServer, $content, $subject, $type, $to, $from, $smtpLogin, $smtpPassword, $smtpPort = 25, $smtpEncryption)
|
||||
{
|
||||
include(INSTALL_PATH.'/../tools/swift/Swift.php');
|
||||
include(INSTALL_PATH.'/../tools/swift/Swift/Connection/SMTP.php');
|
||||
include(INSTALL_PATH.'/../tools/swift/Swift/Connection/NativeMail.php');
|
||||
require_once(INSTALL_PATH.'/../tools/swift/Swift.php');
|
||||
require_once(INSTALL_PATH.'/../tools/swift/Swift/Connection/SMTP.php');
|
||||
require_once(INSTALL_PATH.'/../tools/swift/Swift/Connection/NativeMail.php');
|
||||
|
||||
$swift = NULL;
|
||||
$result = NULL;
|
||||
|
||||
@@ -367,12 +367,12 @@ function verifyDbAccess ()
|
||||
url: "model.php",
|
||||
data:
|
||||
"method=checkDB"
|
||||
+"&type=MySQL"
|
||||
+"&server="+ $("#dbServer").val()
|
||||
+"&login="+ $("#dbLogin").val()
|
||||
+"&password="+encodeURIComponent($("#dbPassword").val())
|
||||
+"&engine="+$("#dbEngine option:selected").val()
|
||||
+"&name="+ $("#dbName").val(),
|
||||
+ "&name=" + $("#dbName").val()
|
||||
+ "&tablePrefix=" + $("#db_prefix").val(),
|
||||
success: function(ret)
|
||||
{
|
||||
ret = ret.getElementsByTagName('action')[0];
|
||||
|
||||
@@ -54,9 +54,9 @@ if (version_compare(phpversion(), '5.0.0', '<'))
|
||||
die;
|
||||
}
|
||||
|
||||
require(dirname(__FILE__).'/../config/autoload.php');
|
||||
include_once(INSTALL_PATH.'/classes/ToolsInstall.php');
|
||||
include_once(INSTALL_PATH.'/classes/GetVersionFromDb.php');
|
||||
require_once(dirname(__FILE__).'/../config/autoload.php');
|
||||
require_once(INSTALL_PATH.'/classes/ToolsInstall.php');
|
||||
require_once(INSTALL_PATH.'/classes/GetVersionFromDb.php');
|
||||
|
||||
/* Prevent from bad URI parsing when using index.php */
|
||||
$requestUri = str_replace('index.php', '', $_SERVER['REQUEST_URI']);
|
||||
@@ -71,7 +71,7 @@ $tooOld = true;
|
||||
$installOfOldVersion = false;
|
||||
if (file_exists(INSTALL_PATH.'/../config/settings.inc.php'))
|
||||
{
|
||||
include(INSTALL_PATH.'/../config/settings.inc.php');
|
||||
require_once(INSTALL_PATH.'/../config/settings.inc.php');
|
||||
$oldversion =_PS_VERSION_;
|
||||
|
||||
// fix : complete version number if there is not all 4 numbers
|
||||
@@ -92,7 +92,7 @@ if (file_exists(INSTALL_PATH.'/../config/settings.inc.php'))
|
||||
$installOfOldVersion = (version_compare($oldversion, INSTALL_VERSION) == 1);
|
||||
}
|
||||
|
||||
include(INSTALL_PATH.'/classes/LanguagesManager.php');
|
||||
require_once(INSTALL_PATH.'/classes/LanguagesManager.php');
|
||||
$lm = new LanguageManager(dirname(__FILE__).'/langs/list.xml');
|
||||
$_LANG = array();
|
||||
$_LIST_WORDS = array();
|
||||
@@ -101,7 +101,7 @@ function lang($txt) {
|
||||
return (isset($_LANG[$txt]) ? $_LANG[$txt] : $txt);
|
||||
}
|
||||
if ($lm->getIncludeTradFilename())
|
||||
include_once($lm->getIncludeTradFilename());
|
||||
require_once($lm->getIncludeTradFilename());
|
||||
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||
@@ -173,7 +173,7 @@ if ($lm->getIncludeTradFilename())
|
||||
txtError[5] = "<?php echo lang('Can\'t create settings file, if /config/settings.inc.php exists, please give the public write permissions to this file, else please create a file named settings.inc.php in config directory.'); ?>";
|
||||
txtError[6] = "<?php echo lang('Can\'t write settings file, please create a file named settings.inc.php in config directory.'); ?>";
|
||||
txtError[7] = "<?php echo lang('Impossible to upload the file!'); ?>";
|
||||
txtError[8] = "<?php echo lang('Data integrity is not valided. Hack attempt?'); ?>";
|
||||
txtError[8] = "<?php echo lang('Your database connection settings are not valid. Please check your server, name, login and prefix.'); ?>";
|
||||
txtError[9] = "<?php echo lang('Impossible to read the content of a MySQL content file.'); ?>";
|
||||
txtError[10] = "<?php echo lang('Impossible the access the a MySQL content file.'); ?>";
|
||||
txtError[11] = "<?php echo lang('Error while inserting data in the database:'); ?>";
|
||||
|
||||
@@ -283,3 +283,4 @@ $_LANG['In this aim, use our'] = 'Verwenden Sie dazu unseren';
|
||||
$_LANG['Additional Benefits'] = 'Exklusiv Angebot';
|
||||
$_LANG['Exclusive offers dedicated to PrestaShop merchants'] = 'Exklusiv Angebot für die Verkäufer PrestaShop';
|
||||
$_LANG['PHP magic quotes option is off (recommended)'] = 'Die PHP-Option "magic quotes" ist deaktiviert (empfohlen)';
|
||||
$_LANG['Other activity...'] = 'Andere activiteit...';
|
||||
|
||||
@@ -283,3 +283,4 @@ $_LANG['In this aim, use our'] = 'En este objetivo, utilice nuestro';
|
||||
$_LANG['Additional Benefits'] = 'Otros beneficios';
|
||||
$_LANG['Exclusive offers dedicated to PrestaShop merchants'] = 'Ofertas exclusivas dedicadas a los comerciantes PrestaShop';
|
||||
$_LANG['PHP magic quotes option is off (recommended)'] = 'La opción PHP "magic quotes" está desactivada (aconsejable)';
|
||||
$_LANG['Other activity...'] = 'Otra actividad...';
|
||||
|
||||
@@ -22,7 +22,7 @@ $_LANG['Configure your database by filling out the following fields:'] = 'Config
|
||||
$_LANG['Congratulation, your online shop is now ready!'] = 'Félicitations, votre boutique est installée !';
|
||||
$_LANG['Contact us!'] = 'Contactez-nous !';
|
||||
$_LANG['Create new files and folders allowed'] = 'Création de nouveaux dossiers et fichiers autorisée';
|
||||
$_LANG['Data integrity is not valided. Hack attempt?'] = 'L\'intégrité des données n\'est pas validée.';
|
||||
$_LANG['Your database connection settings are not valid. Please check your server, name, login and prefix.'] = 'Vos informations de connexion à la base de données ne sont pas valides. Veuillez vérifier le serveur, nom, login et préfixe que vous avez indiqué.';
|
||||
$_LANG['Database Server is available but database is not found'] = 'Le serveur de bases de données est disponible mais la base de données n\'a pas été trouvée';
|
||||
$_LANG['Database Server is not found. Please verify the login, password and server fields.'] = 'Le serveur de bases de données n\'a pas été trouvé, merci de vérifier vos identifiants ou le nom du serveur.';
|
||||
$_LANG['Database configuration'] = 'Configuration de la base de données';
|
||||
@@ -289,3 +289,4 @@ $_LANG['Additional Benefits'] = 'Avantages exclusifs PrestaShop';
|
||||
$_LANG['Exclusive offers dedicated to PrestaShop merchants'] = 'Offres réservées aux marchands PrestaShop';
|
||||
$_LANG['PHP magic quotes option is off (recommended)'] = 'L\'option PHP "magic quotes" est désactivée (recommandé)';
|
||||
$_LANG['Dom extension loaded'] = 'L\'extension Dom est activée';
|
||||
$_LANG['Other activity...'] = 'Autre activité..';
|
||||
|
||||
@@ -270,3 +270,4 @@ $_LANG['In this aim, use our'] = 'A questo scopo, utilizzare il nostro';
|
||||
$_LANG['Additional Benefits'] = 'Ulteriori vantaggi';
|
||||
$_LANG['Exclusive offers dedicated to PrestaShop merchants'] = 'Offerte esclusivo dedicato ai venditori PrestaShop';
|
||||
$_LANG['PHP magic quotes option is off (recommended)'] = 'Opzione magic quotes PHP è disattivata (consigliato)';
|
||||
$_LANG['Other activity...'] = 'Altre attività ...';
|
||||
|
||||
@@ -54,6 +54,7 @@ if ( substr($memory_limit,-1) != 'G'
|
||||
){
|
||||
@ini_set('memory_limit','128M');
|
||||
}
|
||||
require_once(dirname(__FILE__).'/../config/autoload.php');
|
||||
|
||||
/* Redefine REQUEST_URI if empty (on some webservers...) */
|
||||
if (!isset($_SERVER['REQUEST_URI']) || $_SERVER['REQUEST_URI'] == '')
|
||||
@@ -64,7 +65,7 @@ $_SERVER['REQUEST_URI'] = str_replace('//', '/', $_SERVER['REQUEST_URI']);
|
||||
|
||||
define('INSTALL_VERSION', '1.5.0.1');
|
||||
define('PS_INSTALLATION_IN_PROGRESS', true);
|
||||
include_once(INSTALL_PATH.'/classes/ToolsInstall.php');
|
||||
require_once(INSTALL_PATH.'/classes/ToolsInstall.php');
|
||||
define('SETTINGS_FILE', INSTALL_PATH.'/../config/settings.inc.php');
|
||||
define('DEFINES_FILE', INSTALL_PATH.'/../config/defines.inc.php');
|
||||
define('INSTALLER__PS_BASE_URI', substr($_SERVER['REQUEST_URI'], 0, -1 * (strlen($_SERVER['REQUEST_URI']) - strrpos($_SERVER['REQUEST_URI'], '/')) - strlen(substr(dirname($_SERVER['REQUEST_URI']), strrpos(dirname($_SERVER['REQUEST_URI']), '/')+1))));
|
||||
@@ -85,31 +86,31 @@ if (isset($_GET['method']))
|
||||
switch ($_GET['method'])
|
||||
{
|
||||
case 'checkConfig' :
|
||||
include_once('xml/checkConfig.php');
|
||||
require_once('xml/checkConfig.php');
|
||||
break;
|
||||
|
||||
case 'checkDB' :
|
||||
include_once('xml/checkDB.php');
|
||||
require_once('xml/checkDB.php');
|
||||
break;
|
||||
|
||||
case 'createDB' :
|
||||
include_once('xml/createDB.php');
|
||||
require_once('xml/createDB.php');
|
||||
break;
|
||||
|
||||
case 'checkMail' :
|
||||
include_once('xml/checkMail.php');
|
||||
require_once('xml/checkMail.php');
|
||||
break;
|
||||
|
||||
case 'checkShopInfos' :
|
||||
include_once('xml/checkShopInfos.php');
|
||||
require_once('xml/checkShopInfos.php');
|
||||
break;
|
||||
|
||||
case 'doUpgrade' :
|
||||
include_once('xml/doUpgrade.php');
|
||||
require_once('xml/doUpgrade.php');
|
||||
break;
|
||||
|
||||
case 'getVersionFromDb' :
|
||||
include_once('xml/getVersionFromDb.php');
|
||||
require_once('xml/getVersionFromDb.php');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,10 +25,22 @@
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
/** remove the uncompatible module gridextjs (1.4.0.8 upgrade)
|
||||
*/
|
||||
function gridextjs_deprecated()
|
||||
{
|
||||
if (file_exists(dirname(__FILE__).'/../../modules/gridextjs'))
|
||||
return rename(dirname(__FILE__).'/../../modules/gridextjs', dirname(__FILE__).'/../../modules/gridextjs.deprecated');
|
||||
// if exists, use _PS_MODULE_DIR_ or _PS_ROOT_DIR_
|
||||
// instead of guessing the modules dir
|
||||
if (defined('_PS_MODULE_DIR_'))
|
||||
$gridextjs_path = _PS_MODULE_DIR_ . 'gridextjs';
|
||||
else
|
||||
if (defined('_PS_ROOT_DIR_'))
|
||||
$gridextjs_path = _PS_ROOT_DIR_ . '/modules/gridextjs';
|
||||
else
|
||||
$gridextjs_path = dirname(__FILE__).'/../../modules/gridextjs';
|
||||
|
||||
if (file_exists($gridextjs_path))
|
||||
return rename($gridextjs_path, str_replace('gridextjs', 'gridextjs.deprecated', $gridextjs_path));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
include('../classes/Tools.php');
|
||||
require_once('../classes/Tools.php');
|
||||
if (!isset($_GET['language']))
|
||||
$_GET['language'] = 0;
|
||||
function getPreinstallXmlLang($object, $field)
|
||||
|
||||
@@ -1509,7 +1509,7 @@ CREATE TABLE `PREFIX_tax_lang` (
|
||||
UNIQUE KEY `tax_lang_index` (`id_tax`,`id_lang`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE PREFIX_timezone (
|
||||
CREATE TABLE `PREFIX_timezone` (
|
||||
id_timezone int(10) unsigned NOT NULL auto_increment,
|
||||
name VARCHAR(32) NOT NULL,
|
||||
PRIMARY KEY timezone_index(`id_timezone`)
|
||||
|
||||
@@ -152,7 +152,7 @@ INSERT INTO `PREFIX_configuration` (`id_configuration`, `name`, `value`, `date_a
|
||||
(80, 'PS_ORDER_PROCESS_TYPE', 0, NOW(), NOW()),
|
||||
(81, 'PS_SPECIFIC_PRICE_PRIORITIES', 'id_shop;id_currency;id_country;id_group', NOW(), NOW()),
|
||||
(82, 'PS_TAX_DISPLAY', 0, NOW(), NOW()),
|
||||
(83, 'PS_SMARTY_FORCE_COMPILE', 1, NOW(), NOW()),
|
||||
(83, 'PS_SMARTY_FORCE_COMPILE', 0, NOW(), NOW()),
|
||||
(84, 'PS_DISTANCE_UNIT', 'km', NOW(), NOW()),
|
||||
(85, 'PS_STORES_DISPLAY_CMS', 1, NOW(), NOW()),
|
||||
(86, 'PS_STORES_DISPLAY_FOOTER', 1, NOW(), NOW()),
|
||||
|
||||
@@ -15,4 +15,6 @@ AND `id_lang` = (
|
||||
|
||||
ALTER TABLE `PREFIX_discount` ADD `include_tax` TINYINT(1) NOT NULL DEFAULT '0';
|
||||
|
||||
UPDATE `PREFIX_order_detail`set `product_price` = `product_price` /( 1-(`group_reduction`/100));
|
||||
UPDATE `PREFIX_order_detail` SET `product_price` = `product_price` /( 1-(`group_reduction`/100));
|
||||
|
||||
DELETE FROM `PREFIX_configuration` WHERE name IN ('PS_LAYERED_BITLY_USERNAME', 'PS_LAYERED_BITLY_API_KEY', 'PS_LAYERED_SHARE') LIMIT 3;
|
||||
@@ -30,11 +30,11 @@ if (function_exists('date_default_timezone_set'))
|
||||
|
||||
define('_PS_MAGIC_QUOTES_GPC_', get_magic_quotes_gpc());
|
||||
|
||||
include(INSTALL_PATH.'/classes/AddConfToFile.php');
|
||||
include(INSTALL_PATH.'/../classes/Validate.php');
|
||||
include(INSTALL_PATH.'/../classes/Db.php');
|
||||
include(INSTALL_PATH.'/../classes/Tools.php');
|
||||
include_once(INSTALL_PATH.'/../config/settings.inc.php');
|
||||
require_once(INSTALL_PATH.'/classes/AddConfToFile.php');
|
||||
require_once(INSTALL_PATH.'/../classes/Validate.php');
|
||||
require_once(INSTALL_PATH.'/../classes/Db.php');
|
||||
require_once(INSTALL_PATH.'/../classes/Tools.php');
|
||||
require_once(INSTALL_PATH.'/../config/settings.inc.php');
|
||||
|
||||
Context::getContext()->shop = Shop::initialize();
|
||||
define('_THEME_NAME_', Context::getContext()->shop->getTheme());
|
||||
|
||||
@@ -36,29 +36,22 @@ if (file_exists(SETTINGS_FILE))
|
||||
if (!unlink(SETTINGS_FILE))
|
||||
die('<action result="fail" error="17" />'."\n");
|
||||
|
||||
include(INSTALL_PATH.'/classes/AddConfToFile.php');
|
||||
include(INSTALL_PATH.'/../classes/Validate.php');
|
||||
include(INSTALL_PATH.'/../classes/Db.php');
|
||||
include(INSTALL_PATH.'/../classes/Tools.php');
|
||||
require_once(INSTALL_PATH.'/classes/AddConfToFile.php');
|
||||
require_once(INSTALL_PATH.'/../classes/Validate.php');
|
||||
require_once(INSTALL_PATH.'/../classes/Db.php');
|
||||
require_once(INSTALL_PATH.'/../classes/Tools.php');
|
||||
|
||||
global $logger;
|
||||
|
||||
//check db access
|
||||
include_once(INSTALL_PATH.'/classes/ToolsInstall.php');
|
||||
$resultDB = ToolsInstall::checkDB($_GET['server'], $_GET['login'], $_GET['password'], $_GET['name'], true, $_GET['engine']);
|
||||
$resultDB = ToolsInstall::checkDB($_GET['server'], $_GET['login'], $_GET['password'], $_GET['name'], true);
|
||||
if ($resultDB !== true){
|
||||
$logger->logError('Invalid database configuration');
|
||||
die("<action result='fail' error='".$resultDB."'/>\n");
|
||||
}
|
||||
|
||||
|
||||
// Check POST data...
|
||||
$data_check = array(
|
||||
!isset($_GET['mode']) OR ( $_GET['mode'] != "full" AND $_GET['mode'] != "lite"),
|
||||
!isset($_GET['tablePrefix']) OR !Validate::isMailName($_GET['tablePrefix']) OR !preg_match('/^[a-z0-9_]*$/i', $_GET['tablePrefix'])
|
||||
);
|
||||
foreach ($data_check AS $data)
|
||||
if ($data)
|
||||
if (!isset($_GET['mode']) OR ($_GET['mode'] != "full" AND $_GET['mode'] != "lite"))
|
||||
die('<action result="fail" error="8"/>'."\n");
|
||||
|
||||
// Writing data in settings file
|
||||
@@ -67,12 +60,12 @@ $_PS_DIRECTORY_ = trim(str_replace(' ', '%20', INSTALLER__PS_BASE_URI), '/');
|
||||
$_PS_DIRECTORY_ = ($_PS_DIRECTORY_) ? '/'.$_PS_DIRECTORY_.'/' : '/';
|
||||
$datas = array(
|
||||
array('_DB_SERVER_', trim($_GET['server'])),
|
||||
array('_DB_TYPE_', trim($_GET['type'])),
|
||||
array('_DB_TYPE_', 'MySQL'),
|
||||
array('_DB_NAME_', trim($_GET['name'])),
|
||||
array('_DB_USER_', trim($_GET['login'])),
|
||||
array('_DB_PASSWD_', trim($_GET['password'])),
|
||||
array('_DB_PREFIX_', trim($_GET['tablePrefix'])),
|
||||
array('_MYSQL_ENGINE_', $_GET['engine']),
|
||||
array('_MYSQL_ENGINE_', trim($_GET['engine'])),
|
||||
array('_PS_CACHING_SYSTEM_', 'MCached'),
|
||||
array('_PS_CACHE_ENABLED_', '0'),
|
||||
array('_MEDIA_SERVER_1_', ''),
|
||||
@@ -103,8 +96,8 @@ foreach (array(INSTALL_PATH.'/../tools/smarty/cache/', INSTALL_PATH.'/../tools/s
|
||||
if ($confFile->error != false)
|
||||
die('<action result="fail" error="'.$confFile->error.'" />'."\n");
|
||||
|
||||
//load new settings
|
||||
include(SETTINGS_FILE);
|
||||
//load new settings, and fatal error if you can't
|
||||
require_once(SETTINGS_FILE);
|
||||
|
||||
//-----------
|
||||
//import SQL data
|
||||
|
||||
@@ -241,7 +241,7 @@ if (empty($neededUpgradeFiles))
|
||||
|
||||
|
||||
//refresh conf file
|
||||
include(INSTALL_PATH.'/classes/AddConfToFile.php');
|
||||
require_once(INSTALL_PATH.'/classes/AddConfToFile.php');
|
||||
$oldLevel = error_reporting(E_ALL);
|
||||
$mysqlEngine = (defined('_MYSQL_ENGINE_') ? _MYSQL_ENGINE_ : 'MyISAM');
|
||||
$datas = array(
|
||||
|
||||
@@ -26,9 +26,9 @@
|
||||
*/
|
||||
|
||||
require_once(SETTINGS_FILE);
|
||||
include_once(INSTALL_PATH.'/classes/GetVersionFromDb.php');
|
||||
require_once(INSTALL_PATH.'/classes/GetVersionFromDb.php');
|
||||
|
||||
include(INSTALL_PATH.'/classes/LanguagesManager.php');
|
||||
require_once(INSTALL_PATH.'/classes/LanguagesManager.php');
|
||||
$lm = new LanguageManager(INSTALL_PATH.'/langs/list.xml');
|
||||
$_LANG = array();
|
||||
$_LIST_WORDS = array();
|
||||
@@ -82,4 +82,4 @@ if ($psVersionDb && in_array($psVersionDb, $versions))
|
||||
else
|
||||
{
|
||||
die('<action result="ko" lang="' . htmlspecialchars(sprintf(lang('Warning, we detected that the version specified in your config/settings.inc.php does not match your SQL database structure.<br />File config/settings.inc.php indicates: %1$s<br />Our automatic detection tool has detected a version between %2$s and %3$s<br /><br />You should edit your config/settings.inc.php file to replace %1$s by your real shop version.<br />Failure to fix this issue before upgrading may result in severe complications.<br />Do not forget to relaunch the installer after this modification by pressing F5 on your web browser.'), '<span class="versionInfo">' . _PS_VERSION_ . '</span>', '<span class="versionInfo">' . $versions[count($versions) - 1] . '</span>', '<span class="versionInfo">' . $versions[0] . '</span>')) . '" />');
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<localizationPack name="Vietnam" version="1.0">
|
||||
<currencies>
|
||||
<currency name="đồng" iso_code="VND" iso_code_num="704" sign="₫" blank="1" conversion_rate="26505.85" format="2" decimals="1" />
|
||||
<currency name="Đồng" iso_code="VND" iso_code_num="704" sign="₫" blank="1" conversion_rate="26505.85" format="2" decimals="1" />
|
||||
</currencies>
|
||||
<languages>
|
||||
<language iso_code="vi" />
|
||||
@@ -21,8 +21,8 @@
|
||||
<units>
|
||||
<unit type="weight" value="kg" />
|
||||
<unit type="volume" value="L" />
|
||||
<unit type="short_distance" value="in" />
|
||||
<unit type="base_distance" value="dong" />
|
||||
<unit type="long_distance" value="mi" />
|
||||
<unit type="short_distance" value="cm" />
|
||||
<unit type="base_distance" value="m" />
|
||||
<unit type="long_distance" value="km" />
|
||||
</units>
|
||||
</localizationPack>
|
||||
|
||||
@@ -26,9 +26,14 @@
|
||||
*/
|
||||
|
||||
/* Getting cookie or logout */
|
||||
include(dirname(__FILE__).'/../../config/config.inc.php');
|
||||
/*include(dirname(__FILE__).'/../../config/config.inc.php');
|
||||
require_once(dirname(__FILE__).'/../../init.php');
|
||||
include(dirname(__FILE__).'/blocklayered.php');
|
||||
include(dirname(__FILE__).'/blocklayered.php');*/
|
||||
|
||||
/* Clean categoryBox before use */
|
||||
if (isset($_GET['categoryBox']) AND is_array($_GET['categoryBox']))
|
||||
foreach ($_GET['categoryBox'] AS &$value)
|
||||
$value = (int)$value;
|
||||
|
||||
$blockLayered = new BlockLayered();
|
||||
echo $blockLayered->ajaxCallBackOffice((isset($_GET['categoryBox']) AND is_array($_GET['categoryBox'])) ? $_GET['categoryBox'] : array(),
|
||||
|
||||
@@ -52,7 +52,6 @@ class BlockLayered extends Module
|
||||
if ($result = parent::install() AND $this->registerHook('leftColumn') AND $this->registerHook('header') AND $this->registerHook('footer')
|
||||
AND $this->registerHook('categoryAddition') AND $this->registerHook('categoryUpdate') AND $this->registerHook('categoryDeletion'))
|
||||
{
|
||||
Configuration::updateValue('PS_LAYERED_SHARE', 0);
|
||||
Configuration::updateValue('PS_LAYERED_HIDE_0_VALUES', 0);
|
||||
Configuration::updateValue('PS_LAYERED_SHOW_QTIES', 1);
|
||||
|
||||
@@ -66,11 +65,8 @@ class BlockLayered extends Module
|
||||
public function uninstall()
|
||||
{
|
||||
/* Delete all configurations */
|
||||
Configuration::deleteByName('PS_LAYERED_SHARE');
|
||||
Configuration::deleteByName('PS_LAYERED_HIDE_0_VALUES');
|
||||
Configuration::deleteByName('PS_LAYERED_SHOW_QTIES');
|
||||
Configuration::deleteByName('PS_LAYERED_BITLY_USERNAME');
|
||||
Configuration::deleteByName('PS_LAYERED_BITLY_API_KEY');
|
||||
|
||||
return parent::uninstall();
|
||||
}
|
||||
@@ -165,6 +161,11 @@ class BlockLayered extends Module
|
||||
|
||||
if (sizeof($_POST['categoryBox']))
|
||||
{
|
||||
/* Clean categoryBox before use */
|
||||
if (isset($_POST['categoryBox']) AND is_array($_POST['categoryBox']))
|
||||
foreach ($_POST['categoryBox'] AS &$value)
|
||||
$value = (int)$value;
|
||||
|
||||
Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'layered_category WHERE id_category IN ('.implode(',', $_POST['categoryBox']).')');
|
||||
|
||||
$filterValues = array();
|
||||
@@ -208,20 +209,9 @@ class BlockLayered extends Module
|
||||
}
|
||||
}
|
||||
elseif (Tools::isSubmit('submitLayeredSettings'))
|
||||
{
|
||||
if (Tools::getValue('share_url'))
|
||||
{
|
||||
if (Tools::getValue('bitly_username') == '')
|
||||
$errors[] = $this->l('Bit.ly username is empty');
|
||||
if (Tools::getValue('bitly_api_key') == '')
|
||||
$errors[] = $this->l('Bit.ly api_key is empty');
|
||||
}
|
||||
|
||||
{
|
||||
if (!sizeof($errors))
|
||||
{
|
||||
Configuration::updateValue('PS_LAYERED_BITLY_USERNAME', Tools::getValue('bitly_username'));
|
||||
Configuration::updateValue('PS_LAYERED_BITLY_API_KEY', Tools::getValue('bitly_api_key'));
|
||||
Configuration::updateValue('PS_LAYERED_SHARE', Tools::getValue('share_url'));
|
||||
Configuration::updateValue('PS_LAYERED_HIDE_0_VALUES', Tools::getValue('ps_layered_hide_0_values'));
|
||||
Configuration::updateValue('PS_LAYERED_SHOW_QTIES', Tools::getValue('ps_layered_show_qties'));
|
||||
|
||||
@@ -268,22 +258,6 @@ class BlockLayered extends Module
|
||||
}
|
||||
|
||||
$html .= '
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function()
|
||||
{
|
||||
$(\'.share_url\').change(function(){
|
||||
toggleBitly();
|
||||
});
|
||||
toggleBitly();
|
||||
|
||||
function toggleBitly(){
|
||||
if ($(\'#share_url_on\').attr(\'checked\'))
|
||||
$(\'#bitly\').slideDown();
|
||||
else
|
||||
$(\'#bitly\').slideUp();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<h2>'.$this->l('Layered navigation').'</h2>
|
||||
<fieldset class="width4">
|
||||
<legend><img src="../img/admin/cog.gif" alt="" />'.$this->l('Existing filters templates').'</legend>';
|
||||
@@ -573,29 +547,8 @@ class BlockLayered extends Module
|
||||
<img src="../img/admin/disabled.gif" alt="'.$this->l('No').'" title="'.$this->l('No').'" style="margin-left: 10px;" />
|
||||
'.$this->l('No').' <input type="radio" name="ps_layered_show_qties" value="0" '.(!Configuration::get('PS_LAYERED_SHOW_QTIES') ? 'checked="checked"' : '').' />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align: right;">'.$this->l('Allow customers to share URLs').'</td>
|
||||
<td>
|
||||
<label class="t" for="share_url_on"><img src="../img/admin/enabled.gif" alt="Yes" title="Yes"></label>
|
||||
'.$this->l('Yes').' <input type="radio" id="share_url_on" name="share_url" class="share_url" value="1" '.(Configuration::get('PS_LAYERED_SHARE') ? 'checked="checked"' : '').'>
|
||||
<label class="t" for="share_url_off"><img src="../img/admin/disabled.gif" alt="No" title="No" style="margin-left: 10px;"></label>
|
||||
'.$this->l('No').' <input type="radio" id="share_url_off" name="share_url" class="share_url" value="0" '.(!Configuration::get('PS_LAYERED_SHARE') ? 'checked="checked"' : '').'>
|
||||
</td>
|
||||
</tr>
|
||||
</tr>
|
||||
</table>
|
||||
<div id="bitly">
|
||||
<p>'.$this->l('To offer your customers short links, create an account on bit.ly, then copy and paste login and API key.').'
|
||||
<a style="text-decoration:underline" href="http://bit.ly/a/sign_up">'.$this->l('Sign Up').'</a></p>
|
||||
<label>'.$this->l('Login bit.ly').'</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" name="bitly_username" value="'. Tools::getValue('bitly_username', Configuration::get('PS_LAYERED_BITLY_USERNAME')).'">
|
||||
</div>
|
||||
<label>'.$this->l('API Key bit.ly').'</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" name="bitly_api_key" value="'.Tools::getValue('bitly_api_key', Configuration::get('PS_LAYERED_BITLY_API_KEY')).'">
|
||||
</div>
|
||||
</div>
|
||||
<p style="text-align: center;"><input type="submit" class="button" name="submitLayeredSettings" value="'.$this->l('Save configuration').'" /></p>
|
||||
</form>
|
||||
</fieldset>';
|
||||
@@ -723,7 +676,7 @@ class BlockLayered extends Module
|
||||
|
||||
/* Return only the number of products */
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
|
||||
SELECT COUNT(p.`id_product`) AS total
|
||||
SELECT COUNT(p.`id_product`) total
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
WHERE 1 '.$queryFilters);
|
||||
|
||||
@@ -739,12 +692,12 @@ class BlockLayered extends Module
|
||||
'.Product::sqlStock('p', 0).'
|
||||
LEFT JOIN '._DB_PREFIX_.'image i ON (i.id_product = p.id_product AND i.cover = 1)
|
||||
LEFT JOIN '._DB_PREFIX_.'image_lang il ON (i.id_image = il.id_image AND il.id_lang = '.(int)$this->context->language->id.')
|
||||
LEFT JOIN '._DB_PREFIX_.'manufacturer m ON (m.id_manufacturer = p.id_manufacturer)
|
||||
LEFT JOIN '._DB_PREFIX_.'manufacturer m ON (m.id_manufacturer = p.id_manufacturer)
|
||||
WHERE p.`active` = 1
|
||||
AND pl.id_lang = '.(int)$this->context->language->id
|
||||
.$queryFilters.
|
||||
' ORDER BY '.Tools::getProductsOrder('by', Tools::getValue('orderby')).' '.Tools::getProductsOrder('way', Tools::getValue('orderway')).
|
||||
' LIMIT '.(((int)(Tools::getValue('p', 1)) - 1) * $n.','.$n);
|
||||
' LIMIT '.(((int)(Tools::getValue('p', 1)) - 1) * $n.','.$n);
|
||||
$this->products = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
|
||||
|
||||
return $this->products;
|
||||
@@ -780,12 +733,12 @@ class BlockLayered extends Module
|
||||
$whereC = rtrim($whereC, 'OR ');
|
||||
$productsSQL = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
SELECT p.`id_product`, p.`condition`, p.`id_manufacturer`, p.`weight`, stock.quantity,
|
||||
(SELECT GROUP_CONCAT(`id_category`) FROM `'._DB_PREFIX_.'category_product` cp WHERE cp.`id_product` = p.`id_product`) as ids_cat,
|
||||
(SELECT GROUP_CONCAT(`id_feature_value`) FROM `'._DB_PREFIX_.'feature_product` fp WHERE fp.`id_product` = p.`id_product`) as ids_feat,
|
||||
(SELECT GROUP_CONCAT(`id_category`) FROM `'._DB_PREFIX_.'category_product` cp WHERE cp.`id_product` = p.`id_product`) ids_cat,
|
||||
(SELECT GROUP_CONCAT(`id_feature_value`) FROM `'._DB_PREFIX_.'feature_product` fp WHERE fp.`id_product` = p.`id_product`) ids_feat,
|
||||
(SELECT GROUP_CONCAT(DISTINCT(pac.`id_attribute`))
|
||||
FROM `'._DB_PREFIX_.'product_attribute_combination` pac
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON (pa.`id_product_attribute` = pac.`id_product_attribute`)
|
||||
WHERE pa.`id_product` = p.`id_product` ) as ids_attr
|
||||
WHERE pa.`id_product` = p.`id_product`) ids_attr
|
||||
FROM '._DB_PREFIX_.'product p
|
||||
'.Product::sqlStock('p', 0).'
|
||||
WHERE p.`active` = 1 AND p.`id_product` IN ( SELECT id_product FROM `'._DB_PREFIX_.'category_product` cp WHERE'.$whereC.')', false);
|
||||
@@ -818,7 +771,7 @@ class BlockLayered extends Module
|
||||
/* Get the filters for the current category */
|
||||
$filters = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('SELECT * FROM '._DB_PREFIX_.'layered_category WHERE id_category = '.(int)$id_parent.' ORDER BY position ASC');
|
||||
$filterBlocks = $f = $a = array();
|
||||
|
||||
|
||||
foreach ($filters AS $filter)
|
||||
{
|
||||
$filterBlocks[(int)$filter['position']]['type_lite'] = $filter['type'];
|
||||
@@ -878,7 +831,6 @@ class BlockLayered extends Module
|
||||
}
|
||||
}
|
||||
|
||||
$weight_unit = Configuration::get('PS_WEIGHT_UNIT');
|
||||
foreach ($filterBlocks AS &$filterBlock)
|
||||
{
|
||||
if ($filterBlock['type_lite'] == 'category')
|
||||
@@ -1067,7 +1019,7 @@ class BlockLayered extends Module
|
||||
$filterBlock['values'] = array($selectedFilters['weight'][0], $selectedFilters['weight'][1]);
|
||||
else
|
||||
$filterBlock['values'] = array(min($weight), max($weight));
|
||||
$filterBlock['unit'] = $weight_unit;
|
||||
$filterBlock['unit'] = Configuration::get('PS_WEIGHT_UNIT');
|
||||
}
|
||||
else
|
||||
unset($selectedFilters['weight']);
|
||||
@@ -1085,15 +1037,13 @@ class BlockLayered extends Module
|
||||
$share_url = $this->context->link->getCategoryLink((int)$category->id, $category->link_rewrite[(int)$this->context->language->id], $this->context->language->id).rtrim($params, '&');
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'display_share' => (int)Configuration::get('PS_LAYERED_SHARE'),
|
||||
'share_url' => $this->getShortLink($share_url),
|
||||
'layered_show_qties' => (int)Configuration::get('PS_LAYERED_SHOW_QTIES'),
|
||||
'id_category_layered' => (int)$id_parent,
|
||||
'selected_filters' => $selectedFilters,
|
||||
'n_filters' => (int)$nFilters,
|
||||
'nbr_filterBlocks' => sizeof($filterBlocks),
|
||||
'filters' => $filterBlocks));
|
||||
|
||||
|
||||
return $this->display(__FILE__, 'blocklayered.tpl');
|
||||
}
|
||||
|
||||
@@ -1110,6 +1060,11 @@ class BlockLayered extends Module
|
||||
$categoryBox[] = (int)$id_category;
|
||||
}
|
||||
|
||||
/* Clean categoryBox before use */
|
||||
if (isset($categoryBox) AND is_array($categoryBox))
|
||||
foreach ($categoryBox AS &$value)
|
||||
$value = (int)$value;
|
||||
|
||||
$attributeGroups = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
SELECT ag.id_attribute_group, ag.is_color_group, agl.name, COUNT(DISTINCT(a.id_attribute)) n
|
||||
FROM '._DB_PREFIX_.'attribute_group ag
|
||||
@@ -1215,6 +1170,7 @@ class BlockLayered extends Module
|
||||
$selectedFilters = $this->getSelectedFilters();
|
||||
$products = $this->getProductByFilters($selectedFilters);
|
||||
$products = Product::getProductsProperties($this->context->language->id, $products);
|
||||
|
||||
$nbProducts = $this->nbr_products;
|
||||
$range = 2; /* how many pages around page selected */
|
||||
|
||||
@@ -1250,7 +1206,6 @@ class BlockLayered extends Module
|
||||
|
||||
$this->context->smarty->assign('comparator_max_item', (int)Configuration::get('PS_COMPARATOR_MAX_ITEM'));
|
||||
$this->context->smarty->assign('products', $products);
|
||||
|
||||
/* We are sending an array in jSon to the .js controller, it will update both the filters and the products zones */
|
||||
return Tools::jsonEncode(array(
|
||||
'filtersBlock' => $this->generateFiltersBlock($selectedFilters),
|
||||
@@ -1473,23 +1428,4 @@ if (!isset($doneCategories[(int)$id_category]['p']))
|
||||
}
|
||||
return $products;
|
||||
}
|
||||
|
||||
private function getShortLink($share_url) {
|
||||
|
||||
$return = '';
|
||||
if (extension_loaded('curl'))
|
||||
{
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, "http://api.bitly.com/v3/shorten");
|
||||
curl_setopt($ch, CURLOPT_HEADER, 0);
|
||||
curl_setopt($ch, CURLOPT_HTTPGET, 1);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, 'login='.Configuration::get('PS_LAYERED_BITLY_USERNAME').'&apiKey='.Configuration::get('PS_LAYERED_BITLY_API_KEY').'&longUrl='.urlencode($share_url).'&format=txt');
|
||||
$return = curl_exec($ch);
|
||||
}
|
||||
if ($return != 'INVALID_LOGIN' AND $return != 'INVALID_APIKEY' AND extension_loaded('curl'))
|
||||
return $return;
|
||||
else
|
||||
return $share_url;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,12 +29,6 @@
|
||||
<div id="layered_block_left" class="block">
|
||||
<h4>{l s='Catalog' mod='blocklayered'}</h4>
|
||||
<div class="block_content">
|
||||
{if $display_share}
|
||||
<div id="layered_url_filter_block">
|
||||
<span class="layered_subtitle" style="float: none;">{l s='Share your search:' mod='blocklayered'}</span>
|
||||
<input value="{$share_url|escape:html:'UTF-8'}">
|
||||
</div>
|
||||
{/if}
|
||||
<form action="#" id="layered_form">
|
||||
<div>
|
||||
{if isset($selected_filters) && $n_filters > 0}
|
||||
|
||||
@@ -34,7 +34,7 @@ class CashOnDelivery extends PaymentModule
|
||||
{
|
||||
$this->name = 'cashondelivery';
|
||||
$this->tab = 'payments_gateways';
|
||||
$this->version = '0.3';
|
||||
$this->version = '0.4';
|
||||
$this->author = 'PrestaShop';
|
||||
$this->need_instance = 0;
|
||||
|
||||
@@ -44,6 +44,13 @@ class CashOnDelivery extends PaymentModule
|
||||
|
||||
$this->displayName = $this->l('Cash on delivery (COD)');
|
||||
$this->description = $this->l('Accept cash on delivery payments');
|
||||
|
||||
/* For 1.4.3 and less compatibility */
|
||||
$updateConfig = array('PS_OS_CHEQUE', 'PS_OS_PAYMENT', 'PS_OS_PREPARATION', 'PS_OS_SHIPPING', 'PS_OS_CANCELED', 'PS_OS_REFUND', 'PS_OS_ERROR', 'PS_OS_OUTOFSTOCK', 'PS_OS_BANKWIRE', 'PS_OS_PAYPAL', 'PS_OS_WS_PAYMENT');
|
||||
if (!Configuration::get('PS_OS_PAYMENT'))
|
||||
foreach ($updateConfig as $u)
|
||||
if (!Configuration::get($u) && defined('_'.$u.'_'))
|
||||
Configuration::updateValue($u, constant('_'.$u.'_'));
|
||||
}
|
||||
|
||||
public function install()
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
$configPath = '../../../config/config.inc.php';
|
||||
if (file_exists($configPath))
|
||||
{
|
||||
include('../../../config/config.inc.php');
|
||||
include('../../../modules/ebay/ebay.php');
|
||||
if (!Tools::getValue('token') || Tools::getValue('token') != Configuration::get('EBAY_SECURITY_TOKEN'))
|
||||
die('ERROR : Invalid Token');
|
||||
|
||||
global $cookie;
|
||||
$cookie = new Cookie('psEbay', '', 3600);
|
||||
|
||||
$ebay = new eBay();
|
||||
$ebay->ajaxProductSync();
|
||||
|
||||
unset($cookie);
|
||||
}
|
||||
else
|
||||
echo 'ERROR';
|
||||
|
||||
+142
-24
@@ -59,7 +59,7 @@ class Ebay extends Module
|
||||
{
|
||||
$this->name = 'ebay';
|
||||
$this->tab = 'market_place';
|
||||
$this->version = '1.2.1';
|
||||
$this->version = '1.2.2';
|
||||
$this->author = 'PrestaShop';
|
||||
parent::__construct ();
|
||||
$this->displayName = $this->l('eBay');
|
||||
@@ -541,8 +541,10 @@ class Ebay extends Module
|
||||
|
||||
|
||||
// Displaying Information from Prestashop
|
||||
$stream_context = stream_context_create(array('http' => array('method'=>"GET", 'timeout' => 5)));
|
||||
$stream_context = stream_context_create(array('http' => array('method'=>"GET", 'timeout' => 2)));
|
||||
$prestashopContent = @file_get_contents('http://www.prestashop.com/partner/modules/ebay.php?version='.$this->version.'&shop='.urlencode(Configuration::get('PS_SHOP_NAME')).'®istered='.($alert['registration'] == 1 ? 'no' : 'yes').'&url='.urlencode($_SERVER['HTTP_HOST']).'&iso_country='.$isoCountry.'&iso_lang='.Tools::strtolower($isoUser).'&id_lang='.(int)$this->context->language->id.'&email='.urlencode(Configuration::get('PS_SHOP_EMAIL')).'&security='.md5(Configuration::get('PS_SHOP_EMAIL')._COOKIE_IV_), false, $stream_context);
|
||||
if (!Validate::isCleanHtml($prestashopContent))
|
||||
$prestashopContent = '';
|
||||
|
||||
// Displaying page
|
||||
$this->_html .= '<fieldset>
|
||||
@@ -1213,8 +1215,36 @@ class Ebay extends Module
|
||||
$("#button_ebay_sync").attr("value", "'.$this->l('Sync with eBay').'\n(" + nbProducts + " '.$this->l('products').')");
|
||||
});
|
||||
});
|
||||
|
||||
function eBaySync()
|
||||
{
|
||||
$(".categorySync").attr("disabled", "true");
|
||||
$("#ebay_sync_mode1").attr("disabled", "true");
|
||||
$("#ebay_sync_mode2").attr("disabled", "true");
|
||||
$("#ebay_sync_option_resync").attr("disabled", "true");
|
||||
$("#button_ebay_sync").attr("disabled", "true");
|
||||
$("#button_ebay_sync").hide("slow");
|
||||
$("#resultSync").html("<img src=\"../modules/ebay/loading-small.gif\" border=\"0\" />");
|
||||
eBaySyncProduct();
|
||||
}
|
||||
|
||||
function eBaySyncProduct()
|
||||
{
|
||||
$.ajax({
|
||||
url: \''._MODULE_DIR_.'ebay/ajax/eBaySyncProduct.php?token='.Configuration::get('EBAY_SECURITY_TOKEN').'&time='.pSQL(date('Ymdhis').rand()).'\',
|
||||
success: function(data)
|
||||
{
|
||||
tab = data.split("|");
|
||||
$("#resultSync").html(tab[1]);
|
||||
if (tab[0] != "OK")
|
||||
eBaySyncProduct();
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<div id="resultSync" style="text-align: center; font-weight: bold; font-size: 14px;"></div>
|
||||
|
||||
<form action="index.php?tab='.$_GET['tab'].'&configure='.$_GET['configure'].'&token='.$_GET['token'].'&tab_module='.$_GET['tab_module'].'&module_name='.$_GET['module_name'].'&id_tab=4§ion=sync" method="post" class="form" id="configForm4">
|
||||
<fieldset style="border: 0">
|
||||
<h4>'.$this->l('You will now push your products on eBay.').' <b>'.$this->l('Reminder,').'</b> '.$this->l('you will not have to pay any fees if you have a shop on eBay.').'</h4>
|
||||
@@ -1269,7 +1299,10 @@ class Ebay extends Module
|
||||
$(document).ready(function() {
|
||||
$("#catSync").show("slow");
|
||||
$("#ebay_sync_mode2").attr("checked", true);
|
||||
});
|
||||
';
|
||||
if (Tools::getValue('section') == 'sync')
|
||||
$html .= 'eBaySync();';
|
||||
$html .= '});
|
||||
</script>';
|
||||
}
|
||||
|
||||
@@ -1293,16 +1326,14 @@ class Ebay extends Module
|
||||
// Update Sync Option
|
||||
Configuration::updateValue('EBAY_SYNC_OPTION_RESYNC', (Tools::getValue('ebay_sync_option_resync') == 1 ? 1 : 0));
|
||||
|
||||
// Empty error result
|
||||
Configuration::updateValue('EBAY_SYNC_LAST_PRODUCT', 0);
|
||||
@unlink('../modules/ebay/ajax/_ebaySyncError.log.php');
|
||||
|
||||
if ($_POST['ebay_sync_mode'] == 'A')
|
||||
{
|
||||
// Update Sync Mod
|
||||
Configuration::updateValue('EBAY_SYNC_MODE', 'A');
|
||||
|
||||
// Retrieve product list for eBay (which have matched categories)
|
||||
$productsList = Db::getInstance()->ExecuteS('SELECT `id_product` FROM `'._DB_PREFIX_.'product` WHERE `quantity` > 0 AND `active` = 1 AND `id_category_default` IN (SELECT `id_category` FROM `'._DB_PREFIX_.'ebay_category_configuration` WHERE `id_category` > 0 AND `id_ebay_category` > 0)');
|
||||
|
||||
// Send each product on eBay
|
||||
$this->_syncProducts($productsList);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1313,13 +1344,102 @@ class Ebay extends Module
|
||||
Db::getInstance()->autoExecute(_DB_PREFIX_.'ebay_category_configuration', array('sync' => 0), 'UPDATE', '');
|
||||
foreach ($_POST['category'] as $id_category)
|
||||
Db::getInstance()->autoExecute(_DB_PREFIX_.'ebay_category_configuration', array('sync' => 1), 'UPDATE', '`id_category` = '.(int)$id_category);
|
||||
$productsList = Db::getInstance()->ExecuteS('SELECT `id_product` FROM `'._DB_PREFIX_.'product` WHERE `quantity` > 0 AND `active` = 1 AND `id_category_default` IN (SELECT `id_category` FROM `'._DB_PREFIX_.'ebay_category_configuration` WHERE `id_category` > 0 AND `id_ebay_category` > 0 AND `sync` = 1)');
|
||||
|
||||
// Send each product on eBay
|
||||
$this->_syncProducts($productsList);
|
||||
}
|
||||
}
|
||||
|
||||
public function ajaxProductSync()
|
||||
{
|
||||
// Take the next product
|
||||
$where = '';
|
||||
if ((int)Configuration::get('EBAY_SYNC_LAST_PRODUCT') > 0)
|
||||
$where = 'AND `id_product` > '.(int)Configuration::get('EBAY_SYNC_LAST_PRODUCT');
|
||||
|
||||
|
||||
if (Configuration::get('EBAY_SYNC_MODE') == 'A')
|
||||
{
|
||||
// Retrieve total nb products for eBay (which have matched categories)
|
||||
$nbProductsTotal = Db::getInstance()->getValue('
|
||||
SELECT COUNT(`id_product`)
|
||||
FROM `'._DB_PREFIX_.'product`
|
||||
WHERE `quantity` > 0 AND `active` = 1
|
||||
AND `id_category_default` IN (SELECT `id_category` FROM `'._DB_PREFIX_.'ebay_category_configuration` WHERE `id_category` > 0 AND `id_ebay_category` > 0)');
|
||||
|
||||
// Retrieve products list for eBay (which have matched categories)
|
||||
$productsList = Db::getInstance()->ExecuteS('
|
||||
SELECT `id_product` FROM `'._DB_PREFIX_.'product`
|
||||
WHERE `quantity` > 0 AND `active` = 1
|
||||
AND `id_category_default` IN (SELECT `id_category` FROM `'._DB_PREFIX_.'ebay_category_configuration` WHERE `id_category` > 0 AND `id_ebay_category` > 0)
|
||||
AND `id_product` NOT IN (SELECT `id_product` FROM `'._DB_PREFIX_.'ebay_product`)
|
||||
'.$where.'
|
||||
ORDER BY `id_product`
|
||||
LIMIT 1');
|
||||
|
||||
// How Many Product Less ?
|
||||
$nbProductsLess = Db::getInstance()->getValue('
|
||||
SELECT COUNT(`id_product`) FROM `'._DB_PREFIX_.'product`
|
||||
WHERE `quantity` > 0 AND `active` = 1
|
||||
AND `id_category_default` IN (SELECT `id_category` FROM `'._DB_PREFIX_.'ebay_category_configuration` WHERE `id_category` > 0 AND `id_ebay_category` > 0)
|
||||
AND `id_product` NOT IN (SELECT `id_product` FROM `'._DB_PREFIX_.'ebay_product`)
|
||||
'.$where);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Retrieve total nb products for eBay (which have matched categories)
|
||||
$nbProductsTotal = Db::getInstance()->getValue('
|
||||
SELECT COUNT(`id_product`)
|
||||
FROM `'._DB_PREFIX_.'product`
|
||||
WHERE `quantity` > 0 AND `active` = 1
|
||||
AND `id_category_default` IN (SELECT `id_category` FROM `'._DB_PREFIX_.'ebay_category_configuration` WHERE `id_category` > 0 AND `id_ebay_category` > 0 AND `sync` = 1)');
|
||||
|
||||
// Retrieve products list for eBay (which have matched categories)
|
||||
$productsList = Db::getInstance()->ExecuteS('
|
||||
SELECT `id_product` FROM `'._DB_PREFIX_.'product`
|
||||
WHERE `quantity` > 0 AND `active` = 1
|
||||
AND `id_category_default` IN (SELECT `id_category` FROM `'._DB_PREFIX_.'ebay_category_configuration` WHERE `id_category` > 0 AND `id_ebay_category` > 0 AND `sync` = 1)
|
||||
AND `id_product` NOT IN (SELECT `id_product` FROM `'._DB_PREFIX_.'ebay_product`)
|
||||
'.$where.'
|
||||
ORDER BY `id_product`
|
||||
LIMIT 1');
|
||||
|
||||
// How Many Product Less ?
|
||||
$nbProductsLess = Db::getInstance()->getValue('
|
||||
SELECT COUNT(`id_product`) FROM `'._DB_PREFIX_.'product`
|
||||
WHERE `quantity` > 0 AND `active` = 1
|
||||
AND `id_category_default` IN (SELECT `id_category` FROM `'._DB_PREFIX_.'ebay_category_configuration` WHERE `id_category` > 0 AND `id_ebay_category` > 0 AND `sync` = 1)
|
||||
AND `id_product` NOT IN (SELECT `id_product` FROM `'._DB_PREFIX_.'ebay_product`)
|
||||
'.$where);
|
||||
}
|
||||
|
||||
// Send each product on eBay
|
||||
if (count($productsList) >= 1)
|
||||
{
|
||||
// Save the last product
|
||||
Configuration::updateValue('EBAY_SYNC_LAST_PRODUCT', (int)$productsList[0]['id_product']);
|
||||
|
||||
// Sync product
|
||||
$this->_syncProducts($productsList);
|
||||
|
||||
echo 'KO|<br /><br /> <img src="../modules/ebay/loading-small.gif" border="0" /> Produits : '.($nbProductsTotal - $nbProductsLess + 1).' / '.$nbProductsTotal.'<br /><br />';
|
||||
}
|
||||
else
|
||||
{
|
||||
echo 'OK|'.$this->displayConfirmation($this->l('Settings updated').' ('.$this->l('Option').' '.Configuration::get('EBAY_SYNC_MODE').' : '.($nbProductsTotal - $nbProductsLess).' / '.$nbProductsTotal.' '.$this->l('product(s) sync with eBay').')');
|
||||
if (file_exists('_ebaySyncError.log.php'))
|
||||
{
|
||||
global $tab_error;
|
||||
include('_ebaySyncError.log.php');
|
||||
foreach ($tab_error as $error)
|
||||
{
|
||||
$productsDetails = '<br /><u>'.$this->l('Product(s) concerned').' :</u>';
|
||||
foreach ($error['products'] as $product)
|
||||
$productsDetails .= '<br />- '.$product;
|
||||
echo $this->displayError($error['msg'].'<br />'.$productsDetails);
|
||||
}
|
||||
echo '<style>#content .alert { text-align: left; width: 875px; }</style>';
|
||||
@unlink('_ebaySyncError.log.php');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function _syncProducts($productsList)
|
||||
{
|
||||
@@ -1332,6 +1452,13 @@ class Ebay extends Module
|
||||
$ebay = new eBayRequest();
|
||||
$categoryDefaultCache = array();
|
||||
|
||||
// Get errors back
|
||||
if (file_exists('_ebaySyncError.log.php'))
|
||||
{
|
||||
global $tab_error;
|
||||
include('_ebaySyncError.log.php');
|
||||
}
|
||||
|
||||
// Up the time limit
|
||||
@set_time_limit(3600);
|
||||
|
||||
@@ -1656,19 +1783,10 @@ class Ebay extends Module
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
if ($count_success > 0)
|
||||
$this->_html .= $this->displayConfirmation($this->l('Settings updated').' ('.$this->l('Option').' '.Configuration::get('EBAY_SYNC_MODE').' : '.$count_success.'/'.$count.' '.$this->l('product(s) sync with eBay').')');
|
||||
|
||||
if ($count_error > 0)
|
||||
{
|
||||
foreach ($tab_error as $error)
|
||||
{
|
||||
$productsDetails = '<br /><u>'.$this->l('Product(s) concerned').' :</u>';
|
||||
foreach ($error['products'] as $product)
|
||||
$productsDetails .= '<br />- '.$product;
|
||||
$this->_html .= $this->displayError($error['msg'].'<br />'.$productsDetails);
|
||||
file_put_contents('_ebaySyncError.log.php', '<?php $tab_error = '.var_export($tab_error, true).'; ?>');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************/
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
@@ -93,7 +93,7 @@ class Hipay extends PaymentModule
|
||||
Configuration::deleteByName('HIPAY_AZ_'.$rowValues['id_zone']);
|
||||
Configuration::deleteByName('HIPAY_AZ_ALL_'.$rowValues['id_zone']);
|
||||
}
|
||||
Db::getInstance()->ExecuteS('DELETE FROM `'._DB_PREFIX_.'module_country` WHERE `id_module` = '.(int)$this->id);
|
||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'module_country` WHERE `id_module` = '.(int)$this->id);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -308,7 +308,7 @@ class Hipay extends PaymentModule
|
||||
Configuration::deleteByName('HIPAY_AZ_'.$rowValues['id_zone']);
|
||||
Configuration::deleteByName('HIPAY_AZ_ALL_'.$rowValues['id_zone']);
|
||||
}
|
||||
Db::getInstance()->ExecuteS('DELETE FROM `'._DB_PREFIX_.'module_country` WHERE `id_module` = '.(int)$this->id);
|
||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'module_country` WHERE `id_module` = '.(int)$this->id);
|
||||
|
||||
return (true);
|
||||
}
|
||||
@@ -328,7 +328,7 @@ class Hipay extends PaymentModule
|
||||
Configuration::updateValue('HIPAY_AZ_'.$id, 'ko');
|
||||
}
|
||||
}
|
||||
Db::getInstance()->ExecuteS('DELETE FROM `'._DB_PREFIX_.'module_country` WHERE `id_module` = '.(int)$this->id);
|
||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'module_country` WHERE `id_module` = '.(int)$this->id);
|
||||
|
||||
// Add the new configuration zones
|
||||
foreach ($_POST as $key => $val)
|
||||
@@ -339,7 +339,7 @@ class Hipay extends PaymentModule
|
||||
$request = 'SELECT id_country FROM '._DB_PREFIX_.'country WHERE ';
|
||||
$results = Db::getInstance()->ExecuteS($request.$this->getRequestZones('id_zone'));
|
||||
foreach ($results as $rowValues)
|
||||
Db::getInstance()->ExecuteS('INSERT INTO '._DB_PREFIX_.'module_country VALUE('.(int)$this->id.', '.(int)$rowValues['id_country'].')');
|
||||
Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'module_country VALUE('.(int)$this->id.', '.(int)$rowValues['id_country'].')');
|
||||
|
||||
}
|
||||
elseif (Tools::isSubmit('submitHipay'))
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
oosHookJsCodeFunctions.push('oosHookJsCodeMailAlert');
|
||||
|
||||
function clearText() {
|
||||
if ($('#oos_customer_email').val() == '{l s='your@email.com' mod='mailalerts'}')
|
||||
if ($('#oos_customer_email').val() == '{/literal}{l s='your@email.com' mod='mailalerts'}{literal}')
|
||||
$('#oos_customer_email').val('');
|
||||
}
|
||||
|
||||
|
||||
@@ -272,11 +272,14 @@ class MRCreateTickets implements IMondialRelayWSMethod
|
||||
*/
|
||||
private function _setRequestDefaultValue()
|
||||
{
|
||||
|
||||
$this->_fields['list']['Enseigne']['value'] = Configuration::get('MR_ENSEIGNE_WEBSERVICE');
|
||||
$this->_fields['list']['Expe_Langage']['value'] = Configuration::get('MR_LANGUAGE');
|
||||
var_dump(Configuration::get('MR_LANGUAGE'));
|
||||
$this->_fields['list']['Expe_Ad1']['value'] = Configuration::get('PS_MR_SHOP_NAME');
|
||||
$this->_fields['list']['Expe_Ad3']['value'] = Configuration::get('PS_SHOP_ADDR1');
|
||||
$this->_fields['list']['Expe_Ad4']['value'] = Configuration::get('PS_SHOP_ADDR2');
|
||||
// Deleted, cause to many failed for the process
|
||||
// $this->_fields['list']['Expe_Ad4']['value'] = Configuration::get('PS_SHOP_ADDR2');
|
||||
$this->_fields['list']['Expe_Ville']['value'] = Configuration::get('PS_SHOP_CITY');
|
||||
$this->_fields['list']['Expe_CP']['value'] = Configuration::get('PS_SHOP_CODE');
|
||||
$this->_fields['list']['Expe_CP']['params']['id_country'] = Configuration::get('PS_COUNTRY_DEFAULT');
|
||||
@@ -286,7 +289,7 @@ class MRCreateTickets implements IMondialRelayWSMethod
|
||||
else
|
||||
$this->_fields['list']['Expe_Pays']['value'] = substr(Configuration::get('PS_SHOP_COUNTRY'), 0, 2);
|
||||
|
||||
$this->_fields['list']['Expe_Tel1']['value'] = Configuration::get('PS_SHOP_PHONE');
|
||||
$this->_fields['list']['Expe_Tel1']['value'] = str_replace(array('.', ' ', '-'), '', Configuration::get('PS_SHOP_PHONE'));
|
||||
$this->_fields['list']['Expe_Mail']['value'] = Configuration::get('PS_SHOP_EMAIL');
|
||||
$this->_fields['list']['NbColis']['value'] = 1;
|
||||
$this->_fields['list']['CRT_Valeur']['value'] = 0;
|
||||
@@ -373,7 +376,11 @@ class MRCreateTickets implements IMondialRelayWSMethod
|
||||
foreach($rootCase['list'] as $paramName => &$valueDetailed)
|
||||
if ($paramName != 'Texte' && $paramName != 'Security')
|
||||
{
|
||||
$valueDetailed['value'] = strtoupper(MRTools::replaceAccentedCharacters($valueDetailed['value']));
|
||||
// Mac server make an empty string instead of a cleaned string
|
||||
// TODO : test on windows and linux server
|
||||
$cleanedString = MRTools::replaceAccentedCharacters($valueDetailed['value']);
|
||||
$valueDetailed['value'] = !empty($cleanedString) ? strtoupper($cleanedString) : strtoupper($valueDetailed['value']);
|
||||
|
||||
// Call a pointer function if exist to do different test
|
||||
if (isset($valueDetailed['methodValidation']) &&
|
||||
method_exists('MRTools', $valueDetailed['methodValidation']) &&
|
||||
@@ -420,10 +427,13 @@ class MRCreateTickets implements IMondialRelayWSMethod
|
||||
$order->update();
|
||||
|
||||
$templateVars = array('{followup}' => $trackingURL);
|
||||
$orderState = (Configuration::get('PS_OS_SHIPPING')) ?
|
||||
Configuration::get('PS_OS_SHIPPING') :
|
||||
_PS_OS_SHIPPING_;
|
||||
|
||||
$history = new OrderHistory();
|
||||
$history->id_order = (int)($params['NDossier']);
|
||||
$history->changeIdOrderState(Configuration::get('PS_OS_SHIPPING'), (int)($params['NDossier']));
|
||||
$history->changeIdOrderState($orderState, (int)($params['NDossier']));
|
||||
$history->id_employee = (int)Context::getContext()->employee->id;
|
||||
$history->addWithemail(true, $templateVars);
|
||||
|
||||
|
||||
@@ -460,7 +460,7 @@ function PS_MRHandleSelectedRelayPoint()
|
||||
$(this).children('a').text(PS_MRTranslationList['Select']);
|
||||
});
|
||||
// Make the Selection
|
||||
$(this).text(PS_MRTranslationList['Selected']);
|
||||
$(this).html(PS_MRTranslationList['Selected']);
|
||||
$(this).parent().attr('class', 'PS_MRFloatRelayPointSelected');
|
||||
|
||||
// Get the info about the relay point (relayPoint_RelayPointNumber_IdCarrier)
|
||||
@@ -775,7 +775,7 @@ $(document).ready(function()
|
||||
});
|
||||
$('#PS_MRDisplayPersonalizedOptions').click(function()
|
||||
{
|
||||
$('#PS_MRPersonalizedFields').toggle('fast');
|
||||
$('#PS_MRAdvancedSettings').toggle('fast');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -161,7 +161,7 @@ class MondialRelay extends Module
|
||||
else
|
||||
{
|
||||
// Reactive transport if database wasn't remove at the last uninstall
|
||||
Db::getInstance()->ExecuteS('
|
||||
Db::getInstance()->Execute('
|
||||
UPDATE `'._DB_PREFIX_.'carrier` c, `'._DB_PREFIX_.'mr_method` m
|
||||
SET `deleted` = 0
|
||||
WHERE c.id_carrier = m.id_carrier');
|
||||
@@ -368,7 +368,8 @@ class MondialRelay extends Module
|
||||
self::$modulePath = _PS_MODULE_DIR_. 'mondialrelay/';
|
||||
self::$MRToken = sha1('mr'._COOKIE_KEY_.'mrAgain');
|
||||
|
||||
$protocol = (Configuration::get('PS_SSL_ENABLED') || Tools::usingSecureMode()) ? 'https://' : 'http://';
|
||||
$protocol = (Configuration::get('PS_SSL_ENABLED') || (!empty($_SERVER['HTTPS'])
|
||||
&& strtolower($_SERVER['HTTPS']) != 'off')) ? 'https://' : 'http://';
|
||||
|
||||
$endURL = __PS_BASE_URI__.'/modules/mondialrelay/';
|
||||
|
||||
@@ -647,16 +648,13 @@ class MondialRelay extends Module
|
||||
<img src="../modules/mondialrelay/images/logo.gif" />'.$this->l('To create a Mondial Relay carrier').
|
||||
'</legend>
|
||||
- '.$this->l('Enter and save your Mondial Relay account settings').'<br />
|
||||
- '.$this->l('Create a Carrier').'<br />
|
||||
- '.$this->l('Create a Carrier using the form "add a carrier" below').'<br />
|
||||
- '.$this->l('Define a price for your carrier on').'
|
||||
<a href="index.php?tab=AdminCarriers&token='.Tools::getAdminToken('AdminCarriers'.(int)(Tab::getIdFromClassName('AdminCarriers')).
|
||||
(int)$this->context->employee->id).'" class="green">'.$this->l('The Carrier page').'</a><br />
|
||||
- '.$this->l('To generate labels, you must have a valid and registered address of your store on your').
|
||||
' <a href="index.php?tab=AdminContact&token='.Tools::getAdminToken('AdminContact'.(int)(Tab::getIdFromClassName('AdminContact')).
|
||||
(int)$this->context->employee->id).'" class="green">'.$this->l('contact page').'</a><br />
|
||||
<p>
|
||||
'.$this->l('URL Cron Task:').' '.Tools::getHttpHost(true, true)._MODULE_DIR_.$this->name.'/cron.php?secure_key='.Configuration::get('MONDIAL_RELAY_SECURE_KEY').
|
||||
'</p>
|
||||
</fieldset>
|
||||
<br class="clear" />
|
||||
<div class="PS_MRFormType">'.
|
||||
@@ -666,7 +664,7 @@ class MondialRelay extends Module
|
||||
$this->settingsstateorderForm().
|
||||
'</div>
|
||||
<div class="PS_MRFormType">'.
|
||||
$this->personalizeFormFields().
|
||||
$this->advancedSettings().
|
||||
'</div>
|
||||
<div class="PS_MRFormType">'.
|
||||
$this->addMethodForm().
|
||||
@@ -893,8 +891,33 @@ class MondialRelay extends Module
|
||||
return $output;
|
||||
}
|
||||
|
||||
/*
|
||||
** Display advanced settings form
|
||||
*/
|
||||
public function advancedSettings()
|
||||
{
|
||||
$form = '';
|
||||
|
||||
$form .= '
|
||||
<fieldset class="PS_MRFormStyle">
|
||||
<legend>
|
||||
<img src="../modules/mondialrelay/images/logo.gif" />'.$this->l('Advanced Settings'). ' -
|
||||
<a href="javascript:void(0);" id="PS_MRDisplayPersonalizedOptions"><font style="color:#00b511;">'.$this->l('Click to display / hide the options').'</font> </a>'.
|
||||
'</legend>
|
||||
<div id="PS_MRAdvancedSettings">
|
||||
<p>
|
||||
'.$this->l('URL Cron Task:').' '.Tools::getHttpHost(true, true)
|
||||
._MODULE_DIR_.$this->name.'/cron.php?secure_key='.
|
||||
Configuration::get('MONDIAL_RELAY_SECURE_KEY').
|
||||
'</p>
|
||||
</div>
|
||||
</fieldset>';
|
||||
return $form;
|
||||
}
|
||||
|
||||
/*
|
||||
** Form to allow personalization fields sent for MondialRelay
|
||||
** Not used anymore but still present if needed
|
||||
*/
|
||||
public function personalizeFormFields()
|
||||
{
|
||||
|
||||
@@ -281,7 +281,7 @@ tr.PS_MRSelectedCarrier > td
|
||||
display: block;
|
||||
width: 60px;
|
||||
height: 20px;
|
||||
padding: 5px 20px 0px 25px;
|
||||
padding: 6px 20px 0px 25px;
|
||||
text-decoration: none;
|
||||
margin-top: 8px;
|
||||
color:#333333;
|
||||
|
||||
@@ -138,9 +138,9 @@ class productsCategory extends Module
|
||||
if ($categoryProduct['id_product'] != $idProduct)
|
||||
{
|
||||
if ($taxes == 0 OR $taxes == 2)
|
||||
$categoryProducts[$key]['displayed_price'] = Product::getPriceStatic((int)$categoryProduct['id_product'], true, NULL);
|
||||
$categoryProducts[$key]['displayed_price'] = Product::getPriceStatic((int)$categoryProduct['id_product'], true, NULL, 2);
|
||||
elseif ($taxes == 1)
|
||||
$categoryProducts[$key]['displayed_price'] = Product::getPriceStatic((int)$categoryProduct['id_product'], false, NULL);
|
||||
$categoryProducts[$key]['displayed_price'] = Product::getPriceStatic((int)$categoryProduct['id_product'], false, NULL, 2);
|
||||
}
|
||||
|
||||
// Get positions
|
||||
|
||||
@@ -279,7 +279,7 @@ class ReferralProgram extends Module
|
||||
<p>
|
||||
<div style="float: left"><label class="t" for="discount_description">'.$this->l('Voucher description:').'</label></div>';
|
||||
$defaultLanguage = (int)(Configuration::get('PS_LANG_DEFAULT'));
|
||||
$languages = Language::getLanguages(false);
|
||||
$languages = Language::getLanguages(true);
|
||||
|
||||
foreach ($languages AS $language)
|
||||
$this->_html .= '
|
||||
@@ -489,7 +489,8 @@ class ReferralProgram extends Module
|
||||
}
|
||||
|
||||
$html = '
|
||||
<h2>'.$this->l('Referral program').'</h2>
|
||||
<div class="clear"> </div>
|
||||
<h2>'.$this->l('Referral program').' ('.count($friends).')</h2>
|
||||
<h3>'.(isset($sponsor) ? $this->l('Customer\'s sponsor:').' <a href="index.php?tab=AdminCustomers&id_customer='.(int)$sponsor->id.'&viewcustomer&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)$this->context->employee->id).'">'.$sponsor->firstname.' '.$sponsor->lastname.'</a>' : $this->l('No one has sponsored this customer.')).'</h3>';
|
||||
|
||||
if ($friends AND sizeof($friends))
|
||||
|
||||
@@ -99,4 +99,4 @@
|
||||
{/if}
|
||||
</div>
|
||||
<!-- /Pagination -->
|
||||
{/if}
|
||||
{/if}
|
||||
@@ -64,4 +64,4 @@
|
||||
{/foreach}
|
||||
</ul>
|
||||
<!-- /Products list -->
|
||||
{/if}
|
||||
{/if}
|
||||
Reference in New Issue
Block a user