/** * Override for disabling support information until API token is set * * @param Varien_Data_Form_Element_Abstract $element * * @return string */ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) { if (!Mage::helper('bronto_verify/apitoken')->getStatus()) { $element->setDisabled('disabled'); } return parent::_getElementHtml($element); }
/** * Override field method to add js * * @param Varien_Data_Form_Element_Abstract $element * @return String */ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) { // Get the default HTML for this option $html = parent::_getElementHtml($element); if (!Mage::registry('mColorPicker')) { $html .= ' <script type="text/javascript"> jQuery.fn.mColorPicker.init.replace = false; jQuery.fn.mColorPicker.init.enhancedSwatches = false; jQuery.fn.mColorPicker.init.allowTransparency = true; jQuery.fn.mColorPicker.init.showLogo = false; jQuery.fn.mColorPicker.defaults.imageFolder = "' . $this->getJsUrl('shopshark/mColorPicker/') . '"; </script> '; Mage::register('mColorPicker', 1); } $html .= ' <script type="text/javascript"> jQuery(function($){ $("#' . $element->getHtmlId() . '").width("200px").attr("data-hex", true).mColorPicker(); }); </script> '; return $html; }
/** * Ajax Create the addressbooks. * * @param Varien_Data_Form_Element_Abstract $element * * @return string */ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) { $url = Mage::helper('adminhtml')->getUrl('*/connector/createnewaddressbook'); $website = Mage::app()->getRequest()->getParam('website', 0); $element->setData('after_element_html', "<script>\n function createAddressbook(form, element) {\n var name = \$('connector_sync_settings_dynamic_addressbook_addressbook_name').value;\n var visibility = \$('connector_sync_settings_dynamic_addressbook_visibility').value;\n var reloadurl = '{$url}';\n if(name && visibility){\n new Ajax.Request(reloadurl, {\n method: 'post',\n parameters: {'name' : name, 'visibility' : visibility, 'website': '{$website}'},\n onComplete: function(transport) {\n window.location.reload();\n }\n });\n }\n return false;\n }\n </script>"); return parent::_getElementHtml($element); }
public function toggleDisabled($element) { if (!$element->getValue() || $element->getValue() != 1) { $element->getForm()->getElement($this->_getSplitPaymentElementId($element))->setDisabled('disabled'); } return parent::getHtml(); }
public function __construct() { parent::__construct(); if (!$this->getTemplate()) { $this->setTemplate('udtiercom/system/form_field/category_rates_config.phtml'); } }
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) { $time = $element->getHtmlId(); // Get the default HTML for this option $html = parent::_getElementHtml($element); return $html; }
public function __construct() { parent::__construct(); if (!$this->getTemplate()) { $this->setTemplate('specialgiftcard/config/date.phtml'); } }
/** * Override method to output our custom HTML with JavaScript * * @param Varien_Data_Form_Element_Abstract $element * * @return String */ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) { $_html = array(); $element->setData('after_element_html', "\n <span id=\"classpath-loadingmask\" style=\"display: none; width: 100px;\">\n <span class=\"loader\" id=\"classpath-loading-mask-loader\" style=\"background: url(" . $this->getSkinUrl('bronto/images/ajax-loader-tr.gif') . ") no-repeat 0 50%; background-size: 20px; padding:3px 0 3px 25px;\">" . $this->__(' Searching For Class Path...') . "</span>\n <span id=\"classpath-loading-mask\"></span>\n </span>\n\n <script>\n //<![CDATA[\n Event.observe(window, 'load', function() {\n var newTr = '<tr id=\"bronto_verify_advanced_classpath_results\"><td class=\"classpath_results\" colspan=\"4\"><div id=\"bronto-classpath-results\"></div></td></tr>';\n \$('" . $this->_getRowElementId($element) . "').insert({after: newTr});\n });\n function searchClasspath() {\n var reloadUrl = '{$this->getUrl('*/advanced/ajaxclasspath')}';\n var statusText = \$('bronto-classpath-results');\n\n var searchText = \$('bronto_verify_advanced_classpath_search').value;\n var classType = \$('classpath-type').value;\n\n statusText.innerHTML = \$('classpath-loadingmask').innerHTML;\n\n new Ajax.Request(reloadUrl, {\n method: 'post',\n parameters: {class: searchText, type: classType},\n onComplete: function(transport) {\n Element.hide('classpath-loadingmask');\n statusText.innerHTML = transport.responseText;\n }\n });\n\n return false;\n }\n //]]>\n </script>\n "); // Add Class Type Selector to Input $classTypeHtml = '<select id="classpath-type"><option value="model">Model (Default)</option><option value="helper">Helper</option><option value="block">Block</option><option value="controller">Controller</option></select>'; // Add Search Button $button = $this->getLayout()->createBlock('bronto_verify/adminhtml_widget_button_classpath')->toHtml(); $buttonHtml = "<p class=\"form-buttons\" id=\"events-button\" style=\"float:none;\">{$button}</p>"; // Add Button to Html $_html[] = $buttonHtml; // Show everything Else if (!empty($_html)) { $elementHtml = $element->getElementHtml(); $elementHtml .= $classTypeHtml; if ($element->getComment()) { $elementHtml .= '<p class="note"><span>' . $element->getComment() . '</span></p>'; $element->setComment(null); } $elementHtml .= '<div style="margin-top:10px">'; $elementHtml .= implode('<br />', $_html); $elementHtml .= '</div>'; return $elementHtml; } return parent::_getElementHtml($element); }
public function __construct() { parent::__construct(); if (!$this->getTemplate()) { $this->setTemplate('udbatch/system/form_field/import_templates.phtml'); } }
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) { $element->setData('onchange', "apiValidation(this.form, this);"); $url = Mage::helper('adminhtml')->getUrl('*/connector/ajaxvalidation'); $element->setData('after_element_html', "\n <script>\n document.observe('dom:loaded', function(){\n apiValidation();\n\n });\n function apiValidation(form, element) {\n var api_user = \$('connector_transactional_emails_credentials_api_username');\n var api_password = \$('connector_transactional_emails_credentials_api_password');\n var reloadurl = '{$url}';\n var encoded = btoa(api_password.value);\n new Ajax.Request(reloadurl, {\n method: 'post',\n parameters: {'api_username' : api_user.value, 'api_password' : encoded},\n onComplete: function(transport) {\n Element.hide('loadingmask');\n if(transport.responseText == '\"Credentials Valid.\"'){\n api_user.setStyle({\n fontWeight: 'bold',\n color: 'green' ,\n background: 'transparent url(\"" . $this->getSkinUrl('images/success_msg_icon.gif') . "\") no-repeat right center'\n })\n }else{\n api_user.setStyle({\n fontWeight: 'bold',\n color: 'red',\n background: 'transparent url(\"" . $this->getSkinUrl('images/error_msg_icon.gif') . "\") no-repeat right center'\n });\n\n }\n }\n });\n\n return false;\n }\n\n </script>\n "); return parent::_getElementHtml($element); }
/** * Override field method to add js * * @param Varien_Data_Form_Element_Abstract $element * @return String */ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) { // Get the default HTML for this option $html = parent::_getElementHtml($element); $html .= '<script>jQuery(function(){ jQuery("#' . $element->getHtmlId() . '").attr("style", "width: 200px !important").attr("data-hex", true).mColorPicker({ imageFolder: "' . $this->getJsUrl('olegnax/mColorPicker/') . '" }); });</script>'; return $html; }
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) { $extra = ''; if ($current_store = Mage::app()->getRequest()->getParam('store')) { $store = Mage::getModel('core/store')->load($current_store); $url = parse_url($store->getBaseUrl()); $host = $url['host']; //$ok = Mage::getStoreConfig('j2tonecheckout/'.base64_decode("bW9kdWxlX3NlcmlhbA==").'/ok', $store->getId()); /*$ok = Mage::getStoreConfig('rewardpoints/verser/ok', $store->getId()); if ($ok === null){ $extra = '<div style="color:red;">'.Mage::helper('rewardpoints')->__('Please insert / verify your serial for "%s" domain', $host).'</div>'; } else if ($ok === "0"){ $extra = '<div style="color:red;">'.Mage::helper('rewardpoints')->__('Serial is not valid for "%s" domain', $host).'</div>'; } else if ($ok == "1"){ $extra = '<div style="color:green;">'.Mage::helper('rewardpoints')->__('Serial is valid for "%s" domain', $host).'</div>'; }*/ $extra = '<div>' . Mage::helper('rewardpoints')->__("Serial defined for store domain '%s'", $host) . '</div>'; } else { $websites = Mage::app()->getWebsites(); $code = Mage::app()->getWebsite(true)->getDefaultGroup()->getDefaultStore()->getCode(); $store = Mage::getModel('core/store')->load($code); $url = parse_url($store->getBaseUrl()); $host = $url['host']; $extra = '<div>' . Mage::helper('rewardpoints')->__("Serial defined for store domain '%s'", $host) . '</div>'; } //$checkbox_name = $element->getName(); //$checkbox_name = str_replace("key", "key_validation", $checkbox_name); $html = $extra; //.'<input type="checkbox" name="'.$checkbox_name.'" id="revalidate" value="1" /> <label for="revalidate">'.Mage::helper('rewardpoints')->__('First time validation / Re-validate').'</label>'; return parent::_getElementHtml($element) . $html; }
/** * @param Varien_Data_Form_Element_Abstract $element * * @return string */ public function render(Varien_Data_Form_Element_Abstract $element) { if (!extension_loaded('soap') || !extension_loaded('openssl') || !Mage::helper('bronto_common')->getApiToken()) { return null; } return parent::render($element); }
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) { // Get the default HTML for this option $output = parent::_getElementHtml($element); // return $output; return $this->_getUrl(); }
/** * Loading background on save. * @param Varien_Data_Form_Element_Abstract $element * * @return string */ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) { // Get the default HTML for this option $html = parent::_getElementHtml($element); $html .= sprintf('<div id="loadingmask" style="position: fixed;"> <div class="loader" id="loading-mask-loader"> <img src="%sskin/adminhtml/default/default/images/ajax-loader-tr.gif" alt="%s"/>%s', preg_replace('/index.php\\//', '', $this->getBaseUrl()), $this->__('Loading...'), $this->__('Loading...')) . '<div id="loading-mask"></div></div>'; $jQuery = '<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" ></script>'; $jQuery .= '<script type="text/javascript"> jQuery.noConflict(); jQuery(document).ready(function() { //hide the load image field jQuery("#row_connector_api_credentials_api_credentials_validator").hide(); jQuery("#row_connector_sync_settings_sync_customer_schedule_validator").hide(); var loadingmask = jQuery("#loadingmask"); loadingmask.hide(); loadingmask.css({top : "50\\%", left: "50\\%"}); //var thisButton = jQuery("button"); //console.log(thisButton); //jQuery("button").click(function(){ // jQuery("body").css({"background-color": "black", "opacity": "0.4"}); // jQuery("#row_connector_api_settings_api_credentials_validator").show(); // jQuery("#row_connector_sync_settings_sync_customer_schedule_validator").show(); // loadingmask.show(); // loadingmask.css({"display": "block", "opacity" : "1"}); //}) }); </script>'; $html .= $jQuery; return $html; }
public function render(Varien_Data_Form_Element_Abstract $element) { $this->setData('scope', $element->getScope()); // Remove the inheritance checkbox $element->unsCanUseWebsiteValue()->unsCanUseDefaultValue(); return parent::render($element); }
/** * Override method to output our custom image * * @param Varien_Data_Form_Element_Abstract $element * @return String */ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) { // Get the default HTML for this option $html = parent::_getElementHtml($element); $html = '<div class="title"><h2>Click on element to remove it from the widget</h2></div><div class="title-2"><h2>Click on element to add it to widget</h2></div><div class="widget-holder"><div class="widget-content">'; $value = $element->getValue(); if ($values = $element->getValues()) { foreach ($values as $option) { $html .= $this->_optionToHtml($element, $option, $value); } } $html .= $element->getAfterElementHtml(); $html .= '</div><div class="items-container"> <div class="product_name-holder"><div class="product_name-sub"></div></div> <div class="rating_stars-holder"><div class="rating_stars-sub"></div></div> <div class="reviews"> <div class="rating_cust_link-holder"><div class="rating_cust_link-sub"></div></div> <div class="rating_add_review_link-holder"><div class="rating_add_review_link-sub"></div></div> </div> <div class="add_to_cart-holder"><div class="add_to_cart-sub"></div></div> <div class="price"><div class="price-holder"><div class="price-sub"></div></div></div> <div class="wishlist-holder"><div class="wishlist-sub"></div></div> <div class="compare-holder"><div class="compare-sub"></div></div> </div></div>'; return $html; }
protected function _prepareLayout() { parent::_prepareLayout(); if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) { $this->getLayout()->getBlock('head')->setCanLoadTinyMce(true); } }
/** * Enter description here... * * @param Varien_Data_Form_Element_Abstract $element * @return string */ public function render(Varien_Data_Form_Element_Abstract $element) { $fieldConfig = $element->getFieldConfig(); $clonePath = (string) $fieldConfig->clone_path; $clonePaths = explode('/', $clonePath); // Prepare value for cloned element $name = 'groups[' . $clonePaths[1] . '][fields][' . $clonePaths[2] . '][value]'; if (isset($this->_affiliateConfigData[$clonePath])) { $data = $this->_affiliateConfigData[$clonePath]; $inherit = false; } else { $data = $this->_affiliateConfigRoot->descend($clonePath); $inherit = true; } if ($fieldConfig->backend_model) { $model = Mage::getModel((string) $fieldConfig->backend_model); if (!$model instanceof Mage_Core_Model_Config_Data) { Mage::throwException('Invalid config field backend model: ' . (string) $fieldConfig->backend_model); } $model->setPath($clonePath)->setValue($data)->afterLoad(); $data = $model->getValue(); } $element->setName($name)->setValue($data)->setInherit($inherit); // Render Element to HTML $html = parent::render($element); // Prepare Javascript for cloned element $cloneId = $element->getHtmlId(); $origId = implode('_', $clonePaths); $html .= "<script type='text/javascript'>\r\nEvent.observe(window, 'load', function() {\r\n \$('{$cloneId}').observe('change', function(){\r\n Form.Element.setValue(\$('{$origId}'), Form.Element.getValue(\$('{$cloneId}')));\r\n });\r\n \$('{$origId}').observe('change', function(){\r\n Form.Element.setValue(\$('{$cloneId}'), Form.Element.getValue(\$('{$origId}')));\r\n });"; if ($element->getCanUseWebsiteValue() || $element->getCanUseDefaultValue()) { $html .= "\r\n \$('{$cloneId}_inherit').observe('click', function(){\r\n var el = \$('{$origId}_inherit');\r\n el.checked = \$('{$cloneId}_inherit').checked;\r\n toggleValueElements(el, Element.previous(el.parentNode));\r\n });\r\n \$('{$origId}_inherit').observe('click', function(){\r\n var el = \$('{$cloneId}_inherit');\r\n el.checked = \$('{$origId}_inherit').checked;\r\n toggleValueElements(el, Element.previous(el.parentNode));\r\n });"; } $html .= "\r\n});\r\n</script>"; return $html; }
public function __construct() { parent::__construct(); if (!$this->getTemplate()) { $this->setTemplate('udmspro/system/form_field/fieldsets_config.phtml'); } }
public function render(Varien_Data_Form_Element_Abstract $element) { $element->setFormat(Varien_Date::DATE_INTERNAL_FORMAT); //or other format $element->setImage($this->getSkinUrl('images/grid-cal.gif')); return parent::render($element); }
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) { if (!Mage::helper('Mage_Catalog_Helper_Category_Flat')->isRebuilt()) { $element->setDisabled('disabled')->setValue(0); } return parent::_getElementHtml($element); }
public function __construct() { parent::__construct(); if (!$this->getTemplate()) { $this->setTemplate('enterprise/giftcardaccount/config/generate.phtml'); } }
/** * Override method to output our custom HTML with JavaScript * * @param Varien_Data_Form_Element_Abstract $element * * @return String */ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) { if (!extension_loaded('soap') || !extension_loaded('openssl')) { $element->setDisabled('disabled')->setValue(0); } else { // Get Config Link $configLink = Mage::helper('bronto_common')->getScopeUrl('/system_config/edit/section/bronto'); if (!Mage::helper('bronto_verify/apitoken')->getStatus()) { if (trim($element->getLabel()) === 'Enable Module') { $element->setDisabled('disabled')->setValue(0); $link = '<a href="' . $configLink . '">Fix it Here</a>'; $element->setComment('<span style="color:red;font-weight: bold">A valid Bronto API key is required. ' . $link . '</span>'); } } else { if (!Mage::helper('bronto_common')->isEnabled()) { if (trim($element->getLabel()) === 'Enable Module') { $element->setDisabled('disabled')->setValue(0); $link = '<a href="' . $configLink . '">Enable It Here</a>'; $element->setComment('<span style="color:red;font-weight: bold">The Bronto Extension for Magento is not enabled. ' . $link . '</span>'); } } else { if (!Mage::helper('bronto_common/support')->isRegistered()) { if (trim($element->getLabel()) !== 'Enable Module' || !$element->getValue()) { $link = '<a href="' . $configLink . '#bronto_support-head">Register Here</a>'; $element->setDisabled('disabled'); $element->setComment('<span style="color:red;font-weight:bold">Extension registration is required. ' . $link . '</span>'); } } } } } return parent::_getElementHtml($element); }
/** * Render Default Product Price field as disabled if user does not have enough permissions * * @param Varien_Data_Form_Element_Abstract $element * @return string */ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) { if (!Mage::helper('enterprise_pricepermissions')->getCanAdminEditProductPrice()) { $element->setReadonly(true, true); } return parent::_getElementHtml($element); }
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) { $store = null; $disabled = false; if ($code = $this->getRequest()->getParam('store')) { $store = Mage::getModel('core/store')->load($code); } if ($store instanceof Mage_Core_Model_Store) { /* @var Nosto_Tagging_Helper_Account $accountHelper */ $accountHelper = Mage::helper('nosto_tagging/account'); /* @var NostoAccount $nostoAccount */ $nostoAccount = $accountHelper->find($store); if ($nostoAccount instanceof NostoAccountInterface) { foreach (NostoApiToken::getApiTokenNames() as $token) { if (!$nostoAccount->getApiToken($token)) { $disabled = true; break; } } } } if ($disabled === true) { /** @noinspection PhpUndefinedMethodInspection */ $element->setDisabled('disabled'); $metaOauth = new Nosto_Tagging_Model_Meta_Oauth(); /** @noinspection PhpUndefinedVariableInspection */ $metaOauth->loadData($store, $nostoAccount); $client = new NostoOAuthClient($metaOauth); $comment = sprintf('Your Nosto account is missing required tokens' . ' for updating settings to Nosto. Please click <a href="%s">' . ' here to re-connect</a> your account.', $client->getAuthorizationUrl()); $element->setData('comment', $comment); } return parent::_getElementHtml($element); }
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) { if (!Mage::helper('catalog/category_flat')->isBuilt()) { $element->setDisabled(true)->setValue(0); } return parent::_getElementHtml($element); }
public function __construct() { parent::__construct(); if (!$this->getTemplate()) { $this->setTemplate('udprod/system/form_field/quick_create_config.phtml'); } }
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) { $html = parent::_getElementHtml($element); $html .= '<br/><div id="font_' . $element->getHtmlId() . '" class="font_preview" style="font-size: 13px; padding: 10px; 0">The quick brown fox jumps over the lazy dog</div>'; $html .= ' <script type="text/javascript"> jQuery(document).ready(function(){ var font = jQuery("#' . $element->getHtmlId() . '").val(); changeFont' . $element->getHtmlId() . '(font); jQuery("#' . $element->getHtmlId() . '").bind("change", function() { value = jQuery("#' . $element->getHtmlId() . '").val(); changeFont' . $element->getHtmlId() . '(value); }); function changeFont' . $element->getHtmlId() . '(val){ var link = jQuery("<link>", { type: "text/css", rel: "stylesheet", href: "//fonts.googleapis.com/css?family=" + val, }).appendTo("head"); jQuery("#font_' . $element->getHtmlId() . '").css("font-family", val); } }); </script> '; return $html; }
public function __construct() { parent::__construct(); if (!$this->getTemplate()) { $this->setTemplate('udtiership/system/form_field/v2/delivery_type.phtml'); } }