Nothing appends with a simple plugin
11 years 7 months ago #191042
by webcrea
Christophe
www.webcrea.fr
Nothing appends with a simple plugin was created by webcrea
-- url of the page with the problem -- : localhost
-- HikaShop version -- : 2.3.4
-- Joomla version -- : 3.4
-- PHP version -- : 5.3.13
I don't understand, I try to do something with a very simple plugin
class plgHikashopMembership extends JPlugin
{
function plgHikashopMembership(&$subject, $config){
parent::__construct($subject, $config);
if(!isset($this->params)){
$plugin = JPluginHelper::getPlugin('hikashop', 'membership');
if(version_compare(JVERSION,'2.5','<')){
jimport('joomla.html.parameter');
$this->params = new JParameter($plugin->params);
} else {
$this->params = new JRegistry($plugin->params);
}
}
}
function onAfterOrderCreate(&$order,&$send_email){
return $this->onAfterOrderUpdate($order,$send_email);
}
function onAfterOrderUpdate(&$order,&$send_email){
$mainframe = JFactory::getApplication();
$mainframe->enqueueMessage('The customer ');
return true;
}
function onAfterOrderDelete($elements){
$mainframe->enqueueMessage('Order delete ');
return true;
}
function onProductBlocksDisplay(&$product, &$html){
$mainframe->enqueueMessage('Produit id = '.$product->product_id);
return true;
}
}
and nothing appends
the plugin is activate and when I include an error, I have an error, I'm sure is running but no message appears
-- HikaShop version -- : 2.3.4
-- Joomla version -- : 3.4
-- PHP version -- : 5.3.13
I don't understand, I try to do something with a very simple plugin
class plgHikashopMembership extends JPlugin
{
function plgHikashopMembership(&$subject, $config){
parent::__construct($subject, $config);
if(!isset($this->params)){
$plugin = JPluginHelper::getPlugin('hikashop', 'membership');
if(version_compare(JVERSION,'2.5','<')){
jimport('joomla.html.parameter');
$this->params = new JParameter($plugin->params);
} else {
$this->params = new JRegistry($plugin->params);
}
}
}
function onAfterOrderCreate(&$order,&$send_email){
return $this->onAfterOrderUpdate($order,$send_email);
}
function onAfterOrderUpdate(&$order,&$send_email){
$mainframe = JFactory::getApplication();
$mainframe->enqueueMessage('The customer ');
return true;
}
function onAfterOrderDelete($elements){
$mainframe->enqueueMessage('Order delete ');
return true;
}
function onProductBlocksDisplay(&$product, &$html){
$mainframe->enqueueMessage('Produit id = '.$product->product_id);
return true;
}
}
and nothing appends
the plugin is activate and when I include an error, I have an error, I'm sure is running but no message appears
Christophe
www.webcrea.fr
Please Log in or Create an account to join the conversation.
11 years 7 months ago #191050
by nicolas
Replied by nicolas on topic Nothing appends with a simple plugin
Hi,
The code looks ok. So I would recommend to check your plugin XML. It needs to match with the class name of the php file.
I'm suspecting that the class name is wrong in your php file based on what you put in the XML file and thus Joomla is looking for another class name which it doesn't find in the file and thus just doesn't run your code. You get the error because it's a parsing error and PHP parses the file in order to check for the class but that doesn't mean that the class name is correct for what Joomla expects.
The code looks ok. So I would recommend to check your plugin XML. It needs to match with the class name of the php file.
I'm suspecting that the class name is wrong in your php file based on what you put in the XML file and thus Joomla is looking for another class name which it doesn't find in the file and thus just doesn't run your code. You get the error because it's a parsing error and PHP parses the file in order to check for the class but that doesn't mean that the class name is correct for what Joomla expects.
Please Log in or Create an account to join the conversation.
Time to create page: 0.181 seconds