I tryed to set debug to yes but do not succeed.I saw nothing in the log regarding my plugin (is it in "Fichier de log pour les paiements" button "voir le rapport" that "echo" should be displayed ? )
I will try to continue to understand how it works ...
But what I have discovered is that it works fine when I complete the payment in the Admin Hikashop part but not when it is triggered from paypal (on localhost, I only tested with the admin part, so I have the same behavior as when i am in live mode).
Does someone have an explanation ? Thanks
My query is on a function...maybe a clue ?
my code below (Ihave deleted some non interesting parts)
class plgHikashopMonsite extends JPlugin{
function plgHikashopMonsite(&$subject, $config){
parent::__construct($subject, $config);
}
function onAfterOrderUpdate(&$order,&$send_email) {
$orderClass = hikashop_get('class.order');
$order = $orderClass->loadFullOrder($order->order_id, true, false);
$db = JFactory::getDbo();
if($order->order_status === 'confirmed')
{
foreach($order->products as $product) {
...
$n_sem = $this->CalculSemaines($order->history[0]->history_created,$nb_sem);
for($ind = 1; $ind < $nbre_indice; $ind++)//insert a row in Abonnes for each product
{
$object = (object)array(
...
);
$db->insertObject('#__monsite_abonnes', $object);
}
}
}
return true;
}
/* calcul de la semaine de fin abonnement = semaine de départ + nbre de semaine */
/*-----------------------------------------------------------------------------*/
[b]public function CalculSemaines($fn_date_order,$fn_nb_sem) [/b]
{
// récupération de la date & heure limite maxi d'acceptation de la commande (paramétrée côté admin).
$fl_param_n_jour = JComponentHelper::getParams('com_monsite) ->get('fl_Jour_limite_pari');
$fl_param_heure = JComponentHelper::getParams('com_monsite') ->get('fl_heure_limite_pari');
//recup date & heure de la commande
$date_com_d = gmdate("Y-m-d", $fn_date_order);
$date_com_h = gmdate("H:i:s", $fn_date_order);
//recherche du numero du jour de la commande
$tabDate = explode('-', $date_com_d);
$timestamp = mktime(0, 0, 0, $tabDate[1], $tabDate[2], $tabDate[0]);
$n_jour_commande = date('w', $timestamp);
//recherche de la semaine liée à la date de la commande dans la table Calendar.
[b] $db = JFactory::getDbo();
$query = $db->getQuery(true)
->select(array('cal_n_sem','cal_c_j'))
->from($db->quoteName('#__footlisted_calendar'))
->where($db->quoteName('cal_d').' = "'.$date_com_d.'"');
$db->setQuery($query);
$date_calendar = $db->loadObject();[/b][color=#bb4444] => seems that get nothing when coming from paypal, ok when in admin part.[/color]
...
}