public function getAfterElementHtml()
 {
     $html = $this->getData('after_element_html');
     $product = Mage::registry('product');
     $storeId = $product->getStoreId();
     $store = Mage::app()->getStore($storeId);
     $html .= '<strong>[' . (string) $store->getBaseCurrencyCode() . ']</strong>';
     if (Mage::helper('tax')->priceIncludesTax($store)) {
         $inclTax = Mage::helper('tax')->__('Inc. Tax');
         $html .= " <strong>[{$inclTax} <span id=\"dynamic-tax-{$this->getHtmlId()}\"></span>]</strong>";
     }
     if (!is_numeric($this->getIdentifier())) {
         return $html;
     }
     $data = array('name' => str_replace('[price]', '[update_price]', $this->getData('name')), 'disabled' => true);
     $hidden = new Varien_Data_Form_Element_Hidden($data);
     $hidden->setForm($this->getForm());
     $data['html_id'] = str_replace('[price]', '[update_price]', $this->getHtmlId());
     $data['label'] = Mage::helper('adyen_subscription')->__('Update prices of all existing subscriptions (prices be updated by cron)', $this->getData('subscription_count'));
     $data['value'] = 1;
     $checkbox = new Varien_Data_Form_Element_Checkbox($data);
     $checkbox->setForm($this->getForm());
     $checkbox->getElementHtml();
     return $html . "<br />\n" . $checkbox->getElementHtml() . $checkbox->getLabelHtml();
 }
Example #2
0
 /**
  * Checkbox render function
  *
  * @param Varien_Data_Form_Element_Abstract $element
  * @return string
  */
 public function render(Varien_Data_Form_Element_Abstract $element)
 {
     $checkbox = new Varien_Data_Form_Element_Checkbox($element->getData());
     $checkbox->setForm($element->getForm());
     $elementHtml = $checkbox->getElementHtml() . sprintf('<label for="%s"><b>%s</b></label><p class="note">%s</p>', $element->getHtmlId(), $element->getLabel(), $element->getNote());
     $html = '<td class="label">&nbsp;</td>';
     $html .= '<td class="value">' . $elementHtml . '</td>';
     return $html;
 }
Example #3
0
 protected function _getAttachmentSelectorHtml()
 {
     $checkbox = new Varien_Data_Form_Element_Checkbox(array('html_id' => 'attachment_toggle', 'checked' => false, 'value' => '1', 'onchange' => 'toggleAttachment(this.checked);', 'after_element_html' => Mage::helper('link')->__('Use an attachment')));
     $checkbox->setForm($this->getForm());
     $file = new Varien_Data_Form_Element_File(array('name' => 'target_file', 'html_id' => 'target_file'));
     $file->setForm($this->getForm());
     return $this->_getCurrentAttachmentHtml() . '
         <label class="target-label" id="target_file_toggle" style="display:' . ($this->getHasAttachment() ? 'none' : 'block') . ';">
             ' . $checkbox->getElementHtml() . '
         </label>
         <label class="target-label" id="target_file_container" style="display:none;">
             ' . $file->getElementHtml() . '
         </label>
     ';
 }
Example #4
0
 public function getElementHtml()
 {
     $element = $this->getElement();
     if (!$element->getValue()) {
         return parent::getElementHtml();
     }
     $element->setOnkeyup("onUrlkeyChanged('" . $element->getHtmlId() . "')");
     $element->setOnchange("onUrlkeyChanged('" . $element->getHtmlId() . "')");
     $data = array('name' => $element->getData('name') . '_create_redirect', 'disabled' => true);
     $hidden = new Varien_Data_Form_Element_Hidden($data);
     $hidden->setForm($element->getForm());
     $storeId = $element->getForm()->getDataObject()->getStoreId();
     $data['html_id'] = $element->getHtmlId() . '_create_redirect';
     $data['label'] = Mage::helper('catalog')->__('Create Permanent Redirect for old URL');
     $data['value'] = $element->getValue();
     $data['checked'] = Mage::helper('catalog')->shouldSaveUrlRewritesHistory($storeId);
     $checkbox = new Varien_Data_Form_Element_Checkbox($data);
     $checkbox->setForm($element->getForm());
     return parent::getElementHtml() . '<br/>' . $hidden->getElementHtml() . $checkbox->getElementHtml() . $checkbox->getLabelHtml();
 }
