Unable to add new line items to CiviCRM Order processor - javascript errors
Brusella opened this issue · comments
Hi,
I'm unable to add additional line items to the CiviCRM Order processor. In the form, I have one membership processors with two line item processors setup. However, I can only input the first line item in the Order processor. Receiving javascript errors via console- see gif screenshot.
Any advice to get this functioning would be appreciated.
Windows 10
Google Chrome
Wordpress 5.4.2
Caldera 1.9.2
Caldera Forms CiviCRM 1.0.5
So I see this is related to an issue resolved in #146
However, I'm having trouble working out where to apply the jquery fix in the relevant php file;
@am2605 -"So a fix seems to be to edit processors/order/order_config.php and add var $j = jQuery.noConflict(); at about line 293, and then use references to
Can anyone help? jquery and php is new to me.
Thanks in advance
Thanks for flagging this bug, i was able to successful patch this to resolve the bug. the steps to do so are as follows:
-
change directory to this folder
/var/www/html/wp-content/plugins/cf-civicrm-master/processors/order -
edit the order_config.php file, i use nano
nano order_config.php -
go to row 293 and add the $j = jQuery.noConflict(); line and replace $ to $j, so the code section will end up like the following, only 3 edits were required, one for the new line for JQuery and 2 $ to be changed to $j:
function cfc_add_line_item( obj ) { $j = jQuery.noConflict(); var id = obj.trigger.data( 'id' ), config = JSON.parse( $j('#' + id + ' .processor_config_string' ).val() ), item_id = 'line_item_' + ( $j( '#' + id + ' .line-item' ).length + 1 ), _name = 'config[processors][' + id + '][config]'; if ( config.line_items ) { config.line_items[item_id] = ''; } else { config['line_items'] = {} config.line_items['line_item_1'] = ''; } var processor = { id: id, config: config }; var line_item = { item_id: item_id, _name: _name }; return line_item; }
-
Then go back to the Order Processor to add the New Line!
Great. Thanks for this