Ejemplo n.º 1
1
 protected function _prepareForm()
 {
     $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post'));
     $form->setHtmlIdPrefix("template");
     $form->setFieldNameSuffix("template");
     /* @var $template Mzax_Emarketing_Model_Template */
     $template = Mage::registry('current_template');
     if ($template->getId()) {
         $form->addField('template_id', 'hidden', array('name' => 'template_id', 'value' => $template->getId()));
     }
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => $this->__('Template Option'), 'class' => 'fieldset-wide'))->addType('editor', Mage::getConfig()->getModelClassName('mzax_emarketing/form_element_templateEditor'))->addType('credits', Mage::getConfig()->getModelClassName('mzax_emarketing/form_element_credits'));
     $fieldset->addField('credits', 'credits', array('name' => 'credits', 'required' => true));
     $fieldset->addField('name', 'text', array('name' => 'name', 'required' => true, 'label' => $this->__('Template Name'), 'title' => $this->__('Template Name')));
     $fieldset->addField('description', 'textarea', array('name' => 'description', 'required' => true, 'label' => $this->__('Description'), 'title' => $this->__('Description'), 'style' => 'height:4em;', 'note' => "For internal use only"));
     $snippets = new Mzax_Emarketing_Model_Medium_Email_Snippets();
     Mage::getSingleton('mzax_emarketing/medium_email')->prepareSnippets($snippets);
     $editorConfig = new Varien_Object();
     $editorConfig->setFilesBrowserWindowUrl($this->getUrl('adminhtml/cms_wysiwyg_images/index'));
     $editorConfig->setWidgetWindowUrl($this->getUrl('adminhtml/widget/index'));
     $editorConfig->setSnippets($snippets);
     $editor = $fieldset->addField('body', 'editor', array('name' => 'body', 'required' => true, 'label' => $this->__('Template HTML'), 'title' => $this->__('Template HTML'), 'logo' => $this->getSkinUrl('images/logo.gif'), 'fullscreen_title' => $this->__('Template %s', $template->getName()), 'style' => 'height:50em;', 'value' => '', 'config' => $editorConfig));
     // Setting custom renderer for content field to remove label column
     $renderer = $this->getLayout()->createBlock('adminhtml/widget_form_renderer_fieldset_element')->setTemplate('cms/page/edit/form/renderer/content.phtml');
     $editor->setRenderer($renderer);
     $form->addValues($template->getData());
     $this->setForm($form);
     $form->setUseContainer(true);
     return parent::_prepareForm();
 }
Ejemplo n.º 2
1
 public function getTag()
 {
     if (!$this->_tag) {
         $this->_tag = Mage::registry('tagModel');
     }
     return $this->_tag;
 }
Ejemplo n.º 3
0
 public function __construct()
 {
     parent::__construct();
     $this->setTemplate('sales/order/details.phtml');
     $this->setOrder(Mage::getModel('sales/order')->load($this->getRequest()->getParam('order_id')));
     Mage::registry('action')->getLayout()->getBlock('root')->setHeaderTitle(Mage::helper('sales')->__('Order Details'));
 }
Ejemplo n.º 4
0
 public function editAction()
 {
     $id = (int) $this->getRequest()->getParam('id');
     $model = Mage::getModel('amgroupcat/rules')->load($id);
     $postData = Mage::registry('amgroupcat_rules_saved_data');
     if ($id == 0 && $postData) {
         $model = Mage::getModel('amgroupcat/rules')->load($id);
     } else {
         if ($id && !$model->getId()) {
             Mage::getSingleton('adminhtml/session')->addError(Mage::helper('amgroupcat')->__('Record does not exist'));
             $this->_redirect('*/*/');
             return;
         }
     }
     /*
      * save form data for all children tabs forms
      */
     Mage::register('amgroupcat_rules', $model);
     /*
      * add tabs on page
      */
     $this->loadLayout();
     $this->_setActiveMenu('catalog/amgroupcat/rules');
     $this->_title($this->__($id ? 'Edit rule' : 'New rule'));
     $this->_addContent($this->getLayout()->createBlock('amgroupcat/adminhtml_rules_edit'));
     $this->_addLeft($this->getLayout()->createBlock('amgroupcat/adminhtml_rules_edit_tabs'));
     /*
      * add ExtJS library for "Category Access Restriction" tab with hierarchical visual output categories
      */
     $this->getLayout()->getBlock('head')->setCanLoadExtJs(true)->setCanLoadRulesJs(true);
     $this->renderLayout();
 }
 function getProduct()
 {
     if (!$this->_product) {
         $this->_product = Mage::registry('product');
     }
     return $this->_product;
 }
