[-] BO: Fix weight impact and default combination on combinations generator

This commit is contained in:
rGaillard committed 2012-09-14 15:45:11 +00:00
1 parent e5c147d0c8
commit 0b1faa3382
3 files changed
+7 -6

No files matched your search

+3 -3
View File
@@ -1079,12 +1079,12 @@ class ProductCore extends ObjectModel
$obj->available_date = '0000-00-00'; $obj->available_date = '0000-00-00';
} }
$obj->default_on = $default_on;
$default_on = 0;
foreach ($combination as $field => $value) foreach ($combination as $field => $value)
$obj->$field = $value; $obj->$field = $value;
$obj->default_on = $default_on;
$default_on = 0;
$obj->save(); $obj->save();
if (!$id_combination) if (!$id_combination)
@@ -46,7 +46,7 @@ class AdminAttributeGeneratorControllerCore extends AdminController
foreach ($attributes as $attribute) foreach ($attributes as $attribute)
{ {
$price += (float)preg_replace('/[^0-9.]/', '', str_replace(',', '.', Tools::getValue('price_impact_'.(int)$attribute))); $price += (float)preg_replace('/[^0-9.]/', '', str_replace(',', '.', Tools::getValue('price_impact_'.(int)$attribute)));
$weight += (float)preg_replace('/[^0-9.]/', '', str_replace(',', '.', Tools::getValue('weight_impact'.(int)$attribute))); $weight += (float)preg_replace('/[^0-9.]/', '', str_replace(',', '.', Tools::getValue('weight_impact_'.(int)$attribute)));
} }
if ($this->product->id) if ($this->product->id)
{ {
@@ -167,7 +167,7 @@ class AdminAttributeGeneratorControllerCore extends AdminController
foreach ($group as $attribute) foreach ($group as $attribute)
{ {
$price = preg_replace('/[^0-9.]/', '', str_replace(',', '.', Tools::getValue('price_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))); $weight = preg_replace('/[^0-9.]/', '', str_replace(',', '.', Tools::getValue('weight_impact_'.(int)$attribute)));
$attributes[] = '('.(int)$id_product.', '.(int)$attribute.', '.(float)$price.', '.(float)$weight.')'; $attributes[] = '('.(int)$id_product.', '.(int)$attribute.', '.(float)$price.', '.(float)$weight.')';
} }
@@ -184,6 +184,7 @@ class AdminAttributeGeneratorControllerCore extends AdminController
'SELECT ai.`id_attribute`, ai.`price`, ai.`weight` 'SELECT ai.`id_attribute`, ai.`price`, ai.`weight`
FROM `'._DB_PREFIX_.'attribute_impact` ai FROM `'._DB_PREFIX_.'attribute_impact` ai
WHERE ai.`id_product` = '.(int)$id_product); WHERE ai.`id_product` = '.(int)$id_product);
if (!$result) if (!$result)
return array(); return array();
foreach ($result as $impact) foreach ($result as $impact)
+1 -1
View File
@@ -127,7 +127,7 @@ function create_attribute_row(id, id_group, name, price, weight)
html += '<td><input type="hidden" value="'+id+'" name="options['+id_group+']['+id+']" />'+name+'</td>'; html += '<td><input type="hidden" value="'+id+'" name="options['+id_group+']['+id+']" />'+name+'</td>';
html += '<td>'+i18n_tax_exc+'<input id="related_to_price_impact_ti_'+id+'" class="price_impact" style="width:50px" type="text" value="'+price+'" name="price_impact_'+id+'" onkeyup="calcPrice($(this), false)"></td>'; html += '<td>'+i18n_tax_exc+'<input id="related_to_price_impact_ti_'+id+'" class="price_impact" style="width:50px" type="text" value="'+price+'" name="price_impact_'+id+'" onkeyup="calcPrice($(this), false)"></td>';
html += '<td>'+i18n_tax_inc+'<input id="related_to_price_impact_'+id+'" class="price_impact_ti" style="width:50px" type="text" value="" name="price_impact_ti_'+id+'" onkeyup="calcPrice($(this), true)"></td>'; html += '<td>'+i18n_tax_inc+'<input id="related_to_price_impact_'+id+'" class="price_impact_ti" style="width:50px" type="text" value="" name="price_impact_ti_'+id+'" onkeyup="calcPrice($(this), true)"></td>';
html += '<td><input style="width:50px" type="text" value="'+weight+'" name="weight_impact['+id+']"></td>'; html += '<td><input style="width:50px" type="text" value="'+weight+'" name="weight_impact_'+id+'"></td>';
html += '</tr>'; html += '</tr>';
return html; return html;