[*] Core: conversion_rate of currencies are now multishop
This commit is contained in:
1 parent
e87d0f9337
commit
2a14176055
6 files changed
+19
-2
No files matched your search
@@ -830,6 +830,13 @@ class CartCore extends ObjectModel
|
|||||||
$id_product_attribute = (int)$id_product_attribute;
|
$id_product_attribute = (int)$id_product_attribute;
|
||||||
$product = new Product($id_product, false, Configuration::get('PS_LANG_DEFAULT'), $shop->id);
|
$product = new Product($id_product, false, Configuration::get('PS_LANG_DEFAULT'), $shop->id);
|
||||||
|
|
||||||
|
if ($id_product_attribute)
|
||||||
|
{
|
||||||
|
$combination = new Combination((int)$id_product_attribute);
|
||||||
|
if ($combination->id_product != $id_product)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/* If we have a product combination, the minimal quantity is set with the one of this combination */
|
/* If we have a product combination, the minimal quantity is set with the one of this combination */
|
||||||
if (!empty($id_product_attribute))
|
if (!empty($id_product_attribute))
|
||||||
$minimal_quantity = (int)Attribute::getAttributeMinimalQty($id_product_attribute);
|
$minimal_quantity = (int)Attribute::getAttributeMinimalQty($id_product_attribute);
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ class CurrencyCore extends ObjectModel
|
|||||||
'sign' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true, 'size' => 8),
|
'sign' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true, 'size' => 8),
|
||||||
'format' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
|
'format' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
|
||||||
'decimals' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'required' => true),
|
'decimals' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'required' => true),
|
||||||
'conversion_rate' =>array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat', 'required' => true),
|
'conversion_rate' =>array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat', 'required' => true, 'shop' => true),
|
||||||
'deleted' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
'deleted' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||||
'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ class AdminCurrenciesControllerCore extends AdminController
|
|||||||
$this->table = 'currency';
|
$this->table = 'currency';
|
||||||
$this->className = 'Currency';
|
$this->className = 'Currency';
|
||||||
$this->lang = false;
|
$this->lang = false;
|
||||||
$this->multishop_context = Shop::CONTEXT_ALL;
|
|
||||||
|
|
||||||
$this->fields_list = array(
|
$this->fields_list = array(
|
||||||
'id_currency' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
|
'id_currency' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
|
||||||
@@ -69,6 +68,9 @@ class AdminCurrenciesControllerCore extends AdminController
|
|||||||
);
|
);
|
||||||
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
|
$this->_select .= 'currency_shop.conversion_rate conversion_rate';
|
||||||
|
$this->_join .= Shop::addSqlAssociation('currency', 'a');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function renderList()
|
public function renderList()
|
||||||
|
|||||||
@@ -323,6 +323,10 @@ class AdminLocalizationControllerCore extends AdminController
|
|||||||
public function updateOptionPsCurrencyDefault($value)
|
public function updateOptionPsCurrencyDefault($value)
|
||||||
{
|
{
|
||||||
Configuration::updateValue('PS_CURRENCY_DEFAULT', $value);
|
Configuration::updateValue('PS_CURRENCY_DEFAULT', $value);
|
||||||
|
|
||||||
|
/* Set conversion rate of default currency to 1 */
|
||||||
|
ObjectModel::updateMultishopTable('Currency', array('conversion_rate' => 1), 'a.id_currency');
|
||||||
|
|
||||||
Currency::refreshCurrencies();
|
Currency::refreshCurrencies();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2023,6 +2023,7 @@ CREATE TABLE `PREFIX_lang_shop` (
|
|||||||
CREATE TABLE `PREFIX_currency_shop` (
|
CREATE TABLE `PREFIX_currency_shop` (
|
||||||
`id_currency` INT( 11 ) UNSIGNED NOT NULL,
|
`id_currency` INT( 11 ) UNSIGNED NOT NULL,
|
||||||
`id_shop` INT( 11 ) UNSIGNED NOT NULL,
|
`id_shop` INT( 11 ) UNSIGNED NOT NULL,
|
||||||
|
`conversion_rate` decimal(13,6) NOT NULL,
|
||||||
PRIMARY KEY (`id_currency`, `id_shop`),
|
PRIMARY KEY (`id_currency`, `id_shop`),
|
||||||
KEY `id_shop` (`id_shop`)
|
KEY `id_shop` (`id_shop`)
|
||||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||||
|
|||||||
@@ -23,3 +23,6 @@ INSERT INTO `PREFIX_configuration`(`name`, `value`, `date_add`, `date_upd`) VALU
|
|||||||
ALTER TABLE `PREFIX_order_cart_rule` CHANGE `name` `name` VARCHAR(254);
|
ALTER TABLE `PREFIX_order_cart_rule` CHANGE `name` `name` VARCHAR(254);
|
||||||
|
|
||||||
ALTER TABLE `PREFIX_cart` CHANGE `delivery_option` `delivery_option` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '';
|
ALTER TABLE `PREFIX_cart` CHANGE `delivery_option` `delivery_option` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '';
|
||||||
|
|
||||||
|
ALTER TABLE `PREFIX_currency_shop` ADD `conversion_rate` DECIMAL( 13, 6 ) NOT NULL;
|
||||||
|
UPDATE `PREFIX_currency_shop` a SET `conversion_rate` = (SELECT `conversion_rate` FROM `PREFIX_currency` b WHERE a.id_currency = b.id_currency);
|
||||||
Reference in new issue
Block a user