// Merge -> revision 9124

This commit is contained in:
rMalie
2011-10-07 09:54:43 +00:00
parent 22d560688d
commit d46fbbc039
56 changed files with 1682 additions and 1656 deletions
+1
View File
@@ -269,6 +269,7 @@ class AdminSelfUpgrade extends AdminSelfTab
{
$allowed = (ConfigurationTest::test_fopen() && $this->rootWritable);
$allowed &= !Configuration::get('PS_SHOP_ENABLE');
$allowed &= $this->upgrader->autoupgrade;
$allowed &= (Configuration::get('PS_AUTOUP_KEEP_TRAD') !== false);
return $allowed;
+1
View File
@@ -284,6 +284,7 @@ function reloadContent(params_plus)
reloadContent();
return false;
});
if (typeof(ajaxCart) != "undefined")
ajaxCart.overrideButtonsInThePage();
if (typeof(reloadProductComparison) == 'function')
+38 -37
View File
@@ -95,8 +95,8 @@ class BlockLayered extends Module
Db::getInstance()->Execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'layered_friendly_url');
Db::getInstance()->Execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'layered_indexable_attribute_group');
Db::getInstance()->Execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'layered_indexable_feature');
Db::getInstance()->Execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'layered_indexable_attribute_group_lang');
Db::getInstance()->Execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'layered_indexable_feature_lang');
Db::getInstance()->Execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'layered_indexable_attribute_group_lang_value');
Db::getInstance()->Execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'layered_indexable_feature_lang_value');
Db::getInstance()->Execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'layered_category');
Db::getInstance()->Execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'layered_filter');
Db::getInstance()->Execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'layered_product_attribute');
@@ -143,9 +143,9 @@ class BlockLayered extends Module
INSERT INTO `'._DB_PREFIX_.'layered_indexable_attribute_group`
SELECT id_attribute_group, 1 FROM `'._DB_PREFIX_.'attribute_group`');
Db::getInstance()->Execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'layered_indexable_attribute_group_lang`');
Db::getInstance()->Execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'layered_indexable_attribute_group_lang_value`');
Db::getInstance()->Execute('
CREATE TABLE `'._DB_PREFIX_.'layered_indexable_attribute_group_lang` (
CREATE TABLE `'._DB_PREFIX_.'layered_indexable_attribute_group_lang_value` (
`id_attribute_group` INT NOT NULL,
`id_lang` INT NOT NULL,
`url_name` VARCHAR(20),
@@ -153,9 +153,9 @@ class BlockLayered extends Module
PRIMARY KEY (`id_attribute_group`, `id_lang`)) ENGINE = '._MYSQL_ENGINE_);
// Attributes
Db::getInstance()->Execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'layered_indexable_attribute_lang`');
Db::getInstance()->Execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'layered_indexable_attribute_lang_value`');
Db::getInstance()->Execute('
CREATE TABLE `'._DB_PREFIX_.'layered_indexable_attribute_lang` (
CREATE TABLE `'._DB_PREFIX_.'layered_indexable_attribute_lang_value` (
`id_attribute` INT NOT NULL,
`id_lang` INT NOT NULL,
`url_name` VARCHAR(20),
@@ -175,9 +175,9 @@ class BlockLayered extends Module
INSERT INTO `'._DB_PREFIX_.'layered_indexable_feature`
SELECT id_feature, 1 FROM `'._DB_PREFIX_.'feature`');
Db::getInstance()->Execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'layered_indexable_feature_lang`');
Db::getInstance()->Execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'layered_indexable_feature_lang_value`');
Db::getInstance()->Execute('
CREATE TABLE `'._DB_PREFIX_.'layered_indexable_feature_lang` (
CREATE TABLE `'._DB_PREFIX_.'layered_indexable_feature_lang_value` (
`id_feature` INT NOT NULL,
`id_lang` INT NOT NULL,
`url_name` VARCHAR(20) NOT NULL,
@@ -185,9 +185,9 @@ class BlockLayered extends Module
PRIMARY KEY (`id_feature`, `id_lang`)) ENGINE = '._MYSQL_ENGINE_);
// Features values
Db::getInstance()->Execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'layered_indexable_feature_value_lang`');
Db::getInstance()->Execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'layered_indexable_feature_value_lang_value`');
Db::getInstance()->Execute('
CREATE TABLE `'._DB_PREFIX_.'layered_indexable_feature_value_lang` (
CREATE TABLE `'._DB_PREFIX_.'layered_indexable_feature_value_lang_value` (
`id_feature_value` INT NOT NULL,
`id_lang` INT NOT NULL,
`url_name` VARCHAR(20),
@@ -261,9 +261,9 @@ class BlockLayered extends Module
INNER JOIN '._DB_PREFIX_.'attribute a ON (a.id_attribute_group = ag.id_attribute_group)
INNER JOIN '._DB_PREFIX_.'attribute_lang al ON (al.id_attribute = a.id_attribute)
LEFT JOIN '._DB_PREFIX_.'layered_indexable_attribute_group liag ON (liag.id_attribute_group = a.id_attribute_group)
LEFT JOIN '._DB_PREFIX_.'layered_indexable_attribute_group_lang liagl
LEFT JOIN '._DB_PREFIX_.'layered_indexable_attribute_group_lang_value liagl
ON (liagl.id_attribute_group = ag.id_attribute_group AND liagl.id_lang = '.(int)$filter['id_lang'].')
LEFT JOIN '._DB_PREFIX_.'layered_indexable_attribute_lang lial
LEFT JOIN '._DB_PREFIX_.'layered_indexable_attribute_lang_value lial
ON (lial.id_attribute = a.id_attribute AND lial.id_lang = '.(int)$filter['id_lang'].')
WHERE a.id_attribute_group = '.(int)$filter['id_value'].' AND agl.id_lang = al.id_lang AND agl.id_lang = '.(int)$filter['id_lang']);
foreach ($attributes as $attribute)
@@ -291,9 +291,9 @@ class BlockLayered extends Module
LEFT JOIN '._DB_PREFIX_.'layered_indexable_feature lif ON (lif.id_feature = fl.id_feature)
INNER JOIN '._DB_PREFIX_.'feature_value fv ON (fv.id_feature = fl.id_feature)
INNER JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.id_feature_value = fv.id_feature_value)
LEFT JOIN '._DB_PREFIX_.'layered_indexable_feature_lang lifl
LEFT JOIN '._DB_PREFIX_.'layered_indexable_feature_lang_value lifl
ON (lifl.id_feature = fl.id_feature AND lifl.id_lang = '.(int)$filter['id_lang'].')
LEFT JOIN '._DB_PREFIX_.'layered_indexable_feature_value_lang lifvl
LEFT JOIN '._DB_PREFIX_.'layered_indexable_feature_value_lang_value lifvl
ON (lifvl.id_feature_value = fvl.id_feature_value AND lifvl.id_lang = '.(int)$filter['id_lang'].')
WHERE fl.id_feature = '.(int)$filter['id_value'].' AND fvl.id_lang = fl.id_lang AND fvl.id_lang = '.(int)$filter['id_lang']);
foreach ($features as $feature)
@@ -477,13 +477,13 @@ class BlockLayered extends Module
Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'layered_indexable_feature WHERE id_feature = '.(int)$params['id_feature']);
Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'layered_indexable_feature VALUES ('.(int)$params['id_feature'].', '.(int)Tools::getValue('layered_indexable').')');
Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'layered_indexable_feature_lang WHERE id_feature = '.(int)$params['id_feature']); // don't care about the id_lang
Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'layered_indexable_feature_lang_value WHERE id_feature = '.(int)$params['id_feature']); // don't care about the id_lang
foreach (Language::getLanguages(false) as $language)
{
// Data are validated by method "hookPostProcessFeature"
$id_lang = (int)$language['id_lang'];
Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'layered_indexable_feature_lang
VALUES ('.(int)$params['id_feature'].', '.$id_lang.', \''.Tools::link_rewrite(Tools::getValue('url_name_'.$id_lang)).'\',
Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'layered_indexable_feature_lang_value
VALUES ('.(int)$params['id_feature'].', '.$id_lang.', \''.pSQL(Tools::link_rewrite(Tools::getValue('url_name_'.$id_lang))).'\',
\''.pSQL(Tools::safeOutput(Tools::getValue('meta_title_'.$id_lang), true)).'\')');
}
}
@@ -493,13 +493,13 @@ class BlockLayered extends Module
if (!$params['id_feature_value'])
return;
Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'layered_indexable_feature_value_lang WHERE id_feature_value = '.(int)$params['id_feature_value']); // don't care about the id_lang
Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'layered_indexable_feature_value_lang_value WHERE id_feature_value = '.(int)$params['id_feature_value']); // don't care about the id_lang
foreach (Language::getLanguages(false) as $language)
{
// Data are validated by method "hookPostProcessFeatureValue"
$id_lang = (int)$language['id_lang'];
Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'layered_indexable_feature_value_lang
VALUES ('.(int)$params['id_feature_value'].', '.$id_lang.', \''.Tools::link_rewrite(Tools::getValue('url_name_'.$id_lang)).'\',
Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'layered_indexable_feature_value_lang_value
VALUES ('.(int)$params['id_feature_value'].', '.$id_lang.', \''.pSQL(Tools::link_rewrite(Tools::getValue('url_name_'.$id_lang))).'\',
\''.pSQL(Tools::safeOutput(Tools::getValue('meta_title_'.$id_lang), true)).'\')');
}
}
@@ -508,7 +508,7 @@ class BlockLayered extends Module
{
if (!$params['id_feature_value'])
return;
Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'layered_indexable_feature_value_lang WHERE id_feature_value = '.(int)$params['id_feature_value']);
Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'layered_indexable_feature_value_lang_value WHERE id_feature_value = '.(int)$params['id_feature_value']);
}
public function hookPostProcessFeatureValue($params)
@@ -523,7 +523,7 @@ class BlockLayered extends Module
$langValue = array();
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(
'SELECT url_name, meta_title, id_lang FROM '._DB_PREFIX_.'layered_indexable_feature_value_lang
'SELECT url_name, meta_title, id_lang FROM '._DB_PREFIX_.'layered_indexable_feature_value_lang_value
WHERE id_feature_value = '.(int)$params['id_feature_value']);
if ($result)
foreach ($result as $data)
@@ -565,13 +565,13 @@ class BlockLayered extends Module
if (!$params['id_attribute'])
return;
Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'layered_indexable_attribute_lang WHERE id_attribute = '.(int)$params['id_attribute']); // don't care about the id_lang
Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'layered_indexable_attribute_lang_value WHERE id_attribute = '.(int)$params['id_attribute']); // don't care about the id_lang
foreach (Language::getLanguages(false) as $language)
{
// Data are validated by method "hookPostProcessAttribute"
$id_lang = (int)$language['id_lang'];
Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'layered_indexable_attribute_lang
VALUES ('.(int)$params['id_attribute'].', '.$id_lang.', \''.Tools::link_rewrite(Tools::getValue('url_name_'.$id_lang)).'\',
Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'layered_indexable_attribute_lang_value
VALUES ('.(int)$params['id_attribute'].', '.$id_lang.', \''.pSQL(Tools::link_rewrite(Tools::getValue('url_name_'.$id_lang))).'\',
\''.pSQL(Tools::safeOutput(Tools::getValue('meta_title_'.$id_lang), true)).'\')');
}
}
@@ -580,7 +580,7 @@ class BlockLayered extends Module
{
if (!$params['id_attribute'])
return;
Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'layered_indexable_attribute_lang WHERE id_attribute = '.(int)$params['id_attribute']);
Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'layered_indexable_attribute_lang_value WHERE id_attribute = '.(int)$params['id_attribute']);
}
public function hookPostProcessAttribute($params)
@@ -595,7 +595,7 @@ class BlockLayered extends Module
$langValue = array();
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(
'SELECT url_name, meta_title, id_lang FROM '._DB_PREFIX_.'layered_indexable_attribute_lang
'SELECT url_name, meta_title, id_lang FROM '._DB_PREFIX_.'layered_indexable_attribute_lang_value
WHERE id_attribute = '.(int)$params['id_attribute']);
if ($result)
foreach ($result as $data)
@@ -652,13 +652,13 @@ class BlockLayered extends Module
Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'layered_indexable_attribute_group WHERE id_attribute_group = '.(int)$params['id_attribute_group']);
Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'layered_indexable_attribute_group VALUES ('.(int)$params['id_attribute_group'].', '.(int)Tools::getValue('layered_indexable').')');
Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'layered_indexable_attribute_group_lang WHERE id_attribute_group = '.(int)$params['id_attribute_group']); // don't care about the id_lang
Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'layered_indexable_attribute_group_lang_value WHERE id_attribute_group = '.(int)$params['id_attribute_group']); // don't care about the id_lang
foreach (Language::getLanguages(false) as $language)
{
// Data are validated by method "hookPostProcessAttributeGroup"
$id_lang = (int)$language['id_lang'];
Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'layered_indexable_attribute_group_lang
VALUES ('.(int)$params['id_attribute_group'].', '.$id_lang.', \''.Tools::link_rewrite(Tools::getValue('url_name_'.$id_lang)).'\',
Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'layered_indexable_attribute_group_lang_value
VALUES ('.(int)$params['id_attribute_group'].', '.$id_lang.', \''.pSQL(Tools::link_rewrite(Tools::getValue('url_name_'.$id_lang))).'\',
\''.pSQL(Tools::safeOutput(Tools::getValue('meta_title_'.$id_lang), true)).'\')');
}
}
@@ -690,7 +690,7 @@ class BlockLayered extends Module
return;
Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'layered_indexable_attribute_group WHERE id_attribute_group = '.(int)$params['id_attribute_group']);
Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'layered_indexable_attribute_group_lang WHERE id_attribute_group = '.(int)$params['id_attribute_group']);
Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'layered_indexable_attribute_group_lang_value WHERE id_attribute_group = '.(int)$params['id_attribute_group']);
}
public function hookAttributeGroupForm($params)
@@ -702,7 +702,7 @@ class BlockLayered extends Module
$langValue = array();
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(
'SELECT url_name, meta_title, id_lang FROM '._DB_PREFIX_.'layered_indexable_attribute_group_lang
'SELECT url_name, meta_title, id_lang FROM '._DB_PREFIX_.'layered_indexable_attribute_group_lang_value
WHERE id_attribute_group = '.(int)$params['id_attribute_group']);
if ($result)
foreach ($result as $data)
@@ -761,7 +761,7 @@ class BlockLayered extends Module
$langValue = array();
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(
'SELECT url_name, meta_title, id_lang FROM '._DB_PREFIX_.'layered_indexable_feature_lang
'SELECT url_name, meta_title, id_lang FROM '._DB_PREFIX_.'layered_indexable_feature_lang_value
WHERE id_feature = '.(int)$params['id_feature']);
if ($result)
foreach ($result as $data)
@@ -2084,9 +2084,9 @@ class BlockLayered extends Module
AND agl.id_lang = '.(int)$cookie->id_lang.'
LEFT JOIN '._DB_PREFIX_.'category_product cp ON (cp.id_product = p.id_product)
INNER JOIN '._DB_PREFIX_.'category c ON (c.id_category = cp.id_category AND c.nleft >= '.(int)$parent->nleft.' AND c.nright <= '.(int)$parent->nright.')
LEFT JOIN '._DB_PREFIX_.'layered_indexable_attribute_group_lang liagl
LEFT JOIN '._DB_PREFIX_.'layered_indexable_attribute_group_lang_value liagl
ON (liagl.id_attribute_group = lpa.id_attribute_group AND liagl.id_lang = '.(int)$cookie->id_lang.')
LEFT JOIN '._DB_PREFIX_.'layered_indexable_attribute_lang lial
LEFT JOIN '._DB_PREFIX_.'layered_indexable_attribute_lang_value lial
ON (lial.id_attribute = lpa.id_attribute AND lial.id_lang = '.(int)$cookie->id_lang.') ';
$sqlQuery['where'] = 'WHERE a.id_attribute_group = '.(int)$filter['id_value'].' ';
$sqlQuery['group'] = '
@@ -2107,9 +2107,9 @@ class BlockLayered extends Module
LEFT JOIN '._DB_PREFIX_.'feature_lang fl ON (fl.id_feature = fp.id_feature AND fl.id_lang = '.(int)$cookie->id_lang.')
INNER JOIN '._DB_PREFIX_.'feature_value fv ON (fv.id_feature_value = fp.id_feature_value AND (fv.custom IS NULL OR fv.custom = 0))
LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.id_feature_value = fp.id_feature_value AND fvl.id_lang = '.(int)$cookie->id_lang.')
LEFT JOIN '._DB_PREFIX_.'layered_indexable_feature_lang lifl
LEFT JOIN '._DB_PREFIX_.'layered_indexable_feature_lang_value lifl
ON (lifl.id_feature = fp.id_feature AND lifl.id_lang = '.(int)$cookie->id_lang.')
LEFT JOIN '._DB_PREFIX_.'layered_indexable_feature_value_lang lifvl
LEFT JOIN '._DB_PREFIX_.'layered_indexable_feature_value_lang_value lifvl
ON (lifvl.id_feature_value = fp.id_feature_value AND lifvl.id_lang = '.(int)$cookie->id_lang.') ';
$sqlQuery['where'] = 'WHERE p.`active` = 1 AND fp.id_feature = '.(int)$filter['id_value'].' ';
$sqlQuery['group'] = 'GROUP BY fv.id_feature_value ';
@@ -2244,6 +2244,7 @@ class BlockLayered extends Module
$conditionArray[$key]['checked'] = true;
if (isset($products) && $products)
foreach ($products as $product)
if(isset($conditionArray[$product['condition']]))
$conditionArray[$product['condition']]['nbr']++;
$filterBlocks[] = array('type_lite' => 'condition', 'type' => 'condition', 'id_key' => 0, 'name' => $this->l('Condition'), 'values' => $conditionArray);
break;
+9 -1
View File
@@ -53,7 +53,7 @@ class CanadaPost extends CarrierModule
{
$this->name = 'canadapost';
$this->tab = 'shipping_logistics';
$this->version = '0.1';
$this->version = '0.5';
$this->author = 'PrestaShop';
$this->limited_countries = array('ca');
@@ -1390,6 +1390,14 @@ class CanadaPost extends CarrierModule
{
// Init var
$address = new Address($params->id_address_delivery);
if (!Validate::isLoadedObject($address))
{
// If address is not loaded, we take data from shipping estimator module (if installed)
global $cookie;
$address->id_country = $cookie->id_country;
$address->id_state = $cookie->id_state;
$address->postcode = $cookie->postcode;
}
$recipient_country = Db::getInstance()->getRow('SELECT `iso_code` FROM `'._DB_PREFIX_.'country` WHERE `id_country` = '.(int)($address->id_country));
$recipient_state = Db::getInstance()->getRow('SELECT `iso_code` FROM `'._DB_PREFIX_.'state` WHERE `id_state` = '.(int)($address->id_state));
$shipper_country = Db::getInstance()->getRow('SELECT `iso_code` FROM `'._DB_PREFIX_.'country` WHERE `id_country` = '.(int)(Configuration::get('CP_CARRIER_COUNTRY')));
+1 -1
View File
@@ -2,7 +2,7 @@
<module>
<name>canadapost</name>
<displayName><![CDATA[Canada Post Carrier]]></displayName>
<version><![CDATA[0.1]]></version>
<version><![CDATA[0.5]]></version>
<description><![CDATA[Offer your customers, different delivery methods with Canada Post]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[shipping_logistics]]></tab>
+1 -1
View File
@@ -39,7 +39,7 @@ switch (Tools::getValue('method'))
die(Tools::jsonEncode($carrierCompare->getStatesByIdCountry((int)Tools::getValue('id_country'))));
break;
case 'getCarriers':
die(Tools::jsonEncode($carrierCompare->getCarriersListByIdZone((int)Tools::getValue('id_country'), (int)Tools::getValue('id_state', 0))));
die(Tools::jsonEncode($carrierCompare->getCarriersListByIdZone((int)Tools::getValue('id_country'), (int)Tools::getValue('id_state', 0), Tools::safeOutput(Tools::getValue('zipcode', 0)))));
break;
case 'saveSelection':
$errors = $carrierCompare->saveSelection((int)Tools::getValue('id_country'), (int)Tools::getValue('id_state', 0), Tools::getValue('zipcode', 0), (int)Tools::getValue('id_carrier', 0));
+2 -2
View File
@@ -51,7 +51,7 @@ function updateCarriersList()
$.ajax({
type: 'POST',
url: baseDir + 'modules/carriercompare/ajax.php',
data: 'method=getCarriers&id_country=' + $('#id_country').val()+'&id_state=' + $('#id_state').val(),
data: 'method=getCarriers&id_country=' + $('#id_country').val() + '&id_state=' + $('#id_state').val() + '&zipcode=' + $('#zipcode').val(),
dataType: 'json',
success: function(json) {
$('#carriers_list').children().remove();
@@ -135,4 +135,4 @@ $(document).ready(function() {
});
updateStateByIdCountry();
updateCarriersList();
});
});
+11 -4
View File
@@ -34,7 +34,7 @@ class CarrierCompare extends Module
{
$this->name = 'carriercompare';
$this->tab = 'shipping_logistics';
$this->version = '1.0';
$this->version = '1.1';
$this->author = 'PrestaShop';
$this->need_instance = 0;
@@ -96,8 +96,15 @@ class CarrierCompare extends Module
/*
** Get carriers by country id, called by the ajax process
*/
public function getCarriersListByIdZone($id_country, $id_state = 0)
public function getCarriersListByIdZone($id_country, $id_state = 0, $zipcode = 0)
{
// cookie saving/updating
$this->context->cookie->id_country = $id_country;
if ($id_state != 0)
$this->context->cookie->id_state = $id_state;
if ($zipcode != 0)
$this->context->cookie->postcode = $zipcode;
$id_zone = 0;
if ($id_state != 0)
$id_zone = State::getIdZone($id_state);
@@ -106,7 +113,7 @@ class CarrierCompare extends Module
$carriers = Carrier::getCarriersForOrder((int)$id_zone);
return (sizeof($carriers) ? $carriers : array());
return (count($carriers) ? $carriers : array());
}
public function saveSelection($id_country, $id_state, $zipcode, $id_carrier)
@@ -128,7 +135,7 @@ class CarrierCompare extends Module
return $errors;
$ids_carrier = array();
foreach (self::getCarriersListByIdZone($id_country, $id_state) as $carrier)
foreach (self::getCarriersListByIdZone($id_country, $id_state, $zipcode) as $carrier)
$ids_carrier[] = $carrier['id_carrier'];
if (!in_array($id_carrier, $ids_carrier))
$errors[] = $this->l('This carrier ID isn\'t available for your selection');
+3 -3
View File
@@ -67,7 +67,7 @@
<p>
<label for="zipcode">{l s='Zipcode' mod='carriercompare'}</label>
<input type="text" name="zipcode" id="zipcode" value="{$zipcode|escape:'htmlall':'UTF-8'}"/>
<input type="text" name="zipcode" id="zipcode" value="{$zipcode|escape:'htmlall':'UTF-8'}"/> ({l s='Needed for certain carriers' mod='carriercompare'})
</p>
<div id="availableCarriers" style="display: none;">
@@ -88,8 +88,8 @@
<p class="warning center" id="noCarrier" style="display: none;">{l s='No carrier is available for this selection' mod='carriercompare'}</p>
<p class="center">
<input class="exclusive_large" id="carriercompare_submit" type="submit" name="carriercompare_submit" value="{l s='Update my shipping option' mod='carriercompare'}"/>
<input class="exclusive_large" id="carriercompare_submit" type="submit" name="carriercompare_submit" value="{l s='Refresh' mod='carriercompare'}"/>
</p>
</fieldset>
</form>
{/if}
{/if}
+1 -1
View File
@@ -2,7 +2,7 @@
<module>
<name>carriercompare</name>
<displayName><![CDATA[Shipping Estimation]]></displayName>
<version><![CDATA[1.0]]></version>
<version><![CDATA[1.1]]></version>
<description><![CDATA[Module to compare carrier possibilities before using the checkout process]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[shipping_logistics]]></tab>
+1 -1
View File
@@ -2,7 +2,7 @@
<module>
<name>fedexcarrier</name>
<displayName><![CDATA[Fedex Carrier]]></displayName>
<version><![CDATA[1.2.3]]></version>
<version><![CDATA[1.2.4]]></version>
<description><![CDATA[Offer your customers, different delivery methods with Fedex]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[shipping_logistics]]></tab>
+10 -2
View File
@@ -56,7 +56,7 @@ class FedexCarrier extends CarrierModule
{
$this->name = 'fedexcarrier';
$this->tab = 'shipping_logistics';
$this->version = '1.2.3';
$this->version = '1.2.4';
$this->author = 'PrestaShop';
$this->limited_countries = array('us');
@@ -594,7 +594,7 @@ class FedexCarrier extends CarrierModule
</div>
</fieldset>
<div class="margin-form"><input class="button" name="submitSave" type="submit"></div>
<div class="margin-form"><input class="button" name="submitSave" type="submit" value="'.$this->l('Configure').'"></div>
</form>
<script>
@@ -1563,6 +1563,14 @@ class FedexCarrier extends CarrierModule
{
// Init var
$address = new Address($params->id_address_delivery);
if (!Validate::isLoadedObject($address))
{
// If address is not loaded, we take data from shipping estimator module (if installed)
global $cookie;
$address->id_country = $cookie->id_country;
$address->id_state = $cookie->id_state;
$address->postcode = $cookie->postcode;
}
$recipient_country = Db::getInstance()->getRow('SELECT `iso_code` FROM `'._DB_PREFIX_.'country` WHERE `id_country` = '.(int)($address->id_country));
$recipient_state = Db::getInstance()->getRow('SELECT `iso_code` FROM `'._DB_PREFIX_.'state` WHERE `id_state` = '.(int)($address->id_state));
$shipper_country = Db::getInstance()->getRow('SELECT `iso_code` FROM `'._DB_PREFIX_.'country` WHERE `id_country` = '.(int)(Configuration::get('FEDEX_CARRIER_COUNTRY')));
@@ -63,7 +63,7 @@ class MRManagement extends MondialRelay
SET `id_method` = '.(int)$this->_params['id_mr_method'].', ';
if (is_array($this->_params['relayPointInfo']))
foreach($this->_params['relayPointInfo'] as $nameKey => $value)
$query .= '`MR_Selected_'.pSQL($nameKey).'` = "'.pSQL($value).'", ';
$query .= '`MR_Selected_'.MRTools::bqSQL($nameKey).'` = "'.pSQL($value).'", ';
else // Clean the existing relay point data
$query .= '
MR_Selected_Num = NULL,
@@ -82,11 +82,11 @@ class MRManagement extends MondialRelay
(`id_customer`, `id_method`, `id_cart`, ';
if (is_array($this->_params['relayPointInfo']))
foreach($this->_params['relayPointInfo'] as $nameKey => $value)
$query .= '`MR_Selected_'.pSQL($nameKey).'`, ';
$query .= '`MR_Selected_'.MRTools::bqSQL($nameKey).'`, ';
$query = rtrim($query, ', ').') VALUES (
'.$this->_params['id_customer'].',
'.$this->_params['id_mr_method'].',
'.$this->_params['id_cart'].', ';
'.(int)$this->_params['id_customer'].',
'.(int)$this->_params['id_mr_method'].',
'.(int)$this->_params['id_cart'].', ';
if (is_array($this->_params['relayPointInfo']))
foreach($this->_params['relayPointInfo'] as $nameKey => $value)
$query .= '"'.pSQL($value).'", ';
+14
View File
@@ -30,6 +30,9 @@
*/
class MRTools
{
/*
** Replace all accented chars to normal
*/
static public function replaceAccentedCharacters($string)
{
if (function_exists('iconv'))
@@ -46,6 +49,17 @@ class MRTools
return $cleanedString;
}
/*
** Fix security and compatibility for PS < 1.4.5
*/
static function bqSQL($string)
{
return str_replace('`', '\`', pSQL($string));
}
/*
** Check zip code by country
*/
static public function checkZipcodeByCountry($zipcode, $params)
{
$id_country = $params['id_country'];
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -59,7 +59,7 @@ class MondialRelay extends Module
{
$this->name = 'mondialrelay';
$this->tab = 'shipping_logistics';
$this->version = '1.7.5';
$this->version = '1.7.5.1';
parent::__construct();
+4 -2
View File
@@ -138,9 +138,11 @@ class ProductComment extends ObjectModel
.($last ? 'LIMIT 1' : '')
);
if ($last)
if (!$results)
return false;
elseif ($last)
return array_shift($results);
else
return $results;
}
+2 -2
View File
@@ -950,10 +950,10 @@ class shopimporter extends ImportModule
INNER JOIN
'._DB_PREFIX_.'category c2
ON
c.id_parent = c2.id_category_'.pSQL($moduleName).'
c.id_parent = c2.`id_category_'.bqSQL($moduleName).'`
SET
c.id_parent = c2.id_category
WHERE c.id_category_'.pSQL($moduleName).' != 0');
WHERE c.`id_category_'.bqSQL($moduleName).'` != 0');
$category = new Category();
$cats = $category->getSimpleCategories((int)Configuration::get('PS_LANG_DEFAULT'));
foreach($cats as $cat)
+1 -1
View File
@@ -87,7 +87,7 @@ class StatsSearch extends ModuleGraph
function hookSearch($params)
{
$sql = 'INSERT INTO `'._DB_PREFIX_.'statssearch` (`id_shop`, `id_group_shop`, `keywords`, `results`, `date_add`)
VALUES ('.$this->context->shop->getID().', '.$this->context->shop->getGroupID().', \''.pSQL($params['expr']).'\', '.(int)($params['total']).', NOW())';
VALUES ('.$this->context->shop->getID(true).', '.$this->context->shop->getGroupID().', \''.pSQL($params['expr']).'\', '.(int)$params['total'].', NOW())';
Db::getInstance()->Execute($sql);
}
-4
View File
@@ -25,10 +25,6 @@
* International Registered Trademark & Property of PrestaShop SA
**/
/**
* @author Nans Pellicari - Prestashop
* @version 1.3
*/
include_once('../../config/config.inc.php');
include_once('../../init.php');
include_once(dirname(__FILE__).'/twenga.php');
-4
View File
@@ -25,10 +25,6 @@
* International Registered Trademark & Property of PrestaShop SA
**/
/**
* @author Nans Pellicari - Prestashop
* @version 1.3
*/
class PrestashopStats
{
/**
-1
View File
@@ -35,7 +35,6 @@
* - compare an array of values to check if required fields are set.
* - use the twenga API method and throw exceptions if error or exceptions occurred.
* - Transform the xml response into PHP values.
* @author Nans Pellicari - Prestashop
* @version 1.3
*/
abstract class TwengaFields
@@ -25,10 +25,6 @@
* International Registered Trademark & Property of PrestaShop SA
**/
/**
* @author Nans Pellicari - Prestashop
* @version 1.3
*/
class TwengaFieldsGetSubscriptionLink extends TwengaFields
{
public function __construct()
@@ -25,10 +25,6 @@
* International Registered Trademark & Property of PrestaShop SA
**/
/**
* @author Nans Pellicari - Prestashop
* @version 1.3
*/
class TwengaFieldsGetTrackingScript extends TwengaFields
{
public function __construct()
@@ -24,9 +24,5 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
**/
/**
* @author Nans Pellicari - Prestashop
* @version 1.3
*/
class TwengaFieldsOrderCancel extends TwengaFieldsOrderValidate
{}
@@ -25,9 +25,5 @@
* International Registered Trademark & Property of PrestaShop SA
**/
/**
* @author Nans Pellicari - Prestashop
* @version 1.3
*/
class TwengaFieldsOrderExist extends TwengaFieldsOrderValidate
{}
@@ -25,10 +25,6 @@
* International Registered Trademark & Property of PrestaShop SA
**/
/**
* @author Nans Pellicari - Prestashop
* @version 1.3
*/
class TwengaFieldsOrderValidate extends TwengaFields
{
public function __construct()
@@ -25,9 +25,5 @@
* International Registered Trademark & Property of PrestaShop SA
**/
/**
* @author Nans Pellicari - Prestashop
* @version 1.3
*/
class TwengaFieldsSiteActivate extends TwengaFieldsSiteExist
{}
@@ -25,10 +25,6 @@
* International Registered Trademark & Property of PrestaShop SA
**/
/**
* @author Nans Pellicari - Prestashop
* @version 1.3
*/
class TwengaFieldsSiteExist extends TwengaFields
{
public function __construct()
-1
View File
@@ -29,7 +29,6 @@
* This Class allow to use Twenga API.
* See details for more infos.
*
* @author Nans Pellicari - Prestashop
* @version 1.3
*/
class TwengaObj
+4 -5
View File
@@ -30,7 +30,6 @@
* 1. subscribe to their Ready to Sell engine,
* 2. activate a tracking for order process if user has been used twenga engine,
* 3. submit a xml feed of shop products to Twenga.
* @author Nans Pellicari - Prestashop
* @version 1.3
*/
@@ -524,16 +523,16 @@ class Twenga extends PaymentModule
*/
public static function getCurrentCountryName()
{
$id_lang = ((isset(Context::getContext()->language->id)) ? Context::getContext()->language->id :
((isset($_POST['id_lang'])) ? $_POST['id_lang'] : NULL));
$id_lang = ((Context::getContext()->language) ? Context::getContext()->language->id :
((isset($_POST['id_lang'])) ? (int)$_POST['id_lang'] : null));
if ($id_lang === NULL)
return 'Undefined id_lang';
$country = Db::getInstance()->ExecuteS('
SELECT c.name as name
FROM '._DB_PREFIX_.'country_lang as c
WHERE c.id_lang = '.$id_lang.'
AND c.id_country = '. Configuration::get('PS_COUNTRY_DEFAULT'));
WHERE c.id_lang = '.(int)$id_lang.'
AND c.id_country = '.(int)Configuration::get('PS_COUNTRY_DEFAULT'));
if (!isset($country[0]['name']))
$country[0]['name'] = 'Undefined';
+1 -1
View File
@@ -2,7 +2,7 @@
<module>
<name>upscarrier</name>
<displayName><![CDATA[UPS Carrier]]></displayName>
<version><![CDATA[1.2.1]]></version>
<version><![CDATA[1.2.2]]></version>
<description><![CDATA[Offer your customers, different delivery methods with UPS]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[shipping_logistics]]></tab>
+9 -1
View File
@@ -55,7 +55,7 @@ class UpsCarrier extends CarrierModule
{
$this->name = 'upscarrier';
$this->tab = 'shipping_logistics';
$this->version = '1.2.1';
$this->version = '1.2.2';
$this->author = 'PrestaShop';
$this->limited_countries = array('us');
@@ -1539,6 +1539,14 @@ class UpsCarrier extends CarrierModule
{
// Init var
$address = new Address($params->id_address_delivery);
if (!Validate::isLoadedObject($address))
{
// If address is not loaded, we take data from shipping estimator module (if installed)
global $cookie;
$address->id_country = $cookie->id_country;
$address->id_state = $cookie->id_state;
$address->postcode = $cookie->postcode;
}
$recipient_country = Db::getInstance()->getRow('SELECT `iso_code` FROM `'._DB_PREFIX_.'country` WHERE `id_country` = '.(int)($address->id_country));
$recipient_state = Db::getInstance()->getRow('SELECT `iso_code` FROM `'._DB_PREFIX_.'state` WHERE `id_state` = '.(int)($address->id_state));
$shipper_country = Db::getInstance()->getRow('SELECT `iso_code` FROM `'._DB_PREFIX_.'country` WHERE `id_country` = '.(int)(Configuration::get('UPS_CARRIER_COUNTRY')));
+1 -1
View File
@@ -2,7 +2,7 @@
<module>
<name>uspscarrier</name>
<displayName><![CDATA[U.S.P.S. Rate Calulator]]></displayName>
<version><![CDATA[1.2]]></version>
<version><![CDATA[1.2.1]]></version>
<description><![CDATA[Calculates shipping rates for United States Postal Service for Domestic shipping within the USA.]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[shipping_logistics]]></tab>
+9 -1
View File
@@ -53,7 +53,7 @@ class UspsCarrier extends CarrierModule
{
$this->name = 'uspscarrier';
$this->tab = 'shipping_logistics';
$this->version = '1.2';
$this->version = '1.2.1';
$this->author = 'PrestaShop';
$this->limited_countries = array('us');
@@ -1557,6 +1557,14 @@ class UspsCarrier extends CarrierModule
{
// Init var
$address = new Address($params->id_address_delivery);
if (!Validate::isLoadedObject($address))
{
// If address is not loaded, we take data from shipping estimator module (if installed)
global $cookie;
$address->id_country = $cookie->id_country;
$address->id_state = $cookie->id_state;
$address->postcode = $cookie->postcode;
}
$recipient_country = Db::getInstance()->getRow('SELECT `iso_code` FROM `'._DB_PREFIX_.'country` WHERE `id_country` = '.(int)($address->id_country));
$recipient_state = Db::getInstance()->getRow('SELECT `iso_code` FROM `'._DB_PREFIX_.'state` WHERE `id_state` = '.(int)($address->id_state));
$shipper_country = Db::getInstance()->getRow('SELECT `iso_code` FROM `'._DB_PREFIX_.'country` WHERE `id_country` = '.(int)(Configuration::get('USPS_CARRIER_COUNTRY')));