[TYPO3-commerce] FYI 96 #9894 - tx_commerce_product->get_Articles_by_AttributeArray returns wrong articles
Morten Haggren
mo at idefa.dk
Fri Sep 24 08:44:00 CEST 2010
Had my cup of morning coffee, and now I realize what it changes - the
2nd run though the foreach is never changed in the old method, so;
+1 by reading ( & coffee! )
oh and do get rid of that foolish "if( $first )" code
On 2010-09-24 08:36, Morten Haggren wrote:
> Reading through the code I dont see how this will change the outcome of
> the function;
>
> Before;
>
> $next_array was reset before the foreach, and then again on each run
> through it that wasn't the $first
>
> After;
> $next_array is reset at the start of each run through the foreach
>
> If your getting different results all of a sudden I'm guessing this
> change isn't responsible.
>
> However since the code is equivalent I see no harm in implementing it,
> I'd suggest taking the same opertunity to get completely rid of the "if
> ( $first )" code structure as it's a quite inelegant solution to an easy
> problem ( simply define $attribute_uid_list as an array before the
> foreach, and intersect each run though regardless of what run it is )
>
> /Morten
>
> On 2010-09-23 16:42, Sascha Egerer wrote:
>> This is a SVN patch request.
>>
>> Type: Bugfix
>>
>> Branches:
>> trunk
>>
>> Description:
>> The function get_Articles_by_AttributeArray in tx_commerce_product
>> returns wrong articles because an array is not initialized in a foreach
>> loop.
>>
>> Solution:
>> Initialize the variable after each loop iteration
>>
>>
>> Regards
>>
>> Sascha Egerer
>
>
--
RewriteRule ^Morten Olesen$ Morten Haggren [R=301,L]
More information about the TYPO3-team-commerce
mailing list