Example #5
0
 public function testSetForm()
 {
     $this->_virtual = new Varien_Object();
     $helper = $this->getMock('Mage_Catalog_Helper_Product', array('getTypeSwitcherControlLabel'));
     $helper->expects($this->any())->method('getTypeSwitcherControlLabel')->will($this->returnValue('Virtual / Downloadable'));
     $this->assertNull($this->_virtual->getId());
     $this->assertNull($this->_virtual->getName());
     $this->assertNull($this->_virtual->getLabel());
     $this->assertNull($this->_virtual->getForm());
     $this->_model = new Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Weight_Renderer(array('element' => $this->_virtual, 'helper' => $helper));
     $form = new Varien_Data_Form();
     $this->_model->setForm($form);
     $this->assertEquals(Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Weight_Renderer::VIRTUAL_FIELD_HTML_ID, $this->_virtual->getId());
     $this->assertEquals('is_virtual', $this->_virtual->getName());
     $this->assertEquals('Virtual / Downloadable', $this->_virtual->getLabel());
     $this->assertSame($form, $this->_virtual->getForm());
 }
Example #6
0
 public function getElementHtml()
 {
     $element = $this->getElement();
     $params = $this->getRequest()->getParams();
     if ($params['id']) {
         $product = Mage::getModel('catalog/product')->load($params['id']);
         foreach ($product->getOptions() as $option) {
         }
         if ($product) {
             switch ($product->getTypeId()) {
                 case 'simple':
                 case 'virtual':
                 case 'downloadable':
                     return parent::getElementHtml();
                     break;
                 case 'grouped':
                 case 'bundle':
                 case 'configurable':
                     $block = $this->getLayout()->createBlock('rewardpoints/adminhtml_gridboth');
                     $block->setSingle(true);
                     $block->setFilterVisible(false);
                     $block->setPagerVisible(false);
                     $block->setProductId($product->getId());
                     $block->setProduct($product);
                     if ($product->getTypeId() == 'configurable') {
                         $block->setIsConfigurable();
                     }
                     $data = array('name' => 'mw_show_hide_set_point', 'class' => 'mw_show_hide_set_point', 'label' => 'Set for this product?', 'value' => 0, 'checked' => false);
                     $checkbox = new Varien_Data_Form_Element_Checkbox($data);
                     $checkbox->setForm($element->getForm());
                     $html_renderer = $checkbox->getElementHtml() . "<span id='mw-lb-set-point'>" . $checkbox->getLabelHtml() . "</span>" . "<div class='mw-reward-point-product'>" . $block->toHtml() . "</div>" . "<div class='mw-reward-point-input' style='display:none'>" . parent::getElementHtml() . "</div>";
                     return $html_renderer;
                     break;
             }
         }
     }
 }
Example #7
0
 /**
  * Add the 'Use Config Settings' checkbox to the input element
  *
  * @param Varien_Data_Form_Element_Abstract $element
  * @return string
  */
 public function render(Varien_Data_Form_Element_Abstract $element)
 {
     $id = 'use_config_' . $element->getId();
     $checkbox = new Varien_Data_Form_Element_Checkbox(array('html_id' => $id, 'name' => $id));
     $checkbox->setForm($element->getForm());
     $checkbox->setAfterElementHtml(' <label for="' . $id . '">' . $this->helper('adminhtml')->__('Use Config Settings') . '</label>' . $this->getElementJs());
     $checkbox->setOnclick(sprintf("if(this.checked){\$('%s').disabled=true;}else{\$('%s').disabled=false;}", $element->getForm()->getHtmlIdPrefix() . $element->getId(), $element->getForm()->getHtmlIdPrefix() . $element->getId()));
     if (!$element->getValue()) {
         $checkbox->setChecked(true);
         $element->setDisabled(true);
         if (preg_match("/^carousel_([a-z_]{1,})\$/", $element->getId(), $result)) {
             $element->setValue(Mage::getStoreConfig('ibanners/carousel/' . $result[1]));
         }
     }
     $element->setNote($checkbox->getElementHtml());
     return parent::render($element);
 }
