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

index/category listing, final notifier for categories_description correct? #6467

Closed
torvista opened this issue May 20, 2024 · 4 comments · Fixed by #6469
Closed

index/category listing, final notifier for categories_description correct? #6467

torvista opened this issue May 20, 2024 · 4 comments · Fixed by #6469

Comments

@torvista
Copy link
Member

$zco_notifier->notify('NOTIFY_HEADER_INDEX_MAIN_TEMPLATE_VARS_PAGE_BODY', NULL, $tpl_page_body, $current_categories_name);
require($template->get_template_dir($tpl_page_body, DIR_WS_TEMPLATE, $current_page_base,'templates'). '/' . $tpl_page_body);
// This should be last line of the script:
$zco_notifier->notify('NOTIFY_HEADER_END_INDEX_MAIN_TEMPLATE_VARS', NULL, $current_categories_description);

I was looking at modifying the categories description and see this notifier is after the template is loaded/after the category description is used.

@scottcwilson
Copy link
Sponsor Contributor

I wonder if we should add $current_categories_description as a parameter to NOTIFY_HEADER_INDEX_MAIN_TEMPLATE_VARS_PAGE_BODY.

@drbyte
Copy link
Member

drbyte commented May 20, 2024

Yes that should probably be changed.

WORKAROUND: Since $current_categories_description is a variable in global scope, you could probably just global $current_categories_description in your Observer's update method for NOTIFY_HEADER_INDEX_MAIN_TEMPLATE_VARS_PAGE_BODY and alter its content directly.

@torvista
Copy link
Member Author

Yes, I often do that...which makes me think why specifically pass any variable that is global?

@scottcwilson
Copy link
Sponsor Contributor

Because it makes the code more self documenting. The intent is much clearer.

scottcwilson added a commit to scottcwilson/zencart that referenced this issue May 22, 2024
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.

3 participants