Ejemplo n.º 6
0
 protected function _toHtml()
 {
     $rssObj = Mage::getModel('rss/rss');
     $order = Mage::registry('current_order');
     $title = Mage::helper('rss')->__('Order # %s Notification(s)', $order->getIncrementId());
     $newurl = Mage::getUrl('sales/order/view', array('order_id' => $order->getId()));
     $data = array('title' => $title, 'description' => $title, 'link' => $newurl, 'charset' => 'UTF-8');
     $rssObj->_addHeader($data);
     $resourceModel = Mage::getResourceModel('rss/order');
     $results = $resourceModel->getAllCommentCollection($order->getId());
     if ($results) {
         foreach ($results as $result) {
             $urlAppend = 'view';
             $type = $result['entity_type_code'];
             if ($type && $type != 'order') {
                 $urlAppend = $type;
             }
             $type = Mage::helper('rss')->__(ucwords($type));
             $title = Mage::helper('rss')->__('Details for %s #%s', $type, $result['increment_id']);
             $description = '<p>' . Mage::helper('rss')->__('Notified Date: %s<br/>', $this->formatDate($result['created_at'])) . Mage::helper('rss')->__('Comment: %s<br/>', $result['comment']) . '</p>';
             $url = Mage::getUrl('sales/order/' . $urlAppend, array('order_id' => $order->getId()));
             $data = array('title' => $title, 'link' => $url, 'description' => $description);
             $rssObj->_addEntry($data);
         }
     }
     $title = Mage::helper('rss')->__('Order #%s created at %s', $order->getIncrementId(), $this->formatDate($order->getCreatedAt()));
     $url = Mage::getUrl('sales/order/view', array('order_id' => $order->getId()));
     $description = '<p>' . Mage::helper('rss')->__('Current Status: %s<br/>', $order->getStatusLabel()) . Mage::helper('rss')->__('Total: %s<br/>', $order->formatPrice($order->getGrandTotal())) . '</p>';
     $data = array('title' => $title, 'link' => $url, 'description' => $description);
     $rssObj->_addEntry($data);
     return $rssObj->createRssXml();
 }
Ejemplo n.º 7
0
 public function getAttributeObject()
 {
     if (null === $this->_attribute) {
         return Mage::registry('entity_attribute');
     }
     return $this->_attribute;
 }
Ejemplo n.º 8
0
 public function initForm()
 {
     $form = new Varien_Data_Form();
     $form->setHtmlIdPrefix('_info');
     $model = Mage::registry('current_giftcardaccount');
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('enterprise_giftcardaccount')->__('Information')));
     if ($model->getId()) {
         $fieldset->addField('code', 'label', array('name' => 'code', 'label' => Mage::helper('enterprise_giftcardaccount')->__('Gift Card Code'), 'title' => Mage::helper('enterprise_giftcardaccount')->__('Gift Card Code')));
         $fieldset->addField('state_text', 'label', array('name' => 'state_text', 'label' => Mage::helper('enterprise_giftcardaccount')->__('Status'), 'title' => Mage::helper('enterprise_giftcardaccount')->__('Status')));
     }
     $fieldset->addField('status', 'select', array('label' => Mage::helper('enterprise_giftcardaccount')->__('Active'), 'title' => Mage::helper('enterprise_giftcardaccount')->__('Active'), 'name' => 'status', 'required' => true, 'options' => array(Enterprise_GiftCardAccount_Model_Giftcardaccount::STATUS_ENABLED => Mage::helper('enterprise_giftcardaccount')->__('Yes'), Enterprise_GiftCardAccount_Model_Giftcardaccount::STATUS_DISABLED => Mage::helper('enterprise_giftcardaccount')->__('No'))));
     if (!$model->getId()) {
         $model->setData('status', Enterprise_GiftCardAccount_Model_Giftcardaccount::STATUS_ENABLED);
     }
     $fieldset->addField('is_redeemable', 'select', array('label' => Mage::helper('enterprise_giftcardaccount')->__('Redeemable'), 'title' => Mage::helper('enterprise_giftcardaccount')->__('Redeemable'), 'name' => 'is_redeemable', 'required' => true, 'options' => array(Enterprise_GiftCardAccount_Model_Giftcardaccount::REDEEMABLE => Mage::helper('enterprise_giftcardaccount')->__('Yes'), Enterprise_GiftCardAccount_Model_Giftcardaccount::NOT_REDEEMABLE => Mage::helper('enterprise_giftcardaccount')->__('No'))));
     if (!$model->getId()) {
         $model->setData('is_redeemable', Enterprise_GiftCardAccount_Model_Giftcardaccount::REDEEMABLE);
     }
     $fieldset->addField('website_id', 'select', array('name' => 'website_id', 'label' => Mage::helper('enterprise_giftcardaccount')->__('Website'), 'title' => Mage::helper('enterprise_giftcardaccount')->__('Website'), 'required' => true, 'values' => Mage::getSingleton('adminhtml/system_store')->getWebsiteValuesForForm(true)));
     $fieldset->addType('price', 'Enterprise_GiftCardAccount_Block_Adminhtml_Giftcardaccount_Form_Price');
     $fieldset->addField('balance', 'price', array('label' => Mage::helper('enterprise_giftcardaccount')->__('Balance'), 'title' => Mage::helper('enterprise_giftcardaccount')->__('Balance'), 'name' => 'balance', 'class' => 'validate-number', 'required' => true, 'note' => '<div id="balance_currency"></div>'));
     $fieldset->addField('date_expires', 'date', array('name' => 'date_expires', 'label' => Mage::helper('enterprise_giftcardaccount')->__('Expiration Date'), 'title' => Mage::helper('enterprise_giftcardaccount')->__('Expiration Date'), 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'format' => Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT)));
     $form->setValues($model->getData());
     $this->setForm($form);
     return $this;
 }