Example #8
0
 /**
  * Return HTML code for list <label> with checkbox, checked if subscribed, otherwise not
  *
  * @param array $list List data from MC
  * @return string HTML code
  */
 public function listLabel($list)
 {
     $myLists = $this->getSubscribedLists();
     //if is on database it gets checked
     $alreadyOnList = Mage::getSingleton('monkey/asyncsubscribers')->getCollection()->addFieldToFilter('lists', $list['id'])->addFieldToFilter('email', $this->_getEmail())->addFieldToFilter('processed', 0);
     if (count($alreadyOnList) > 0) {
         $myLists[] = $list['id'];
     }
     $checkbox = new Varien_Data_Form_Element_Checkbox();
     $checkbox->setForm($this->getForm());
     $checkbox->setHtmlId('list-' . $list['id']);
     $checkbox->setChecked((bool) (is_array($myLists) && in_array($list['id'], $myLists)));
     $checkbox->setTitle($checkbox->getChecked() ? $this->__('Click to unsubscribe from this list.') : $this->__('Click to subscribe to this list.'));
     $checkbox->setLabel($list['name']);
     $hname = $this->_htmlGroupName($list);
     $checkbox->setName($hname . '[subscribed]');
     $checkbox->setValue($list['id']);
     $checkbox->setClass('monkey-list-subscriber');
     return $checkbox->getLabelHtml() . $checkbox->getElementHtml();
 }
 /**
  * Return "Use default" checkbox html
  *
  * @param Varien_Data_Form_Element_Abstract $element
  * @return string
  */
 public function getInheritElementHtml(Varien_Data_Form_Element_Abstract $element)
 {
     $elementId = $element->getHtmlId();
     $inheritCheckbox = new Varien_Data_Form_Element_Checkbox(array('html_id' => $elementId . '_inherit', 'name' => preg_replace('/\\[value\\](\\[\\])?$/', '[inherit]', $element->getName()), 'value' => '1', 'class' => 'checkbox config-inherit', 'onclick' => 'toggleValueElements(this, $(\'' . $elementId . '\').up())'));
     if ($element->getInherit()) {
         $inheritCheckbox->setChecked(true);
     }
     $inheritCheckbox->setForm($element->getForm());
     return $inheritCheckbox->getElementHtml();
 }
Example #10
0
 /**
  * Return HTML code for list <label> with checkbox, checked if subscribed, otherwise not
  *
  * @param array $list List data from MC
  * @return string HTML code
  */
 public function listLabel($list)
 {
     $myLists = $this->getSubscribedLists();
     $checkbox = new Varien_Data_Form_Element_Checkbox();
     $checkbox->setForm($this->getForm());
     $checkbox->setHtmlId('list-' . $list['id']);
     $checkbox->setChecked((bool) (is_array($myLists) && in_array($list['id'], $myLists)));
     $checkbox->setTitle($checkbox->getChecked() ? $this->__('Click to unsubscribe from this list.') : $this->__('Click to subscribe to this list.'));
     $checkbox->setLabel($list['name']);
     $hname = $this->_htmlGroupName($list);
     $checkbox->setName($hname . '[subscribed]');
     $checkbox->setValue($list['id']);
     $checkbox->setClass('monkey-list-subscriber');
     return $checkbox->getLabelHtml() . $checkbox->getElementHtml();
 }
Example #11
0
 /**
  * Set form for both fields
  *
  * @param Varien_Data_Form $form
  * @return Varien_Data_Form
  */
 public function setForm($form)
 {
     $this->_virtual->setForm($form);
     return parent::setForm($form);
 }