0
私はPrestashop Mailを使用しようとしています::外部PHPファイル(APIエンドポイント)で送信 私は、config.inc.php、init.phpも含めて試しました。 PHPのメール機能で動作するAPIのようです。しかしPrestaにはMailクラスがあり、他のPrestashopクラスは正しく動作します。prestashop Mail :: ::外部PHPファイルで送信
class VoucherModel extends baseModel{
// Other methods
public function addSubscriber($email)
{
$result = Db::getInstance()->insert("mail_subscribers", array(
"email" => pSQL($email)
));
if($result){
$cartRule = "XYZ123";
$sendMail = $this->_sendMail($email, $cartRule);
return $sendMail;
}
}
public function _sendMail($email, $code = "LOVEMANA")
{
$templateVars['{code}'] = $code;
$id_land = Language::getIdByIso('cs');
$template_name = 'sendvoucher';
$title = 'Váše kredity';
$from = Configuration::get('PS_SHOP_EMAIL');
$fromName = Configuration::get('PS_SHOP_NAME');
$mailDir = _PS_THEME_DIR_.'/mails/';
return Mail::Send($id_land, $template_name, $title, $templateVars, $email, "", $from, $fromName);
}
}
しかし、私はエラーを取得: は、私は、コードを持っているPrestaShopの1.6.1.9とPHP 5.6
を持って
Got error 'PHP message: PHP Deprecated: Non-static method Mail::send() should not be called statically, assuming $this from incompatible context in /home/97569-75425.cloudwaysapps.com/axbxzqwhfd/public_html/obchod/mobileapiv2/models/prestashop.php on line 780
PHP message: PHP Stack trace:
PHP message: PHP 1. {main}() /home/97569-75425.cloudwaysapps.com/axbxzqwhfd/public_html/obchod/mobileapiv2/index.php:0
PHP message: PHP 2. Luracast\\Restler\\Restler->handle() /home/97569-75425.cloudwaysapps.com/axbxzqwhfd/public_html/obchod/mobileapiv2/index.php:41
PHP message: PHP 3. Luracast\\Restler\\Restler->call() /home/97569-75425.cloudwaysapps.com/axbxzqwhfd/public_html/obchod/mobileapiv2/include/Luracast/Restler/Restler.php:283
PHP message: PHP 4. call_user_func_array:{/home/97569-75425.cloudwaysapps.com/axbxzqwhfd/public_html/obchod/mobileapiv2/include/Luracast/Restler/Restler.php:989}() /home/97569-75425.cloudwaysapps.com/axbxzqwhfd/public_html/obchod/mobileapiv2/include/Luracast/Restler/Restler.php:989
PHP message: PHP 5. v1\\Api->subscribe() /home/97569-75425.cloudwaysapps.com/axbxzqwhfd/public_html/obchod/mobileapiv2/include/Luracast/Restler/Restler.php:989
PHP message: PHP 6. prestashop->addSubscriber() /home/97569-75425.cloudwaysapps.com/axbxzqwhfd/public_html/obchod/mobileapiv2/v1/Api.php:1090
PHP message: PHP 7. prestashop->_sendMail() /home/97569-75425.cloudwaysapps.com/axbxzqwhfd/public_html/obchod/mobileapiv2/models/prestashop.php:764
PHP message: PHP Deprecated: Non-static method PEAR::raiseError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Mail.php on line 117
PHP message: PHP Stack trace:
PHP message: PHP 1. {main}() /home/97569-75425.cloudwaysapps.com/axbxzqwhfd/public_html/obchod/mobileapiv2/index.php:0
PHP message: PHP 2. Luracast\\Restler\\Restler->handle() /home/97569-75425.cloudwaysapps.com/axbxzqwhfd/public_html/obchod/mobileapiv2/index.php:41
PHP message: PHP 3. Luracast\\Restler\\Restler->call() /home/97569-75425.cloudwaysapps.com/axbxzqwhfd/public_html/obchod/mobileapiv2/include/Luracast/Restler/Restler.php:283
PHP message: PHP 4. call_user_func_array:{/home/97569-75425.cloudwaysapps.com/axbxzqwhfd/public_html/obchod/mobileapiv2/include/Luracast/Restler/Restler.php:989}() /home/97569-75425.cloudwaysapps.com/axbxzqwhfd/public_html/obchod/mobileapiv2/include/Luracast/Restler/Restler.php:989
PHP message: PHP 5. v1\\Api->subscribe() /home/97569-75425.cloudwaysapps.com/axbxzqwhfd/public_html/obchod/mobileapiv2/include/Luracast/Restler/Restler.php:989
PHP message: PHP 6. prestashop->addSubscriber() /home/97569-75425.cloudwaysapps.com/axbxzqwhfd/public_html/obchod/mobileapiv2/v1/Api.php:1090
PHP message: PHP 7. prestashop->_sendMail() /home/97569-75425.cloudwaysapps.com/axbxzqwhfd/public_html/obchod/mobileapiv2/models/prestashop.php:764
PHP message: PHP 8. Mail->send() /home/97569-75425.cloudwaysapps.com/axbxzqwhfd/public_html/obchod/mobileapiv2/models/prestashop.php:780
', referer: https://beta.drink-mana.com/en/
その他PrestaShopのクラスが正しく動作します。 (Configuration :: get、Product :: getPriceStatic)
何も、まだ取得:非推奨:非静的メソッドPEAR :: raiseError()は静的に呼び出されるべきではありません。$ thisは/usr/share/php/Mail.phpの117行目で互換性のないコンテキストと仮定してください。 –
このエラーを取り除くには、/ usr/share/php/Mail.phpに置き換えてPEAR :: raiseErrorを(new PEAR) - > raiseErrorに置き換えます。私はshureではないが、それは助けることができる。 –
これを行う権限はありません。 –