Ejemplo n.º 9
0
 protected function _prepareForm()
 {
     $model = Mage::registry('permissions_user');
     $form = new Varien_Data_Form();
     $form->setHtmlIdPrefix('user_');
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('adminhtml')->__('Account Information')));
     if ($model->getUserId()) {
         $fieldset->addField('user_id', 'hidden', array('name' => 'user_id'));
     } else {
         if (!$model->hasData('is_active')) {
             $model->setIsActive(1);
         }
     }
     $fieldset->addField('username', 'text', array('name' => 'username', 'label' => Mage::helper('adminhtml')->__('User Name'), 'id' => 'username', 'title' => Mage::helper('adminhtml')->__('User Name'), 'required' => true));
     $fieldset->addField('firstname', 'text', array('name' => 'firstname', 'label' => Mage::helper('adminhtml')->__('First Name'), 'id' => 'firstname', 'title' => Mage::helper('adminhtml')->__('First Name'), 'required' => true));
     $fieldset->addField('lastname', 'text', array('name' => 'lastname', 'label' => Mage::helper('adminhtml')->__('Last Name'), 'id' => 'lastname', 'title' => Mage::helper('adminhtml')->__('Last Name'), 'required' => true));
     $fieldset->addField('email', 'text', array('name' => 'email', 'label' => Mage::helper('adminhtml')->__('Email'), 'id' => 'customer_email', 'title' => Mage::helper('adminhtml')->__('User Email'), 'class' => 'required-entry validate-email', 'required' => true));
     $fieldset->addField('current_password', 'obscure', array('name' => 'current_password', 'label' => Mage::helper('adminhtml')->__('Current Admin Password'), 'id' => 'current_password', 'title' => Mage::helper('adminhtml')->__('Current Admin Password'), 'class' => 'input-text', 'required' => true));
     if ($model->getUserId()) {
         $fieldset->addField('password', 'password', array('name' => 'new_password', 'label' => Mage::helper('adminhtml')->__('New Password'), 'id' => 'new_pass', 'title' => Mage::helper('adminhtml')->__('New Password'), 'class' => 'input-text validate-admin-password'));
         $fieldset->addField('confirmation', 'password', array('name' => 'password_confirmation', 'label' => Mage::helper('adminhtml')->__('Password Confirmation'), 'id' => 'confirmation', 'class' => 'input-text validate-cpassword'));
     } else {
         $fieldset->addField('password', 'password', array('name' => 'password', 'label' => Mage::helper('adminhtml')->__('Password'), 'id' => 'customer_pass', 'title' => Mage::helper('adminhtml')->__('Password'), 'class' => 'input-text required-entry validate-admin-password', 'required' => true));
         $fieldset->addField('confirmation', 'password', array('name' => 'password_confirmation', 'label' => Mage::helper('adminhtml')->__('Password Confirmation'), 'id' => 'confirmation', 'title' => Mage::helper('adminhtml')->__('Password Confirmation'), 'class' => 'input-text required-entry validate-cpassword', 'required' => true));
     }
     if (Mage::getSingleton('admin/session')->getUser()->getId() != $model->getUserId()) {
         $fieldset->addField('is_active', 'select', array('name' => 'is_active', 'label' => Mage::helper('adminhtml')->__('This account is'), 'id' => 'is_active', 'title' => Mage::helper('adminhtml')->__('Account Status'), 'class' => 'input-select', 'style' => 'width: 80px', 'options' => array('1' => Mage::helper('adminhtml')->__('Active'), '0' => Mage::helper('adminhtml')->__('Inactive'))));
     }
     $fieldset->addField('user_roles', 'hidden', array('name' => 'user_roles', 'id' => '_user_roles'));
     $data = $model->getData();
     unset($data['password']);
     $form->setValues($data);
     $this->setForm($form);
     return parent::_prepareForm();
 }
