HenkDeVries Posted February 27, 2014 Share Posted February 27, 2014 Hope that there are some people around that can help me, I just started php so I am already saying sorry :-) I created a license check for my custom magento module. It's all working fine when I test it but now I need to integrate it with my module. One part needs to go in to the DataHelper the other in my frontend template file. I have checked some examples and what they do is extend the helper file and then get the variable in the frontend template file with $X= $this->helper('X')->X(); Code for in my frontend temlate file (just to test if it's working) if ( $var === false ) { echo '<img style="float: center;height:300px;width:auto;" src="http://clipartist.info/Art/April/al_with_red_flag_cybergedeon_al_with_red_flag-999px.png" alt="">'; } Working license check function checkLicense($key, $url = null) { static $wsdl = 'x'; if ($url == null) { $url = $_SERVER['HTTP_HOST']; } $clientOptions = array( 'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP, //'trace'=> 1, // when the service b0rks, enable the tracing, for easier debugging ); $client = new SoapClient($wsdl, $clientOptions); $params = array( 'LicenseKey' => $key, 'URL' => $url, ); $checkLicenseResponse = $client->CheckLicense($params); return !empty($checkLicenseResponse->IsValid) && $checkLicenseResponse->IsValid === true; } $licensekey = Mage::getStoreConfig('SDOCP_options/module/enable_serial'); $url = ''; $var = checkLicense($licensekey, $url); Custom Module Helper <?php class Magextension_Sdocp_Helper_Data extends Mage_Core_Helper_Abstract { public function checkIsEnabled() { $flag = Mage::getStoreConfig('SDOCP_options/module/enabled'); return $flag; } public function checkOutOfStockEnabled() { $flag = Mage::getStoreConfig('SDOCP_options/product_page/show_out_of_stock_product'); return $flag; } } Link to comment https://forums.phpfreaks.com/topic/286576-any-phpfreaks-here-that-also-know-magento-extend-data-helper/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.