diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index aae5bc87f..0a6f9f6d1 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -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 diff --git a/lib/WebGUI/Asset/MatrixListing.pm b/lib/WebGUI/Asset/MatrixListing.pm index eaf913ee7..39eaf0d88 100644 --- a/lib/WebGUI/Asset/MatrixListing.pm +++ b/lib/WebGUI/Asset/MatrixListing.pm @@ -335,21 +335,17 @@ sub getEditForm { foreach my $category (keys %{$self->getParent->getCategories}) { $form->raw(''.$category.''); - 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';