Ejemplo n.º 10
0
 /**
  * Prepare form fields and structure
  *
  * @return Mage_Adminhtml_Block_Widget_Form
  */
 protected function _prepareForm()
 {
     $model = Mage::registry('current_status');
     $labels = $model ? $model->getStoreLabels() : array();
     $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post'));
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('Mage_Sales_Helper_Data')->__('Order Status Information')));
     $fieldset->addField('is_new', 'hidden', array('name' => 'is_new', 'value' => 1));
     $fieldset->addField('status', 'text', array('name' => 'status', 'label' => Mage::helper('Mage_Sales_Helper_Data')->__('Status Code'), 'class' => 'required-entry validate-code', 'required' => true));
     $fieldset->addField('label', 'text', array('name' => 'label', 'label' => Mage::helper('Mage_Sales_Helper_Data')->__('Status Label'), 'class' => 'required-entry', 'required' => true));
     $fieldset = $form->addFieldset('store_labels_fieldset', array('legend' => Mage::helper('Mage_Sales_Helper_Data')->__('Store View Specific Labels'), 'table_class' => 'form-list stores-tree'));
     foreach (Mage::app()->getWebsites() as $website) {
         $fieldset->addField("w_{$website->getId()}_label", 'note', array('label' => $website->getName(), 'fieldset_html_class' => 'website'));
         foreach ($website->getGroups() as $group) {
             $stores = $group->getStores();
             if (count($stores) == 0) {
                 continue;
             }
             $fieldset->addField("sg_{$group->getId()}_label", 'note', array('label' => $group->getName(), 'fieldset_html_class' => 'store-group'));
             foreach ($stores as $store) {
                 $fieldset->addField("store_label_{$store->getId()}", 'text', array('name' => 'store_labels[' . $store->getId() . ']', 'required' => false, 'label' => $store->getName(), 'value' => isset($labels[$store->getId()]) ? $labels[$store->getId()] : '', 'fieldset_html_class' => 'store'));
             }
         }
     }
     if ($model) {
         $form->addValues($model->getData());
     }
     $form->setAction($this->getUrl('*/sales_order_status/save'));
     $form->setUseContainer(true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
Ejemplo n.º 11
0
 /**
  * Instantiate select to get matched customers
  *
  * @return Enterprise_Reminder_Model_Resource_Customer_Collection
  */
 protected function _initSelect()
 {
     $rule = Mage::registry('current_reminder_rule');
     $select = $this->getSelect();
     $customerTable = $this->getTable('customer/entity');
     $couponTable = $this->getTable('enterprise_reminder/coupon');
     $logTable = $this->getTable('enterprise_reminder/log');
     $salesRuleCouponTable = $this->getTable('salesrule/coupon');
     $select->from(array('c' => $couponTable), array('associated_at', 'emails_failed', 'is_active'));
     $select->where('c.rule_id = ?', $rule->getId());
     $select->joinInner(array('e' => $customerTable), 'e.entity_id = c.customer_id', array('entity_id', 'email'));
     $subSelect = $this->getConnection()->select();
     $subSelect->from(array('g' => $logTable), array('customer_id', 'rule_id', 'emails_sent' => new Zend_Db_Expr('COUNT(log_id)'), 'last_sent' => new Zend_Db_Expr('MAX(sent_at)')));
     $subSelect->where('rule_id = ?', $rule->getId());
     $subSelect->group(array('customer_id', 'rule_id'));
     $select->joinLeft(array('l' => $subSelect), 'l.rule_id = c.rule_id AND l.customer_id = c.customer_id', array('l.emails_sent', 'l.last_sent'));
     $select->joinLeft(array('sc' => $salesRuleCouponTable), 'sc.coupon_id = c.coupon_id', array('code', 'usage_limit', 'usage_per_customer'));
     $this->_joinFields['associated_at'] = array('table' => 'c', 'field' => 'associated_at');
     $this->_joinFields['emails_failed'] = array('table' => 'c', 'field' => 'emails_failed');
     $this->_joinFields['is_active'] = array('table' => 'c', 'field' => 'is_active');
     $this->_joinFields['code'] = array('table' => 'sc', 'field' => 'code');
     $this->_joinFields['usage_limit'] = array('table' => 'sc', 'field' => 'usage_limit');
     $this->_joinFields['usage_per_customer'] = array('table' => 'sc', 'field' => 'usage_per_customer');
     $this->_joinFields['emails_sent'] = array('table' => 'l', 'field' => 'emails_sent');
     $this->_joinFields['last_sent'] = array('table' => 'l', 'field' => 'last_sent');
     return $this;
 }
Ejemplo n.º 12
0
 protected function _initRule()
 {
     Mage::register('current_promo_quote_rule', Mage::getModel('rewards/salesrule_rule'));
     if ($id = (int) $this->getRequest()->getParam('id')) {
         Mage::registry('current_promo_quote_rule')->load($id);
     }
 }
Ejemplo n.º 13
0
 /**
  * Retrieve Product object
  *
  * @return Mage_Catalog_Model_Product
  */
 public function getProduct()
 {
     if (!$this->getData('product')) {
         $this->setData('product', Mage::registry('product'));
     }
     return $this->getData('product');
 }
Ejemplo n.º 14
0
 /**
  * Returns Google shopping item ID or null if product was published in current store
  *
  * @return string|null
  * @throws RuntimeException If Mage_GoogleShopping is not active
  */
 public function getGoogleShoppingItemId()
 {
     if (false === $this->_gsItem) {
         $this->_gsItem = ($product = Mage::registry('current_product')) ? $this->_getGoogleShoppingAdapter()->getItemId($product) : null;
     }
     return $this->_gsItem;
 }
Ejemplo n.º 15
0
 protected function _prepareForm()
 {
     $form = new Varien_Data_Form();
     /**
      * Initialize product object as form property
      * for using it in elements generation
      */
     $form->setDataObject(Mage::registry('product'));
     $fieldset = $form->addFieldset('group_fields', array());
     $attributes = $this->getGroupAttributes();
     $this->_setFieldset($attributes, $fieldset, array('gallery'));
     $values = Mage::registry('product')->getData();
     /**
      * Set attribute default values for new product
      */
     if (!Mage::registry('product')->getId()) {
         foreach ($attributes as $attribute) {
             if (!isset($values[$attribute->getAttributeCode()])) {
                 $values[$attribute->getAttributeCode()] = $attribute->getDefaultValue();
             }
         }
     }
     Mage::dispatchEvent('adminhtml_catalog_product_edit_prepare_form', array('form' => $form));
     $form->addValues($values);
     $form->setFieldNameSuffix('product');
     $this->setForm($form);
 }
Ejemplo n.º 16
0
 public function getParseType()
 {
     $data = Mage::registry('current_convert_profile')->getGuiData();
     if ($data) {
         return $data['parse']['type'] == 'excel_xml' ? 'xml' : $data['parse']['type'];
     }
 }
Ejemplo n.º 17
0
 public function prefarestoreForm($block)
 {
     if (Mage::registry('store_type') == 'store') {
         $form = $block["block"]->getForm();
         $storeid = Mage::app()->getRequest()->getParam("store_id");
         $collections = Mage::getModel('jmmegamenu/jmmegamenugroup')->getCollection()->addFieldToFilter("storeid", array("eq" => $storeid))->setOrder("id", "DESC");
         $listgroup = array();
         foreach ($collections as $collection) {
             $listgroup[$collection->id] = $collection->title;
         }
         //add the menugoup field
         if (!empty($listgroup)) {
             $resource = Mage::getSingleton('core/resource');
             $read = $resource->getConnection('core_read');
             $menutable = $resource->getTableName('jmmegamenu_store_menugroup');
             $query = 'SELECT menugroupid ' . ' FROM ' . $menutable . ' WHERE store_id = ' . (int) $storeid . ' ORDER BY id';
             $rows = $read->fetchRow($query);
             $fieldset = $form->addFieldset('jmmegamenu_fieldset', array('legend' => Mage::helper('core')->__('Jm megamenu Information')));
             //print_r($listgroup);die();
             $fieldset->addField('menugroup', 'select', array('name' => 'menugroup', 'label' => Mage::helper('jmmegamenu')->__('Menu Group'), 'no_span' => true, 'values' => $listgroup));
             $menugroup = $form->getElement("menugroup");
             $menugroup->setValue($rows['menugroupid']);
             if ($rows['menugroupid']) {
                 //die($rows['menugroupid']);
                 $form->setValue("menugroup", $rows['menugroupid']);
             }
             $block["block"]->setForm($form);
             // print_r($block);die();
         }
     }
 }
Ejemplo n.º 18
0
 /**
  * Prepare form
  *
  * @return Mage_Adminhtml_Block_Widget_Form
  */
 protected function _prepareForm()
 {
     $model = Mage::registry('current_template');
     if (!$model) {
         $model = new Varien_Object();
     }
     $action = $this->getUrl('*/*/saveTemplate');
     $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $action, 'method' => 'post', 'enctype' => 'multipart/form-data'));
     $form->setHtmlIdPrefix('template_');
     $fieldset = $form->addFieldset('edit_template', array('legend' => $this->__('Template')));
     $this->_addElementTypes($fieldset);
     if ($model->getId()) {
         $fieldset->addField('id', 'hidden', array('name' => 'id'));
         $fieldset->addField('template_id', 'hidden', array('name' => 'template_id'));
     }
     $fieldset->addField('application_id', 'select', array('name' => 'application_id', 'label' => $this->__('Application'), 'title' => $this->__('Application'), 'disabled' => $model->getId() || !$this->_fieldsEnabled ? true : false, 'values' => Mage::helper('xmlconnect')->getApplicationOptions(), 'note' => $this->__('Creating a Template is allowed only for applications which have device type iPhone.'), 'required' => true));
     $fieldset->addField('name', 'text', array('name' => 'name', 'label' => $this->__('Template Name'), 'title' => $this->__('Template Name'), 'required' => true, 'disabled' => $model->getId() || !$this->_fieldsEnabled ? true : false, 'note' => $this->__('Maximum length is 255'), 'maxlength' => 255));
     $fieldset->addField('push_title', 'text', array('name' => 'push_title', 'label' => $this->__('Push Title'), 'title' => $this->__('Push Title'), 'required' => true, 'disabled' => !$this->_fieldsEnabled ? true : false, 'note' => $this->__('Maximum length is 140'), 'maxlength' => 140));
     $this->_dependentFields['message_title'] = $fieldset->addField('message_title', 'text', array('name' => 'message_title', 'label' => $this->__('Message Title'), 'title' => $this->__('Message Title'), 'required' => true, 'disabled' => !$this->_fieldsEnabled ? true : false, 'note' => $this->__('Maximum length is 255'), 'maxlength' => 255));
     $widgetFilters = array('is_email_compatible' => 1);
     $wysiwygConfig = Mage::getSingleton('cms/wysiwyg_config')->getConfig(array('widget_filters' => $widgetFilters));
     $this->_dependentFields['content'] = $fieldset->addField('content', 'editor', array('label' => $this->__('Template Content'), 'title' => $this->__('Template Content'), 'name' => 'content', 'style' => 'height:30em;', 'state' => 'html', 'required' => true, 'disabled' => !$this->_fieldsEnabled ? true : false, 'config' => $wysiwygConfig));
     $form->setValues($model->getData());
     $form->setUseContainer(true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
 public function isProductListVisible()
 {
     if ($category = Mage::registry('current_category')) {
         return $category->getData('display_mode') != 'PAGE';
     }
     return true;
 }
Ejemplo n.º 20
0
 /**
  * Preparation of current form
  *
  * @return Inic_Faq_Block_Admin_Edit_Tab_Main Self
  */
 protected function _prepareForm()
 {
     $model = Mage::registry('faq');
     $form = new Varien_Data_Form();
     $form->setHtmlIdPrefix('faq_');
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('faq')->__('General information'), 'class' => 'fieldset-wide'));
     if ($model->getFaqId()) {
         $fieldset->addField('faq_id', 'hidden', array('name' => 'faq_id'));
     }
     $approveInfo = $fieldset->addField('question', 'text', array('name' => 'question', 'label' => Mage::helper('faq')->__('FAQ item question'), 'title' => Mage::helper('faq')->__('FAQ item question'), 'required' => true));
     /**
      * Check is single store mode
      */
     if (!Mage::app()->isSingleStoreMode()) {
         $store_id = $fieldset->addField('store_id', 'multiselect', array('name' => 'store_id[]', 'label' => Mage::helper('faq')->__('Store view'), 'title' => Mage::helper('faq')->__('Store view'), 'required' => true, 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true)));
     } else {
         $store_id = $fieldset->addField('store_id', 'hidden', array('name' => 'store_id[]', 'value' => Mage::app()->getStore(true)->getId()));
         $model->setStoreId(Mage::app()->getStore(true)->getId());
     }
     $status = $fieldset->addField('is_active', 'select', array('label' => Mage::helper('faq')->__('Status'), 'title' => Mage::helper('faq')->__('Item status'), 'name' => 'is_active', 'required' => true, 'options' => array('1' => Mage::helper('faq')->__('Enabled'), '0' => Mage::helper('faq')->__('Disabled'))));
     $fieldset->addField('is_most_frequent', 'select', array('label' => Mage::helper('faq')->__('Is Most Frequent'), 'title' => Mage::helper('faq')->__('Is Most Frequent'), 'name' => 'is_most_frequent', 'required' => true, 'options' => array('1' => Mage::helper('faq')->__('Yes'), '0' => Mage::helper('faq')->__('No'))));
     $category_id = $fieldset->addField('category_id', 'multiselect', array('label' => Mage::helper('faq')->__('Category'), 'title' => Mage::helper('faq')->__('Category'), 'name' => 'category_id[]', 'required' => false, 'values' => Mage::getResourceSingleton('faq/category_collection')->toOptionArray()));
     $fieldset->addField('answer', 'editor', array('name' => 'answer', 'label' => Mage::helper('faq')->__('Content'), 'title' => Mage::helper('faq')->__('Content'), 'style' => 'height:36em;', 'config' => Mage::getSingleton('cms/wysiwyg_config')->getConfig(), 'state' => 'html', 'required' => true));
     $data = $model->getData();
     if (!count($data)) {
         $data['store_id'] = 0;
     }
     $form->setValues($data);
     $this->setForm($form);
     $cat_id = $model->getData('category_id');
     $selected = $cat_id ? $cat_id : "";
     $this->setChild('form_after', $this->getLayout()->createBlock('faq/adminhtml_widget_form_element_selectdependence')->addFieldMap($store_id->getHtmlId(), $category_id->getHtmlId(), $selected));
     return parent::_prepareForm();
 }
