Call to undefined method Infusionsoft\Api\Rest\ContactService::addWithDupCheck() - php

This was working all this while with no issues and updates.
$user_id = $infusionsoft->contacts->addWithDupCheck($contact, 'Email');
Now all of a sudden it isn't
PHP Fatal error: Uncaught Error: Call to undefined method
Infusionsoft\Api\Rest\ContactService::addWithDupCheck() in
/home/user/public_html/infusionsoft/addContact.cli.php:29
~/public_html/infusionsoft$ cat composer.json
{
"require": {
"infusionsoft/php-sdk": "^1.0"
}
}

InfusionSoft has replaced their older XML-RPC API with REST. REST is now default. So I had to do :
$user_id = $infusionsoft->contacts('xml')->addWithDupCheck($contact, 'Email');

Related

Zend framework 3 and rackspace authenticate() is not working

This code was working fine with zf2 but when i migrated to ZF3 it is giving me the following error
$user = 'username';
$key = 'secret key';
$rackspace = new ZendService\Rackspace\Files($user,$key);
if ($rackspace->authenticate()) {
printf("Authenticated with token: %s",$rackspace->getToken());
} else {
printf("ERROR: %s",$rackspace->getErrorMsg());
}
File : zendframework\zendservice-rackspace\library\ZendService\Rackspace\AbstractRackspace.php:365
Message: Call to a member function getFieldValue() on boolean
The error is from the Rackspace library, I haven't use getFieldValue() anywhere
IN the Library itself there is a line that was causing the error
The line 401 in AbstractRackspace.php
$this->managementUrl = $result->getHeaders()->get(self::MANAGEMENT_URL)->getFieldValue();
the error was due to this line as the MANAGEMENT_URL is not set there in the header. i commented that line in the file and the error is gone

php 7.0 fatal error Call to undefined method Product::

I try to used to an old customized module in my Prestashop that runs with php 7.0.
I got an error and no idea...
Fatal error: Uncaught Error: Call to undefined method Product::getFrontFeaturesHiddenByNameStatic()
And here is the line of code.
$feature = Product::getFrontFeaturesHiddenByNameStatic((int)($params['cookie']->id_lang), $product['id_product'],'_Descriptif accueil');
And that function is defined in "override" folder.
public static function getFrontFeaturesHiddenByNameStatic($id_lang, $id_product, $featureName) {
self::getFrontFeaturesStatic($id_lang, $id_product);
if( isset(self::$_frontFeaturesCacheHidden[$id_product.'-'.$id_lang]) )
foreach(self::$_frontFeaturesCacheHidden[$id_product.'-'.$id_lang] as $feature) {
if( $featureName == $feature["name"] )
return $feature;
}
return null; // nothing has been found
}
Thanks in advance !
I think I found the solution.
Actually the override definition was not in the right folder.
It was in override/classes and failed, while set in modules/mymodule/override/classes, it seems to work fine...
Thank for your help!

Use prestashop Mail::Send in external PHP file

i trying to use Prestashop Mail::Send in external php file (Our API endpoint)
I tryied include config.inc.php, init.php also. It looks like API working with PHP mail functions. But presta have Mail class, other Prestashop classes works correctly.
I have Prestashop 1.6.1.9 and PHP 5.6
I have code:
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);
}
}
But i getting error:
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/
Other Prestashop classes work correctly. (Configuration::get, Product::getPriceStatic)
Try to call this method non-statical.
If you have PHP 5.4+ try to use this code:
return (new Mail)->Send($id_land, $template_name, $title, $templateVars, $email, "", $from, $fromName);
Or if u have PHP < 5.4, try this:
$mail = new Mail();
return $mail->Send($id_land, $template_name, $title, $templateVars, $email, "", $from, $fromName);

Fatal error: Call to undefined function tep_session_name()

I am trying to update one of the sites I maintain to the latest PHP and during this, I have come across the following error:
Fatal error: Call to undefined function tep_session_name() in ... /includes/application_top.php on line 83
The code it is referring to is:
// set the session name and save path
tep_session_name('osCAdminID');
tep_session_save_path(SESSION_WRITE_DIRECTORY);
But I have looked at the sessions.php file are the function is defined in the below code:
function tep_session_name($name = '') {
if ($name != '') {
return session_name($name);
} else {
return session_name();
}
}
Any help in identifying the cause would be greatly appreciated.
Thanks, E.
I'm absolutely sure, that you call this function before you include file with function declaration

Fatal error: Class 'JFactory' not found in Joomla upgrade

I've just upgraded my Joomla to the version 2.5.16
One file with the following code is now returning the error:
Fatal error: Class 'JFactory' not found in
This is the code:
<?php
$user = JFactory::getUser();
$group_id = &JFactory::group_id();
$user_id = $user->get('id');
?>

Categories