public function getAfterElementHtml() { $html = parent::getAfterElementHtml(); $html .= ' <script type="text/javascript"> var switchStatementPoStatusSelect = function() { for (i=0; i<$("statement_po_type").options.length; i++) { var statusSel = $("statement_"+$("statement_po_type").options[i].value+"_status") if (statusSel) { if (statusSel.id == "statement_"+$("statement_po_type").value+"_status") { statusSel.up("tr").show() statusSel.enable() } else { statusSel.up("tr").hide() statusSel.disable() } } } } $("statement_po_type").observe("change", switchStatementPoStatusSelect) document.observe("dom:loaded", switchStatementPoStatusSelect) </script> '; return $html; }
public function getAfterElementHtml() { $html = parent::getAfterElementHtml(); $html .= ' <script type="text/javascript"> var switchPayoutPoStatusSelect = function() { var defStPoType = "' . Mage::getStoreConfig('udropship/statement/statement_po_type') . '"; var getStPoType = function(val) { return val == "999" ? defStPoType : val; } for (i=0; i<$("statement_po_type").options.length; i++) { var statusSel = $("payout_"+getStPoType($("statement_po_type").options[i].value)+"_status"); if (statusSel) { if (statusSel.id == "payout_"+getStPoType($("statement_po_type").value)+"_status" && $("payout_po_status_type").value == "payout") { statusSel.up("tr").show(); statusSel.enable(); } else { statusSel.up("tr").hide(); statusSel.disable(); } } } } document.observe("dom:loaded", function(){ $("payout_po_status_type").observe("change", switchPayoutPoStatusSelect) $("statement_po_type").observe("change", switchPayoutPoStatusSelect) switchPayoutPoStatusSelect(); }); </script> '; return $html; }
public function getAfterElementHtml() { $html = parent::getAfterElementHtml(); $defPoType = (string) Mage::getStoreConfig('udropship/statement/statement_po_type'); $html .= ' <script type="text/javascript"> var switchStatementPoStatusSelect = function() { for (i=0; i<$("statement_po_type").options.length; i++) { var poTypeValue = $("statement_po_type").value; if (poTypeValue == "999") { poTypeValue = "' . $defPoType . '"; } var statusSel = $("statement_"+$("statement_po_type").options[i].value+"_status") if (statusSel) { if (statusSel.id == "statement_"+poTypeValue+"_status") { statusSel.up("tr").show() statusSel.enable() } else { statusSel.up("tr").hide() statusSel.disable() } } } } $("statement_po_type").observe("change", switchStatementPoStatusSelect) document.observe("dom:loaded", switchStatementPoStatusSelect) </script> '; return $html; }
public function getAfterElementHtml() { $vendor = Mage::registry('vendor_data'); $vId = $vendor ? $vendor->getId() : 0; $html = parent::getAfterElementHtml(); $htmlId = $this->getHtmlId(); if (Mage::helper('udtiership')->isV2SimpleRates()) { $targetHtmlId = str_replace('delivery_type_selector', 'v2_simple_rates', $htmlId) . '_container'; } elseif (Mage::helper('udtiership')->isV2SimpleConditionalRates()) { $targetHtmlId = str_replace('delivery_type_selector', 'v2_simple_cond_rates', $htmlId) . '_container'; } else { $targetHtmlId = str_replace('delivery_type_selector', 'v2_rates', $htmlId) . '_container'; } $targetUrl = Mage::getModel('core/url')->getUrl('udtiershipadmin/index/loadVendorRates', array('delivery_type' => 'DELIVERYTYPE', 'vendor_id' => $vId)); $html .= "\n <script type=\"text/javascript\">\n Event.observe('{$htmlId}', 'change', function(){\n if (\$F('{$htmlId}')) {\n var targetHtmlId = '{$targetHtmlId}';\n new Ajax.Updater(targetHtmlId, '{$targetUrl}'.replace('DELIVERYTYPE', \$F('{$htmlId}')), {asynchronous:true, evalScripts:true});\n }\n });\n </script>"; return $html; }
public function getAfterElementHtml() { $html = parent::getAfterElementHtml(); $html .= ' <script type="text/javascript"> var switchNotifyLowstockSelect = function() { if ($("notify_lowstock").value==1) { $("notify_lowstock_qty").up("tr").show() $("notify_lowstock_qty").enable() } else { $("notify_lowstock_qty").up("tr").hide() $("notify_lowstock_qty").disable() } } $("notify_lowstock").observe("change", switchNotifyLowstockSelect) document.observe("dom:loaded", switchNotifyLowstockSelect) </script> '; return $html; }
public function getAfterElementHtml() { $html = parent::getAfterElementHtml(); $fc = (array) $this->getData('field_config'); if (isset($fc['depend_fields']) && ($dependFields = (array) $fc['depend_fields'])) { foreach ($dependFields as &$dv) { $dv = explode(',', $dv); } $dfJson = Zend_Json::encode($dependFields); $html .= <<<EOT <script type="text/javascript"> document.observe("dom:loaded", function() { \tvar df = \$H({$dfJson}) \tvar syncDependFields = function() { \t\tdf.each(function(pair){ \t\t\tif (\$(pair.key) && (trElem = \$(pair.key+'-container'))) { \t\t\t\tif (\$A(pair.value).indexOf(\$('{$this->getHtmlId()}').value) != -1) { \t\t\t\t\ttrElem.show() \t\ttrElem.select('select').invoke('enable') \t\ttrElem.select('input').invoke('enable') \t\ttrElem.select('textarea').invoke('enable') \t} else { \t\ttrElem.hide() \t\ttrElem.select('select').invoke('disable') \t\ttrElem.select('input').invoke('disable') \t\ttrElem.select('textarea').invoke('disable') \t} \t\t\t} \t\t}) \t} \$('{$this->getHtmlId()}').observe('change', syncDependFields) syncDependFields() }) </script> EOT; } return $html; }
public function getAfterElementHtml() { $html = parent::getAfterElementHtml(); $htmlId = $this->getHtmlId(); $ratesHtmlId = str_replace('udtiership_use_custom', 'udtiership_rates', $htmlId); $curProd = Mage::registry('current_product'); if ($curProd && $curProd->getData('_edit_in_vendor')) { $trTag = 'li'; } else { $trTag = 'tr'; } $html .= <<<EOT <script type="text/javascript"> var syncUdtiershipUseCustom = function() { if (\$('{$ratesHtmlId}') && (trElem = \$('{$ratesHtmlId}').up("{$trTag}"))) { if (\$F('{$htmlId}') && \$F('{$htmlId}')!='0') { trElem.show(); trElem.select('select').invoke('enable'); trElem.select('input').invoke('enable'); trElem.select('textarea').invoke('enable'); } else { trElem.hide(); trElem.select('select').invoke('disable'); trElem.select('input').invoke('disable'); trElem.select('textarea').invoke('disable'); } \t} } document.observe('dom:loaded', function() { \$('{$htmlId}').observe('change', syncUdtiershipUseCustom); syncUdtiershipUseCustom(); }); </script> EOT; return $html; }
public function getAfterElementHtml() { $javaScript = "\n <script type=\"text/javascript\">\n Event.observe('{$this->getHtmlId()}', 'change', function(){\n specific=\$('{$this->getHtmlId()}').value;\n \$('{$this->_getSpecificCountryElementId()}').disabled = (!specific || specific!=1);\n });\n </script>"; return $javaScript . parent::getAfterElementHtml(); }
public function getAfterElementHtml() { $html = parent::getAfterElementHtml(); $fc = (array) $this->getData('field_config'); if (isset($fc['depend_fields']) && ($dependFields = (array) $fc['depend_fields']) || isset($fc['hide_depend_fields']) && ($hideDependFields = (array) $fc['hide_depend_fields'])) { if (!empty($dependFields)) { foreach ($dependFields as &$dv) { $dv = $dv != '' ? explode(',', $dv) : array(''); } unset($dv); $dfJson = Zend_Json::encode($dependFields); } else { $dfJson = '{}'; } if (!empty($hideDependFields)) { foreach ($hideDependFields as &$dv) { $dv = $dv != '' ? explode(',', $dv) : array(''); } unset($dv); $hideDfJson = Zend_Json::encode($hideDependFields); } else { $hideDfJson = '{}'; } $html .= <<<EOT <script type="text/javascript"> document.observe("dom:loaded", function() { \tvar df = \$H({$dfJson}); \tvar hideDf = \$H({$hideDfJson}); \tvar enableDisable = function (pair, flag) { if (\$(pair.key) && (trElem = \$(pair.key).up("tr"))) { if (flag == (\$A(pair.value).indexOf(\$('{$this->getHtmlId()}').value) != -1)) { trElem.show() trElem.select('select').each(function(__sEl){ __sEl.enable(); if (__sEl.udSyncDependFields) { __sEl.udSyncDependFields(); } }); trElem.select('input').invoke('enable') trElem.select('textarea').invoke('enable') } else { trElem.hide() trElem.select('select').invoke('disable') trElem.select('input').invoke('disable') trElem.select('textarea').invoke('disable') } } } \tvar syncDependFields = function() { \t\tdf.each(function(pair){ \t\t\tenableDisable(pair, true); \t\t}); \t\thideDf.each(function(pair){ \t\t\tenableDisable(pair, false); \t\t}); \t} \t\$('{$this->getHtmlId()}').udSyncDependFields = syncDependFields; \$('{$this->getHtmlId()}').observe('change', \$('{$this->getHtmlId()}').udSyncDependFields.bind(\$('{$this->getHtmlId()}'))) \$('{$this->getHtmlId()}').udSyncDependFields() }) </script> EOT; } return $html; }