Ejemplo n.º 21
0
 /**
  * Prepare related orders collection
  *
  * @return Mage_Adminhtml_Block_Widget_Grid
  */
 protected function _prepareCollection()
 {
     $collection = Mage::getResourceModel('Mage_Sales_Model_Resource_Order_Grid_Collection');
     $collection->addBillingAgreementsFilter(Mage::registry('current_billing_agreement')->getId());
     $this->setCollection($collection);
     return Mage_Adminhtml_Block_Widget_Grid::_prepareCollection();
 }
 public function handleEventBlockAlert($observer)
 {
     $product = Mage::registry('current_product');
     if ('product.info.addtocart' == $observer->getEvent()->getBlock()->getNameInLayout() && $product->getTypeId() == 'virtual') {
         $today = date("Y-m-d");
         $mainCollection = Mage::getResourceModel('wage_trainevent/trainevent_collection')->addStoreFilter(Mage::app()->getStore())->addProductFilter($product);
         $firstCollection = $mainCollection->getFirstItem();
         $trainEventEndDate = $firstCollection->getData('end_date');
         if (strtotime($today) >= strtotime($trainEventEndDate) && $trainEventEndDate) {
             $isLogged = Mage::helper('customer')->isLoggedIn();
             if (!$isLogged) {
                 $transport = $observer->getEvent()->getTransport();
                 $alertBlock = Mage::app()->getLayout()->createBlock('wage_trainevent/trainevent_subscribe', 'event.subscribe');
                 $alertBlock->setTemplate('wage_trainevent/subscribe_guest.phtml');
                 $html = $alertBlock->toHtml();
                 $transport->setHtml($html);
             } else {
                 $transport = $observer->getEvent()->getTransport();
                 $alertBlock = Mage::app()->getLayout()->createBlock('wage_trainevent/trainevent_subscribe', 'event.subscribe');
                 $alertBlock->setTemplate('wage_trainevent/subscribe_customer.phtml');
                 $alertBlock->setHtmlClass('alert-stock link-stock-alert');
                 $alertBlock->setSignupLabel('Sign up to get notified to get next Event Planning');
                 $html = $alertBlock->toHtml();
                 $transport->setHtml($html);
             }
         }
     }
 }
