-
Notifications
You must be signed in to change notification settings - Fork 1
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
PSHEASSN-517: Handle fees block in Event Info page #11
base: PSHEASSN-463-member-and-non-member-pricing
Are you sure you want to change the base?
PSHEASSN-517: Handle fees block in Event Info page #11
Conversation
7fc8a4d
to
8da8e62
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really don't understand the "technical details" of this ticket that are related to this commit 8da8e62 and not sure what are you trying to solve here, can you maybe try to word it differently, can you also try to write what is the issue from the user perspective in the "before" and "after" sections, because the screenshots alone does not tell much.
@@ -62,7 +62,14 @@ protected function buildForm($formName, &$form) { | |||
continue 2; | |||
} | |||
|
|||
$priceFieldValueID = $element->getAttribute('value'); | |||
if ($isCheckboxElement) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would alter this to :
if ($isCheckboxElement) {
// for civicrm versions >= 5.35.0
$priceFieldValueID = $element->getAttribute('id');
}
else {
// for civicrm versions < 5.35.0
$priceFieldValueID = $element->getAttribute('value');
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I've updated my PR,
This is not CiviCRM 5.35.1 issue, I tried it on 5.28 and it seems that $element->getAttribute('value')
for checkbox will always return "1"
Hence we need to use the id attribute.
8da8e62
to
9448b4b
Compare
9448b4b
to
a79946b
Compare
a79946b
to
c0749c1
Compare
Overview
This PR is to alter the fee block in the Event Info page to show the right price field values depending on the current user's membership.
Created price set with two price field and each one has two options then configured members only event.
Before - Event Info
Event Info page will show all fee items.
After - Event Info
Event Info page will show fee items depending on the user's membership - below you will see non member price field values.
Before - Event Registration
There is no checkbox options.
After - Event Registration
Checkbox options are visible.
Technical Details
I used the
hook_civicrm_pageRun
hook to alter the Event Info page, but the values are already proccessed and sent toSmarty
template.Below you can see
$_template->_tpl_vars['feeBlock']
value:As you can see the fee items include both price fields and price field values and it is bad idea to guess the ID from the label. Instead, the method
getFeeItems
will return fee items with theirID
then altered$_template->_tpl_vars['feeBlock']
to hide price field values depending on user's membership.Comments
This PR contains these small fixes/updates :