// Merge -> revision 7875

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@7877 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rMalie
2011-08-03 16:16:49 +00:00
parent 6f08bcb12e
commit f2b5ee338b
38 changed files with 320 additions and 85 deletions
+1 -1
View File
@@ -52,7 +52,7 @@ class AdminCarriers extends AdminTab
$this->optionTitle = $this->l('Carrier options'); $this->optionTitle = $this->l('Carrier options');
$this->_fieldsOptions = array( $this->_fieldsOptions = array(
'PS_CARRIER_DEFAULT' => array('title' => $this->l('Default carrier:'), 'desc' => $this->l('The default carrier used in shop'), 'cast' => 'intval', 'type' => 'select', 'identifier' => 'id_carrier', 'list' => Carrier::getCarriers((int)(Configuration::get('PS_LANG_DEFAULT')), true , false,false, NULL, ALL_CARRIERS)), 'PS_CARRIER_DEFAULT' => array('title' => $this->l('Default carrier:'), 'desc' => $this->l('The default carrier used in shop'), 'cast' => 'intval', 'type' => 'select', 'identifier' => 'id_carrier', 'list' => Carrier::getCarriers((int)(Configuration::get('PS_LANG_DEFAULT')), true , false,false, NULL, Carrier::ALL_CARRIERS)),
); );
parent::__construct(); parent::__construct();
+10 -2
View File
@@ -1191,6 +1191,10 @@ class AdminImport extends AdminTab
$info = self::getMaskedRow($line); $info = self::getMaskedRow($line);
self::setDefaultValues($info); self::setDefaultValues($info);
if (array_key_exists('id', $info) AND (int)($info['id']) AND Manufacturer::existsInDatabase((int)($info['id'])))
$manufacturer = new Manufacturer((int)($info['id']));
else
$manufacturer = new Manufacturer(); $manufacturer = new Manufacturer();
self::array_walk($info, array('AdminImport', 'fillInfo'), $manufacturer); self::array_walk($info, array('AdminImport', 'fillInfo'), $manufacturer);
@@ -1242,9 +1246,13 @@ class AdminImport extends AdminTab
$info = self::getMaskedRow($line); $info = self::getMaskedRow($line);
self::setDefaultValues($info); self::setDefaultValues($info);
$supplier = new Supplier();
self::array_walk($info, array('AdminImport', 'fillInfo'), $supplier);
if (array_key_exists('id', $info) AND (int)($info['id']) AND Supplier::existsInDatabase((int)($info['id'])))
$supplier = new Supplier((int)($info['id']));
else
$supplier = new Supplier();
self::array_walk($info, array('AdminImport', 'fillInfo'), $supplier);
if (($fieldError = $supplier->validateFields(UNFRIENDLY_ERROR, true)) === true AND ($langFieldError = $supplier->validateFieldsLang(UNFRIENDLY_ERROR, true)) === true) if (($fieldError = $supplier->validateFields(UNFRIENDLY_ERROR, true)) === true AND ($langFieldError = $supplier->validateFieldsLang(UNFRIENDLY_ERROR, true)) === true)
{ {
$res = false; $res = false;
+1 -1
View File
@@ -293,7 +293,7 @@ class AdminInformation extends AdminTab
if ($recursive) if ($recursive)
{ {
while (($file = readdir($dh)) !== false) while (($file = readdir($dh)) !== false)
if (@filetype($dir.$file) == 'dir' AND $file != '.' AND $file != '..') if (is_dir($dir.$file) AND $file != '.' AND $file != '..')
if (!self::test_dir($dir.$file, true)) if (!self::test_dir($dir.$file, true))
return false; return false;
} }
+17 -9
View File
@@ -2726,19 +2726,27 @@ class AdminProducts extends AdminTab
<td class="col-left"><label for="id_category_default" class="t">'.$this->l('Default category:').'</label></td> <td class="col-left"><label for="id_category_default" class="t">'.$this->l('Default category:').'</label></td>
<td> <td>
<div id="no_default_category" style="color: red;font-weight: bold;display: none;">'.$this->l('Please check a category in order to select the default category.').'</div> <div id="no_default_category" style="color: red;font-weight: bold;display: none;">'.$this->l('Please check a category in order to select the default category.').'</div>
<script>var post_selected_cat;</script>'; <script type="text/javascript">
if (Tools::isSubmit('categoryBox')) var post_selected_cat;
</script>';
$default_category = Tools::getValue('id_category', 1);
if (!$obj->id)
{ {
$postCat = Tools::getValue('categoryBox'); $selectedCat = Category::getCategoryInformations(Tools::getValue('categoryBox', array($default_category)), $this->_defaultFormLanguage);
$selectedCat = Category::getSimpleCategories($this->_defaultFormLanguage, false, true, 'AND c.`id_category` IN ('.(empty($postCat) ? '1' : implode(',', $postCat)).')'); echo '
echo '<script>post_selected_cat = \''.implode(',', $postCat).'\';</script>'; <script type="text/javascript">
post_selected_cat = \''.implode(',', array_keys($selectedCat)).'\';
</script>';
} }
if ($obj->id) else
{
if (Tools::isSubmit('categoryBox'))
$selectedCat = Category::getCategoryInformations(Tools::getValue('categoryBox', array($default_category)), $this->_defaultFormLanguage);
else
$selectedCat = Product::getProductCategoriesFull($obj->id, $this->_defaultFormLanguage); $selectedCat = Product::getProductCategoriesFull($obj->id, $this->_defaultFormLanguage);
else if(!Tools::isSubmit('categoryBox')) }
$selectedCat[] = array('id_category' => 1, 'name' => $this->l('Home'));
echo '<select id="id_category_default" name="id_category_default">';
echo '<select id="id_category_default" name="id_category_default">';
foreach($selectedCat AS $cat) foreach($selectedCat AS $cat)
echo '<option value="'.$cat['id_category'].'" '.($obj->id_category_default == $cat['id_category'] ? 'selected' : '').'>'.$cat['name'].'</option>'; echo '<option value="'.$cat['id_category'].'" '.($obj->id_category_default == $cat['id_category'] ? 'selected' : '').'>'.$cat['name'].'</option>';
echo '</select> echo '</select>
+1 -1
View File
@@ -72,7 +72,7 @@ class AdminRangePrice extends AdminTab
$currency = $this->context->currency; $currency = $this->context->currency;
$carrierArray = array(); $carrierArray = array();
$carriers = Carrier::getCarriers((int)(Configuration::get('PS_LANG_DEFAULT')), true , false,false, NULL, PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE); $carriers = Carrier::getCarriers((int)(Configuration::get('PS_LANG_DEFAULT')), true , false,false, NULL, Carrier::PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE);
$id_carrier = Tools::getValue('id_carrier', $obj->id_carrier); $id_carrier = Tools::getValue('id_carrier', $obj->id_carrier);
foreach ($carriers AS $carrier) foreach ($carriers AS $carrier)
if (!$carrier['is_free']) if (!$carrier['is_free'])
+1 -1
View File
@@ -72,7 +72,7 @@ class AdminRangeWeight extends AdminTab
return; return;
$carrierArray = array(); $carrierArray = array();
$carriers = Carrier::getCarriers((int)(Configuration::get('PS_LANG_DEFAULT')), true , false,false, NULL, PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE); $carriers = Carrier::getCarriers((int)(Configuration::get('PS_LANG_DEFAULT')), true , false,false, NULL, Carrier::PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE);
$id_carrier = Tools::getValue('id_carrier', $obj->id_carrier); $id_carrier = Tools::getValue('id_carrier', $obj->id_carrier);
foreach ($carriers AS $carrier) foreach ($carriers AS $carrier)
if (!$carrier['is_free']) if (!$carrier['is_free'])
+2 -1
View File
@@ -204,7 +204,8 @@ class AdminShipping extends AdminTab
{ {
$carrierArray = array(); $carrierArray = array();
$id_carrier = Tools::getValue('id_carrier'); $id_carrier = Tools::getValue('id_carrier');
$carriers = Carrier::getCarriers(Configuration::get('PS_LANG_DEFAULT'), true , false,false, NULL, PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE);
$carriers = Carrier::getCarriers(Configuration::get('PS_LANG_DEFAULT'), true , false,false, NULL, Carrier::PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE);
foreach ($carriers AS $carrier) foreach ($carriers AS $carrier)
if (!$carrier['is_free']) if (!$carrier['is_free'])
$carrierArray[] = array( $carrierArray[] = array(
+19 -4
View File
@@ -27,6 +27,15 @@
class CarrierCore extends ObjectModel class CarrierCore extends ObjectModel
{ {
/**
* getCarriers method filter
*/
const PS_CARRIERS_ONLY = 1;
const CARRIERS_MODULE = 2;
const CARRIERS_MODULE_NEED_RANGE = 3;
const PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE = 4;
const ALL_CARRIERS = 5;
const SHIPPING_METHOD_DEFAULT = 0; const SHIPPING_METHOD_DEFAULT = 0;
const SHIPPING_METHOD_WEIGHT = 1; const SHIPPING_METHOD_WEIGHT = 1;
const SHIPPING_METHOD_PRICE = 2; const SHIPPING_METHOD_PRICE = 2;
@@ -340,7 +349,7 @@ class CarrierCore extends ObjectModel
* @param boolean $active Returns only active carriers when true * @param boolean $active Returns only active carriers when true
* @return array Carriers * @return array Carriers
*/ */
public static function getCarriers($id_lang, $active = false, $delete = false, $id_zone = false, $ids_group = NULL, $modules_filters = 1) public static function getCarriers($id_lang, $active = false, $delete = false, $id_zone = false, $ids_group = NULL, $modules_filters = self::PS_CARRIERS_ONLY)
{ {
if (!Validate::isBool($active)) if (!Validate::isBool($active))
die(Tools::displayError()); die(Tools::displayError());
@@ -351,7 +360,7 @@ class CarrierCore extends ObjectModel
$ids .= (int)($id).', '; $ids .= (int)($id).', ';
$ids = rtrim($ids, ', '); $ids = rtrim($ids, ', ');
if ($ids == '') if ($ids == '')
return (array()); return array();
} }
$sql = 'SELECT c.*, cl.delay $sql = 'SELECT c.*, cl.delay
@@ -430,6 +439,12 @@ class CarrierCore extends ObjectModel
return $countries; return $countries;
} }
/**
*
* @param int $id_zone
* @param Array $groups group of the customer
* @return Array
*/
public static function getCarriersForOrder($id_zone, $groups = NULL) public static function getCarriersForOrder($id_zone, $groups = NULL)
{ {
$context = Context::getContext(); $context = Context::getContext();
@@ -441,9 +456,9 @@ class CarrierCore extends ObjectModel
$id_currency = $context->currency->id; $id_currency = $context->currency->id;
if (is_array($groups) AND !empty($groups)) if (is_array($groups) AND !empty($groups))
$result = Carrier::getCarriers($id_lang, true, false, (int)$id_zone, $groups, PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE); $result = Carrier::getCarriers($id_lang, true, false, (int)$id_zone, $groups, self::PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE);
else else
$result = Carrier::getCarriers($id_lang, true, false, (int)$id_zone, array(1), PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE); $result = Carrier::getCarriers($id_lang, true, false, (int)$id_zone, array(1), self::PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE);
$resultsArray = array(); $resultsArray = array();
foreach ($result AS $k => $row) foreach ($result AS $k => $row)
+34 -2
View File
@@ -1008,8 +1008,8 @@ class CategoryCore extends ObjectModel
public function getWsNbProductsRecursive() public function getWsNbProductsRecursive()
{ {
$result = Db::getInstance()->ExecuteS( $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
'SELECT count(distinct(id_product)) as nb_product_recursive FROM `'._DB_PREFIX_.'category_product` SELECT count(distinct(id_product)) as nb_product_recursive FROM `'._DB_PREFIX_.'category_product`
WHERE id_category IN (SELECT id_category WHERE id_category IN (SELECT id_category
FROM `'._DB_PREFIX_.'category` FROM `'._DB_PREFIX_.'category`
WHERE nleft > '.(int)$this->nleft. WHERE nleft > '.(int)$this->nleft.
@@ -1018,5 +1018,37 @@ class CategoryCore extends ObjectModel
return -1; return -1;
return $result[0]['nb_product_recursive']; return $result[0]['nb_product_recursive'];
} }
/**
*
* @param Array $ids_category
* @param int $id_lang
* @return Array
*/
public static function getCategoryInformations($ids_category, $id_lang = null)
{
if ($id_lang === null)
{
global $cookie;
$id_lang = $cookie->id_lang;
}
if (!is_array($ids_category) || !sizeof($ids_category))
return;
$categories = array();
$results = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
SELECT c.`id_category`, cl.`name`, cl.`link_rewrite`, cl.`id_lang`
FROM `'._DB_PREFIX_.'category` c
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category`)
WHERE cl.`id_lang` = '.(int)$id_lang.'
AND c.`id_category` IN ('.implode(',', $ids_category).')
');
foreach($results as $category)
$categories[$category['id_category']] = $category;
return $categories;
}
} }
+1 -1
View File
@@ -110,7 +110,7 @@ class ConfigurationTestCore
if ($recursive) if ($recursive)
{ {
while (($file = readdir($dh)) !== false) while (($file = readdir($dh)) !== false)
if (@filetype($dir.$file) == 'dir' AND $file != '.' AND $file != '..') if (is_dir($dir.$file) AND $file != '.' AND $file != '..')
if (!self::test_dir($dir.$file, true)) if (!self::test_dir($dir.$file, true))
return false; return false;
} }
+17 -1
View File
@@ -117,7 +117,7 @@ abstract class ObjectModelCore
if ($id_lang != NULL && Validate::isLoadedObject(new Language($id_lang))) if ($id_lang != NULL && Validate::isLoadedObject(new Language($id_lang)))
$this->id_lang = $id_lang; $this->id_lang = $id_lang;
elseif ($id_lang != NULL) elseif ($id_lang != NULL)
die(Tools::displayError()); $this->id_lang = Configuration::get('PS_LANG_DEFAULT');
if ($id_shop && $this->langMultiShop) if ($id_shop && $this->langMultiShop)
{ {
@@ -853,4 +853,20 @@ abstract class ObjectModelCore
return false; return false;
return true; return true;
} }
/**
* Specify if an ObjectModel is already in database
*
* @param $id_entity entity id
* @return boolean
*/
public static function existsInDatabase($id_entity)
{
$row = Db::getInstance()->getRow('
SELECT `id_'.self::$table.'`
FROM `'._DB_PREFIX_.self::$table.'` e
WHERE e.`id_'.self::$table.'` = '.(int)($id_entity));
return isset($row['id_product']);
}
} }
+2 -17
View File
@@ -1567,7 +1567,8 @@ class ProductCore extends ObjectModel
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(' $row = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
SELECT cp.`id_category`, cl.`name`, cl.`link_rewrite` FROM `'._DB_PREFIX_.'category_product` cp SELECT cp.`id_category`, cl.`name`, cl.`link_rewrite` FROM `'._DB_PREFIX_.'category_product` cp
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (cp.`id_category` = cl.`id_category`) LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (cp.`id_category` = cl.`id_category`)
WHERE cp.`id_product` = '.(int)$id_product); WHERE cp.`id_product` = '.(int)$id_product.'
AND cl.`id_lang` = '.(int)$id_lang);
foreach ($row as $val) foreach ($row as $val)
$ret[$val['id_category']] = $val; $ret[$val['id_category']] = $val;
return $ret; return $ret;
@@ -3037,22 +3038,6 @@ class ProductCore extends ObjectModel
return true; return true;
} }
/**
* Specify if a product is already in database
*
* @param $id_product Product id
* @return boolean
*/
public static function existsInDatabase($id_product)
{
$row = Db::getInstance()->getRow('
SELECT `id_product`
FROM '._DB_PREFIX_.'product p
WHERE p.`id_product` = '.(int)($id_product));
return isset($row['id_product']);
}
public static function idIsOnCategoryId($id_product, $categories) public static function idIsOnCategoryId($id_product, $categories)
{ {
$sql = 'SELECT id_product FROM `'._DB_PREFIX_.'category_product` WHERE `id_product`='.(int)($id_product).' AND `id_category` IN('; $sql = 'SELECT id_product FROM `'._DB_PREFIX_.'category_product` WHERE `id_product`='.(int)($id_product).' AND `id_category` IN(';
-2
View File
@@ -538,8 +538,6 @@ class ToolsCore
self::deleteDirectory($dirname.$file, true); self::deleteDirectory($dirname.$file, true);
elseif (file_exists($dirname.$file)) elseif (file_exists($dirname.$file))
unlink($dirname.$file); unlink($dirname.$file);
else
p('Unable to delete '.$dirname.$file);
} }
if($delete_self) if($delete_self)
rmdir($dirname); rmdir($dirname);
+1
View File
@@ -124,6 +124,7 @@ define('PS_ROUND_DOWN', 1);
define('PS_ROUND_HALF', 2); define('PS_ROUND_HALF', 2);
/* Carrier::getCarriers() filter */ /* Carrier::getCarriers() filter */
// these defines are DEPRECATED since 1.4.5 version
define('PS_CARRIERS_ONLY', 1); define('PS_CARRIERS_ONLY', 1);
define('CARRIERS_MODULE', 2); define('CARRIERS_MODULE', 2);
define('CARRIERS_MODULE_NEED_RANGE', 3); define('CARRIERS_MODULE_NEED_RANGE', 3);
+10
View File
@@ -164,6 +164,16 @@ class OrderDetailControllerCore extends FrontController
} }
} }
public function setMedia()
{
if (Tools::getValue('ajax') != 'true')
{
parent::setMedia();
Tools::addCSS(_THEME_CSS_DIR_.'history.css');
Tools::addCSS(_THEME_CSS_DIR_.'addresses.css');
}
}
public function displayHeader() public function displayHeader()
{ {
if (Tools::getValue('ajax') != 'true') if (Tools::getValue('ajax') != 'true')
+1 -1
View File
@@ -116,7 +116,7 @@
<td>&nbsp;</td> <td>&nbsp;</td>
</tr> </tr>
<tr> <tr>
<td style="font-size: 10px; border-top: 1px solid #D9DADE;" align="center"><a style="color: #db3484; font-weight: bold; text-decoration: none;" href="versions/1.4.1.0/mails/en/%7Bshop_url%7D">{shop_name}</a> powered with <a style="text-decoration: none; color: #374953;" href="http://www.prestashop.com/">PrestaShop&trade;</a></td> <td style="font-size: 10px; border-top: 1px solid #D9DADE;" align="center"><a style="color: #db3484; font-weight: bold; text-decoration: none;" href="{shop_url}">{shop_name}</a> powered with <a style="text-decoration: none; color: #374953;" href="http://www.prestashop.com/">PrestaShop&trade;</a></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
+1 -1
View File
@@ -25,6 +25,6 @@ Versand
{invoice_block_txt} {invoice_block_txt}
Sie können diese Bestellung ansehen und Ihre Rechnung aus dem Abschnitt "Bestellverlauf" Ihres Kontos downloaden, indem Sie auf unserer Webseite auf "Mein Konto" klicken. Sie können diese Bestellung ansehen und Ihre Rechnung aus dem Abschnitt "Bestellverlauf" Ihres Kontos downloaden, indem Sie auf unserer Webseite auf "Mein Konto" klicken.
Wenn Sie ein Gast-Konto haben, können Sie Ihre Bestellung auf dieser Webseite verfolgen: {shop_url}gast-bestellverfolgung.php Wenn Sie ein Gast-Konto haben, können Sie Ihre Bestellung auf dieser Webseite verfolgen: {shop_url}guest-tracking.php
{shop_name} powered with PrestaShop™ {shop_name} powered with PrestaShop™
+4 -1
View File
@@ -116,7 +116,10 @@ function reloadContent(params_plus)
data = $('#layered_form').serialize(); data = $('#layered_form').serialize();
$('.layered_slider').each( function () { $('.layered_slider').each( function () {
data += '&'+$(this).attr('id')+'='+$(this).slider('values', 0)+'_'+$(this).slider('values', 1); var sliderStart = $(this).slider('values', 0);
var sliderStop = $(this).slider('values', 1);
if(typeof(sliderStart) == 'number' && typeof(sliderStop) == 'number')
data += '&'+$(this).attr('id')+'='+sliderStart+'_'+sliderStop;
}); });
if ($('#selectPrductSort').length) if ($('#selectPrductSort').length)
+2 -1
View File
@@ -633,7 +633,7 @@ class BlockLayered extends Module
$selectedFilters[$res[1].($id_key ? '_'.$id_key : '')] = array(); $selectedFilters[$res[1].($id_key ? '_'.$id_key : '')] = array();
$selectedFilters[$res[1].($id_key ? '_'.$id_key : '')][] = (int)$value; $selectedFilters[$res[1].($id_key ? '_'.$id_key : '')][] = (int)$value;
} }
elseif (in_array($res[1], array('weight'))) elseif ($res[1] == 'weight')
$selectedFilters[$res[1]] = $tmpTab; $selectedFilters[$res[1]] = $tmpTab;
} }
} }
@@ -715,6 +715,7 @@ class BlockLayered extends Module
break; break;
case 'weight': case 'weight':
if($selectedFilters['weight'][0] != 0 || $selectedFilters['weight'][1] != 0)
$queryFilters .= ' AND p.`weight` BETWEEN '.(float)($selectedFilters['weight'][0] - 0.001).' AND '.(float)($selectedFilters['weight'][1] + 0.001); $queryFilters .= ' AND p.`weight` BETWEEN '.(float)($selectedFilters['weight'][0] - 0.001).' AND '.(float)($selectedFilters['weight'][1] + 0.001);
break; break;
} }
+11
View File
@@ -151,5 +151,16 @@
<p style="margin: 20px 0; text-align: center;"><img src="{$img_ps_dir}loader.gif" alt="" /><br />{l s='Loading...' mod='blocklayered'}</p> <p style="margin: 20px 0; text-align: center;"><img src="{$img_ps_dir}loader.gif" alt="" /><br />{l s='Loading...' mod='blocklayered'}</p>
</div> </div>
</div> </div>
{else}
<div id="layered_block_left" class="block">
<div class="block_content">
<form action="#" id="layered_form">
<input type="hidden" name="id_category_layered" value="{$id_category_layered}" />
</form>
</div>
<div id="layered_ajax_loader" style="display: none;">
<p style="margin: 20px 0; text-align: center;"><img src="{$img_ps_dir}loader.gif" alt="" /><br />{l s='Loading...' mod='blocklayered'}</p>
</div>
</div>
{/if} {/if}
<!-- /Block layered navigation module --> <!-- /Block layered navigation module -->
+1 -2
View File
@@ -310,8 +310,7 @@ class DateOfDelivery extends Module
private function _setCarrierRuleForm() private function _setCarrierRuleForm()
{ {
$carriers = Carrier::getCarriers($this->context->language->id, true, false, false, null, Carrier::ALL_CARRIERS);
$carriers = Carrier::getCarriers($this->context->language->id, true , false,false, NULL, ALL_CARRIERS);
if (Tools::isSubmit('editCarrierRule') AND $this->_isCarrierRuleExists(Tools::getValue('id_carrier_rule'))) if (Tools::isSubmit('editCarrierRule') AND $this->_isCarrierRuleExists(Tools::getValue('id_carrier_rule')))
$carrier_rule = $this->_getCarrierRule(Tools::getValue('id_carrier_rule')); $carrier_rule = $this->_getCarrierRule(Tools::getValue('id_carrier_rule'));
+1 -1
View File
@@ -125,7 +125,7 @@ class Dejala extends CarrierModule
$djlCarrier = DejalaCarrierUtils::getCarrierByName($this->name) ; $djlCarrier = DejalaCarrierUtils::getCarrierByName($this->name) ;
if (Configuration::get('PS_CARRIER_DEFAULT') == (int)($djlCarrier->id)) if (Configuration::get('PS_CARRIER_DEFAULT') == (int)($djlCarrier->id))
{ {
$carriers = Carrier::getCarriers($this->context->language->id, true, false, false, NULL, PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE); $carriers = Carrier::getCarriers($this->context->language->id, true, false, false, NULL, Carrier::PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE);
foreach($carriers as $carrier) foreach($carriers as $carrier)
{ {
if ($carrier['active'] AND !$carrier['deleted'] AND ($carrier['external_module_name'] != $this->name)) if ($carrier['active'] AND !$carrier['deleted'] AND ($carrier['external_module_name'] != $this->name))
+3 -2
View File
@@ -86,8 +86,9 @@ class DejalaCarrierUtils
return true; return true;
} }
public static function getCarrierByName($name) { public static function getCarrierByName($name)
$carriers = Carrier::getCarriers(Context::getContext()->language->id, true, false, false, NULL, ALL_CARRIERS); {
$carriers = Carrier::getCarriers(Context::getContext()->language->id, true, false, false, null, Carrier::ALL_CARRIERS);
foreach($carriers as $carrier) foreach($carriers as $carrier)
if (!$carrier['deleted'] AND $carrier['external_module_name'] == $name) if (!$carrier['deleted'] AND $carrier['external_module_name'] == $name)
return new Carrier((int)$carrier['id_carrier']) ; return new Carrier((int)$carrier['id_carrier']) ;
+2 -1
View File
@@ -12,7 +12,8 @@ if (file_exists($configPath))
$nbProducts = Db::getInstance()->getValue(' $nbProducts = Db::getInstance()->getValue('
SELECT COUNT(`id_product`) as nb SELECT COUNT(`id_product`) as nb
FROM `'._DB_PREFIX_.'product` FROM `'._DB_PREFIX_.'product`
WHERE `id_category_default` IN (SELECT `id_category` FROM `'._DB_PREFIX_.'ebay_category_configuration` WHERE `id_ebay_category` > 0 AND `sync` = 1)'); WHERE `quantity` > 0 AND `active` = 1
AND `id_category_default` IN (SELECT `id_category` FROM `'._DB_PREFIX_.'ebay_category_configuration` WHERE `id_ebay_category` > 0 AND `sync` = 1)');
echo $nbProducts; echo $nbProducts;
} }
+2 -2
View File
@@ -2,9 +2,9 @@
<module> <module>
<name>ebay</name> <name>ebay</name>
<displayName><![CDATA[eBay]]></displayName> <displayName><![CDATA[eBay]]></displayName>
<version><![CDATA[1.1]]></version> <version><![CDATA[1.2]]></version>
<description><![CDATA[Open your shop on the eBay market place !]]></description> <description><![CDATA[Open your shop on the eBay market place !]]></description>
<author><![CDATA[]]></author> <author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[market_place]]></tab> <tab><![CDATA[market_place]]></tab>
<is_configurable>1</is_configurable> <is_configurable>1</is_configurable>
<need_instance>1</need_instance> <need_instance>1</need_instance>
+22 -4
View File
@@ -374,7 +374,7 @@ class eBayRequest
$requestXml .= ' <ErrorLanguage>fr_FR</ErrorLanguage>'."\n"; $requestXml .= ' <ErrorLanguage>fr_FR</ErrorLanguage>'."\n";
$requestXml .= ' <WarningLevel>High</WarningLevel>'."\n"; $requestXml .= ' <WarningLevel>High</WarningLevel>'."\n";
$requestXml .= ' <Item>'."\n"; $requestXml .= ' <Item>'."\n";
$requestXml .= ' <SKU>prestashop-'.$datas['id_product'].'</SKU>'; $requestXml .= ' <SKU>prestashop-'.$datas['id_product'].(isset($datas['reference']) ? '-'.$datas['reference'] : '').'</SKU>';
$requestXml .= ' <Title>'.substr($datas['name'], 0, 55).'</Title>'."\n"; $requestXml .= ' <Title>'.substr($datas['name'], 0, 55).'</Title>'."\n";
if (isset($datas['pictures'])) if (isset($datas['pictures']))
{ {
@@ -503,7 +503,7 @@ class eBayRequest
$requestXml .= ' <WarningLevel>High</WarningLevel>'."\n"; $requestXml .= ' <WarningLevel>High</WarningLevel>'."\n";
$requestXml .= ' <Item>'."\n"; $requestXml .= ' <Item>'."\n";
$requestXml .= ' <ItemID>'.$datas['itemID'].'</ItemID>'."\n"; $requestXml .= ' <ItemID>'.$datas['itemID'].'</ItemID>'."\n";
$requestXml .= ' <SKU>prestashop-'.$datas['id_product'].'</SKU>'; $requestXml .= ' <SKU>prestashop-'.$datas['id_product'].(isset($datas['reference']) ? '-'.$datas['reference'] : '').'</SKU>';
$requestXml .= ' <Quantity>'.$datas['quantity'].'</Quantity>'."\n"; $requestXml .= ' <Quantity>'.$datas['quantity'].'</Quantity>'."\n";
$requestXml .= ' <StartPrice>'.$datas['price'].'</StartPrice>'."\n"; $requestXml .= ' <StartPrice>'.$datas['price'].'</StartPrice>'."\n";
if (Configuration::get('EBAY_SYNC_OPTION_RESYNC') != 1) if (Configuration::get('EBAY_SYNC_OPTION_RESYNC') != 1)
@@ -653,7 +653,7 @@ class eBayRequest
foreach ($datas['variations'] as $key => $variation) foreach ($datas['variations'] as $key => $variation)
{ {
$requestXml .= ' <Variation>'."\n"; $requestXml .= ' <Variation>'."\n";
$requestXml .= ' <SKU>prestashop-'.$key.'</SKU>'."\n"; $requestXml .= ' <SKU>prestashop-'.$key.(isset($variation['reference']) ? '-'.$variation['reference'] : '').'</SKU>'."\n";
$requestXml .= ' <StartPrice>'.$variation['price'].'</StartPrice>'."\n"; $requestXml .= ' <StartPrice>'.$variation['price'].'</StartPrice>'."\n";
$requestXml .= ' <Quantity>'.$variation['quantity'].'</Quantity>'."\n"; $requestXml .= ' <Quantity>'.$variation['quantity'].'</Quantity>'."\n";
$requestXml .= ' <VariationSpecifics>'."\n"; $requestXml .= ' <VariationSpecifics>'."\n";
@@ -1005,6 +1005,24 @@ class eBayRequest
} }
if ($id_product > 0) if ($id_product > 0)
$itemList[] = array('id_product' => $id_product, 'id_product_attribute' => $id_product_attribute, 'quantity' => $quantity, 'price' => (string)$transaction->TransactionPrice); $itemList[] = array('id_product' => $id_product, 'id_product_attribute' => $id_product_attribute, 'quantity' => $quantity, 'price' => (string)$transaction->TransactionPrice);
else
{
$id_product = Db::getInstance()->getValue('
SELECT `id_product` FROM `'._DB_PREFIX_.'product`
WHERE `reference` = \''.pSQL((string)$transaction->item->SKU).'\' OR `reference` = \''.pSQL((string)$transaction->item->CustomLabel).'\'
OR `reference` = \''.pSQL((string)$transaction->Variation->SKU).'\' OR `reference` = \''.pSQL((string)$transaction->Variation->CustomLabel).'\'');
if ((int)$id_product > 0)
$itemList[] = array('id_product' => $id_product, 'quantity' => $quantity, 'price' => (string)$transaction->TransactionPrice);
else
{
$row = Db::getInstance()->getValue('
SELECT `id_product`, `id_product_attribute` FROM `'._DB_PREFIX_.'product_attribute`
WHERE `reference` = \''.pSQL((string)$transaction->item->SKU).'\' OR `reference` = \''.pSQL((string)$transaction->item->CustomLabel).'\'
OR `reference` = \''.pSQL((string)$transaction->Variation->SKU).'\' OR `reference` = \''.pSQL((string)$transaction->Variation->CustomLabel).'\'');
if ((int)$row['id_product'] > 0)
$itemList[] = array('id_product' => $row['id_product'], 'id_product_attribute' => $row['id_product_attribute'], 'quantity' => $quantity, 'price' => (string)$transaction->TransactionPrice);
}
}
} }
$orderList[] = array( $orderList[] = array(
@@ -1014,7 +1032,7 @@ class eBayRequest
'date' => substr((string)$order->CreatedTime, 0, 10).' '.substr((string)$order->CreatedTime, 11, 8), 'date' => substr((string)$order->CreatedTime, 0, 10).' '.substr((string)$order->CreatedTime, 11, 8),
'name' => (string)$order->ShippingAddress->Name, 'name' => (string)$order->ShippingAddress->Name,
'firstname' => $name[0], 'firstname' => $name[0],
'familyname' => $name[1], 'familyname' => (isset($name[1]) ? $name[1] : $name[0]),
'address1' => (string)$order->ShippingAddress->Street1, 'address1' => (string)$order->ShippingAddress->Street1,
'address2' => (string)$order->ShippingAddress->Street2, 'address2' => (string)$order->ShippingAddress->Street2,
'city' => (string)$order->ShippingAddress->CityName, 'city' => (string)$order->ShippingAddress->CityName,
+50 -9
View File
@@ -56,7 +56,8 @@ class Ebay extends Module
{ {
$this->name = 'ebay'; $this->name = 'ebay';
$this->tab = 'market_place'; $this->tab = 'market_place';
$this->version = '1.1'; $this->version = '1.2';
$this->author = 'PrestaShop';
parent::__construct (); parent::__construct ();
$this->displayName = $this->l('eBay'); $this->displayName = $this->l('eBay');
$this->description = $this->l('Open your shop on the eBay market place !'); $this->description = $this->l('Open your shop on the eBay market place !');
@@ -92,6 +93,10 @@ class Ebay extends Module
// Check if installed // Check if installed
if (self::isInstalled($this->name)) if (self::isInstalled($this->name))
{ {
// Upgrade eBay module
if (Configuration::get('EBAY_VERSION') != $this->version)
$this->upgrade();
// Generate warnings // Generate warnings
if (!Configuration::get('EBAY_API_TOKEN')) if (!Configuration::get('EBAY_API_TOKEN'))
$this->warning = $this->l('You must register your module on eBay.'); $this->warning = $this->l('You must register your module on eBay.');
@@ -225,6 +230,20 @@ class Ebay extends Module
return true; return true;
} }
public function upgrade()
{
$version = Configuration::get('EBAY_VERSION');
if ($version == '1.1' || empty($version))
{
// Upgrade SQL
include(dirname(__FILE__).'/sql-upgrade-1-2.php');
foreach ($sql as $s)
if (!Db::getInstance()->Execute($s))
return false;
Configuration::updateValue('EBAY_VERSION', $this->version);
}
}
/******************************************************************/ /******************************************************************/
/** Hook Methods **************************************************/ /** Hook Methods **************************************************/
@@ -292,15 +311,28 @@ class Ebay extends Module
if (Configuration::get('EBAY_ORDER_LAST_UPDATE') < date('Y-m-d', strtotime('-45 minutes')).'T'.date('H:i:s', strtotime('-45 minutes')).'.000Z') if (Configuration::get('EBAY_ORDER_LAST_UPDATE') < date('Y-m-d', strtotime('-45 minutes')).'T'.date('H:i:s', strtotime('-45 minutes')).'.000Z')
{ {
$ebay = new eBayRequest(); $ebay = new eBayRequest();
$orderList = $ebay->getOrders(Configuration::get('EBAY_ORDER_LAST_UPDATE'), $dateNew); $orderList = $ebay->getOrders(date('Y-m-d', strtotime('-90 days')).'T'.date('H:i:s', strtotime('-45 minutes')).'.000Z', $dateNew);
if ($orderList) if ($orderList)
foreach ($orderList as $order) foreach ($orderList as $order)
if ($order['status'] == 'Complete'&& if ($order['status'] == 'Complete' && $order['amount'] > 0.1 && isset($order['product_list']) && count($order['product_list']))
isset($order['product_list']) && count($order['product_list']))
{ {
if (!Db::getInstance()->getValue('SELECT `id_ebay_order` FROM `'._DB_PREFIX_.'ebay_order` WHERE `id_order_ref` = \''.pSQL($order['id_order_ref']).'\''))
{
$result = Db::getInstance()->getRow('SELECT `id_customer` FROM `'._DB_PREFIX_.'customer` WHERE `active` = 1 AND `email` = \''.pSQL($order['email']).'\' AND `deleted` = 0'.(substr(_PS_VERSION_, 0, 3) == '1.3' ? '' : ' AND `is_guest` = 0')); $result = Db::getInstance()->getRow('SELECT `id_customer` FROM `'._DB_PREFIX_.'customer` WHERE `active` = 1 AND `email` = \''.pSQL($order['email']).'\' AND `deleted` = 0'.(substr(_PS_VERSION_, 0, 3) == '1.3' ? '' : ' AND `is_guest` = 0'));
$id_customer = (isset($result['id_customer']) ? $result['id_customer'] : 0); $id_customer = (isset($result['id_customer']) ? $result['id_customer'] : 0);
// Check for empty name
$order['firstname'] = str_replace('_', '', trim($order['firstname']));
$order['familyname'] = str_replace('_', '', trim($order['familyname']));
if (empty($order['familyname']))
$order['familyname'] = $order['firstname'];
if (empty($order['firstname']))
$order['firstname'] = $order['familyname'];
if (Validate::isEmail($order['email']) && !empty($order['firstname']) && !empty($order['familyname']))
{
// Add customer if he doesn't exist // Add customer if he doesn't exist
if ($id_customer < 1) if ($id_customer < 1)
{ {
@@ -382,6 +414,11 @@ class Ebay extends Module
Db::getInstance()->autoExecute(_DB_PREFIX_.'orders', $updateOrder, 'UPDATE', '`id_order` = '.(int)$id_order); Db::getInstance()->autoExecute(_DB_PREFIX_.'orders', $updateOrder, 'UPDATE', '`id_order` = '.(int)$id_order);
foreach ($order['product_list'] as $product) foreach ($order['product_list'] as $product)
Db::getInstance()->autoExecute(_DB_PREFIX_.'order_detail', array('product_price' => floatval($product['price']), 'tax_rate' => 0, 'reduction_percent' => 0), 'UPDATE', '`id_order` = '.(int)$id_order.' AND `product_id` = '.(int)$product['id_product'].' AND `product_attribute_id` = '.(int)$product['id_product_attribute']); Db::getInstance()->autoExecute(_DB_PREFIX_.'order_detail', array('product_price' => floatval($product['price']), 'tax_rate' => 0, 'reduction_percent' => 0), 'UPDATE', '`id_order` = '.(int)$id_order.' AND `product_id` = '.(int)$product['id_product'].' AND `product_attribute_id` = '.(int)$product['id_product_attribute']);
// Register the ebay order ref
Db::getInstance()->autoExecute(_DB_PREFIX_.'ebay_order', array('id_order_ref' => pSQL($order['id_order_ref']), 'id_order' => (int)$id_order), 'INSERT');
}
}
} }
} }
@@ -1075,11 +1112,13 @@ class Ebay extends Module
$nbProductsModeA = Db::getInstance()->getValue(' $nbProductsModeA = Db::getInstance()->getValue('
SELECT COUNT(`id_product`) as nb SELECT COUNT(`id_product`) as nb
FROM `'._DB_PREFIX_.'product` FROM `'._DB_PREFIX_.'product`
WHERE `id_category_default` IN (SELECT `id_category` FROM `'._DB_PREFIX_.'ebay_category_configuration` WHERE `id_ebay_category` > 0)'); WHERE `quantity` > 0 AND `active` = 1
AND `id_category_default` IN (SELECT `id_category` FROM `'._DB_PREFIX_.'ebay_category_configuration` WHERE `id_ebay_category` > 0)');
$nbProductsModeB = Db::getInstance()->getValue(' $nbProductsModeB = Db::getInstance()->getValue('
SELECT COUNT(`id_product`) as nb SELECT COUNT(`id_product`) as nb
FROM `'._DB_PREFIX_.'product` FROM `'._DB_PREFIX_.'product`
WHERE `id_category_default` IN (SELECT `id_category` FROM `'._DB_PREFIX_.'ebay_category_configuration` WHERE `id_ebay_category` > 0 AND `sync` = 1)'); WHERE `quantity` > 0 AND `active` = 1
AND `id_category_default` IN (SELECT `id_category` FROM `'._DB_PREFIX_.'ebay_category_configuration` WHERE `id_ebay_category` > 0 AND `sync` = 1)');
$nbProducts = $nbProductsModeA; $nbProducts = $nbProductsModeA;
if (Configuration::get('EBAY_SYNC_MODE') == 'B') if (Configuration::get('EBAY_SYNC_MODE') == 'B')
@@ -1213,7 +1252,7 @@ class Ebay extends Module
Configuration::updateValue('EBAY_SYNC_MODE', 'A'); Configuration::updateValue('EBAY_SYNC_MODE', 'A');
// Retrieve product list for eBay (which have matched categories) // Retrieve product list for eBay (which have matched categories)
$productsList = Db::getInstance()->ExecuteS('SELECT `id_product` FROM `'._DB_PREFIX_.'product` WHERE `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)'); $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 // Send each product on eBay
$this->_syncProducts($productsList); $this->_syncProducts($productsList);
@@ -1227,7 +1266,7 @@ class Ebay extends Module
Db::getInstance()->autoExecute(_DB_PREFIX_.'ebay_category_configuration', array('sync' => 0), 'UPDATE', ''); Db::getInstance()->autoExecute(_DB_PREFIX_.'ebay_category_configuration', array('sync' => 0), 'UPDATE', '');
foreach ($_POST['category'] as $id_category) foreach ($_POST['category'] as $id_category)
Db::getInstance()->autoExecute(_DB_PREFIX_.'ebay_category_configuration', array('sync' => 1), 'UPDATE', '`id_category` = '.(int)$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 `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)'); $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 // Send each product on eBay
$this->_syncProducts($productsList); $this->_syncProducts($productsList);
@@ -1282,6 +1321,7 @@ class Ebay extends Module
{ {
$variationsList[$c['group_name']][$c['attribute_name']] = 1; $variationsList[$c['group_name']][$c['attribute_name']] = 1;
$variations[$c['id_product'].'-'.$c['id_product_attribute']]['id_attribute'] = $c['id_product_attribute']; $variations[$c['id_product'].'-'.$c['id_product_attribute']]['id_attribute'] = $c['id_product_attribute'];
$variations[$c['id_product'].'-'.$c['id_product_attribute']]['reference'] = $c['reference'];
$variations[$c['id_product'].'-'.$c['id_product_attribute']]['quantity'] = $c['quantity']; $variations[$c['id_product'].'-'.$c['id_product_attribute']]['quantity'] = $c['quantity'];
$variations[$c['id_product'].'-'.$c['id_product_attribute']]['variations'][] = array('name' => $c['group_name'], 'value' => $c['attribute_name']); $variations[$c['id_product'].'-'.$c['id_product_attribute']]['variations'][] = array('name' => $c['group_name'], 'value' => $c['attribute_name']);
$variations[$c['id_product'].'-'.$c['id_product_attribute']]['price_static'] = Product::getPriceStatic((int)$c['id_product'], true, (int)$c['id_product_attribute']); $variations[$c['id_product'].'-'.$c['id_product_attribute']]['price_static'] = Product::getPriceStatic((int)$c['id_product'], true, (int)$c['id_product_attribute']);
@@ -1322,6 +1362,7 @@ class Ebay extends Module
// Generate array and try insert in database // Generate array and try insert in database
$datas = array( $datas = array(
'id_product' => $product->id, 'id_product' => $product->id,
'reference' => $product->reference,
'name' => str_replace('&', '&amp;', $product->name), 'name' => str_replace('&', '&amp;', $product->name),
'brand' => $product->manufacturer_name, 'brand' => $product->manufacturer_name,
'description' => $product->description, 'description' => $product->description,
@@ -1688,4 +1729,4 @@ class Ebay extends Module
} }
?>
+28 -1
View File
@@ -48,5 +48,32 @@
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;'; ) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;';
// Create Order Table in Database
$sql[] = 'CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'ebay_order` (
`id_ebay_order` int(16) NOT NULL AUTO_INCREMENT,
`id_order_ref` varchar(128) NOT NULL,
`id_order` int(16) NOT NULL,
UNIQUE(`id_order_ref`),
PRIMARY KEY (`id_ebay_order`)
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;';
// Create Sync History Table in Database
$sql[] = 'CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'ebay_sync_history` (
`id_ebay_sync_history` int(16) NOT NULL AUTO_INCREMENT,
`is_manual` tinyint(1) NOT NULL,
`datetime` datetime NOT NULL,
PRIMARY KEY (`id_ebay_sync_history`)
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;';
// Create Sync History Product Table in Database
$sql[] = 'CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'ebay_sync_history_product` (
`id_ebay_sync_history_product` int(16) NOT NULL AUTO_INCREMENT,
`id_ebay_sync_history` int(16),
`id_product` int(16),
KEY (`id_ebay_sync_history`),
PRIMARY KEY (`id_ebay_sync_history_product`)
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;';
?>
+4 -1
View File
@@ -5,5 +5,8 @@
$sql[] = 'DROP TABLE IF EXISTS `'._DB_PREFIX_.'ebay_category`;'; $sql[] = 'DROP TABLE IF EXISTS `'._DB_PREFIX_.'ebay_category`;';
$sql[] = 'DROP TABLE IF EXISTS `'._DB_PREFIX_.'ebay_category_configuration`;'; $sql[] = 'DROP TABLE IF EXISTS `'._DB_PREFIX_.'ebay_category_configuration`;';
$sql[] = 'DROP TABLE IF EXISTS `'._DB_PREFIX_.'ebay_product`;'; $sql[] = 'DROP TABLE IF EXISTS `'._DB_PREFIX_.'ebay_product`;';
$sql[] = 'DROP TABLE IF EXISTS `'._DB_PREFIX_.'ebay_order`;';
$sql[] = 'DROP TABLE IF EXISTS `'._DB_PREFIX_.'ebay_sync_history`;';
$sql[] = 'DROP TABLE IF EXISTS `'._DB_PREFIX_.'ebay_sync_history_product`;';
?>
+6
View File
@@ -0,0 +1,6 @@
<?php
// Init
$sql = array();
+32
View File
@@ -0,0 +1,32 @@
<?php
// Init
$sql = array();
// Create Order Table in Database
$sql[] = 'CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'ebay_order` (
`id_ebay_order` int(16) NOT NULL AUTO_INCREMENT,
`id_order_ref` varchar(128) NOT NULL,
`id_order` int(16) NOT NULL,
UNIQUE(`id_order_ref`),
PRIMARY KEY (`id_ebay_order`)
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;';
// Create Sync History Table in Database
$sql[] = 'CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'ebay_sync_history` (
`id_ebay_sync_history` int(16) NOT NULL AUTO_INCREMENT,
`is_manual` tinyint(1) NOT NULL,
`datetime` datetime NOT NULL,
PRIMARY KEY (`id_ebay_sync_history`)
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;';
// Create Sync History Product Table in Database
$sql[] = 'CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'ebay_sync_history_product` (
`id_ebay_sync_history_product` int(16) NOT NULL AUTO_INCREMENT,
`id_ebay_sync_history` int(16),
`id_product` int(16),
KEY (`id_ebay_sync_history`),
PRIMARY KEY (`id_ebay_sync_history_product`)
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;';
+1 -2
View File
@@ -29,8 +29,7 @@
{if $editorial->body_home_logo_link}<a href="{$editorial->body_home_logo_link|escape:'htmlall':'UTF-8'}" title="{$editorial->body_title|escape:'htmlall':'UTF-8'|stripslashes}">{/if} {if $editorial->body_home_logo_link}<a href="{$editorial->body_home_logo_link|escape:'htmlall':'UTF-8'}" title="{$editorial->body_title|escape:'htmlall':'UTF-8'|stripslashes}">{/if}
{if $homepage_logo}<img src="{$link->getMediaLink($image_path)}" alt="{$editorial->body_title|escape:'htmlall':'UTF-8'|stripslashes}" {if $image_width}width="{$image_width}"{/if} {if $image_height}height="{$image_height}" {/if}/>{/if} {if $homepage_logo}<img src="{$link->getMediaLink($image_path)}" alt="{$editorial->body_title|escape:'htmlall':'UTF-8'|stripslashes}" {if $image_width}width="{$image_width}"{/if} {if $image_height}height="{$image_height}" {/if}/>{/if}
{if $editorial->body_home_logo_link}</a>{/if} {if $editorial->body_home_logo_link}</a>{/if}
{if $editorial->body_logo_subheading}<p id="editorial_image_legend">{$editorial->body_logo_subheading|stripslashes}</p> {if $editorial->body_logo_subheading}<p id="editorial_image_legend">{$editorial->body_logo_subheading|stripslashes}</p>{/if}
{elseif $editorial->body_logo_subheading}<p id="editorial_image_legend">{$editorial->body_logo_subheading}</p>{/if}
{if $editorial->body_title}<h1>{$editorial->body_title|stripslashes}</h1> {if $editorial->body_title}<h1>{$editorial->body_title|stripslashes}</h1>
{elseif $editorial->body_title}<h1>{$editorial->body_title|stripslashes}</h1>{/if} {elseif $editorial->body_title}<h1>{$editorial->body_title|stripslashes}</h1>{/if}
{if $editorial->body_subheading}<h2>{$editorial->body_subheading|stripslashes}</h2> {if $editorial->body_subheading}<h2>{$editorial->body_subheading|stripslashes}</h2>
+8 -6
View File
@@ -321,11 +321,13 @@ class Hipay extends PaymentModule
{ {
// Delete all configurated zones // Delete all configurated zones
foreach ($_POST as $key => $val) foreach ($_POST as $key => $val)
{
if (strncmp($key, 'HIPAY_AZ_ALL_', strlen('HIPAY_AZ_ALL_')) == 0) if (strncmp($key, 'HIPAY_AZ_ALL_', strlen('HIPAY_AZ_ALL_')) == 0)
{ {
$id = substr($key, -(strlen($key) - strlen('HIPAY_AZ_ALL_'))); $id = substr($key, -(strlen($key) - strlen('HIPAY_AZ_ALL_')));
Configuration::updateValue('HIPAY_AZ_'.$id, 'ko'); Configuration::updateValue('HIPAY_AZ_'.$id, 'ko');
} }
}
Db::getInstance()->ExecuteS('DELETE FROM `'._DB_PREFIX_.'module_country` WHERE `id_module` = '.(int)$this->id); Db::getInstance()->ExecuteS('DELETE FROM `'._DB_PREFIX_.'module_country` WHERE `id_module` = '.(int)$this->id);
// Add the new configuration zones // Add the new configuration zones
@@ -353,17 +355,17 @@ class Hipay extends PaymentModule
if (Configuration::get('HIPAY_SITEID_TEST_'.$currency['iso_code']) != Tools::getValue('HIPAY_SITEID_TEST_'.$currency['iso_code'])) if (Configuration::get('HIPAY_SITEID_TEST_'.$currency['iso_code']) != Tools::getValue('HIPAY_SITEID_TEST_'.$currency['iso_code']))
Configuration::updateValue('HIPAY_CATEGORY_TEST_'.$currency['iso_code'], false); Configuration::updateValue('HIPAY_CATEGORY_TEST_'.$currency['iso_code'], false);
Configuration::updateValue('HIPAY_ACCOUNT_'.$currency['iso_code'], Tools::getValue('HIPAY_ACCOUNT_'.$currency['iso_code'])); Configuration::updateValue('HIPAY_ACCOUNT_'.$currency['iso_code'], trim(Tools::getValue('HIPAY_ACCOUNT_'.$currency['iso_code'])));
Configuration::updateValue('HIPAY_PASSWORD_'.$currency['iso_code'], Tools::getValue('HIPAY_PASSWORD_'.$currency['iso_code'])); Configuration::updateValue('HIPAY_PASSWORD_'.$currency['iso_code'], trim(Tools::getValue('HIPAY_PASSWORD_'.$currency['iso_code'])));
Configuration::updateValue('HIPAY_SITEID_'.$currency['iso_code'], Tools::getValue('HIPAY_SITEID_'.$currency['iso_code'])); Configuration::updateValue('HIPAY_SITEID_'.$currency['iso_code'], trim(Tools::getValue('HIPAY_SITEID_'.$currency['iso_code'])));
Configuration::updateValue('HIPAY_CATEGORY_'.$currency['iso_code'], Tools::getValue('HIPAY_CATEGORY_'.$currency['iso_code'])); Configuration::updateValue('HIPAY_CATEGORY_'.$currency['iso_code'], Tools::getValue('HIPAY_CATEGORY_'.$currency['iso_code']));
if ($this->prod AND Tools::getValue('HIPAY_ACCOUNT_'.$currency['iso_code'])) if ($this->prod AND Tools::getValue('HIPAY_ACCOUNT_'.$currency['iso_code']))
$accounts[Tools::getValue('HIPAY_ACCOUNT_'.$currency['iso_code'])] = 1; $accounts[Tools::getValue('HIPAY_ACCOUNT_'.$currency['iso_code'])] = 1;
Configuration::updateValue('HIPAY_ACCOUNT_TEST_'.$currency['iso_code'], Tools::getValue('HIPAY_ACCOUNT_TEST_'.$currency['iso_code'])); Configuration::updateValue('HIPAY_ACCOUNT_TEST_'.$currency['iso_code'], trim(Tools::getValue('HIPAY_ACCOUNT_TEST_'.$currency['iso_code'])));
Configuration::updateValue('HIPAY_PASSWORD_TEST_'.$currency['iso_code'], Tools::getValue('HIPAY_PASSWORD_TEST_'.$currency['iso_code'])); Configuration::updateValue('HIPAY_PASSWORD_TEST_'.$currency['iso_code'], trim(Tools::getValue('HIPAY_PASSWORD_TEST_'.$currency['iso_code'])));
Configuration::updateValue('HIPAY_SITEID_TEST_'.$currency['iso_code'], Tools::getValue('HIPAY_SITEID_TEST_'.$currency['iso_code'])); Configuration::updateValue('HIPAY_SITEID_TEST_'.$currency['iso_code'], trim(Tools::getValue('HIPAY_SITEID_TEST_'.$currency['iso_code'])));
Configuration::updateValue('HIPAY_CATEGORY_TEST_'.$currency['iso_code'], Tools::getValue('HIPAY_CATEGORY_TEST_'.$currency['iso_code'])); Configuration::updateValue('HIPAY_CATEGORY_TEST_'.$currency['iso_code'], Tools::getValue('HIPAY_CATEGORY_TEST_'.$currency['iso_code']));
if (!$this->prod AND Tools::getValue('HIPAY_ACCOUNT_TEST_'.$currency['iso_code'])) if (!$this->prod AND Tools::getValue('HIPAY_ACCOUNT_TEST_'.$currency['iso_code']))
+1 -1
View File
@@ -185,7 +185,7 @@ class MailAlerts extends Module
// Filling-in vars for email // Filling-in vars for email
$template = 'new_order'; $template = 'new_order';
$subject = $this->l('New order', $id_lang); $subject = $this->l('New order').' - '.sprintf('%06d', $order->id);
$templateVars = array( $templateVars = array(
'{firstname}' => $customer->firstname, '{firstname}' => $customer->firstname,
'{lastname}' => $customer->lastname, '{lastname}' => $customer->lastname,
+1 -1
View File
@@ -884,7 +884,7 @@ class PayPal extends PaymentModule
Configuration::updateValue('PAYPAL_BUSINESS', trim(Tools::getValue('email_paypal'))); Configuration::updateValue('PAYPAL_BUSINESS', trim(Tools::getValue('email_paypal')));
Configuration::updateValue('PAYPAL_HEADER', Tools::getValue('banner_url')); Configuration::updateValue('PAYPAL_HEADER', Tools::getValue('banner_url'));
Configuration::updateValue('PAYPAL_API_USER', trim(Tools::getValue('api_username'))); Configuration::updateValue('PAYPAL_API_USER', trim(Tools::getValue('api_username')));
Configuration::updateValue('PAYPAL_API_PASSWORD', Tools::getValue('api_password')); Configuration::updateValue('PAYPAL_API_PASSWORD', trim(Tools::getValue('api_password')));
Configuration::updateValue('PAYPAL_API_SIGNATURE', trim(Tools::getValue('api_signature'))); Configuration::updateValue('PAYPAL_API_SIGNATURE', trim(Tools::getValue('api_signature')));
Configuration::updateValue('PAYPAL_EXPRESS_CHECKOUT', (int)(Tools::isSubmit('paypal_express'))); Configuration::updateValue('PAYPAL_EXPRESS_CHECKOUT', (int)(Tools::isSubmit('paypal_express')));
Configuration::updateValue('PAYPAL_MODE_DEBUG', (int)(Tools::isSubmit('paypal_debug'))); Configuration::updateValue('PAYPAL_MODE_DEBUG', (int)(Tools::isSubmit('paypal_debug')));
+1 -1
View File
@@ -407,7 +407,7 @@ class Socolissimo extends CarrierModule
'inputs' => $inputs, 'serialsInput' => $serialsInput, 'finishProcess' => $this->l('To choose SoColissimo, click on a delivery method'))); 'inputs' => $inputs, 'serialsInput' => $serialsInput, 'finishProcess' => $this->l('To choose SoColissimo, click on a delivery method')));
$country = new Country((int)($params['address']->id_country)); $country = new Country((int)($params['address']->id_country));
$carriers = Carrier::getCarriers($cookie->id_lang, true , false,false, NULL, ALL_CARRIERS); $carriers = Carrier::getCarriers($cookie->id_lang, true , false,false, NULL, Carrier::ALL_CARRIERS);
$ids = array(); $ids = array();
foreach($carriers as $carrier) foreach($carriers as $carrier)
$ids[] = $carrier['id_carrier']; $ids[] = $carrier['id_carrier'];
+12 -2
View File
@@ -46,7 +46,7 @@ class Treepodia extends Module
{ {
$this->name = 'treepodia'; $this->name = 'treepodia';
$this->tab = 'front_office_features'; $this->tab = 'front_office_features';
$this->version = '1.3'; $this->version = '1.4';
$this->displayName = 'Treepodia'; $this->displayName = 'Treepodia';
parent::__construct(); parent::__construct();
@@ -123,13 +123,23 @@ XML;
foreach ($languages AS $language) foreach ($languages AS $language)
$infos->addChild('lang', $language['iso_code']); $infos->addChild('lang', $language['iso_code']);
$limit_sql = '';
$limit_start = (int)Tools::getValue('limit_start');
$limit_end = (int)Tools::getValue('limit_end');
if ($limit_start > 0)
{
if ($limit_end < $limit_start)
$limit_end = $limit_start + 10;
$limit_sql = ' LIMIT '.(int)$limit_start.','.(int)$limit_end;
}
$sqlProducts = Db::getInstance()->ExecuteS(' $sqlProducts = Db::getInstance()->ExecuteS('
SELECT p.id_product, p.reference, p.weight, m.name manufacturer, s.name supplier, p.on_sale, p.id_manufacturer, pd.id_product_download SELECT p.id_product, p.reference, p.weight, m.name manufacturer, s.name supplier, p.on_sale, p.id_manufacturer, pd.id_product_download
FROM '._DB_PREFIX_.'product p FROM '._DB_PREFIX_.'product p
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)
LEFT JOIN '._DB_PREFIX_.'supplier s ON (s.id_supplier = p.id_supplier) LEFT JOIN '._DB_PREFIX_.'supplier s ON (s.id_supplier = p.id_supplier)
LEFT JOIN '._DB_PREFIX_.'product_download pd ON (pd.id_product = p.id_product) LEFT JOIN '._DB_PREFIX_.'product_download pd ON (pd.id_product = p.id_product)
WHERE p.active = 1'); WHERE p.active = 1'.$limit_sql);
foreach ($sqlProducts AS $sqlProduct) foreach ($sqlProducts AS $sqlProduct)
{ {
+8 -1
View File
@@ -29,7 +29,10 @@
var baseDir = '{$base_dir_ssl}'; var baseDir = '{$base_dir_ssl}';
//]]> //]]>
</script> </script>
{if !isset($smarty.get.ajax)}
<div class="block-center" id="block-history">
<div id="block-order-detail">
{/if}
<form action="{if isset($opc) && $opc}{$link->getPageLink('order-opc', true)}{else}{$link->getPageLink('order', true)}{/if}" method="post" class="submit"> <form action="{if isset($opc) && $opc}{$link->getPageLink('order-opc', true)}{else}{$link->getPageLink('order', true)}{/if}" method="post" class="submit">
<div> <div>
<input type="hidden" value="{$order->id}" name="id_order"/> <input type="hidden" value="{$order->id}" name="id_order"/>
@@ -369,3 +372,7 @@
{else} {else}
<p><img src="{$img_dir}icon/infos.gif" alt="" class="icon" />&nbsp;{l s='You can\'t make a merchandise return with a guest account'}</p> <p><img src="{$img_dir}icon/infos.gif" alt="" class="icon" />&nbsp;{l s='You can\'t make a merchandise return with a guest account'}</p>
{/if} {/if}
{if !isset($smarty.get.ajax)}
</div>
</div>
{/if}