// Fixed problem with rounding on tax excluded price #PSCFV-3778
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@17019 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
1 parent
17e71862ac
commit
06c0e7fcef
1 file changed
+23
-19
@@ -39,24 +39,25 @@ class AdminAttributeGeneratorControllerCore extends AdminController
|
|||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function addAttribute($arr, $price = 0, $weight = 0)
|
protected function addAttribute($attributes, $price = 0, $weight = 0)
|
||||||
{
|
{
|
||||||
foreach ($arr as $attr)
|
foreach ($attributes as $attribute)
|
||||||
{
|
{
|
||||||
$price += (float)$_POST['price_impact_'.(int)$attr];
|
$price += (float)preg_replace('/[^0-9.]/', '', str_replace(',', '.', Tools::getValue('price_impact_'.(int)$attribute)));
|
||||||
$weight += (float)$_POST['weight_impact'][(int)$attr];
|
$weight += (float)preg_replace('/[^0-9.]/', '', str_replace(',', '.', Tools::getValue('weight_impact'.(int)$attribute)));
|
||||||
}
|
}
|
||||||
if ($this->product->id)
|
if ($this->product->id)
|
||||||
{
|
{
|
||||||
return (array(
|
return array(
|
||||||
'id_product' => (int)$this->product->id,
|
'id_product' => (int)$this->product->id,
|
||||||
'price' => (float)$price,
|
'price' => (float)$price,
|
||||||
'weight' => (float)$weight,
|
'weight' => (float)$weight,
|
||||||
'ecotax' => 0,
|
'ecotax' => 0,
|
||||||
'quantity' => (int)$_POST['quantity'],
|
'quantity' => (int)Tools::getValue('quantity'),
|
||||||
'reference' => pSQL($_POST['reference']),
|
'reference' => pSQL($_POST['reference']),
|
||||||
'default_on' => 0,
|
'default_on' => 0,
|
||||||
'available_date' => '0000-00-00'));
|
'available_date' => '0000-00-00'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
@@ -163,13 +164,16 @@ class AdminAttributeGeneratorControllerCore extends AdminController
|
|||||||
$attributes = array();
|
$attributes = array();
|
||||||
foreach ($tab as $group)
|
foreach ($tab as $group)
|
||||||
foreach ($group as $attribute)
|
foreach ($group as $attribute)
|
||||||
$attributes[] = '('.(int)$id_product.', '.(int)$attribute.', '.(float)$_POST['price_impact_'.(int)$attribute].', '.(float)$_POST['weight_impact'][(int)$attribute].')';
|
{
|
||||||
|
$price = preg_replace('/[^0-9.]/', '', str_replace(',', '.', Tools::getValue('price_impact_'.(int)$attribute)));
|
||||||
|
$weight = preg_replace('/[^0-9.]/', '', str_replace(',', '.', Tools::getValue('weight_impact'.(int)$attribute)));
|
||||||
|
$attributes[] = '('.(int)$id_product.', '.(int)$attribute.', '.(float)$price.', '.(float)$weight.')';
|
||||||
|
}
|
||||||
|
|
||||||
return Db::getInstance()->execute(
|
return Db::getInstance()->execute('
|
||||||
'INSERT INTO `'._DB_PREFIX_.'attribute_impact` (`id_product`, `id_attribute`, `price`, `weight`)
|
INSERT INTO `'._DB_PREFIX_.'attribute_impact` (`id_product`, `id_attribute`, `price`, `weight`)
|
||||||
VALUES '.implode(',', $attributes).'
|
VALUES '.implode(',', $attributes).'
|
||||||
ON DUPLICATE KEY UPDATE `price`=VALUES(price), `weight`=VALUES(weight)'
|
ON DUPLICATE KEY UPDATE `price` = VALUES(price), `weight` = VALUES(weight)');
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function getAttributesImpacts($id_product)
|
protected static function getAttributesImpacts($id_product)
|
||||||
|
|||||||
Reference in new issue
Block a user