protected function _addHomeLink() { if (Mage::getStoreConfig('weltpixel_megamenu/general/display_home_link')) { $homeNode = new Varien_Data_Tree_Node(array('name' => 'Home', 'id' => 'home-link', 'url' => Mage::getBaseUrl(), 'is_active' => Mage::getBlockSingleton('page/html_header')->getIsHomePage()), 'id', $this->_menu->getTree()); $this->_menu->addChild($homeNode); } }
protected function _prepareForm() { $model = Mage::registry('current_promo_checkoutrule_rule'); //$form = new Varien_Data_Form(array('id' => 'edit_form1', 'action' => $this->getData('action'), 'method' => 'post')); $form = new Varien_Data_Form(); $form->setHtmlIdPrefix('rule_'); $renderer = Mage::getBlockSingleton('adminhtml/widget_form_renderer_fieldset')->setTemplate('promo/fieldset.phtml')->setNewChildUrl($this->getUrl('*/promo_checkoutrule/newConditionHtml/form/rule_conditions_fieldset')); $fieldset = $form->addFieldset('conditions_fieldset', array('legend' => Mage::helper('checkoutrule')->__('Apply the rule only if the following conditions are met (leave blank for all products)')))->setRenderer($renderer); $fieldset->addField('conditions', 'text', array('name' => 'conditions', 'label' => Mage::helper('checkoutrule')->__('Conditions'), 'title' => Mage::helper('checkoutrule')->__('Conditions')))->setRule($model)->setRenderer(Mage::getBlockSingleton('rule/conditions')); /* $fieldset = $form->addFieldset('actions_fieldset', array( 'legend'=>Mage::helper('checkoutrule')->__('Apply the rule to cart items matching the following conditions') ))->setRenderer($renderer); $fieldset->addField('actions', 'text', array( 'name' => 'actions', 'label' => Mage::helper('checkoutrule')->__('Apply To'), 'title' => Mage::helper('checkoutrule')->__('Apply To'), 'required' => true, ))->setRule($model)->setRenderer(Mage::getBlockSingleton('rule/actions')); */ $form->setValues($model->getData()); //$form->setUseContainer(true); $this->setForm($form); return parent::_prepareForm(); }
public function render(Varien_Data_Form_Element_Abstract $element) { $html = $this->_getHeaderHtml($element); $renderer = Mage::getBlockSingleton('adminhtml/system_config_form_field'); $attributes = Mage::getConfig()->getNode(self::XML_PATH_IMAGE_TYPES)->asArray(); foreach ($attributes as $key => $attribute) { /** * Watermark size field */ $field = new Varien_Data_Form_Element_Text(); $field->setName("groups[watermark][fields][{$key}_size][value]")->setForm($this->getForm())->setLabel(Mage::helper('adminhtml')->__('Size for %s', $attribute['title']))->setRenderer($renderer); $html .= $field->toHtml(); /** * Watermark upload field */ $field = new Varien_Data_Form_Element_Imagefile(); $field->setName("groups[watermark][fields][{$key}_image][value]")->setForm($this->getForm())->setLabel(Mage::helper('adminhtml')->__('Watermark File for %s', $attribute['title']))->setRenderer($renderer); $html .= $field->toHtml(); /** * Watermark position field */ $field = new Varien_Data_Form_Element_Select(); $field->setName("groups[watermark][fields][{$key}_position][value]")->setForm($this->getForm())->setLabel(Mage::helper('adminhtml')->__('Position of Watermark for %s', $attribute['title']))->setRenderer($renderer)->setValues(Mage::getSingleton('adminhtml/system_config_source_catalog_product_watermark_position')->toOptionArray()); $html .= $field->toHtml(); } $html .= $this->_getFooterHtml($element); return $html; }
protected function _sendEmail() { $data = $this->getRequest()->getParams(); $senderInfo = $data['sender']; $recipients = $data['recipients']; $recipientEmail = $recipients['email']; $recipientName = $recipients['name']; $offer = Mage::getModel('customerreward/offer')->load($this->getRequest()->getParam('offer_id')); $offer->setCurrentDate(Mage::helper('core')->formatDate(now(), 'long')); $description = Mage::getBlockSingleton('customerreward/offer_view')->setOffer($offer)->getTitleDescriptionHtml(); $offer->setTitleHtml($description['title']); $offer->setDescription($description['description']); $offer->setImageUrl(Mage::getBaseUrl('media') . $offer->getImage()); if (Mage::helper('customerreward')->getReferConfig('coupon')) { $offer->setCoupon($data['coupon']); } //send email $translate = Mage::getSingleton('core/translate'); $translate->setTranslateInline(false); $mailTemplate = Mage::getModel('core/email_template'); $message = nl2br(htmlspecialchars($senderInfo['message'])); $sender = array('name' => Mage::helper('customerreward')->htmlEscape($senderInfo['name']), 'email' => Mage::helper('customerreward')->htmlEscape($senderInfo['email'])); $mailTemplate->setDesignConfig(array('area' => 'frontend', 'store' => Mage::app()->getStore()->getId())); $template = Mage::helper('customerreward')->getEmailConfig('sendfriend'); foreach ($recipientEmail as $k => $email) { $name = $recipientName[$k]; $mailTemplate->sendTransactional($template, 'sales', $email, $name, array('store' => Mage::app()->getStore(), 'name' => $name, 'email' => $email, 'message' => $message, 'sender_name' => $sender['name'], 'sender_email' => $sender['email'], 'title' => $data['title'], 'url' => $data['url'], 'offer' => $offer)); } $translate->setTranslateInline(true); return $this; }
protected function _getFieldRenderer() { if (empty($this->_fieldRenderer)) { $this->_fieldRenderer = Mage::getBlockSingleton('Mage_Adminhtml_Block_System_Config_Form_Field'); } return $this->_fieldRenderer; }
public function getStateInfo() { $_hlp = $this->_helper; //Check the Layered Nav position (Search or Catalog pages) $ajaxUrl = ''; if ($_hlp->isSearch()) { $ajaxUrl = Mage::getUrl('layerednav/front/search'); } elseif ($cat = $this->getLayer()->getCurrentCategory()) { $ajaxUrl = Mage::getUrl('layerednav/front/category', array('id' => $cat->getId())); } $ajaxUrl = $_hlp->stripQuery($ajaxUrl); $url = $_hlp->getContinueShoppingUrl(); //Set the AJAX Pagination $pageKey = Mage::getBlockSingleton('page/html_pager')->getPageVarName(); //Get parameters of serach $queryStr = $_hlp->getParams(true, $pageKey); if ($queryStr) { $queryStr = substr($queryStr, 1); } $this->setClearAllUrl($_hlp->getClearAllUrl($url)); if (false !== strpos($url, '?')) { $url = substr($url, 0, strpos($url, '?')); } return array($url, $queryStr, $ajaxUrl); }
/** * process controller_action_predispatch_webpos_index_productsearch event * * @return Magestore_Inventorywebpos_Model_Observer */ public function initProductSearch($observer) { $keyword = Mage::app()->getRequest()->getPost('keyword'); $barcode = Mage::getModel('inventorybarcode/barcode')->load($keyword, 'barcode'); $result = array(); $storeId = Mage::app()->getStore()->getStoreId(); $showOutofstock = Mage::getStoreConfig('webpos/general/show_product_outofstock', $storeId); $productBlock = Mage::getBlockSingleton('catalog/product_list'); if ($barcode->getId()) { $productId = $barcode->getProductEntityId(); $product = Mage::getModel('catalog/product')->load($productId); $addToCart = $productBlock->getAddToCartUrl($product) . 'tempadd/1'; $result[] = $productId; $html = ''; $html .= '<ul>'; $html .= '<li id="sku_only" url="' . $addToCart . '" onclick="setLocation(\'' . $addToCart . '\')">'; $html .= '<strong>' . Mage::getBlockSingleton('core/template')->htmlEscape($product->getName()) . '</strong>-' . Mage::helper('core')->currency($product->getFinalPrice()); $html .= '<br /><strong>SKU: </strong>' . $product->getSku(); if ($showOutofstock) { $html .= '<br />'; if ($product->isAvailable()) { $html .= '<p class="availability in-stock">' . Mage::helper('inventorywebpos')->__('Availability:') . '<span>' . Mage::helper('inventorywebpos')->__('In stock') . '</span></p><div style="clear:both"></div>'; } else { $html .= '<p class="availability out-of-stock">' . Mage::helper('inventorywebpos')->__('Availability:') . '<span>' . Mage::helper('inventorywebpos')->__('Out of stock') . '</span></p><div style="clear:both"></div>'; } } $html .= '</li>'; $html .= '</ul>'; echo $html; return; } else { $searchInstance = new Magestore_Inventorywebpos_Model_Search_Barcode(); $results = $searchInstance->setStart(1)->setLimit(10)->setQuery($keyword)->load()->getResults(); if (count($results)) { $html = ''; $html .= '<ul>'; foreach ($results as $item) { $productId = $item['product_id']; $product = Mage::getModel('catalog/product')->load($productId); $addToCart = $productBlock->getAddToCartUrl($product) . 'tempadd/1'; $result[] = $product->getId(); $html .= '<li onclick="setLocation(\'' . $addToCart . '\')">'; $html .= '<strong>' . Mage::getBlockSingleton('core/template')->htmlEscape($product->getName()) . '</strong>-' . Mage::helper('core')->currency($product->getFinalPrice()); $html .= '<br /><strong>SKU: </strong>' . $product->getSku(); if ($showOutofstock) { $html .= '<br />'; if ($product->isAvailable()) { $html .= '<p class="availability in-stock">' . Mage::helper('inventorywebpos')->__('Availability:') . '<span>' . Mage::helper('inventorywebpos')->__('In stock') . '</span></p><div style="clear:both"></div>'; } else { $html .= '<p class="availability out-of-stock">' . Mage::helper('inventorywebpos')->__('Availability:') . '<span>' . Mage::helper('inventorywebpos')->__('Out of stock') . '</span></p><div style="clear:both"></div>'; } } $html .= '</li>'; } $html .= '</ul>'; echo $html; return; } } }
/** * Returns URL which should be loaded if person chooses to remove this filter item from active filters * @return string * @see Mage_Catalog_Model_Layer_Filter_Item::getRemoveUrl() * This method is overridden by copying (method body was pasted from parent class and modified as needed). All * changes are marked with comments. */ public function getRemoveUrl() { // MANA BEGIN: add multivalue filter handling if ($this->hasData('remove_url')) { return $this->getData('remove_url'); } $values = $this->getFilter()->getMSelectedValues(); // this could fail if called from some kind of standard filter if (!$values) { $values = array(); } unset($values[array_search($this->getValue(), $values)]); if (count($values) > 0) { $query = array($this->getFilter()->getRequestVar() => implode('_', $values), Mage::getBlockSingleton('page/html_pager')->getPageVarName() => null); } else { $query = array($this->getFilter()->getRequestVar() => $this->getFilter()->getResetValue()); } // MANA END $params = array('_secure' => Mage::app()->getFrontController()->getRequest()->isSecure()); $params['_current'] = true; $params['_use_rewrite'] = true; $params['_m_escape'] = ''; $params['_query'] = $query; return Mage::helper('mana_filters')->markLayeredNavigationUrl(Mage::getUrl('*/*/*', $params), '*/*/*', $params); }
public function getUrl() { $request = Mage::app()->getRequest(); if ($request->getModuleName() == 'catalogsearch') { return parent::getUrl(); } if ($this->getFilter() instanceof Mage_Catalog_Model_Layer_Filter_Category) { $category = Mage::getModel('catalog/category')->load($this->getValue()); $query = array(Mage::getBlockSingleton('page/html_pager')->getPageVarName() => null); $suffix = Mage::getStoreConfig('catalog/seo/category_url_suffix'); $catpart = str_replace($suffix, '', $category->getUrl()); if (preg_match('/\\/l\\/.+/', Mage::app()->getRequest()->getOriginalPathInfo(), $matches)) { $layeredpart = str_replace($suffix, '', $matches[0]); } else { $layeredpart = ''; } return $catpart . $layeredpart . $suffix; } else { $var = $this->getFilter()->getRequestVar(); $request = Mage::app()->getRequest(); $labelValue = strpos($request->getRequestUri(), 'catalogsearch') !== false ? $this->getValue() : $this->getLabel(); $attribute = $this->getFilter()->getData('attribute_model'); //->getAttributeCode() if ($attribute) { $value = $attribute->getAttributeCode() == 'price' || $attribute->getBackendType() == 'decimal' ? $this->getValue() : $labelValue; } else { $value = $labelValue; } $query = array($var => $value, Mage::getBlockSingleton('page/html_pager')->getPageVarName() => null); return Mage::helper('seosuite')->getLayerFilterUrl(array('_current' => true, '_use_rewrite' => true, '_query' => $query)); } }
/** * api page Dashboard * * ?call=bestsellers * & params = { * "page":"1", * "limit":"10", * "store":"1", * "order_status":"string|array()", * "date_range":"1d|7d|15d|30d|3m|6m|1y|2y|lt" * } */ public function apiIndex($params) { //if filter by order status if (isset($params['order_status'])) { if (!is_array($params['order_status'])) { $params['order_status'] = array($params['order_status']); } $this->_helper->setOrderStatus($params['order_status']); } //if filter by date range if (isset($params['date_range'])) { $this->_helper->setBestsellersDateRangeCode($params['date_range']); } $block_bestsellers = Mage::getBlockSingleton('simisalestrackingapi/bestsellers'); $rows = array(); $number = 0; //number of bestsellers filtered if ($collection = $this->_helper->getBestsellersCollection()) { $collection->getSelect()->limit($params['limit'], $params['page'] * $params['limit']); $data = $collection->getData(); $number = $this->_helper->getNumBestsellers(); foreach ($data as $r) { $rows[] = array('product_id' => (int) $r['product_id'], 'sku' => $r['sku'], 'name' => $r['product_name'], 'qty' => (int) $r['qty'], 'sales' => Mage::helper('core')->currency($r['sales'], true, false)); } } return array('title' => $block_bestsellers->getTitleTime(), 'updated_at' => $block_bestsellers->getUpdatedTime(), 'is_old' => $block_bestsellers->isOld(), 'num_bestsellers' => $number, 'data' => $rows); }
protected function _prepareForm() { if (Mage::getSingleton('adminhtml/session')->getFormData()) { $data = Mage::getSingleton('adminhtml/session')->getFormData(); } elseif ($this->getPeriod()) { $data = $this->getPeriod()->getData(); } $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))), 'method' => 'post', 'enctype' => 'multipart/form-data')); $fieldset = $form->addFieldset('period_details', array('legend' => $this->__('Period Details'))); $fieldset->addField('id', 'hidden', array('required' => false, 'name' => 'id')); $fieldset->addField('name', 'text', array('required' => true, 'name' => 'name', 'label' => 'Name')); $fieldset->addField('sort_order', 'text', array('required' => false, 'name' => 'sort_order', 'label' => 'Sort Order')); $select = new Varien_Data_Form_Element_Select(array('name' => 'period_type', 'style' => 'width:241px', 'options' => Mage::getModel('sarp/source_periods')->getGridOptions())); $select->setId('period_type')->setRenderer(Mage::getBlockSingleton('sarp/adminhtml_widget_form_renderer_element'))->setForm($form)->setValue(@$data['period_type']); $fieldset->addField('period_value', 'text', array('required' => true, 'name' => 'period_value', 'label' => 'Repeat each', 'style' => 'width:30px', 'after_element_html' => $select->toHtml())); $selectE = new Varien_Data_Form_Element_Select(array('name' => 'expire_type', 'style' => 'width:241px', 'options' => Mage::getModel('sarp/source_periods')->getGridOptions())); $selectE->setId('expire_type')->setRenderer(Mage::getBlockSingleton('sarp/adminhtml_widget_form_renderer_element'))->setForm($form)->setValue(@$data['expire_type']); $fieldset->addField('expire_value', 'text', array('required' => false, 'name' => 'expire_value', 'label' => 'Expires After', 'style' => 'width:30px', 'after_element_html' => $selectE->toHtml())); $fieldset->addField('excluded_weekdays', 'multiselect', array('required' => false, 'name' => 'excluded_weekdays', 'label' => 'Exclude Weekdays', 'values' => Mage::getModel('sarp/source_periods_weekdays')->getAllOptions())); $fieldset->addField('payment_offset', 'text', array('required' => false, 'name' => 'payment_offset', 'label' => 'Require payment before, days')); if (!isset($data['expire_value']) || $data['expire_value'] == 0) { $data['expire_value'] = ''; } if (!isset($data['excluded_weekdays']) || !strlen($data['excluded_weekdays'])) { $data['excluded_weekdays'] = -1; } $form->setValues($data); $form->setUseContainer(true); $this->setForm($form); return parent::_prepareForm(); }
protected function _getAdditionalHtml() { if (Mage::getVersion() >= '1.4.0.1') { $block = Mage::getBlockSingleton('aitunits/adjnav_layer_js'); return $block->toHtml(); } }
public function render(Varien_Data_Form_Element_Abstract $element) { $this->setElement($element); $model = Mage::getModel('salesrule/rule'); if ($websiteCode = $this->getRequest()->getParam('website')) { $data = Mage::app()->getWebsite($websiteCode)->getConfig($this->_pathConfiguration); } if ($storeCode = $this->getRequest()->getParam('store')) { $data = Mage::app()->getStore($storeCode)->getConfig($this->_pathConfiguration); } if (empty($data)) { $data = Mage::getStoreConfig($this->_pathConfiguration, 0); } if (!empty($data)) { $model->loadPost(unserialize($data)); } $html = $this->_getHeaderHtml($element); foreach ($element->getSortedElements() as $field) { if ($field->getId() == 'atos_securecode_conditions') { $field->setRule($model)->setRenderer(Mage::getBlockSingleton('rule/conditions')); $html .= '<tr id="row_' . $field->getId() . '">' . ' <td class="label"><label for="' . $field->getId() . '">' . $field->getLabel() . '</label></td>' . ' <td class="value"><div id="' . $field->getId() . '">' . $field->toHtml() . '</div></td>' . ' <td class="scope-label">' . $field->getScopeLabel() . '</td>' . ' <td class=""></td>' . '</tr>'; } else { $html .= $field->toHtml(); } } $html .= $this->_getFooterHtml($element); return $html; }
protected function _prepareForm() { //Création du formulaire et assignation au block $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))), 'method' => 'post')); //On cree un fieldset auquel on va rajouter tous les champs $fieldset = $form->addFieldset('edit_rule_id', array('legend' => $this->__('Customer AutoGroups Rule'))); $fieldset->addField('name', 'text', array('name' => 'name', 'label' => $this->__('Name'), 'required' => true, 'validate' => 'required-entry')); $fieldset->addField('description', 'textarea', array('name' => 'description', 'label' => $this->__('Description'), 'required' => false, 'validate' => 'required-entry')); $renderer = Mage::getBlockSingleton('adminhtml/widget_form_renderer_fieldset')->setTemplate('promo/fieldset.phtml')->setNewChildUrl($this->getUrl('*/promo_quote/newConditionHtml/form/rule_conditions_fieldset')); $fieldset2 = $form->addFieldset('conditions_fieldset', array('legend' => $this->__('Select Customer Properties')))->setRenderer($renderer); if (Mage::registry('autogroup_rule')) { $model = Mage::registry('autogroup_rule'); } else { $model = Mage::getModel('hhennes_autogroups/rule'); } $fieldset2->addField('conditions', 'text', array('name' => 'conditions', 'label' => $this->__('Conditions'), 'title' => $this->__('Conditions')))->setRule($model)->setRenderer(Mage::getBlockSingleton('rule/conditions')); //Récupération des groupes clients @ToDO voir pour utiliser les fonctions magento $groups = Mage::helper('hhennes_autogroups')->getGroupList(); //Groupe de destination $fieldset->addField('group_id', 'select', array('name' => 'group_id', 'label' => $this->__('Group'), 'required' => true, 'validate' => 'required-entry', 'options' => $groups)); $fieldset->addField('active', 'select', array('name' => 'active', 'label' => $this->__('Active'), 'required' => true, 'validate' => 'required-entry', 'options' => array('1' => $this->__('Yes'), '0' => $this->__('No')))); $priority = Mage::helper('hhennes_autogroups')->getPrioritiesList(); $fieldset->addField('priority', 'select', array('name' => 'priority', 'label' => $this->__('priority'), 'required' => true, 'validate' => 'required-entry', 'options' => $priority)); $fieldset->addField('stop_processing', 'select', array('name' => 'stop_processing', 'label' => $this->__('Stop Processing'), 'required' => true, 'validate' => 'required-entry', 'options' => array('1' => $this->__('Yes'), '0' => $this->__('No')))); if (Mage::registry('autogroup_rule')) { $form->setValues(Mage::registry('autogroup_rule')->getData()); } $form->setUseContainer(true); $this->setForm($form); return parent::_prepareForm(); }
protected function _prepareForm() { $model = Mage::registry('current_promo_quote_rule'); $form = new Varien_Data_Form(); $form->setHtmlIdPrefix('rule_'); $renderer = Mage::getBlockSingleton('adminhtml/widget_form_renderer_fieldset')->setTemplate('promo/fieldset.phtml'); $renderer->setNewChildUrl($this->getUrl('*/manage_promo_quote/newConditionHtml/form/rule_conditions_fieldset')); $fieldset = $form->addFieldset('conditions_fieldset', array('legend' => Mage::helper('salesrule')->__('Apply the rule only if the following conditions are met (leave blank for all products)')))->setRenderer($renderer); $fieldset->addField('conditions', 'text', array('name' => 'conditions', 'label' => Mage::helper('salesrule')->__('Conditions'), 'title' => Mage::helper('salesrule')->__('Conditions')))->setRule($model)->setRenderer(Mage::getBlockSingleton('rule/conditions')); /* $fieldset = $form->addFieldset('actions_fieldset', array( 'legend'=>Mage::helper('salesrule')->__('Apply the rule to cart items matching the following conditions') ))->setRenderer($renderer); $fieldset->addField('actions', 'text', array( 'name' => 'actions', 'label' => Mage::helper('salesrule')->__('Apply to'), 'title' => Mage::helper('salesrule')->__('Apply to'), 'required' => true, ))->setRule($model)->setRenderer(Mage::getBlockSingleton('rule/actions')); */ if ($this->_isRedemptionType()) { $this->_getPointsActionFieldset($form); } $form->setValues($model->getData()); $this->setForm($form); return parent::_prepareForm(); }
protected function _prepareForm() { //$model = Mage::registry('productblock_data'); $model = Mage::getModel('awautorelated/blocks')->load((int) $this->getRequest()->getParam('id')); //$model = Mage::getModel('sale/rule'); $form = new Varien_Data_Form(); //$form->setHtmlIdPrefix('viewed_'); $helper = Mage::helper('awautorelated'); /* $renderer = Mage::getBlockSingleton('adminhtml/widget_form_renderer_fieldset') ->setTemplate('promo/fieldset.phtml') ->setNewChildUrl($this->getUrl('adminhtml/promo_quote/newConditionHtml/form/conditions_fieldset')); */ $renderer = Mage::getBlockSingleton('adminhtml/widget_form_renderer_fieldset')->setTemplate('promo/fieldset.phtml')->setNewChildUrl($this->getUrl('*/*/newConditionHtml', array('form' => 'viewed_conditions_fieldset', 'prefix' => 'viewed', 'rule' => base64_encode('awautorelated/blocks_product_ruleviewed')))); $fieldset = $form->addFieldset('viewed_conditions_fieldset', array('legend' => $this->__('Conditions (leave blank for all products)')))->setRenderer($renderer); $rule = Mage::getModel('awautorelated/blocks_product_ruleviewed'); $rule->getConditions()->setJsFormObject('viewed_conditions_fieldset'); $rule->getConditions()->setId('viewed_conditions_fieldset'); $rule->setForm($fieldset); if ($model->getData('currently_viewed') && is_array($model->getData('currently_viewed')->getData('conditions'))) { $conditions = $model->getData('currently_viewed')->getData('conditions'); $rule->getConditions()->loadArray($conditions, 'viewed'); $rule->getConditions()->setJsFormObject('viewed_conditions_fieldset'); } $fieldset->addField('viewed_conditions', 'text', array('name' => 'viewed_conditions', 'label' => $this->__('Apply To'), 'title' => $this->__('Apply To'), 'required' => true))->setRule($rule)->setRenderer(Mage::getBlockSingleton('rule/conditions')); $form->setValues($model->getData()); $this->setForm($form); return parent::_prepareForm(); }
protected function _prepareForm() { $model = Mage::registry('current_promo_quote_rule'); //$form = new Varien_Data_Form(array('id' => 'edit_form1', 'action' => $this->getData('action'), 'method' => 'post')); $form = new Varien_Data_Form(); $form->setHtmlIdPrefix('rule_'); $fieldset = $form->addFieldset('action_fieldset', array('legend' => Mage::helper('salesrule')->__('Update prices using the following information'))); $fieldset->addField('simple_action', 'select', array('label' => Mage::helper('salesrule')->__('Apply'), 'name' => 'simple_action', 'options' => array(Mage_SalesRule_Model_Rule::BY_PERCENT_ACTION => Mage::helper('salesrule')->__('Percent of product price discount'), Mage_SalesRule_Model_Rule::BY_FIXED_ACTION => Mage::helper('salesrule')->__('Fixed amount discount'), Mage_SalesRule_Model_Rule::CART_FIXED_ACTION => Mage::helper('salesrule')->__('Fixed amount discount for whole cart'), Mage_SalesRule_Model_Rule::BUY_X_GET_Y_ACTION => Mage::helper('salesrule')->__('Buy X get Y free (discount amount is Y)'), VC_FreeGift_Model_Salesrule_Rule::PRODUCT_AUTO_ADD => Mage::helper('vc_freegift')->__('Auto add promo items with products'), VC_FreeGift_Model_Salesrule_Rule::CART_AUTO_ADD => Mage::helper('vc_freegift')->__('Auto add promo items for the whole cart'), VC_FreeGift_Model_Salesrule_Rule::PRODUCT_SAME_AUTO_ADD => Mage::helper('vc_freegift')->__('Auto add the same product')))); $fieldset->addField('promo_items', 'text', array('name' => 'promo_items', 'required' => true, 'class' => 'required-entry', 'label' => Mage::helper('salesrule')->__('Promo Items'))); $fieldset->addField('promo_qty', 'text', array('name' => 'promo_qty', 'required' => true, 'class' => 'validate-not-negative-number', 'label' => Mage::helper('salesrule')->__('Promo Qty'))); $fieldset->addField('discount_amount', 'text', array('name' => 'discount_amount', 'required' => true, 'class' => 'validate-not-negative-number', 'label' => Mage::helper('salesrule')->__('Discount Amount'))); $model->setDiscountAmount($model->getDiscountAmount() * 1); $fieldset->addField('discount_qty', 'text', array('name' => 'discount_qty', 'label' => Mage::helper('salesrule')->__('Maximum Qty Discount is Applied To'))); $model->setDiscountQty($model->getDiscountQty() * 1); $fieldset->addField('discount_step', 'text', array('name' => 'discount_step', 'label' => Mage::helper('salesrule')->__('Discount Qty Step (Buy X)'))); $fieldset->addField('apply_to_shipping', 'select', array('label' => Mage::helper('salesrule')->__('Apply to Shipping Amount'), 'title' => Mage::helper('salesrule')->__('Apply to Shipping Amount'), 'name' => 'apply_to_shipping', 'values' => Mage::getSingleton('adminhtml/system_config_source_yesno')->toOptionArray())); $fieldset->addField('simple_free_shipping', 'select', array('label' => Mage::helper('salesrule')->__('Free Shipping'), 'title' => Mage::helper('salesrule')->__('Free Shipping'), 'name' => 'simple_free_shipping', 'options' => array(0 => Mage::helper('salesrule')->__('No'), Mage_SalesRule_Model_Rule::FREE_SHIPPING_ITEM => Mage::helper('salesrule')->__('For matching items only'), Mage_SalesRule_Model_Rule::FREE_SHIPPING_ADDRESS => Mage::helper('salesrule')->__('For shipment with matching items')))); $fieldset->addField('stop_rules_processing', 'select', array('label' => Mage::helper('salesrule')->__('Stop Further Rules Processing'), 'title' => Mage::helper('salesrule')->__('Stop Further Rules Processing'), 'name' => 'stop_rules_processing', 'options' => array('1' => Mage::helper('salesrule')->__('Yes'), '0' => Mage::helper('salesrule')->__('No')))); $renderer = Mage::getBlockSingleton('adminhtml/widget_form_renderer_fieldset')->setTemplate('promo/fieldset.phtml')->setNewChildUrl($this->getUrl('*/promo_quote/newActionHtml/form/rule_actions_fieldset')); $fieldset = $form->addFieldset('actions_fieldset', array('legend' => Mage::helper('salesrule')->__('Apply the rule only to cart items matching the following conditions (leave blank for all items)')))->setRenderer($renderer); $fieldset->addField('actions', 'text', array('name' => 'actions', 'label' => Mage::helper('salesrule')->__('Apply To'), 'title' => Mage::helper('salesrule')->__('Apply To'), 'required' => true))->setRule($model)->setRenderer(Mage::getBlockSingleton('rule/actions')); Mage::dispatchEvent('adminhtml_block_salesrule_actions_prepareform', array('form' => $form)); //$model->setPromoItems('test'); $form->setValues($model->getData()); if ($model->isReadonly()) { foreach ($fieldset->getElements() as $element) { $element->setReadonly(true, true); } } //$form->setUseContainer(true); $this->setForm($form); return $this; }
/** * * @return Mage_Adminhtml_Block_System_Config_Form */ public function initForm() { $this->_initObjects(); $form = $this->_initForm(); $sections = $this->_configFields->getSection($this->getSectionCode(), $this->getWebsiteCode(), $this->getStoreCode()); $groups = $sections->groups; $groupName = $this->getGroupName(); $group = $groups->{$groupName}; /** * @var $fieldsetRenderer Mage_Adminhtml_Block_System_Config_Form_Fieldset */ if ($group->frontend_model) { $fieldsetRenderer = Mage::getBlockSingleton((string) $group->frontend_model); } else { $fieldsetRenderer = Mage::getBlockSingleton('Mage_Adminhtml_Block_Widget_Form_Renderer_Fieldset'); } $fieldsetConfig = array('legend' => Mage::helper('payone_core')->__((string) $group->label)); if (!empty($group->comment)) { $fieldsetConfig['comment'] = Mage::helper('payone_core')->__((string) $group->comment); } /** @var $fieldset Varien_Data_Form_Element_Fieldset */ $fieldset = $form->addFieldset($sections->getName() . '_' . $group->getName(), $fieldsetConfig); $fieldset->setRenderer($fieldsetRenderer); $fieldsetRenderer->setForm($this); $fieldsetRenderer->setConfigData($this->_configData); $fieldsetRenderer->setGroup($group); $this->_prepareFieldOriginalData($fieldset, $group); $this->_addElementTypes($fieldset); $this->initFields($fieldset, $group, $sections); $fieldset->addField('page_code', 'hidden', array('name' => 'page_code', 'value' => $this->getPageCode())); $form->setUseContainer(true); $this->setForm($form); return $this; }
protected function _prepareForm() { $model = Mage::registry('productlist_data'); $form = new Varien_Data_Form(); $form->setHtmlIdPrefix('rule_'); /* $soure_type = $form->addFieldset('custom_fieldset', array( 'legend' => $this->__('Product Source') )); $soure_type->addField('source_type', 'select', array( 'label' => $this->__('Select Source'), 'name' => 'source_type', 'options' => array( 'latest' => $this->__('Latest'), 'new_arrival' => $this->__('New Arrival'), 'special' => $this->__('Special'), 'most_viewed' => $this->__('Most Viewed'), 'best_seller' => $this->__('Best Seller'), 'top_rate' => $this->__('Top Rated') ), 'note' => $this->__('Default is Latest'), )); */ $renderer = Mage::getBlockSingleton('adminhtml/widget_form_renderer_fieldset')->setTemplate('promo/fieldset.phtml')->setNewChildUrl($this->getUrl('*/*/newConditionHtml/form/rule_conditions_fieldset')); $fieldset = $form->addFieldset('conditions_fieldset', array('legend' => Mage::helper('productlist')->__('Conditions (leave blank for all products)')))->setRenderer($renderer); $fieldset->addField('conditions', 'text', array('name' => 'conditions', 'label' => Mage::helper('productlist')->__('Conditions'), 'title' => Mage::helper('productlist')->__('Conditions'), 'required' => true))->setRule($model)->setRenderer(Mage::getBlockSingleton('rule/conditions')); $form->setValues($model->getData()); $this->setForm($form); return parent::_prepareForm(); }
protected function _prepareForm() { $model = Mage::registry('current_promo_quote_rule'); //$form = new Varien_Data_Form(array('id' => 'edit_form1', 'action' => $this->getData('action'), 'method' => 'post')); $form = new Varien_Data_Form(); $form->setHtmlIdPrefix('rule_'); $fieldset = $form->addFieldset('action_fieldset', array('legend' => Mage::helper('salesrule')->__('Update prices using the following information'))); $fieldset->addField('simple_action', 'select', array('label' => Mage::helper('salesrule')->__('Apply'), 'name' => 'simple_action', 'options' => array('by_percent' => Mage::helper('salesrule')->__('Percent of product price discount'), 'by_fixed' => Mage::helper('salesrule')->__('Fixed amount discount'), 'cart_fixed' => Mage::helper('salesrule')->__('Fixed amount discount for whole cart'), 'buy_x_get_y' => Mage::helper('salesrule')->__('Buy X get Y free (discount amount is Y)')))); $fieldset->addField('discount_amount', 'text', array('name' => 'discount_amount', 'required' => true, 'class' => 'validate-not-negative-number', 'label' => Mage::helper('salesrule')->__('Discount amount'))); $model->setDiscountAmount($model->getDiscountAmount() * 1); $fieldset->addField('discount_qty', 'text', array('name' => 'discount_qty', 'label' => Mage::helper('salesrule')->__('Maximum Qty Discount is Applied to'))); $model->setDiscountQty($model->getDiscountQty() * 1); $fieldset->addField('discount_step', 'text', array('name' => 'discount_step', 'label' => Mage::helper('salesrule')->__('Discount Qty Step (Buy X)'))); $fieldset->addField('simple_free_shipping', 'select', array('label' => Mage::helper('salesrule')->__('Free shipping'), 'title' => Mage::helper('salesrule')->__('Free shipping'), 'name' => 'simple_free_shipping', 'options' => array(0 => Mage::helper('salesrule')->__('No'), Mage_SalesRule_Model_Rule::FREE_SHIPPING_ITEM => Mage::helper('salesrule')->__('For matching items only'), Mage_SalesRule_Model_Rule::FREE_SHIPPING_ADDRESS => Mage::helper('salesrule')->__('For shipment with matching items')))); $fieldset->addField('stop_rules_processing', 'select', array('label' => Mage::helper('salesrule')->__('Stop further rules processing'), 'title' => Mage::helper('salesrule')->__('Stop further rules processing'), 'name' => 'stop_rules_processing', 'options' => array('1' => Mage::helper('salesrule')->__('Yes'), '0' => Mage::helper('salesrule')->__('No')))); $renderer = Mage::getBlockSingleton('adminhtml/widget_form_renderer_fieldset')->setTemplate('promo/fieldset.phtml')->setNewChildUrl($this->getUrl('*/promo_quote/newActionHtml/form/rule_actions_fieldset')); $fieldset = $form->addFieldset('actions_fieldset', array('legend' => Mage::helper('salesrule')->__('Apply the rule only to cart items matching the following conditions (leave blank for all items)')))->setRenderer($renderer); $fieldset->addField('actions', 'text', array('name' => 'actions', 'label' => Mage::helper('salesrule')->__('Apply to'), 'title' => Mage::helper('salesrule')->__('Apply to'), 'required' => true))->setRule($model)->setRenderer(Mage::getBlockSingleton('rule/actions')); $form->setValues($model->getData()); if ($model->isReadonly()) { foreach ($fieldset->getElements() as $element) { $element->setReadonly(true, true); } } //$form->setUseContainer(true); $this->setForm($form); return parent::_prepareForm(); }
protected function _prepareForm() { $_form = new Varien_Data_Form(); $this->setForm($_form); $_data = Mage::registry('categoryblock_data'); if ($_data->getRelatedProducts()) { $_data = $this->_prepareRelatedTabData($_data); } $_fieldset = $_form->addFieldset('general_fieldset', array('legend' => $this->__('General'))); $_fieldset->addField('related_products_include', 'select', array('name' => 'related_products[include]', 'label' => $this->__('Include'), 'values' => Mage::getModel('awautorelated/source_block_category_include')->toOptionArray())); if ($_data->getData('related_products_count') === null) { $_data->setData('related_products_count', Mage::helper('awautorelated/config')->getNumberOfProducts()); } $_fieldset->addField('related_products_count', 'text', array('name' => 'related_products[count]', 'title' => $this->__('Number of products'), 'label' => $this->__('Number of products'), 'required' => true)); $_fieldset->addField('order', 'select', array('name' => 'related_products[order][type]', 'label' => $this->__('Order Products'), 'title' => $this->__('Order Products'), 'values' => Mage::getModel('awautorelated/source_block_common_order')->toOptionArray())); $_fieldset->addField('order_attribute', 'select', array('name' => 'related_products[order][attribute]', 'values' => Mage::getModel('awautorelated/source_catalog_product_attributes')->toOptionArray(), 'note' => $this->__('Select Attribute'))); $_fieldset->addField('order_direction', 'select', array('name' => 'related_products[order][direction]', 'values' => Mage::getModel('awautorelated/source_resource_collection_order')->toOptionArray(), 'note' => $this->__('Sort Direction'))); $_fieldset->addField('show_out_of_stock', 'select', array('name' => 'related_products[show_out_of_stock]', 'label' => $this->__('Show "Out of stock" Products'), 'title' => $this->__('Show "Out of stock" Products'), 'values' => Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray())); $renderer = Mage::getBlockSingleton('adminhtml/widget_form_renderer_fieldset')->setTemplate('promo/fieldset.phtml')->setNewChildUrl($this->getUrl('*/*/newConditionHtml', array('form' => 'conditions_fieldset', 'prefix' => 'related', 'rule' => base64_encode('awautorelated/blocks_category_rule')))); $_fieldset = $_form->addFieldset('conditions_fieldset', array('legend' => $this->__('Conditions (leave blank for all products)')))->setRenderer($renderer); /* Setup of the rule control */ $model = Mage::getModel('awautorelated/blocks_category_rule'); $model->setForm($_fieldset); $model->getConditions()->setJsFormObject('conditions_fieldset'); if ($_data->getData('related_products') && is_array($_data->getData('related_products')->getData('conditions'))) { $conditions = $_data->getData('related_products')->getData('conditions'); $model->getConditions()->loadArray($conditions, 'related'); $model->getConditions()->setJsFormObject('conditions_fieldset'); } $_fieldset->addField('conditions', 'text', array('name' => 'related_conditions', 'label' => Mage::helper('salesrule')->__('Conditions'), 'title' => Mage::helper('salesrule')->__('Conditions')))->setRule($model)->setRenderer(Mage::getBlockSingleton('rule/conditions')); $_form->setValues($_data); }
protected function _prepareForm() { if (Mage::getSingleton('adminhtml/session')->getFormData()) { $data = Mage::getSingleton('adminhtml/session')->getFormData(); Mage::getSingleton('adminhtml/session')->setFormData(null); } elseif (Mage::registry('offer_data')) { $data = Mage::registry('offer_data')->getData(); } $form = new Varien_Data_Form(); $form->setHtmlIdPrefix('offer_'); $this->setForm($form); $form->addFieldSet('description_fieldset', array('legend' => Mage::helper('customerreward')->__('Description')))->setRenderer(Mage::getBlockSingleton('adminhtml/widget_form_renderer_fieldset')->setTemplate('customerreward/offer/description.phtml')); $fieldset = $form->addFieldset('general_fieldset', array('legend' => Mage::helper('customerreward')->__('General information'))); $fieldset->addField('title', 'text', array('label' => Mage::helper('customerreward')->__('Title'), 'title' => Mage::helper('customerreward')->__('Title'), 'class' => 'required-entry', 'required' => true, 'name' => 'title')); $fieldset->addField('description', 'editor', array('label' => Mage::helper('customerreward')->__('Description'), 'title' => Mage::helper('customerreward')->__('Description'), 'class' => 'required-entry', 'required' => true, 'name' => 'description', 'wysiwyg' => true)); $fieldset->addField('image', 'image', array('name' => 'image', 'label' => Mage::helper('customerreward')->__('Image'), 'title' => Mage::helper('customerreward')->__('Image'), 'note' => Mage::helper('customerreward')->__('Recommend image width is 200px.'))); if (!Mage::app()->isSingleStoreMode()) { $fieldset->addField('website_ids', 'multiselect', array('name' => 'website_ids[]', 'label' => Mage::helper('customerreward')->__('Websites'), 'title' => Mage::helper('customerreward')->__('Websites'), 'required' => true, 'values' => Mage::getSingleton('adminhtml/system_config_source_website')->toOptionArray())); } else { $fieldset->addField('website_ids', 'hidden', array('name' => 'website_ids[]', 'value' => Mage::app()->getStore(true)->getWebsiteId())); $data['website_ids'] = Mage::app()->getStore(true)->getWebsiteId(); } $fieldset->addField('customer_group_ids', 'multiselect', array('label' => Mage::helper('customerreward')->__('Customer groups'), 'title' => Mage::helper('customerreward')->__('Customer groups'), 'name' => 'customer_group_ids', 'required' => true, 'values' => Mage::getResourceModel('customer/group_collection')->addFieldToFilter('customer_group_id', array('gt' => 0))->load()->toOptionArray())); $fieldset->addField('coupon', 'text', array('label' => Mage::helper('customerreward')->__('Coupon code Pattern'), 'title' => Mage::helper('customerreward')->__('Coupon code Pattern'), 'name' => 'coupon', 'note' => Mage::helper('customerreward')->__('Empty if using the default configuration. Pattern examples:<br/><strong>[A.8] : 8 alpha chars<br/>[N.4] : 4 numerics<br/>[AN.6] : 6 alphanumeric<br/>REWARD-[A.4]-[AN.6] : REWARD-ADFA-12NF0O'))); $fieldset->addField('uses_per_coupon', 'text', array('label' => Mage::helper('customerreward')->__('Uses per Coupon'), 'title' => Mage::helper('customerreward')->__('Uses per Coupon'), 'name' => 'uses_per_coupon', 'note' => Mage::helper('customerreward')->__('0 is unlimited'))); $fieldset->addField('uses_per_customer', 'text', array('label' => Mage::helper('customerreward')->__('Uses per Customer'), 'title' => Mage::helper('customerreward')->__('Uses per Customer'), 'name' => 'uses_per_customer', 'note' => Mage::helper('customerreward')->__('0 is unlimited'))); $dateFormatIso = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT); $fieldset->addField('from_date', 'date', array('name' => 'from_date', 'label' => Mage::helper('customerreward')->__('Validate from'), 'title' => Mage::helper('customerreward')->__('From date'), 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'input_format' => Varien_Date::DATE_INTERNAL_FORMAT, 'format' => $dateFormatIso)); $fieldset->addField('to_date', 'date', array('name' => 'to_date', 'label' => Mage::helper('customerreward')->__('Validate to'), 'title' => Mage::helper('customerreward')->__('To date'), 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'input_format' => Varien_Date::DATE_INTERNAL_FORMAT, 'format' => $dateFormatIso)); $fieldset->addField('is_active', 'select', array('label' => Mage::helper('customerreward')->__('Status'), 'title' => Mage::helper('customerreward')->__('Status'), 'name' => 'is_active', 'values' => array(array('value' => '1', 'label' => Mage::helper('customerreward')->__('Active')), array('value' => '0', 'label' => Mage::helper('customerreward')->__('Inactive'))))); $fieldset->addField('sort_order', 'text', array('name' => 'sort_order', 'label' => Mage::helper('customerreward')->__('Priority'), 'title' => Mage::helper('customerreward')->__('Priority'))); $form->setValues($data); return parent::_prepareForm(); }
public function prepareProductCollection($collection) { $collection->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())->addSearchFilter(Mage::helper('catalogsearch')->getQuery()->getQueryText())->setStore(Mage::app()->getStore())->addMinimalPrice()->addFinalPrice()->addTaxPercents()->addStoreFilter()->addUrlRewrite(); Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection); Mage::getSingleton('catalog/product_visibility')->addVisibleInSearchFilterToCollection($collection); $limit = Mage::app()->getRequest()->getParam('limit'); if (!$limit) { $limit = 9; } $collection->setPage(Mage::getBlockSingleton('page/html_pager')->getCurrentPage(), $limit)->setOrder(Mage::getBlockSingleton('catalog/product_list_toolbar')->getCurrentOrder(), Mage::getBlockSingleton('catalog/product_list_toolbar')->getCurrentDirection()); $fisrt = NULL; $last = NULL; if (isset($_GET['last'])) { $last = $_GET['last']; } if (isset($_GET['first'])) { $fisrt = $_GET['first']; } if (isset($_GET['rate'])) { $rate = $_GET['rate']; $last = $last / $rate; $fisrt = $fisrt / $rate; } if ($fisrt && $last) { $collection->addFieldToFilter('price', array('gteq' => $fisrt))->addFieldToFilter('price', array('lteq' => $last)); } return $this; }
public function getFilterUrl(array $filters, $noFilters = false, array $q = array()) { $query = array('isLayerAjax' => null, Mage::getBlockSingleton('page/html_pager')->getPageVarName() => null); $query = array_merge($query, $q); $suffix = Mage::getStoreConfig('catalog/seo/category_url_suffix'); $params = array('_current' => true, '_use_rewrite' => true, '_query' => $query, '_escape' => true); $url = Mage::getUrl('*/*/*', $params); $urlPath = ''; if (!$noFilters) { $layerParams = $this->getCurrentLayerParams($filters); foreach ($layerParams as $key => $value) { $value = str_replace(urlencode(self::MULTIPLE_FILTERS_DELIMITER), self::MULTIPLE_FILTERS_DELIMITER, urlencode($value)); $urlPath .= "/{$key}/{$value}"; } } if (empty($urlPath)) { return $url; } $urlParts = explode('?', $url); // $urlParts[0] = substr($urlParts[0], 0, strlen($urlParts[0]) - strlen($suffix)); $urlParts[0] = Mage::getUrl() . 'games'; $urlParts[0] .= $this->getRoutingSuffix(); $url = $urlParts[0] . $urlPath . $suffix; if (!empty($urlParts[1])) { $url .= '?' . $urlParts[1]; } return $url; }
public function render(Varien_Object $row) { $html = Mage::getBlockSingleton('gridactions/adminhtml_sales_order_grid_widget_renderer_carrier')->renderCombined($row, $this->getColumn()); $html .= ' '; $html .= Mage::getBlockSingleton('gridactions/adminhtml_sales_order_grid_widget_renderer_trackingnumber')->renderCombined($row, $this->getColumn()); return $html; }
protected function _prepareColumns() { $this->addColumn('entity_id', array('header' => Mage::helper('catalog')->__('ID'), 'width' => '50px', 'type' => 'number', 'index' => 'entity_id')); $this->addColumn('name', array('header' => Mage::helper('catalog')->__('Name'), 'index' => 'name')); $store = $this->_getStore(); if ($store->getId()) { $this->addColumn('custom_name', array('header' => Mage::helper('catalog')->__('Name in %s', $store->getName()), 'index' => 'custom_name')); } $this->addColumn('type', array('header' => Mage::helper('catalog')->__('Type'), 'width' => '60px', 'index' => 'type_id', 'type' => 'options', 'options' => Mage::getSingleton('catalog/product_type')->getOptionArray())); $sets = Mage::getResourceModel('eav/entity_attribute_set_collection')->setEntityTypeFilter(Mage::getModel('catalog/product')->getResource()->getTypeId())->load()->toOptionHash(); $this->addColumn('set_name', array('header' => Mage::helper('catalog')->__('Attrib. Set Name'), 'width' => '100px', 'index' => 'attribute_set_id', 'type' => 'options', 'options' => $sets)); $this->addColumn('sku', array('header' => Mage::helper('catalog')->__('SKU'), 'width' => '80px', 'index' => 'sku')); $store = $this->_getStore(); $this->addColumn('price', array('header' => Mage::helper('catalog')->__('Price'), 'type' => 'price', 'currency_code' => $store->getBaseCurrency()->getCode(), 'index' => 'price', 'filter' => 'payperrentals/adminhtml_widget_grid_column_filter_price', 'filter_condition_callback' => array(Mage::getBlockSingleton('payperrentals/adminhtml_widget_grid_column_filter_price'), '_filterPrice'), 'sortable' => false)); if (Mage::helper('catalog')->isModuleEnabled('Mage_CatalogInventory')) { $this->addColumn('qty', array('header' => Mage::helper('catalog')->__('Qty'), 'width' => '100px', 'type' => 'number', 'index' => 'qty')); } $this->addColumn('visibility', array('header' => Mage::helper('catalog')->__('Visibility'), 'width' => '70px', 'index' => 'visibility', 'type' => 'options', 'options' => Mage::getModel('catalog/product_visibility')->getOptionArray())); $this->addColumn('status', array('header' => Mage::helper('catalog')->__('Status'), 'width' => '70px', 'index' => 'status', 'type' => 'options', 'options' => Mage::getSingleton('catalog/product_status')->getOptionArray())); if (!Mage::app()->isSingleStoreMode()) { $this->addColumn('websites', array('header' => Mage::helper('catalog')->__('Websites'), 'width' => '100px', 'sortable' => false, 'index' => 'websites', 'type' => 'options', 'options' => Mage::getModel('core/website')->getCollection()->toOptionHash())); } $this->addColumn('action', array('header' => Mage::helper('catalog')->__('Action'), 'width' => '50px', 'type' => 'action', 'getter' => 'getId', 'actions' => array(array('caption' => Mage::helper('catalog')->__('Edit'), 'url' => array('base' => '*/*/edit', 'params' => array('store' => $this->getRequest()->getParam('store'))), 'field' => 'id')), 'filter' => false, 'sortable' => false, 'index' => 'stores')); if (Mage::helper('catalog')->isModuleEnabled('Mage_Rss')) { $this->addRssList('rss/catalog/notifystock', Mage::helper('catalog')->__('Notify Low Stock RSS')); } $this->sortColumnsByOrder(); return $this; }
protected function _prepareForm() { $model = Mage::registry('current_promo_quote_rule'); //$form = new Varien_Data_Form(array('id' => 'edit_form1', 'action' => $this->getData('action'), 'method' => 'post')); $form = new Varien_Data_Form(); $form->setHtmlIdPrefix('rule_'); $fieldset = $form->addFieldset('display_fieldset', array('legend' => Mage::helper('salesrule')->__('Using the form below you can enable, disable and configure display of the rule in customers\' account'))); $oDb = Mage::getModel('sales_entity/order')->getReadConnection(); $oSelect = $oDb->select(); $oSelect->from(array('salesrule' => Mage::getSingleton('core/resource')->getTableName('aitoc_salesrule_display')), '*')->where('salesrule.rule_id = "' . $model->getRuleId() . '"'); $aDisplayInfo = $oDb->fetchRow($oSelect); if ($aDisplayInfo) { $model->setAitloyaltyCustomerDisplayEnable('1'); $model->setAitloyaltyCustomerDisplayCoupon($aDisplayInfo['coupone_enable']); $oSelect = $oDb->select(); $oSelect->from(array('salesrule' => Mage::getSingleton('core/resource')->getTableName('aitoc_salesrule_display_title')), array('store_id', 'value'))->where('salesrule.rule_id = "' . $model->getRuleId() . '"'); $aDisplayTitles = $oDb->fetchPairs($oSelect); $model->setAitloyaltyCustomerDisplayTitles($aDisplayTitles); # d($aDisplayInfo, 1); // for titles !!!!!!!!!!!!111 // $this->htmlEscape( } $fieldset->addField('aitloyalty_customer_display_enable', 'select', array('label' => Mage::helper('salesrule')->__('Display the rule in customers\' account'), 'title' => Mage::helper('salesrule')->__('Display the rule in customers\' account'), 'name' => 'aitloyalty_customer_display_enable', 'onchange' => 'aitloyalty_ActionOnRuleDisplayChange()', 'options' => array('1' => Mage::helper('salesrule')->__('Yes'), '0' => Mage::helper('salesrule')->__('No')))); $fieldset->addField('aitloyalty_customer_display_coupon', 'select', array('label' => Mage::helper('salesrule')->__('Display the coupon code in customers\' account (if applicable)'), 'title' => Mage::helper('salesrule')->__('Display the coupon code in customers\' account (if applicable)'), 'name' => 'aitloyalty_customer_display_coupon', 'options' => array('1' => Mage::helper('salesrule')->__('Yes'), '0' => Mage::helper('salesrule')->__('No')))); $fieldset->addField('aitloyalty_customer_display_title', 'text', array('name' => 'aitloyalty_customer_display_title', 'label' => Mage::helper('salesrule')->__(''), 'title' => Mage::helper('salesrule')->__(''), 'required' => true))->setRule($model)->setRenderer(Mage::getBlockSingleton('aitloyalty/quote_titles')); $form->setValues($model->getData()); //$form->setUseContainer(true); $this->setForm($form); return $this; }
/** * @return object */ protected function _getRenderer() { if (is_null($this->_renderer)) { $this->_renderer = Mage::getBlockSingleton('bronto_news/adminhtml_itemRender'); } return $this->_renderer; }
protected function _getFieldRenderer() { if (empty($this->_fieldRenderer)) { $this->_fieldRenderer = Mage::getBlockSingleton('adminhtml/system_config_form_field'); } return $this->_fieldRenderer; }
protected function _prepareForm() { $model = Mage::getModel('salesrule/rule'); $fblock = Mage::registry('fblock_data'); $actionsArr = unserialize($fblock->getActions()); if (!empty($actionsArr) && is_array($actionsArr)) { $model->getActions()->loadArray($actionsArr); } //$form = new Varien_Data_Form(array('id' => 'edit_form1', 'action' => $this->getData('action'), 'method' => 'post')); $form = new Varien_Data_Form(); $form->setHtmlIdPrefix('rule_'); $renderer = Mage::getBlockSingleton('adminhtml/widget_form_renderer_fieldset')->setTemplate('promo/fieldset.phtml')->setNewChildUrl($this->getUrl('*/promo_quote/newActionHtml/form/rule_actions_fieldset')); $fieldset = $form->addFieldset('actions_fieldset', array('legend' => Mage::helper('salesrule')->__('Conditions (leave blank for all products)')))->setRenderer($renderer); $fieldset->addField('actions', 'text', array('name' => 'actions', 'label' => Mage::helper('salesrule')->__('Apply To'), 'title' => Mage::helper('salesrule')->__('Apply To'), 'required' => true))->setRule($model)->setRenderer(Mage::getBlockSingleton('rule/actions')); Mage::dispatchEvent('adminhtml_block_salesrule_actions_prepareform', array('form' => $form)); /* $fieldset = $form->addFieldset('actions_fieldset', array( 'legend'=>Mage::helper('salesrule')->__('Apply the rule to cart items matching the following conditions') ))->setRenderer($renderer); $fieldset->addField('actions', 'text', array( 'name' => 'actions', 'label' => Mage::helper('salesrule')->__('Apply To'), 'title' => Mage::helper('salesrule')->__('Apply To'), 'required' => true, ))->setRule($model)->setRenderer(Mage::getBlockSingleton('rule/actions')); */ $form->setValues($model->getData()); //$form->setUseContainer(true); $this->setForm($form); return parent::_prepareForm(); }