Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development
This commit is contained in:
@@ -280,6 +280,7 @@
|
||||
{
|
||||
"action":"UpdateProductImageShopAsso",
|
||||
"id_image":id,
|
||||
"id_product":id_product,
|
||||
"id_shop": id_shop,
|
||||
"active":active,
|
||||
"token" : "{/literal}{$token}{literal}",
|
||||
|
||||
+2
-2
@@ -124,8 +124,8 @@ class AddressCore extends ObjectModel
|
||||
'postcode' => array('type' => self::TYPE_STRING, 'validate' => 'isPostCode', 'size' => 12),
|
||||
'city' => array('type' => self::TYPE_STRING, 'validate' => 'isCityName', 'required' => true, 'size' => 64),
|
||||
'other' => array('type' => self::TYPE_STRING, 'validate' => 'isMessage', 'size' => 300),
|
||||
'phone' => array('type' => self::TYPE_STRING, 'validate' => 'isPhoneNumber', 'size' => 16),
|
||||
'phone_mobile' => array('type' => self::TYPE_STRING, 'validate' => 'isPhoneNumber', 'size' => 16),
|
||||
'phone' => array('type' => self::TYPE_STRING, 'validate' => 'isPhoneNumber', 'size' => 32),
|
||||
'phone_mobile' => array('type' => self::TYPE_STRING, 'validate' => 'isPhoneNumber', 'size' => 32),
|
||||
'dni' => array('type' => self::TYPE_STRING, 'validate' => 'isDniLite', 'size' => 16),
|
||||
'deleted' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'copy_post' => false),
|
||||
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDateFormat', 'copy_post' => false),
|
||||
|
||||
@@ -75,10 +75,11 @@ class AdminAddressesControllerCore extends AdminController
|
||||
public function initToolbar()
|
||||
{
|
||||
parent::initToolbar();
|
||||
$this->toolbar_btn['import'] = array(
|
||||
'href' => $this->context->link->getAdminLink('AdminImport', true).'&import_type='.$this->table,
|
||||
'desc' => $this->l('Import')
|
||||
);
|
||||
if (!$this->display)
|
||||
$this->toolbar_btn['import'] = array(
|
||||
'href' => $this->context->link->getAdminLink('AdminImport', true).'&import_type='.$this->table,
|
||||
'desc' => $this->l('Import')
|
||||
);
|
||||
}
|
||||
|
||||
public function renderForm()
|
||||
|
||||
@@ -1401,6 +1401,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
|
||||
public function ajaxProcessUpdateProductImageShopAsso()
|
||||
{
|
||||
$id_product = Tools::getValue('id_product');
|
||||
if (($id_image = Tools::getValue('id_image')) && ($id_shop = (int)Tools::getValue('id_shop')))
|
||||
if (Tools::getValue('active') == 'true')
|
||||
$res = Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.'image_shop (`id_image`, `id_shop`) VALUES('.(int)$id_image.', '.(int)$id_shop.')');
|
||||
@@ -1408,18 +1409,33 @@ class AdminProductsControllerCore extends AdminController
|
||||
$res = Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'image_shop WHERE `id_image` = '.(int)$id_image.' AND `id_shop` = '.(int)$id_shop);
|
||||
|
||||
// Clean covers in image table
|
||||
$count_cover_image = Db::getInstance()->getValue('SELECT COUNT(*) FROM '._DB_PREFIX_.'image i INNER JOIN '._DB_PREFIX_.'image_shop is ON (i.id_image = is.id_image AND is.id_shop = '.(int)$id_shop.') WHERE i.cover = 1');
|
||||
$count_cover_image = Db::getInstance()->getValue('
|
||||
SELECT COUNT(*) FROM '._DB_PREFIX_.'image i
|
||||
INNER JOIN '._DB_PREFIX_.'image_shop ish ON (i.id_image = ish.id_image AND ish.id_shop = '.(int)$id_shop.')
|
||||
WHERE i.cover = 1 AND `id_product` = '.(int)$id_product);
|
||||
|
||||
$id_image = Db::getInstance()->getValue('
|
||||
SELECT i.`id_image` FROM '._DB_PREFIX_.'image i
|
||||
INNER JOIN '._DB_PREFIX_.'image_shop ish ON (i.id_image = ish.id_image AND ish.id_shop = '.(int)$id_shop.')
|
||||
WHERE `id_product` = '.(int)$id_product);
|
||||
|
||||
if ($count_cover_image < 1)
|
||||
Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'image i, '._DB_PREFIX_.'image_shop is SET i.cover = 1 WHERE i.id_image = is.id_image AND is.id_shop = '.(int)$id_shop.' LIMIT 1');
|
||||
Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'image i SET i.cover = 1 WHERE i.id_image = '.(int)$id_image.' AND i.`id_product` = '.(int)$id_product.' LIMIT 1');
|
||||
|
||||
if ($count_cover_image > 1)
|
||||
Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'image i, '._DB_PREFIX_.'image_shop is SET i.cover = 0 WHERE cover = 1 AND i.id_image = is.id_image AND is.id_shop = '.(int)$id_shop.' LIMIT '.intval($count_cover_image - 1));
|
||||
|
||||
Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'image i SET i.cover = 0 WHERE i.id_image <> '.(int)$id_image.' AND i.`id_product` = '.(int)$id_product);
|
||||
|
||||
// Clean covers in image_shop table
|
||||
$count_cover_image_shop = Db::getInstance()->getValue('SELECT COUNT(*) FROM '._DB_PREFIX_.'image_shop is WHERE is.id_shop = '.(int)$id_shop.' AND is.cover = 1');
|
||||
$count_cover_image_shop = Db::getInstance()->getValue('
|
||||
SELECT COUNT(*)
|
||||
FROM '._DB_PREFIX_.'image_shop ish
|
||||
INNER JOIN '._DB_PREFIX_.'image i ON (i.id_image = ish.id_image AND i.`id_product` = '.(int)$id_product.')
|
||||
WHERE ish.id_shop = '.(int)$id_shop.' AND ish.cover = 1');
|
||||
|
||||
if ($count_cover_image_shop < 1)
|
||||
Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'image_shop is SET is.cover = 1 WHERE is.id_shop = '.(int)$id_shop.' LIMIT 1');
|
||||
Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'image_shop ish SET ish.cover = 1 WHERE ish.id_image = '.(int)$id_image.' AND ish.id_shop = '.(int)$id_shop.' LIMIT 1');
|
||||
if ($count_cover_image_shop > 1)
|
||||
Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'image_shop is SET is.cover = 0 WHERE is.cover = 1 AND is.id_shop = '.(int)$id_shop.' LIMIT '.intval($count_cover_image_shop - 1));
|
||||
Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'image_shop ish SET ish.cover = 0 WHERE ish.id_image <> '.(int)$id_image.' AND ish.cover = 1 AND ish.id_shop = '.(int)$id_shop.' LIMIT '.intval($count_cover_image_shop - 1));
|
||||
|
||||
if ($res)
|
||||
$this->jsonConfirmation($this->_conf[27]);
|
||||
|
||||
@@ -33,8 +33,8 @@ CREATE TABLE `PREFIX_address` (
|
||||
`postcode` varchar(12) default NULL,
|
||||
`city` varchar(64) NOT NULL,
|
||||
`other` text,
|
||||
`phone` varchar(16) default NULL,
|
||||
`phone_mobile` varchar(16) default NULL,
|
||||
`phone` varchar(32) default NULL,
|
||||
`phone_mobile` varchar(32) default NULL,
|
||||
`vat_number` varchar(32) default NULL,
|
||||
`dni` varchar(16) DEFAULT NULL,
|
||||
`date_add` datetime NOT NULL,
|
||||
|
||||
@@ -41,3 +41,6 @@ UPDATE PREFIX_configuration SET `value` = '8388608' WHERE `name` = 'PS_PRODUCT_P
|
||||
ALTER TABLE `PREFIX_guest` ADD `mobile_theme` tinyint(1) NOT NULL DEFAULT 0;
|
||||
ALTER TABLE `PREFIX_orders` ADD `mobile_theme` tinyint(1) NOT NULL DEFAULT 0 AFTER `gift_message`;
|
||||
ALTER TABLE `PREFIX_cart` ADD `mobile_theme` tinyint(1) NOT NULL DEFAULT 0 AFTER `gift_message`;
|
||||
|
||||
ALTER TABLE `PREFIX_address` CHANGE `phone` `phone` varchar(32) default NULL;
|
||||
ALTER TABLE `PREFIX_address` CHANGE `phone_mobile` `phone_mobile` varchar(32) default NULL;
|
||||
|
||||
@@ -523,7 +523,7 @@ class BlockLayered extends Module
|
||||
$id_lang = (int)$language['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)).'\')');
|
||||
\''.pSQL(Tools::getValue('meta_title_'.$id_lang), true).'\')');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -539,7 +539,7 @@ class BlockLayered extends Module
|
||||
$id_lang = (int)$language['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)).'\')');
|
||||
\''.pSQL(Tools::getValue('meta_title_'.$id_lang), true).'\')');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -626,7 +626,7 @@ class BlockLayered extends Module
|
||||
$id_lang = (int)$language['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)).'\')');
|
||||
\''.pSQL(Tools::getValue('meta_title_'.$id_lang), true).'\')');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -727,7 +727,7 @@ class BlockLayered extends Module
|
||||
$id_lang = (int)$language['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)).'\')');
|
||||
\''.pSQL(Tools::getValue('meta_title_'.$id_lang), true).'\')');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -132,8 +132,8 @@ class StatsBestManufacturers extends ModuleGrid
|
||||
LEFT JOIN '._DB_PREFIX_.'orders o ON (o.id_order = od.id_order)
|
||||
LEFT JOIN '._DB_PREFIX_.'currency c ON (c.id_currency = o.id_currency)
|
||||
LEFT JOIN '._DB_PREFIX_.'manufacturer m ON (m.id_manufacturer = p.id_manufacturer)
|
||||
WHERE '.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
AND o.invoice_date BETWEEN '.$this->getDate().'
|
||||
WHERE o.invoice_date BETWEEN '.$this->getDate().'
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
AND o.valid = 1
|
||||
AND m.id_manufacturer IS NOT NULL
|
||||
GROUP BY p.id_manufacturer';
|
||||
|
||||
Reference in New Issue
Block a user