Ejemplo n.º 23
0
 public function getLayerednavigationajax()
 {
     if (!$this->hasData('layerednavigationajax')) {
         $this->setData('layerednavigationajax', Mage::registry('layerednavigationajax'));
     }
     return $this->getData('layerednavigationajax');
 }
Ejemplo n.º 24
0
 /**
  * Set title and a hack for tabs container
  *
  * @return Mage_Sales_Block_Adminhtml_Recurring_Profile_View
  */
 protected function _beforeToHtml()
 {
     $profile = Mage::registry('current_recurring_profile');
     $this->_headerText = Mage::helper('sales')->__('Recurring Profile # %s', $profile->getReferenceId());
     $this->setViewHtml('<div id="' . $this->getDestElementId() . '"></div>');
     return parent::_beforeToHtml();
 }
Ejemplo n.º 25
0
 protected function _prepareForm()
 {
     /*
      * Checking if user have permissions to save information
      */
     if ($this->_isAllowedAction('save')) {
         $isElementDisabled = false;
     } else {
         $isElementDisabled = true;
     }
     $form = new Varien_Data_Form();
     $form->setHtmlIdPrefix('page_');
     $model = Mage::registry('cms_page');
     $layoutFieldset = $form->addFieldset('layout_fieldset', array('legend' => Mage::helper('cms')->__('Page Layout'), 'class' => 'fieldset-wide', 'disabled' => $isElementDisabled));
     $layoutFieldset->addField('root_template', 'select', array('name' => 'root_template', 'label' => Mage::helper('cms')->__('Layout'), 'required' => true, 'values' => Mage::getSingleton('page/source_layout')->toOptionArray(), 'disabled' => $isElementDisabled));
     if (!$model->getId()) {
         $model->setRootTemplate(Mage::getSingleton('page/source_layout')->getDefaultValue());
     }
     $layoutFieldset->addField('layout_update_xml', 'textarea', array('name' => 'layout_update_xml', 'label' => Mage::helper('cms')->__('Layout Update XML'), 'style' => 'height:24em;', 'disabled' => $isElementDisabled));
     $designFieldset = $form->addFieldset('design_fieldset', array('legend' => Mage::helper('cms')->__('Custom Design'), 'class' => 'fieldset-wide', 'disabled' => $isElementDisabled));
     $dateFormatIso = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
     $designFieldset->addField('custom_theme_from', 'date', array('name' => 'custom_theme_from', 'label' => Mage::helper('cms')->__('Custom Design From'), 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'format' => $dateFormatIso, 'disabled' => $isElementDisabled));
     $designFieldset->addField('custom_theme_to', 'date', array('name' => 'custom_theme_to', 'label' => Mage::helper('cms')->__('Custom Design To'), 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'format' => $dateFormatIso, 'disabled' => $isElementDisabled));
     $designFieldset->addField('custom_theme', 'select', array('name' => 'custom_theme', 'label' => Mage::helper('cms')->__('Custom Theme'), 'values' => Mage::getModel('core/design_source_design')->getAllOptions(), 'disabled' => $isElementDisabled));
     $designFieldset->addField('custom_root_template', 'select', array('name' => 'custom_root_template', 'label' => Mage::helper('cms')->__('Custom Layout'), 'values' => Mage::getSingleton('page/source_layout')->toOptionArray(true), 'disabled' => $isElementDisabled));
     $designFieldset->addField('custom_layout_update_xml', 'textarea', array('name' => 'custom_layout_update_xml', 'label' => Mage::helper('cms')->__('Custom Layout Update XML'), 'style' => 'height:24em;', 'disabled' => $isElementDisabled));
     Mage::dispatchEvent('adminhtml_cms_page_edit_tab_design_prepare_form', array('form' => $form));
     $form->setValues($model->getData());
     $this->setForm($form);
     return parent::_prepareForm();
 }
