le 19 Juin participez à Drupagora

Méthode de calcule en multiplication

Ludo@
Invité n'ayant pas de compte PHPfrance

03 Nov 2012, 19:57

Bonjour


Si vous pouviez me donner une méthode de calcule sur cette page php je voudrais à la place d'un calcule divison en que ça se fasse en multiplication sur la page php il y a une opération de division je vous joint cette page php et les images pour une modification merci pour votre soutien.

Voir les images Merci

[img][IMG]http://img11.hostingpics.net/pics/557844calculedevisdiviser.jpg[/img][/img]

[img][IMG]http://img11.hostingpics.net/thumbs/mini_475286calculedevisdiviser2.jpg[/img][/img]

[php]<?php




class box extends Module
{
private $_html = '';
private $_postErrors = array();
private $idArea;

public function __construct()
{
$this->name = 'box';
$this->tab = 'Calcule';
$this->version = '1.0';

$config = Configuration::get('BOX_ID_AREA');
if (isset($config)) $this->idArea = $config;

parent::__construct();

$this->page = basename(__FILE__, '.php');
$this->displayName = $this->l('Box Calculation');
$this->description = $this->l('Calculates box quantities by square metters.');
$this->confirmUninstall = $this->l('Are you sure you want to delete uninstall this module?');
if (!isset($this->idArea))
$this->warning = $this->l('Area ID must be configured in order to use this module correctly');
}

public function install()
{
if (!parent::install()
OR !$this->registerHook('extraRight') OR !$this->registerHook('productActions'))
return false;
return true;
}

public function uninstall()
{
if (!parent::uninstall()
OR !Configuration::deleteByName('BOX_ID_AREA'))
return false;
return true;
}

private function _postValidation()
{
if (isset($_POST['btnSubmit']))
{
if (empty($_POST['idArea']))
$this->_postErrors[] = $this->l('Area id is required.');
}
}

private function _postProcess()
{
if (isset($_POST['btnSubmit']))
{
Configuration::updateValue('BOX_ID_AREA', $_POST['idArea']);
}
$this->_html .= Module::displayConfirmation($this->l('Settings updated'));
}

private function _displayBox()
{
$this->_html .= '<br /><img src="../modules/box/img/box128.png" style="float:left;">
<br /><br /><span style="color:blue;font-weight:bold;">'.$this->l('This module allows the customer to calculate the required amount of boxes according to the area to be imaged.').'</span><br />
<br /><span style="color:black;font-weight:bold;">'.$this->l('It adds an area on the product page so that the customer carries out this calculation.').'</span>
<br /><br /><br /><br /><br /><br />';
}

private function _displayForm()
{
$this->_html .=
'<form action="'.$_SERVER['REQUEST_URI'].'" method="post">
<fieldset>
<legend><img src="../img/admin/contact.gif" />'.$this->l('Features ID Configuration').'</legend>
<table class="table" border="0" width="900" cellpadding="0" cellspacing="2" id="form">
<tr>
<td style="padding-bottom:15px;"><b>'.$this->l('Area ID:').'&nbsp;&nbsp;</b></td>
<td><input type="text" MAXLENGTH="10" name="idArea" value="'.htmlentities(Tools::getValue('idArea', $this->idArea), ENT_COMPAT, 'UTF-8').'" /></td>
<td>'.$this->l('- The id number of the Area feature.').'</td>
<td align="center"><input class="button" name="btnSubmit" value="'.$this->l('Update settings').'" type="submit" /></td></tr>
</table> <span style="color:blue;"> ID de la caract&eacuteristique &agrave indiquer ici</span>
</fieldset>
</form>';
}

public function getContent()
{
$this->_html = '<h2>'.$this->displayName.'</h2>';

if (!empty($_POST))
{
$this->_postValidation();
if (!sizeof($this->_postErrors))
$this->_postProcess();
else
foreach ($this->_postErrors AS $err)
$this->_html .= '<div class="alert error">'. $err .'</div>';
}
else
$this->_html .= '<br />';

$this->_displayBox();
$this->_displayForm();

return $this->_html;
}

function hookExtraRight($params)
{
if (!$this->active)
return ;

$product = new Product(intval(Tools::getValue('id_product')));

if (!Validate::isLoadedObject($product))
return ;

$features = $product->getFrontFeatures(intval($params['cookie']->id_lang));
$m2 = false;
foreach($features as $key => $feature)
{
if($feature['id_feature'] == $this->idArea AND $feature['value'] != '')
{
$m2 = $feature['value'];
}
}

if(!$m2)
return ;

global $smarty;

$smarty->assign('m2', $m2);
$smarty->assign('metter', htmlEntities('m² ='));

return $this->display(__FILE__, 'productbox.tpl');

}

function hookProductActions($params)
{
if (!$this->active)
return ;

$product = new Product(intval(Tools::getValue('id_product')));

if (!Validate::isLoadedObject($product))
return ;

$features = $product->getFrontFeatures(intval($params['cookie']->id_lang));
$m2 = false;
foreach($features as $key => $feature)
{
if($feature['id_feature'] == $this->idArea AND $feature['value'] != '')
$m2 = $feature['value'];
}

if(!$m2)
return ;

global $smarty;

$smarty->assign('mm2', $m2);
$smarty->assign('metter', htmlEntities('m²'));
$smarty->assign('product', $product);

return $this->display(__FILE__, 'productaction.tpl');

}
}
?>
[/php]

ludo@
Invité n'ayant pas de compte PHPfrance

03 Nov 2012, 20:01