//// Merge -> revision 8290

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@8295 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
tDidierjean
2011-09-01 09:53:43 +00:00
parent d27c0b3b7d
commit c2258ae8e9
50 changed files with 431 additions and 256 deletions
@@ -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(),
+22 -86
View File
@@ -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;
}
}
-6
View File
@@ -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}
+8 -1
View File
@@ -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()
+21
View File
@@ -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
View File
@@ -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')).'&registered='.($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&section=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

+4 -4
View File
@@ -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'))
+1 -1
View File
@@ -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);
+2 -2
View File
@@ -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');
});
});
+30 -7
View File
@@ -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()
{
+1 -1
View File
@@ -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
+3 -2
View File
@@ -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">&nbsp;</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))