Ejemplo n.º 26
0
 /**
  * Retrieve the current page
  *
  * @return false|Fishpig_AttributeSplashPro_Model_Page
  */
 public function getPage()
 {
     if (($page = Mage::registry('splash_page')) !== null) {
         return $page;
     }
     return false;
 }
Ejemplo n.º 27
0
 /**
  * Get product input types as option array
  *
  * @return array
  */
 public function toOptionArray()
 {
     $inputTypes = array(array('value' => 'price', 'label' => Mage::helper('catalog')->__('Price')), array('value' => 'media_image', 'label' => Mage::helper('catalog')->__('Media Image')));
     $response = new Varien_Object();
     $response->setTypes(array());
     Mage::dispatchEvent('adminhtml_product_attribute_types', array('response' => $response));
     $_disabledTypes = array();
     $_hiddenFields = array();
     foreach ($response->getTypes() as $type) {
         $inputTypes[] = $type;
         if (isset($type['hide_fields'])) {
             $_hiddenFields[$type['value']] = $type['hide_fields'];
         }
         if (isset($type['disabled_types'])) {
             $_disabledTypes[$type['value']] = $type['disabled_types'];
         }
     }
     if (Mage::registry('attribute_type_hidden_fields') === null) {
         Mage::register('attribute_type_hidden_fields', $_hiddenFields);
     }
     if (Mage::registry('attribute_type_disabled_types') === null) {
         Mage::register('attribute_type_disabled_types', $_disabledTypes);
     }
     return array_merge(parent::toOptionArray(), $inputTypes);
 }
 protected function _prepareForm()
 {
     $form = new Varien_Data_Form();
     $this->setForm($form);
     $fieldset = $form->addFieldset('promotional_form', array('legend' => Mage::helper('promotional')->__('General')));
     $fieldset->addField('name', 'text', array('label' => Mage::helper('promotional')->__('Name'), 'name' => 'name', 'class' => 'required-entry', 'required' => true));
     $dateFormatIso = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
     $fieldset->addField('date_from', 'date', array('label' => Mage::helper('promotional')->__('Date From'), 'name' => 'date_from', 'required' => false, 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'format' => $dateFormatIso));
     $fieldset->addField('date_to', 'date', array('label' => Mage::helper('promotional')->__('Date To'), 'name' => 'date_to', 'required' => false, 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'format' => $dateFormatIso));
     if (!Mage::app()->isSingleStoreMode()) {
         $fieldset->addField('store_view', 'multiselect', array('label' => Mage::helper('promotional')->__('Store View'), 'name' => 'store_view', 'class' => 'required-entry', 'required' => true, 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true)));
     }
     $fieldset->addField('page_type', 'multiselect', array('label' => Mage::helper('promotional')->__('Page Type'), 'name' => 'page_type', 'class' => 'required-entry', 'required' => true, 'values' => Mage::getModel('promotional/source_page')->toOptionArray()));
     $fieldset->addField('position', 'select', array('label' => Mage::helper('promotional')->__('Position'), 'name' => 'position', 'class' => 'required-entry', 'required' => true, 'values' => Mage::getModel('promotional/source_position')->toOptionArray()));
     $fieldset->addField('status', 'select', array('label' => Mage::helper('promotional')->__('Status'), 'name' => 'status', 'class' => 'required-entry', 'required' => true, 'values' => Mage::getModel('promotional/source_status')->toOptionArray()));
     $fieldset->addField('width', 'text', array('label' => Mage::helper('promotional')->__('Width, px'), 'name' => 'width', 'required' => false, 'note' => $this->__('Minimum width is 200px')));
     $fieldset->addField('height', 'text', array('label' => Mage::helper('promotional')->__('Height, px'), 'name' => 'height', 'required' => false, 'note' => $this->__('Miimum height is 300px')));
     if (Mage::getSingleton('adminhtml/session')->getPromotionalData()) {
         $form->setValues(Mage::getSingleton('adminhtml/session')->getPromotionalData());
         Mage::getSingleton('adminhtml/session')->setPromotionalData(null);
     } elseif (Mage::registry('promotional_data')) {
         $form->setValues(Mage::registry('promotional_data')->getData());
     }
     if (Mage::getSingleton('adminhtml/session')->getPromotionalData() == NULL && Mage::registry('promotional_data')->getData() == NULL) {
         $form->setValues(array('position' => Mage::helper('promotional')->getDefaultPosition()));
     }
     return parent::_prepareForm();
 }
