i have a table 'ma_produit'
ma_produit_cstm.prixdevente_c is the price of sale of the produit
i have a table 'ma_commande'
ma_commande_cstm.qte_c is the quantity of the prodct ('ma_produit')
this is my logic hook
<?php
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class ma_commandeHooks {
public function verif_qte( &$bean, $event, $arguments){
}
public function prix_a_paye( &$bean, $event, $arguments){
//require_once("modules/ma_produit/ma_produit.php");
/*$prod = $bean->get_related_list(New ma_produit(),"produit");
$prod_bean = $prod['list'][0];
$prod_bean->custom_fields->retrieve();*/
$ma_produit = new ma_produit();
$ma_produit->retrieve($bean->ma_produit_id);
$query="SELECT ma_produit_cstm.* FROM ma_produit_cstm where ma_produit_cstm.id_c='" . $bean->ma_produit_id."'";
$result = $bean->db->query($query, true);
$row =$bean->db->fetchByAssoc($result);
$prix=$row ['prixdevente_c'];
$bean->prixpayant_c = $prix * $bean->qte_c;
$bean->save;
}
}
?>


LinkBack URL
About LinkBacks



Reply With Quote
Bookmarks