CartThrob / MailingLists

Allows you to add customer to one or more Campaign Monitor or Mailchimp email lists during checkout
4 stars 1 forks source link

Currently breaks in newer versions of EE... #1

Open etheya opened 9 years ago

etheya commented 9 years ago

Noticed there is an issue with this at present due to the changes that were made within EE over the last few versions...

Fatal error: Call to undefined method Cp::set_variable() in /expressionengine/third_party/cartthrob_mailing_list/libraries/Mbr_addon_builder.php on line 119

Think its linked to the following.. https://ellislab.com/expressionengine/user-guide/development/usage/cp.html have had look at changing this but not got it right so far.

any ideas?

bgarrant commented 8 years ago

I am also getting this same issue with the Mailing List add-on. Does it even work with MailChimp any more?

Fatal error: Call to undefined method Cp::set_variable() in /expressionengine/third_party/cartthrob_mailing_list/libraries/Mbr_addon_builder.php on line 119

tyssen commented 8 years ago

I solved this by copying from cartthrob/libraries/Mbr_addon_builder.php

For the error above, replace line 119 with:

$this->EE->cp->cp_page_title = $this->EE->lang->line($this->module_name.'_module_name').' - '.$this->EE->lang->line('nav_head_'.$current_nav);

which should then thrown another error pointing at line 1608 which I fixed by replacing

'.(isset($channel_titles) ? "channels: ".$this->EE->javascript->generate_json($channel_titles).',' : NULL).'
'.(isset($product_channel_titles) ? "product_channels: ".$this->EE->javascript->generate_json($product_channel_titles).',' : NULL).'
'.(isset($fields) ? "fields: ".$this->EE->javascript->generate_json($fields).',' : NULL).'
'.(isset($product_channel_fields) ? "product_channel_fields: ".$this->EE->javascript->generate_json($product_channel_fields).',' : NULL).'
'.(isset($order_channel_fields) ? "order_channel_fields: ".$this->EE->javascript->generate_json($order_channel_fields).',' : NULL).'
'.(isset($status_titles) ? "statuses: ".$this->EE->javascript->generate_json($status_titles).',' : NULL).'
'.(isset($templates) ? "templates: ".$this->EE->javascript->generate_json($templates).',' : NULL).'
'.(isset($states) ? "states: ".$this->EE->javascript->generate_json($states).',' : NULL).'
'.(isset($countries) ? "countries: ".$this->EE->javascript->generate_json($countries).',': NULL).'
'.(isset($states_and_countries) ? "statesAndCountries: ".$this->EE->javascript->generate_json($states_and_countries).',' : NULL).'

with

'.(isset($channel_titles) ? "channels: ".json_encode($channel_titles).',' : NULL).'
'.(isset($product_channel_titles) ? "product_channels: ".json_encode($product_channel_titles).',' : NULL).'
'.(isset($fields) ? "fields: ".json_encode($fields).',' : NULL).'
'.(isset($member_fields) ? "member_fields: ".json_encode($member_fields).',' : NULL).'
'.(isset($product_channel_fields) ? "product_channel_fields: ".json_encode($product_channel_fields).',' : NULL).'
'.(isset($order_channel_fields) ? "order_channel_fields: ".json_encode($order_channel_fields).',' : NULL).'
'.(isset($status_titles) ? "statuses: ".json_encode($status_titles).',' : NULL).'
'.(isset($templates) ? "templates: ".json_encode($templates).',' : NULL).'
'.(isset($states) ? "states: ".json_encode($states).',' : NULL).'
'.(isset($countries) ? "countries: ".json_encode($countries).',': NULL).'
'.(isset($states_and_countries) ? "statesAndCountries: ".json_encode($states_and_countries).',' : NULL).'