When the subproducts_surcharge_extra function is call, it should return:
attribute (+$123) or
attribute (-$123) or
attribute
but it only shows
attribute
the code was wrong in two points:
1- Doesnt get the attribute id (assumes as 0 (?))
2- it assumes positve price change
instead:
function subproducts_surcharge_extra($attribute, $override = FALSE) {
return ((variable_get('subproducts_dynamic_pricing', 0) || $override) && ($attribute->surcharge != 0)) ? t('%name (+%surcharge)', array('%name' => $attribute->name, '%surcharge' => payment_format($attribute->surcharge))) : $attribute->name;
}
should be:
function subproducts_surcharge_extra($attribute, $override = FALSE) {
if ((variable_get('subproducts_dynamic_pricing', $attribute->aid) || $override) && ($attribute->surcharge != 0)) {
($attribute->surcharge > 0) ? $signal='+' : $signal='' ;
return t('%name (%signal%surcharge)', array('%name' => $attribute->name, '%signal' => $signal, '%surcharge' => payment_format($attribute->surcharge)));
}
else {
return $attribute->name;
};
}
regards
massa
Comments
Comment #1
darren ohNo patch is attached.
Comment #2
brmassa commentedComment #3
recidive commentedSomeone else besides the author needs to test the code before it can be commited.
Comment #4
nedjoThanks brmassa for flagging this issue and for your other fine work on subproducts.
The issue here is that there is no way to set the variable 'subproducts_dynamic_pricing', which should be a set to 0 or 1. Originally the idea was to implement a routine where changes in attribute surcharges would trigger updates of existing subproduct prices. This wasn't implemented. Without this, the display of surcharges could be incorrect, as the attribute surcharges may have changed after the subproduct was created.
As a beginning, here's a patch introducing the setting. But before applying this it would be better to implement updating of the subproduct price at the same time if this variable is set to enabled. I don't have time to do so so am not assigning this to myself.
brmassa?
Comment #5
brmassa commentednedjo
as was thinking about do this auto-update feature. as long the code isnt commented, it was hard to find the proper way... but i need this feature so... voila: when you update a attribute's price all subproducts' prices will also be updated.
just after
it should be
1* it wont update prices after the 'enable dynamic pricing' be turned on. i dont know where the code should be inserted (after _settings all variables are saved and thats all...) if you knows where, add this (similar, but not the same code as above):
2* as i once said, i cant create a patch coz my modules have many other mods. i suggest to you do so.
regards,
Massa
Comment #6
brmassa commented