I am trying to create a price quotation module.
So far i have in my
page -> details -> details.tpl divs where my sucess failure message should appear
- roughly copied from pricealarmstatus.
I have in my tabs.tpl an include for my form in a new tab (not sure how to move that include into my module)
in my form i have
<input type="hidden" name="cl" value="[{$oViewConf->getActiveClassName()}]"/>
<input type="hidden" name="fnc" value="send"/>
In my module metadata i have
'extend' => array( 'oxEmail' => 'anfrage/extendedoxEmail', 'details' => 'anfrage/views/anfrage' )
I have then an anfrage view which extends the details view and contains the following
<?php
class Anfrage extends Details
{
/** Anfrage status.
* @var integer
*/
protected $_AnfrageStatus = null;/** * Composes and sends Anfrage written message, returns false if some parameters are missing. * * @return bool */ public function send() { $myConfig = $this->getConfig(); $myUtils = oxUtils::getInstance(); //control captcha $sMac = oxConfig::getParameter( 'c_mac' ); $sMacHash = oxConfig::getParameter( 'c_mach' ); $oCaptcha = $this->getCaptcha(); if ( !$oCaptcha->pass( $sMac, $sMacHash ) ) { $this->_iAnfrageStatus = 2; return; } $aParams = oxConfig::getParameter( 'editval' ); if ( !isset( $aParams['oxuser__oxusername'] ) || !$myUtils->isValidEmail( $aParams['oxuser__oxusername'] ) ) { $this->_iAnfrageStatus = 0; return; } $aParams['aid'] = $this->getProduct()->getId(); $sSubject = oxConfig::getParameter( 'c_subject' ); $sMessage = $aParams['oxuser__oxlname'] . "(" .$aParams['oxuser__oxusername'] . ")<br /> Company: ".$aParams['oxuser__oxcname'] ."<br />". nl2br( oxConfig::getParameter( 'c_message' ) ); // Send Email $oEmail = oxNew( 'extendedoxEmail' );
$oEmail->sendAnfrageMail( $aParams, $sSubject);
} /** * Return anfrage status (if it was sent) * * @return integer */ public function getAnfrageStatus() { return $this->_iAnfrageStatus; }
}
Should basically just send a mail. - i’ve kicked out error reporting at the moment, while trying to get it to work. This is being called (when you add a render function you can see that)
I also have my extended email
<?php
class extendedoxEmail extends oxEmail {public function sendAnfrageMail( $aParams, $sSubject = null ) { $this->_clearMailer(); $oShop = $this->_getShop(); //set mail params (from, fromName, smtp) $this->_setMailParams( $oShop ); $oLang = oxLang::getInstance(); $this->setRecipient( $oShop->oxshops__oxorderemail->value, $oShop->oxshops__oxname->getRawValue() ); $this->setSubject( ( $sSubject !== null ) ? $sSubject : $oArticle->oxarticles__oxtitle->getRawValue() ); $this->setBody( 'bing bon bang'); $this->setFrom( $aParams['oxuser__oxusername'], "" ); $this->setReplyTo( $aParams['oxuser__oxusername'], "" ); return $this->send(); }
}
Getting the following error
oxSystemComponentException-oxException (time: 2012-11-02 15:52:40): [0]: EXCEPTION_SYSTEMCOMPONENT_CLASSNOTFOUND
Stack Trace: #0 /var/www/vhostscore/oxutilsobject.php(125): oxUtilsObject->_getObject(‘oxsystemcompone…’, 0, Array)
#1 [internal function]: oxUtilsObject->oxNew(‘oxSystemCompone…’)
#2 /var/www/vhostscore/oxfunctions.php(314): call_user_func_array(Array, Array)
#3 /var/www/vhostscore/oxutilsobject.php(115): oxNew(‘oxSystemCompone…’)
#4 [internal function]: oxUtilsObject->oxNew(‘extendedoxEmail’)
#5 /var/www/vhostscore/oxfunctions.php(314): call_user_func_array(Array, Array)
#6 /var/www/vhostsmodules/anfrage/views/anfrage.php(55): oxNew(‘extendedoxEmail’)
#7 /var/www/vhostsviews/oxview.php(518): Anfrage->send()
#8 /var/www/vhostsviews/oxshopcontrol.php(312): oxView->executeFunction(‘send’)
#9 /var/www/vhostsviews/oxshopcontrol.php(114): oxShopControl->_process(‘details’, ‘send’)
#10 /var/www/vhostsindex.php(103): oxShopControl->start()
#11 {main}Faulty component –> extendedoxemail
Can someone tell me why ?