-- HikaShop version -- : 2.4.0
-- Joomla version -- : 3.4.1
Hello,
I would like to get some information.
I have created a new plugin to insert a row in a table after the user confirms his cart with the status 'pending'.
After the Paypal notification, the status has to be set to 'valide'.
I suppose that if all is correct this plugin is called when the event is triggered (at the same time than Paypal plugin)...
And of course, it doesn't work...
I have read a post where the person has the same problem ...but didnt' find the answer...
When I directly code in the paypal plugin, it works !
The plugin is published in Joomla.
PHP : just some basic queries to see if it works...After,i will use data from the order to make my request.
<?php
/**
* @package HikaShop for Joomla!
* @version 2.3.2
* @author hikashop.com
* @copyright (C) 2010-2014 HIKARI SOFTWARE. All rights reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/
defined('_JEXEC') or die('Restricted access');
?><?php
class plgHikashopFootlisted extends JPlugin{
function plgHikashopFootlisted(&$subject, $config){
parent::__construct($subject, $config);
}
function onPaymentNotification(&$statuses) {
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->update($db->qn('#__footlisted_abonnes'))
->set($db->qn('abo_duree').' = 3')
->where($db->qn('id').' = 7');
try
{
$db->setQuery($query)->execute();
}
catch (Exception $exc)
{
}
return true;
}
function onAfterOrderConfirm(&$order, &$methods, $method_id){
parent::onAfterOrderConfirm($order, $methods, $method_id);
$user = JFactory::getUser();
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->update($db->qn('#__footlisted_abonnes'))
->set($db->qn('abo_n_fact').' = "test"')
->where($db->qn('id').' = 7');
try
{
$db->setQuery($query)->execute();
}
catch (Exception $exc)
{
}
return true;
}
}
XML
<?xml version="1.0" encoding="utf-8"?>
<extension type="plugin" version="1.0" method="upgrade" group="hikashop">
<name>Hikashop Footlisted Plugin</name>
<creationDate>{__DAY__} {__MONTH__} {__YEAR__}</creationDate>
<version>{__PLUGIN_VERSION__}</version>
<author>xxxxxx</author>
<authorEmail>xxxxxxx</authorEmail>
<authorUrl>http://www.hikashop.com</authorUrl>
<copyright>(C) 2010-{__YEAR__} HIKARI SOFTWARE. All rights reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<description>This plugin enables to create something</description>
<files>
<filename plugin="footlisted">footlisted.php</filename>
</files>
<params addpath="/components/com_hikashop/params">
</params>
</extension>
Have you got an idea about my problem?
Thanks a lot/mille merci !
PS : if someone has an example of inserting/updating a row using the data of the order,your welcome