/** * Generates html for a gift certificate using sample data. * Ouputs the result in JSON. **/ private function exampleGiftCertificate() { $id = !empty($_REQUEST['id']) ? $_REQUEST['id'] : null; $html = !empty($_REQUEST['html']) ? $_REQUEST['html'] : null; if($id) { // load a gift certificate theme by id if(!$theme = ISC_GIFTCERTIFICATE_THEME::findById($id)) { return; } } else if($html) { // build a temporary theme object using template html $theme = new ISC_GIFTCERTIFICATE_THEME(); $theme->setTemplateContents($html); } else { // no id or template html passed, abort return; } $certificate = array( "giftcertto" => GetLang('GiftCertificateSampleTo'), "giftcerttoemail" => GetLang('GiftCertificateSampleToEmail'), "giftcertfrom" => GetLang('GiftCertificateSampleFrom'), "giftcertfromemail" => GetLang('GiftCertificateSampleFromEmail'), "giftcertmessage" => GetLang('GiftCertificateSampleMessage'), "giftcertcode" => GetLang('GiftCertificateSampleCode'), "giftcertamount" => GetLang('GiftCertificateSampleAmount'), "giftcertexpirydate" => GetLang('GiftCertificateSampleExpiryDate'), ); $html = $theme->generateGiftCertificateHTML($certificate); $data = array('html' => $html); ISC_JSON::output('', true, $data); }