fixed #9865: Matrix: Later added attributes are not detected in older listings

This commit is contained in:
Yung Han Khoe 2009-03-28 15:51:45 +00:00
parent 15b29252ed
commit 2f1837c608
2 changed files with 8 additions and 11 deletions

View file

@ -1,6 +1,7 @@
7.7.2
- fixed #9955: Matrix alpha sort is backwards
- fixed #9934: Matrix 2.0 - Products should be listed alphabetically
- fixed #9865: Matrix: Later added attributes are not detected in older listings
7.7.1
- the AdSku project: create a Sku that allows buyers to purchase advertising in select AdSpaces at selected priorities

View file

@ -335,21 +335,17 @@ sub getEditForm {
foreach my $category (keys %{$self->getParent->getCategories}) {
$form->raw('<tr><td colspan="2"><b>'.$category.'</b></td></tr>');
my $attributes;
if ($session->form->process('func') eq 'add'){
$attributes = $db->read("select * from Matrix_attribute where category = ? and assetId = ?",
[$category,$matrixId]);
}
else{
$attributes = $db->read("select * from Matrix_attribute as attribute
left join MatrixListing_attribute as listing using(attributeId)
where listing.matrixListingId = ? and category =? and attribute.assetId = ?",
[$self->getId,$category,$matrixId]);
}
my $attributes = $db->read("select * from Matrix_attribute where category = ? and assetId = ?",
[$category,$matrixId]);
while (my $attribute = $attributes->hashRef) {
$attribute->{label} = $attribute->{name};
$attribute->{subtext} = $attribute->{description};
$attribute->{name} = 'attribute_'.$attribute->{attributeId};
unless($session->form->process('func') eq 'add'){
$attribute->{value} = $db->quickScalar("select value from MatrixListing_attribute
where attributeId = ? and matrixId = ? and matrixListingId = ?",
[$attribute->{attributeId},$matrixId,$self->getId]);
}
if($attribute->{fieldType} eq 'Combo'){
my %options;
tie %options, 'Tie::IxHash';