[-] BO : Bug fixed related to #PSCFV-1354 - Specific price with multishop, groups/currencies/countries should vary in function of the selected shop
This commit is contained in:
@@ -25,6 +25,9 @@
|
|||||||
*}
|
*}
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
var product_url = '{$link->getAdminLink('AdminProducts', true)}';
|
||||||
|
|
||||||
var Customer = {
|
var Customer = {
|
||||||
"hiddenField": jQuery('#id_customer'),
|
"hiddenField": jQuery('#id_customer'),
|
||||||
"field": jQuery('#customer'),
|
"field": jQuery('#customer'),
|
||||||
@@ -257,7 +260,7 @@ jQuery(document).ready(Customer.init);
|
|||||||
<input type="hidden" name="sp_id_shop" value="0" />
|
<input type="hidden" name="sp_id_shop" value="0" />
|
||||||
{else}
|
{else}
|
||||||
<div class="margin-form">
|
<div class="margin-form">
|
||||||
<select name="sp_id_shop">
|
<select name="sp_id_shop" id="sp_id_shop">
|
||||||
{if !$admin_one_shop}<option value="0">{l s='All shops'}</option>{/if}
|
{if !$admin_one_shop}<option value="0">{l s='All shops'}</option>{/if}
|
||||||
{foreach from=$shops item=shop}
|
{foreach from=$shops item=shop}
|
||||||
<option value="{$shop.id_shop}">{$shop.name|htmlentitiesUTF8}</option>
|
<option value="{$shop.id_shop}">{$shop.name|htmlentitiesUTF8}</option>
|
||||||
@@ -272,14 +275,14 @@ jQuery(document).ready(Customer.init);
|
|||||||
{/foreach}
|
{/foreach}
|
||||||
</select>
|
</select>
|
||||||
>
|
>
|
||||||
<select name="sp_id_country">
|
<select name="sp_id_country" id="sp_id_country">
|
||||||
<option value="0">{l s='All countries'}</option>
|
<option value="0">{l s='All countries'}</option>
|
||||||
{foreach from=$countries item=country}
|
{foreach from=$countries item=country}
|
||||||
<option value="{$country.id_country}">{$country.name|htmlentitiesUTF8}</option>
|
<option value="{$country.id_country}">{$country.name|htmlentitiesUTF8}</option>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
</select>
|
</select>
|
||||||
>
|
>
|
||||||
<select name="sp_id_group">
|
<select name="sp_id_group" id="sp_id_group">
|
||||||
<option value="0">{l s='All groups'}</option>
|
<option value="0">{l s='All groups'}</option>
|
||||||
{foreach from=$groups item=group}
|
{foreach from=$groups item=group}
|
||||||
<option value="{$group.id_group}">{$group.name}</option>
|
<option value="{$group.id_group}">{$group.name}</option>
|
||||||
|
|||||||
@@ -147,6 +147,17 @@ class CountryCore extends ObjectModel
|
|||||||
return $countries;
|
return $countries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getCountriesByIdShop($id_shop, $id_lang)
|
||||||
|
{
|
||||||
|
$sql = 'SELECT *
|
||||||
|
FROM `'._DB_PREFIX_.'country` c
|
||||||
|
LEFT JOIN `'._DB_PREFIX_.'country_shop` cs ON (cs.`id_country`= c.`id_country`)
|
||||||
|
LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON (c.`id_country` = cl.`id_country` AND cl.`id_lang` = '.(int)$id_lang.')
|
||||||
|
WHERE `id_shop` = '.(int)$id_shop;
|
||||||
|
|
||||||
|
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a country ID with its iso code
|
* Get a country ID with its iso code
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -212,6 +212,19 @@ class CurrencyCore extends ObjectModel
|
|||||||
return $tab;
|
return $tab;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getCurrenciesByIdShop($id_shop = 0)
|
||||||
|
{
|
||||||
|
$sql = 'SELECT *
|
||||||
|
FROM `'._DB_PREFIX_.'currency` c
|
||||||
|
LEFT JOIN `'._DB_PREFIX_.'currency_shop` cs ON (cs.`id_currency` = c.`id_currency`)
|
||||||
|
'.($id_shop != 0 ? ' WHERE cs.`id_shop` = '.(int)$id_shop : '').'
|
||||||
|
GROUP BY c.id_currency
|
||||||
|
ORDER BY `name` ASC';
|
||||||
|
|
||||||
|
return Db::getInstance()->executeS($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static function getPaymentCurrenciesSpecial($id_module, $id_shop = null)
|
public static function getPaymentCurrenciesSpecial($id_module, $id_shop = null)
|
||||||
{
|
{
|
||||||
if (is_null($id_shop))
|
if (is_null($id_shop))
|
||||||
|
|||||||
+7
-1
@@ -71,12 +71,18 @@ class GroupCore extends ObjectModel
|
|||||||
|
|
||||||
protected $webserviceParameters = array();
|
protected $webserviceParameters = array();
|
||||||
|
|
||||||
public static function getGroups($id_lang)
|
public static function getGroups($id_lang, $id_shop = false)
|
||||||
{
|
{
|
||||||
|
$shop_criteria = '';
|
||||||
|
if ($id_shop)
|
||||||
|
$shop_criteria = 'LEFT JOIN `'._DB_PREFIX_.'group_shop` gs ON (gs.`id_group` = g.`id_group`)
|
||||||
|
WHERE `id_shop` = '.(int)$id_shop;
|
||||||
|
|
||||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
SELECT g.`id_group`, g.`reduction`, g.`price_display_method`, gl.`name`
|
SELECT g.`id_group`, g.`reduction`, g.`price_display_method`, gl.`name`
|
||||||
FROM `'._DB_PREFIX_.'group` g
|
FROM `'._DB_PREFIX_.'group` g
|
||||||
LEFT JOIN `'._DB_PREFIX_.'group_lang` AS gl ON (g.`id_group` = gl.`id_group` AND gl.`id_lang` = '.(int)$id_lang.')
|
LEFT JOIN `'._DB_PREFIX_.'group_lang` AS gl ON (g.`id_group` = gl.`id_group` AND gl.`id_lang` = '.(int)$id_lang.')
|
||||||
|
'.$shop_criteria.'
|
||||||
ORDER BY g.`id_group` ASC');
|
ORDER BY g.`id_group` ASC');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -546,11 +546,28 @@ product_tabs['Prices'] = new function(){
|
|||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.loadInformations = function(select_id, action)
|
||||||
|
{
|
||||||
|
id_shop = $('#sp_id_shop').val();
|
||||||
|
$.ajax({
|
||||||
|
url: product_url + '&action='+action+'&ajax=true&id_shop='+id_shop,
|
||||||
|
success: function(data) {
|
||||||
|
$(select_id + ' option').not(':first').remove();
|
||||||
|
$(select_id).append(data);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
this.onReady = function(){
|
this.onReady = function(){
|
||||||
self.toggleSpecificPrice();
|
self.toggleSpecificPrice();
|
||||||
self.deleteSpecificPrice();
|
self.deleteSpecificPrice();
|
||||||
self.bindDelete();
|
self.bindDelete();
|
||||||
|
|
||||||
|
$('#sp_id_shop').change(function() {
|
||||||
|
self.loadInformations('#sp_id_group','getGroupsOptions');
|
||||||
|
self.loadInformations('#spm_currency_0', 'getCurrenciesOptions');
|
||||||
|
self.loadInformations('#sp_id_country', 'getCountriesOptions');
|
||||||
|
});
|
||||||
if (display_multishop_checkboxes)
|
if (display_multishop_checkboxes)
|
||||||
ProductMultishop.checkAllPrices();
|
ProductMultishop.checkAllPrices();
|
||||||
};
|
};
|
||||||
@@ -1564,3 +1581,4 @@ $(document).ready(function() {
|
|||||||
return (code == 13) ? false : true;
|
return (code == 13) ? false : true;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user