Jump to content

HenkDeVries

New Members
  • Posts

    3
  • Joined

  • Last visited

Everything posted by HenkDeVries

  1. 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; } }
  2. Hi, sorry I am new to php but I am a bit stuck. I am using below code to check a license through a webservice. The result of var_dump is bool(true). How can I save the True and use it to for example show an image or a text? Let's say if it's true show something when false do nothing 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_dump(checkLicense($licensekey, $url));
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.