Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Carousel Slides in Wrong Order #53

Closed
miqrogroove opened this issue Dec 27, 2022 · 3 comments · Fixed by #54
Closed

Carousel Slides in Wrong Order #53

miqrogroove opened this issue Dec 27, 2022 · 3 comments · Fixed by #54

Comments

@miqrogroove
Copy link
Contributor

miqrogroove commented Dec 27, 2022

When loading an object Details page in v1.7.15, the carousel slides are in ascending numerical order by representation ID. The detailRepresentationThumbnails on the other hand are in catalog order. This discrepancy causes unexpected behavior of the left and right arrow clicks.

This is a continuation of problems described in #38.

@miqrogroove
Copy link
Contributor Author

miqrogroove commented Dec 27, 2022

This is where it looks like representations are being ordered by ID for slides:

ksort($va_rep_info);

The array keys are set to zero for primary representation, otherwise by ID (?) -- needs testing.

Here is the input data I will use to test this:

mysql> SELECT * FROM ca_objects_x_object_representations WHERE object_id = 2906;
+-------------+-----------+-------------------+------------+------+
| relation_id | object_id | representation_id | is_primary | rank |
+-------------+-----------+-------------------+------------+------+
|        3636 |      2906 |              3542 |          1 | 3542 |
|        3637 |      2906 |              3543 |          0 | 3543 |
|        3638 |      2906 |              3544 |          0 | 3544 |
|        3642 |      2906 |              3545 |          0 | 3642 |
|        3644 |      2906 |              3546 |          0 | 3644 |
|        3643 |      2906 |              3547 |          0 | 3643 |
+-------------+-----------+-------------------+------------+------+
6 rows in set (0.00 sec)

@miqrogroove
Copy link
Contributor Author

My test stubs using above input data failed as expected. For each of the last five rows, this expression evaluated to true and forced the $vn_index assignment to the representation ID on the next line after that:

}elseif (!($vn_index = (int)$qr_reps->get(RepresentableBaseModel::getRepresentationRelationshipTableName($qr_reps->tableName()).'.rank'))) {

@miqrogroove
Copy link
Contributor Author

miqrogroove commented Dec 27, 2022

New test using the same data and the following stub...

var_export( $qr_reps->get(RepresentableBaseModel::getRepresentationRelationshipTableName($qr_reps->tableName()).'.rank'), true )

... always returns NULL

Drilling down further, $qr_reps->tableName() returns as expected with 'ca_object_representations'.

Then RepresentableBaseModel::getRepresentationRelationshipTableName() returns NULL. Here is the culprit!

PR will be sent shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant