Post by SubatWest » Thu Oct 27, 2016 12:45 am

Hi

Has anyone used this extension.
https://www.opencart.com/index.php?rout ... _license=0

It does a good job but does not seem to complete the task and whilst it acknowledges the unsubscribe with the correct message it does not clear the entry box after a new email nor issue a success message. It does add the email to the database. Have tried to contact the author but no success. Any ideas?

Thanks

Active Member

Posts

Joined
Fri Oct 31, 2014 1:29 am

Post by cyclops12 » Thu Oct 27, 2016 3:05 am

That would be because the module is for 2.0.2.0 and you are using 2.1.0.1.......they are different!!!

Expert Member

Posts

Joined
Sun Sep 27, 2015 1:10 am

Post by SubatWest » Thu Oct 27, 2016 3:43 am

Yes I understand that but the coding and referencing within the module are not in conflict with OC version, as far as I can see. As I say the module slots into place and runs up until the execution of the end command. I noted that back in Apr another user posted the same issue but followed it up with a quote he had 'fixed it' but frustratingly he did not say how! By the way I have other version modules running on my version that are 2x.

Active Member

Posts

Joined
Fri Oct 31, 2014 1:29 am

Post by cyclops12 » Thu Oct 27, 2016 5:49 pm

Ok i shall try it out tonight if i get time and let you know if it works for me

Expert Member

Posts

Joined
Sun Sep 27, 2015 1:10 am

Post by SubatWest » Sun Oct 30, 2016 10:56 pm

Hi
Did you ahve any comments re your trial?
Thanks

Active Member

Posts

Joined
Fri Oct 31, 2014 1:29 am

Post by cyclops12 » Mon Oct 31, 2016 12:31 am

Yeah sorry for the late reply...
I installed this on a fresh default 2.0.3.1 version and it seems to be ok, not sure what im supposed to be looking for but the messages appear and email clears when subscribing
subscribe.JPG

subscribe.JPG (29.28 KiB) Viewed 1661 times

and unsubscribing
unsubscribe.JPG

unsubscribe.JPG (28.8 KiB) Viewed 1661 times


Expert Member

Posts

Joined
Sun Sep 27, 2015 1:10 am

Post by cyclops12 » Mon Oct 31, 2016 12:47 am

Another thing to add is this looks ok in "content bottom" but wont fit in left or right column layout

Also am getting error message:
Error.JPG

Error.JPG (19.72 KiB) Viewed 1660 times

so looking into that :)

EDIT: in said file on line 42 you have

Code: Select all

<div class="row" id="newsletter<?php echo $module; ?>">
I changed it to

Code: Select all

<div class="row" id="newsletter">
and no more error message and all still works

Expert Member

Posts

Joined
Sun Sep 27, 2015 1:10 am

Post by SubatWest » Mon Oct 31, 2016 7:22 am

Thanks for that.
I tried the change but no effect. Despite the appearance that everything is similar in structure to the different OC versions there is obviously a difference as you originally wrote. Will investigate further.
Thanks

Active Member

Posts

Joined
Fri Oct 31, 2014 1:29 am

Post by SubatWest » Mon Oct 31, 2016 6:26 pm

Hi
Have checked everything and there is no reason obvious as to why the extension is not functioning correctly. When I unsubscribe it's fine.
1_2016-10-31 10_10_02-Your Store.png

When I unsubscribe. iget the following: - 1_2016-10-31 10_10_02-Your Store.png (8.55 KiB) Viewed 1641 times

When I immediately subscribe another email without cancelling the message I get the following :
2_2016-10-31 10_11_02-Your Store.png

2_2016-10-31 10_11_02-Your Store.png (9.09 KiB) Viewed 1641 times

The message does not disappear and no success message appears BUT the email does get posrted!

Then in a fresh entering of an email I get after 'Loading' appears:
3_2016-10-31 10_17_42-Your Store.png

3_2016-10-31 10_17_42-Your Store.png (6.9 KiB) Viewed 1641 times

Again no success message BUT the email does get posted.
The .tpl scrip appears fine:

Code: Select all

<script language="javascript">
jQuery(document).ready(function($) {
	$('#lt_newsletter_form').submit(function(){
		$.ajax({
			type: 'post',
			url: '<?php echo $action; ?>',
			data:$("#lt_newsletter_form").serialize(),
			dataType: 'json',			
			beforeSend: function() {
				$('.btn-newsletter').attr('disabled', true).button('loading');
			},	
			complete: function() {
				$('.btn-newsletter').attr('disabled', false).button('reset');
			},				
			success: function(json) {
				$('.alert, .text-danger').remove();
				$('.form-group').removeClass('has-error');

				if (json.error) {
					$('#lt_newsletter_module').after('<div class="alert alert-danger newsletter-msg">' + json.error + '<button type="button" class="close" data-dismiss="alert">&times;</button></div>');
				} else {
					$('#lt_newsletter_module').after('<div class="alert alert-success newsletter-msg">' + json.success + '<button type="button" class="close" data-dismiss="alert">&times;</button></div>');
					$('#lt_newsletter_email').val('');
				}
			}

		});
		return false;
	});
});
</script>   
and the calling code also seems fine:

Code: Select all

	public function subscribe()
	{
		$this->load->language('module/lt_newsletter');
		
		$this->load->model('module/lt_newsletter');

		if (($this->request->server['REQUEST_METHOD'] == 'POST'))
		{
			$email = $this->request->post['lt_newsletter_email'];
			
			if ((utf8_strlen($email) > 96) || !preg_match('/^[^\@]+@.*.[a-z]{2,15}$/i', $email)) {
				$json['error'] = $this->language->get('error_invalid');
			}
			else{
				$row = $this->model_module_lt_newsletter->row($email);
			
      	if($row)
				{
					$this->model_module_lt_newsletter->unsubscribe($email);
					$json['success'] = $this->language->get('text_unsubscribed');
				}
				else{
					$this->model_module_lt_newsletter->subscribe($email);
					$json['success'] = $this->language->get('text_subscribed');
          
         
The

Code: Select all

$this->model_module_lt_newsletter->unsubscribe($email);
					$json['success'] = $this->language->get('text_unsubscribed');
does work BUT the

Code: Select all

$this->model_module_lt_newsletter->subscribe($email);
					$json['success'] = $this->language->get('text_subscribed');
does not.

I have tried to contact the author directly and through other posts but no response. So I am stumped.
:(

Active Member

Posts

Joined
Fri Oct 31, 2014 1:29 am

Post by cyclops12 » Mon Oct 31, 2016 8:50 pm

Well as long as all the files were uploaded correctly then i can only assume that another mod/extension is conflicting with it somehow as it works as it should on a default 2.0.3.1 with no extra extensions/mods installed

Depending on how many extra mods you have installed you could disable them one at a time and retry the newsletter module until you come across the culprit. Remember to refresh each time though ;D

Expert Member

Posts

Joined
Sun Sep 27, 2015 1:10 am

Post by SubatWest » Tue Nov 01, 2016 5:34 pm

Just to close this subject.
The issue was a conflict between xaamp and the module it appears. When I moved the site outside the xaamp enviorment it worked first time.

Active Member

Posts

Joined
Fri Oct 31, 2014 1:29 am

Post by cyclops12 » Tue Nov 01, 2016 5:52 pm

Hmm bit annoying but at least you got it working ;D

Expert Member

Posts

Joined
Sun Sep 27, 2015 1:10 am
Who is online

Users browsing this forum: No registered users and 4 guests