VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: bennopriceless on January 20, 2019, 06:52:21 AM

Title: Back in stock notification not working
Post by: bennopriceless on January 20, 2019, 06:52:21 AM
VirtueMart 3.2.14
Joomla! 3.8.8 Stable
PHP  7.2.13

Hi,

I have a lot of customers signing up for back in stock notifications but when I update the stock it does not seem the emails are sent. I have subscribed for the notifications on different products on multiple email accounts and it has not worked on any of them.

All other system emails appear to work correctly. Configuration/shoppers/myaccount is set to receive system emails and there are not other users set as vendor in the mysql table. Configuration/emails is set to HTML mail.

In Joomla mail settings "Send mail" and mass email are enabled, and mailer is set to PHP. When I send the test mail, it comes through right away.

I'm fairly new at this so not sure if it is something I'm doing wrong but some advice would be great.

Thank you for your time.
Title: Re: Back in stock notification not working
Post by: Jörgen on January 20, 2019, 09:34:50 AM
Updating stock does not suffice. If the users are still on the sending list in the products edit the eails have not been sent. You have to manually send the email in product edit by clicking send email.

By the way, You have to make a plan to update Your shop. Both VM and Joomla are old and insecure.

Jörgen @ Kreativ Fotografi
Title: Re: Back in stock notification not working
Post by: bennopriceless on January 20, 2019, 09:41:47 AM
Thank you for your reply. I will be updating in the near future.

The send email button doesn't seem to work for me. I click it but nothing loads and no emails are sent. Is there something I'm doing wrong?
Title: Re: Back in stock notification not working
Post by: Jörgen on January 20, 2019, 10:07:41 AM
Can You see a list of custumers in the product edit ? Without a list, no eails. Does the super admin get notified ?

Jörgen @ Kreativ Fotografi
Title: Re: Back in stock notification not working
Post by: bennopriceless on January 20, 2019, 10:44:21 AM
Yes, when I go onto some products I can see 4-5 names/emails that are waiting for the notification. When I check "Users waiting to be notified when this product is back in stock " and then "Use notification template", then send email, nothing happens. It is the same when I choose to type the email manually.

I just subscribed the to product with my super user account and then toggled the stock, tried sending the email again, still nothing.

Any idea what might be causing this?

Thank you very much for the help.
Title: Re: Back in stock notification not working
Post by: Jörgen on January 20, 2019, 17:40:50 PM
I would guess that this comes from an out of date plugin in or extension. You are using PHP 7.2.13.
Turn on full error reporting in Joomla and see what is failing. This could also affect other parts of Your website.

Jörgen @ Kreatuv Fotografi
Title: Re: Back in stock notification not working
Post by: bennopriceless on January 21, 2019, 09:47:46 AM
Thanks for the reply. I'll have a look through the error logs and also see if I can do some updates.
Title: Re: Back in stock notification not working
Post by: bennopriceless on January 23, 2019, 04:57:23 AM
Hello,

I have now updated my site to the lastest Virtuemart and Joomla (VirtueMart 3.4.3 10005, Joomla 3.9.2) as well as updating extensions except for ones like CSVI and Akeeba backup (I will do these another time). Unfortunately, this didn't help as the back in stock "Send Email" Button still does not work.

I did however, make some progress. I install Sytem Fatal Catcher plugin from here: https://www.rupostel.com/utilities-for-joomla/extensions/fatal-catcher-plugin

Upon installing this and clicking the "Send Email" button, I was bombarded with 30 emails with this error:

Error message data:
4096 Object of class stdClass could not be converted to string in file: /home/mysite/public_html/libraries/src/Language/Language.php line: 364

After receiving these emails, the back in stock notifications were sent and received on my dummy product/email. After disabling the plugin again, the "Send Email" button does not seem to work again.

I checked the code related to the error above but I don't have the experience/knowledge to make any sense of it:

public function _($string, $jsSafe = false, $interpretBackSlashes = true)
{
// Detect empty string
if ($string == '')
{
return '';
}

$key = strtoupper($string);

if (isset($this->strings[$key]))
{
$string = $this->strings[$key];

// Store debug information
if ($this->debug)
{
$value = \JFactory::getApplication()->get('debug_lang_const') == 0 ? $key : $string;
$string = '**' . $value . '**';

$caller = $this->getCallerInfo();

if (!array_key_exists($key, $this->used))
{
$this->used[$key] = array();
}

$this->used[$key][] = $caller;
}
}
else
{
if ($this->debug)
{
$caller = $this->getCallerInfo();
$caller['string'] = $string;

if (!array_key_exists($key, $this->orphans))
{
$this->orphans[$key] = array();
}

$this->orphans[$key][] = $caller;

$string = '??' . $string . '??';
}
}

if ($jsSafe)
{
// Javascript filter
$string = addslashes($string);
}
elseif ($interpretBackSlashes)
{
if (strpos($string, '\\') !== false)
{
// Interpret \n and \t characters
$string = str_replace(array('\\\\', '\t', '\n'), array("\\", "\t", "\n"), $string);
}
}

return $string;
}


Do you have any thoughts on what I could try next or what I could do to fix this?

