
Originally Posted by
DrByte
Does it help if you simply add the following to the end of the /includes/modules/media_manager.php file? (before the closing ?> line)
Code:
$zv_product_has_media = (sizeof($za_media_manager)) > 0 ? TRUE : FALSE;
Not really.
$zq_media_manager is assigned in a loop, and that only checks whether or not the LAST collection assigned to the product has a non-empty $zq_media_manager.
Also, it's not really the size of $zq_media_manager that's the issue - it's certainly possible for the query that populates $zf_media_manager_query to say that "Yeah, there's clips" when in fact the clips themselves are not in the DB. Yeah, it shouldn't happen. But it's what WAS happening.
A simpler approach which will always do the right thing is simply to remove all assignments to $zv_product_has_media except for the first one, at the top of the file, which initializes it to false.
Then, father down, where it actually fetches the clip names, change:
Code:
$zq_clips = $db->Execute($zv_clips_query);
if ($zq_clips->RecordCount() < 1) {
// $zv_product_has_media = false; <-- we removed this, remember?
} else {
while (!$zq_clips->EOF) {
to
Code:
$zq_clips = $db->Execute($zv_clips_query);
if ($zq_clips->RecordCount() > 0) {
$zv_product_has_media = true;
while (!$zq_clips->EOF) {
Of course, if the clip file doesn't exist the whole thing will come crashing to the ground. Testing it's existence seems like overkill, tho.
Thanks for the DB cleanup code.
-jim