Ejemplo n.º 29
0
 protected function _prepareForm()
 {
     $rule = Mage::registry('current_promo_quote_rule');
     $form = new Varien_Data_Form();
     $form->setHtmlIdPrefix('rule_');
     $fieldset = $form->addFieldset('default_label_fieldset', array('legend' => Mage::helper('salesrule')->__('Default Label')));
     $labels = $rule->getStoreLabels();
     $fieldset->addField('store_default_label', 'text', array('name' => 'store_labels[0]', 'required' => false, 'label' => Mage::helper('salesrule')->__('Default Rule Label for All Store Views'), 'value' => isset($labels[0]) ? $labels[0] : ''));
     $fieldset = $form->addFieldset('store_labels_fieldset', array('legend' => Mage::helper('salesrule')->__('Store View Specific Labels'), 'table_class' => 'form-list stores-tree'));
     $renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset');
     $fieldset->setRenderer($renderer);
     foreach (Mage::app()->getWebsites() as $website) {
         $fieldset->addField("w_{$website->getId()}_label", 'note', array('label' => $website->getName(), 'fieldset_html_class' => 'website'));
         foreach ($website->getGroups() as $group) {
             $stores = $group->getStores();
             if (count($stores) == 0) {
                 continue;
             }
             $fieldset->addField("sg_{$group->getId()}_label", 'note', array('label' => $group->getName(), 'fieldset_html_class' => 'store-group'));
             foreach ($stores as $store) {
                 $fieldset->addField("s_{$store->getId()}", 'text', array('name' => 'store_labels[' . $store->getId() . ']', 'required' => false, 'label' => $store->getName(), 'value' => isset($labels[$store->getId()]) ? $labels[$store->getId()] : '', 'fieldset_html_class' => 'store'));
             }
         }
     }
     if ($rule->isReadonly()) {
         foreach ($fieldset->getElements() as $element) {
             $element->setReadonly(true, true);
         }
     }
     $this->setForm($form);
     return parent::_prepareForm();
 }
Ejemplo n.º 30
0
 /**
  * @return string
  */
 protected function getDownloadInvoiceUrl()
 {
     /** @var $invoice Mage_Sales_Model_Order_Invoice */
     $invoice = Mage::registry('current_invoice');
     $url = $this->getUrl('adminhtml/payonecore_sales_order_invoice/getInvoice', array('invoice_id' => $invoice->getId()));
     return $url;
 }