Thanks again for the help, it is very much appreciated.




Title: Re: Back in stock notification not working
Post by: Jörgen on January 23, 2019, 06:58:45 AM
Looks like something is wrong with Your language setup. What languages do You use and is this properly installed ? What happens if You switch to english in both front and backend ?

Jörgen @ Kreativ Fotografi
Title: Re: Back in stock notification not working
Post by: bennopriceless on January 23, 2019, 07:34:36 AM
Hi there,

I have selected English (en-gb) in Joomla and Virtuemart and disabled all other languages in manage plugins. Still no change though unfortunately; the "Send Email" button still does not work.

Is there anything else I could try?

Thank you very much.
Title: Re: Back in stock notification not working
Post by: pinochico on January 24, 2019, 15:19:32 PM
Use app Virtuemart Email Manager with plugin Notify and new view in Virtuemart - Waiting list.
This app send email automatically after you update stock and no need go to product detail - some admins load stock info from csv or ERP :)

https://helpdesk.easy.minion.cz/aplikace/vm-mailing-manager


Rudolf
Title: Re: Back in stock notification not working
Post by: bennopriceless on January 25, 2019, 03:14:52 AM
Thank you for the reply.

Does this work in English or is there an English version of this?

Kind regards
Title: Re: Back in stock notification not working
Post by: GJC Web Design on January 25, 2019, 11:50:27 AM
QuoteI did however, make some progress. I install Sytem Fatal Catcher plugin from here: https://www.rupostel.com/utilities-for-joomla/extensions/fatal-catcher-plugin

Upon installing this and clicking the "Send Email" button, I was bombarded with 30 emails with this error:

switch xdebug on on your server and the call stack will show you where the libraries/src/Language/Language.php is being called from so u can find the problem
Title: Re: Back in stock notification not working
Post by: pinochico on January 26, 2019, 12:07:30 PM
bennopriceless:

not yet, because this is only helpdesk for our client's from Czech Republic. You can use Google translator.

But version is english, sure.

Rudolf
Title: Re: Back in stock notification not working
Post by: bennopriceless on January 26, 2019, 14:37:57 PM
@pinochico

Thank you very much for the suggestion. If I can't get this working normally I'll use this.

@GJC Web Design

Xdebug doesn't seem to be available with my webhost/cpanel. I have tried checking for PHP errors but it only seems that deprecated warnings show up. Is there anything else I can try?

Thank you very much for the help everyone.
Title: Re: Back in stock notification not working
Post by: GJC Web Design on January 27, 2019, 13:52:09 PM
in  /home/mysite/public_html/libraries/src/Language/Language.php line: 364  add some backtrace() to try and find where it is being called from

https://www.w3schools.com/php/func_error_debug_backtrace.asp

Title: Re: Back in stock notification not working
Post by: bennopriceless on January 27, 2019, 18:51:41 PM
Hi there,

Thank you for the reply but I'm a little bit confused about how to do this. The code on that line is as follows;

$string = str_replace(array('\\\\', '\t', '\n'), array("\\", "\t", "\n"), $string);

How would I add the backtrace to this? If I copy and paste anything to the end of that is causes an error on the site.

Apologies for the inconvenience, my coding skills are very limited.

Title: Re: Back in stock notification not working
Post by: Jörgen on January 27, 2019, 19:11:31 PM
Then You should add this on the line before the failing line:

var_dump(debug_backtrace());

best regards
Jörgen @ Kreativ Fotografi
Title: Re: Back in stock notification not working
Post by: bennopriceless on January 27, 2019, 20:05:57 PM
Thank you, no errors on the site with this but what is the next step? Where can I view the results of this backtrace?

In the error log I can see a line I didn't notice before but I'm not sure if it is related to this issue or not:

[26-Jan-2019 05:17:08 Pacific/Auckland] PHP Warning:  array_replace(): Argument #2 is not an array in /home/mysite/public_html/libraries/src/Document/Document.php on line 694

Please advise.

Thank you very much for your time.
Title: Re: Back in stock notification not working
Post by: Jörgen on January 27, 2019, 21:55:06 PM
Debugging an old VM and Joomla version almost totally blind is an impossible task. Hire a developer or upgrade to the latest VM and Joomla verions.

Jörgen @ Kreativ Fotografi
Title: Re: Back in stock notification not working
Post by: bennopriceless on January 27, 2019, 22:51:40 PM
Hi,

I am already on the latest versions:

VirtueMart 3.4.3 10005
Joomla! 3.9.2 Stable
PHP 7.2.13 (Max my server supports)
Title: Re: Back in stock notification not working
Post by: GJC Web Design on January 27, 2019, 23:57:10 PM
As Jörgen says -- to debug this you have to have some knowledge of php etc and access to the site

to do that you need a dev and they will want paying..

you can use the backtrace immediately after the function call or start looking at the params that are being received

the error is  Object of class stdClass could not be converted to string

so is $string an object? if so why when the func is expecting a string? where is it sent from?
where is  public function _($string, $jsSafe = false, $interpretBackSlashes = true) being called from?

afaik Vm uses all its own functions for things like this so is the culprit even VM in this case or some other plug/ext etc