protected function _prepareForm() { $model = AO::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_'); $renderer = AO::getBlockSingleton('adminhtml/widget_form_renderer_fieldset')->setTemplate('promo/fieldset.phtml')->setNewChildUrl($this->getUrl('*/promo_quote/newConditionHtml/form/rule_conditions_fieldset')); $fieldset = $form->addFieldset('conditions_fieldset', array('legend' => AO::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' => AO::helper('salesrule')->__('Conditions'), 'title' => AO::helper('salesrule')->__('Conditions')))->setRule($model)->setRenderer(AO::getBlockSingleton('rule/conditions')); /* $fieldset = $form->addFieldset('actions_fieldset', array( 'legend'=>AO::helper('salesrule')->__('Apply the rule to cart items matching the following conditions') ))->setRenderer($renderer); $fieldset->addField('actions', 'text', array( 'name' => 'actions', 'label' => AO::helper('salesrule')->__('Apply to'), 'title' => AO::helper('salesrule')->__('Apply to'), 'required' => true, ))->setRule($model)->setRenderer(AO::getBlockSingleton('rule/actions')); */ $form->setValues($model->getData()); //$form->setUseContainer(true); $this->setForm($form); return parent::_prepareForm(); }
protected function _prepareForm() { $model = AO::registry('api_user'); $form = new Varien_Data_Form(); $form->setHtmlIdPrefix('user_'); $fieldset = $form->addFieldset('base_fieldset', array('legend' => AO::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' => AO::helper('adminhtml')->__('User Name'), 'id' => 'username', 'title' => AO::helper('adminhtml')->__('User Name'), 'required' => true)); $fieldset->addField('firstname', 'text', array('name' => 'firstname', 'label' => AO::helper('adminhtml')->__('First Name'), 'id' => 'firstname', 'title' => AO::helper('adminhtml')->__('First Name'), 'required' => true)); $fieldset->addField('lastname', 'text', array('name' => 'lastname', 'label' => AO::helper('adminhtml')->__('Last Name'), 'id' => 'lastname', 'title' => AO::helper('adminhtml')->__('Last Name'), 'required' => true)); $fieldset->addField('email', 'text', array('name' => 'email', 'label' => AO::helper('adminhtml')->__('Email'), 'id' => 'customer_email', 'title' => AO::helper('adminhtml')->__('User Email'), 'class' => 'required-entry validate-email', 'required' => true)); if ($model->getUserId()) { $fieldset->addField('password', 'password', array('name' => 'new_api_key', 'label' => AO::helper('adminhtml')->__('New Api Key'), 'id' => 'new_pass', 'title' => AO::helper('adminhtml')->__('New Api Key'), 'class' => 'input-text validate-password')); $fieldset->addField('confirmation', 'password', array('name' => 'api_key_confirmation', 'label' => AO::helper('adminhtml')->__('Api Key Confirmation'), 'id' => 'confirmation', 'class' => 'input-text validate-cpassword')); } else { $fieldset->addField('password', 'password', array('name' => 'api_key', 'label' => AO::helper('adminhtml')->__('Api Key'), 'id' => 'customer_pass', 'title' => AO::helper('adminhtml')->__('Api Key'), 'class' => 'input-text required-entry validate-password', 'required' => true)); $fieldset->addField('confirmation', 'password', array('name' => 'api_key_confirmation', 'label' => AO::helper('adminhtml')->__('Api Key Confirmation'), 'id' => 'confirmation', 'title' => AO::helper('adminhtml')->__('Api Key Confirmation'), 'class' => 'input-text required-entry validate-cpassword', 'required' => true)); } if (AO::getSingleton('admin/session')->getUser()->getId() != $model->getUserId()) { $fieldset->addField('is_active', 'select', array('name' => 'is_active', 'label' => AO::helper('adminhtml')->__('This account is'), 'id' => 'is_active', 'title' => AO::helper('adminhtml')->__('Account status'), 'class' => 'input-select', 'style' => 'width: 80px', 'options' => array('1' => AO::helper('adminhtml')->__('Active'), '0' => AO::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(); }
public function getCategory() { if (!$this->_category) { $this->_category = AO::registry('category'); } return $this->_category; }
public function getTag() { if (!$this->_tag) { $this->_tag = AO::registry('tagModel'); } return $this->_tag; }
public function saveAction() { $this->_initEnityId(); if ($this->getRequest()->getPost()) { try { $ratingModel = AO::getModel('rating/rating'); $stores = $this->getRequest()->getParam('stores'); $stores[] = 0; $ratingModel->setRatingCode($this->getRequest()->getParam('rating_code'))->setRatingCodes($this->getRequest()->getParam('rating_codes'))->setStores($stores)->setId($this->getRequest()->getParam('id'))->setEntityId(AO::registry('entityId'))->save(); $options = $this->getRequest()->getParam('option_title'); if (is_array($options)) { $i = 1; foreach ($options as $key => $optionCode) { $optionModel = AO::getModel('rating/rating_option'); if (!preg_match("/^add_([0-9]*?)\$/", $key)) { $optionModel->setId($key); } $optionModel->setCode($optionCode)->setValue($i)->setRatingId($ratingModel->getId())->setPosition($i)->save(); $i++; } } AO::getSingleton('adminhtml/session')->addSuccess(AO::helper('adminhtml')->__('Rating was successfully saved')); AO::getSingleton('adminhtml/session')->setRatingData(false); $this->_redirect('*/*/'); return; } catch (Exception $e) { AO::getSingleton('adminhtml/session')->addError($e->getMessage()); AO::getSingleton('adminhtml/session')->setRatingData($this->getRequest()->getPost()); $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id'))); return; } } $this->_redirect('*/*/'); }
public function __construct() { parent::__construct(); $this->setTemplate('sales/order/details.phtml'); $this->setOrder(AO::getModel('sales/order')->load($this->getRequest()->getParam('order_id'))); AO::registry('action')->getLayout()->getBlock('root')->setHeaderTitle(AO::helper('sales')->__('Order Details')); }
protected function _prepareForm() { $model = AO::registry('cms_block'); $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post')); $form->setHtmlIdPrefix('block_'); $fieldset = $form->addFieldset('base_fieldset', array('legend' => AO::helper('cms')->__('General Information'), 'class' => 'fieldset-wide')); if ($model->getBlockId()) { $fieldset->addField('block_id', 'hidden', array('name' => 'block_id')); } $fieldset->addField('title', 'text', array('name' => 'title', 'label' => AO::helper('cms')->__('Block Title'), 'title' => AO::helper('cms')->__('Block Title'), 'required' => true)); $fieldset->addField('identifier', 'text', array('name' => 'identifier', 'label' => AO::helper('cms')->__('Identifier'), 'title' => AO::helper('cms')->__('Identifier'), 'required' => true, 'class' => 'validate-xml-identifier')); /** * Check is single store mode */ if (!AO::app()->isSingleStoreMode()) { $fieldset->addField('store_id', 'multiselect', array('name' => 'stores[]', 'label' => AO::helper('cms')->__('Store View'), 'title' => AO::helper('cms')->__('Store View'), 'required' => true, 'values' => AO::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true))); } else { $fieldset->addField('store_id', 'hidden', array('name' => 'stores[]', 'value' => AO::app()->getStore(true)->getId())); $model->setStoreId(AO::app()->getStore(true)->getId()); } $fieldset->addField('is_active', 'select', array('label' => AO::helper('cms')->__('Status'), 'title' => AO::helper('cms')->__('Status'), 'name' => 'is_active', 'required' => true, 'options' => array('1' => AO::helper('cms')->__('Enabled'), '0' => AO::helper('cms')->__('Disabled')))); $fieldset->addField('content', 'editor', array('name' => 'content', 'label' => AO::helper('cms')->__('Content'), 'title' => AO::helper('cms')->__('Content'), 'style' => 'height:36em', 'wysiwyg' => false, 'required' => true)); $form->setValues($model->getData()); $form->setUseContainer(true); $this->setForm($form); return parent::_prepareForm(); }
/** * Prepare form for render */ protected function _prepareLayout() { parent::_prepareLayout(); $form = new Varien_Data_Form(); $customerGroup = AO::registry('current_group'); $fieldset = $form->addFieldset('base_fieldset', array('legend' => AO::helper('customer')->__('Group Information'))); $name = $fieldset->addField('customer_group_code', 'text', array('name' => 'code', 'label' => AO::helper('customer')->__('Group Name'), 'title' => AO::helper('customer')->__('Group Name'), 'class' => 'required-entry', 'required' => true)); if ($customerGroup->getId() == 0 && $customerGroup->getCustomerGroupCode()) { $name->setDisabled(true); } $fieldset->addField('tax_class_id', 'select', array('name' => 'tax_class', 'label' => AO::helper('customer')->__('Tax class'), 'title' => AO::helper('customer')->__('Tax class'), 'class' => 'required-entry', 'required' => true, 'values' => AO::getSingleton('tax/class_source_customer')->toOptionArray())); if (!is_null($customerGroup->getId())) { // If edit add id $form->addField('id', 'hidden', array('name' => 'id', 'value' => $customerGroup->getId())); } if (AO::getSingleton('adminhtml/session')->getCustomerGroupData()) { $form->addValues(AO::getSingleton('adminhtml/session')->getCustomerGroupData()); AO::getSingleton('adminhtml/session')->setCustomerGroupData(null); } else { $form->addValues($customerGroup->getData()); } $form->setUseContainer(true); $form->setId('edit_form'); $form->setAction($this->getUrl('*/*/save')); $this->setForm($form); }
/** * Prepare form fields * * @return Mage_Adminhtml_Block_Catalog_Search_Edit_Form */ protected function _prepareForm() { $model = AO::registry('current_catalog_search'); /* @var $model Mage_CatalogSearch_Model_Query */ $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post')); $fieldset = $form->addFieldset('base_fieldset', array('legend' => AO::helper('catalog')->__('General Information'))); $yesno = array(array('value' => 0, 'label' => AO::helper('catalog')->__('No')), array('value' => 1, 'label' => AO::helper('catalog')->__('Yes'))); if ($model->getId()) { $fieldset->addField('query_id', 'hidden', array('name' => 'query_id')); } $fieldset->addField('query_text', 'text', array('name' => 'query_text', 'label' => AO::helper('catalog')->__('Search Query'), 'title' => AO::helper('catalog')->__('Search Query'), 'required' => true)); if (!AO::app()->isSingleStoreMode()) { $fieldset->addField('store_id', 'select', array('name' => 'store_id', 'label' => AO::helper('catalog')->__('Store'), 'title' => AO::helper('catalog')->__('Store'), 'values' => AO::getSingleton('adminhtml/system_store')->getStoreValuesForForm(true, false), 'required' => true)); } else { $fieldset->addField('store_id', 'hidden', array('name' => 'store_id')); $model->setStoreId(AO::app()->getStore(true)->getId()); } if ($model->getId()) { $fieldset->addField('num_results', 'text', array('name' => 'num_results', 'label' => AO::helper('catalog')->__('Number of results<br/>(For last time placed)'), 'title' => AO::helper('catalog')->__('Number of results<br/>(For last time placed)'), 'required' => true)); $fieldset->addField('popularity', 'text', array('name' => 'popularity', 'label' => AO::helper('catalog')->__('Number of Uses'), 'title' => AO::helper('catalog')->__('Number of Uses'), 'required' => true)); } $afterElementHtml = '<p class="nm"><small>' . AO::helper('catalog')->__('(Will make search for the query above return results for this search.)') . '</small></p>'; $fieldset->addField('synonim_for', 'text', array('name' => 'synonim_for', 'label' => AO::helper('catalog')->__('Synonym For'), 'title' => AO::helper('catalog')->__('Synonym For'), 'after_element_html' => $afterElementHtml)); $afterElementHtml = '<p class="nm"><small>' . AO::helper('catalog')->__('ex. http://domain.com') . '</small></p>'; $fieldset->addField('redirect', 'text', array('name' => 'redirect', 'label' => AO::helper('catalog')->__('Redirect URL'), 'title' => AO::helper('catalog')->__('Redirect URL'), 'after_element_html' => $afterElementHtml)); $fieldset->addField('display_in_terms', 'select', array('name' => 'display_in_terms', 'label' => AO::helper('catalog')->__('Display in Suggested Terms'), 'title' => AO::helper('catalog')->__('Display in Suggested Terms'), 'values' => $yesno)); $form->setValues($model->getData()); $form->setUseContainer(true); $this->setForm($form); return parent::_prepareForm(); }
/** * Retrieve loaded category collection * * @return Mage_Eav_Model_Entity_Collection_Abstract */ protected function _getProductCollection() { if (is_null($this->_productCollection)) { $layer = AO::getSingleton('catalog/layer'); /* @var $layer Mage_Catalog_Model_Layer */ if ($this->getShowRootCategory()) { $this->setCategoryId(AO::app()->getStore()->getRootCategoryId()); } // if this is a product view page if (AO::registry('product')) { // get collection of categories this product is associated with $categories = AO::registry('product')->getCategoryCollection()->setPage(1, 1)->load(); // if the product is associated with any category if ($categories->count()) { // show products from this category $this->setCategoryId(current($categories->getIterator())); } } $origCategory = null; if ($this->getCategoryId()) { $category = AO::getModel('catalog/category')->load($this->getCategoryId()); if ($category->getId()) { $origCategory = $layer->getCurrentCategory(); $layer->setCurrentCategory($category); } } $this->_productCollection = $layer->getProductCollection(); $this->prepareSortableFieldsByCategory($layer->getCurrentCategory()); if ($origCategory) { $layer->setCurrentCategory($origCategory); } } return $this->_productCollection; }
protected function _prepareForm() { $form = new Varien_Data_Form(); /** * Initialize product object as form property * for using it in elements generation */ $form->setDataObject(AO::registry('product')); $fieldset = $form->addFieldset('group_fields', array()); $attributes = $this->getGroupAttributes(); $this->_setFieldset($attributes, $fieldset, array('gallery')); $values = AO::registry('product')->getData(); /** * Set attribute default values for new product */ if (!AO::registry('product')->getId()) { foreach ($attributes as $attribute) { if (!isset($values[$attribute->getAttributeCode()])) { $values[$attribute->getAttributeCode()] = $attribute->getDefaultValue(); } } } AO::dispatchEvent('adminhtml_catalog_product_edit_prepare_form', array('form' => $form)); $form->addValues($values); $form->setFieldNameSuffix('product'); $this->setForm($form); }
public function sendAction() { $product = $this->_initProduct(); $this->_initSendToFriendModel(); if (!$product || !$product->isVisibleInCatalog()) { $this->_forward('noRoute'); return; } $productHelper = AO::helper('catalog/product'); $sendToFriendModel = AO::registry('send_to_friend_model'); /** * check if user is allowed to send product to a friend */ if (!$sendToFriendModel->canEmailToFriend()) { AO::getSingleton('catalog/session')->addError($this->__('You cannot email this product to a friend')); $this->_redirectReferer($product->getProductUrl()); return; } $maxSendsToFriend = $sendToFriendModel->getMaxSendsToFriend(); if ($maxSendsToFriend) { AO::getSingleton('catalog/session')->addNotice($this->__('You cannot send more than %d times in an hour', $maxSendsToFriend)); } $this->loadLayout(); $this->_initLayoutMessages('catalog/session'); $this->renderLayout(); AO::dispatchEvent('sendfriend_product', array('product' => $product)); }
public function getWishlistCustomer() { if (is_null($this->_customer)) { $this->_customer = AO::getModel('customer/customer')->load(AO::registry('shared_wishlist')->getCustomerId()); } return $this->_customer; }
protected function _initRule() { AO::register('current_promo_quote_rule', AO::getModel('salesrule/rule')); if ($id = (int) $this->getRequest()->getParam('id')) { AO::registry('current_promo_quote_rule')->load($id); } }
public function _beforeToHtml() { $this->_currency = AO::getModel('directory/currency')->load(AO::getStoreConfig(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_BASE)); $this->_collection = AO::getResourceModel('sales/sale_collection')->setCustomerFilter(AO::registry('current_customer'))->load(); $this->_groupedCollection = array(); foreach ($this->_collection as $sale) { if (!is_null($sale->getStoreId())) { $store = AO::app()->getStore($sale->getStoreId()); $websiteId = $store->getWebsiteId(); $groupId = $store->getGroupId(); $storeId = $store->getId(); $sale->setWebsiteId($store->getWebsiteId()); $sale->setWebsiteName($store->getWebsite()->getName()); $sale->setGroupId($store->getGroupId()); $sale->setGroupName($store->getGroup()->getName()); } else { $websiteId = 0; $groupId = 0; $storeId = 0; $sale->setStoreName(AO::helper('customer')->__('Deleted Stores')); } $this->_groupedCollection[$websiteId][$groupId][$storeId] = $sale; $this->_websiteCounts[$websiteId] = isset($this->_websiteCounts[$websiteId]) ? $this->_websiteCounts[$websiteId] + 1 : 1; } return parent::_beforeToHtml(); }
public function getCustomer() { if (!$this->_customer) { $this->_customer = AO::registry('current_customer'); } return $this->_customer; }
protected function _prepareCollection() { $tagId = AO::registry('tagId'); $collection = AO::getModel('tag/tag')->getCustomerCollection()->addProductFilter($this->getProductId())->addGroupByTag(); $this->setCollection($collection); return parent::_prepareCollection(); }
/** * * return Mage_Adminhtml_Block_Widget_Form */ protected function _prepareForm() { $model = AO::registry('checkout_agreement'); $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post')); $fieldset = $form->addFieldset('base_fieldset', array('legend' => AO::helper('checkout')->__('Terms and Conditions Information'), 'class' => 'fieldset-wide')); if ($model->getId()) { $fieldset->addField('agreement_id', 'hidden', array('name' => 'agreement_id')); } $fieldset->addField('name', 'text', array('name' => 'name', 'label' => AO::helper('checkout')->__('Condition Name'), 'title' => AO::helper('checkout')->__('Condition Name'), 'required' => true)); $fieldset->addField('is_active', 'select', array('label' => AO::helper('checkout')->__('Status'), 'title' => AO::helper('checkout')->__('Status'), 'name' => 'is_active', 'required' => true, 'options' => array('1' => AO::helper('checkout')->__('Enabled'), '0' => AO::helper('checkout')->__('Disabled')))); $fieldset->addField('is_html', 'select', array('label' => AO::helper('checkout')->__('Show Content as'), 'title' => AO::helper('checkout')->__('Show Content as'), 'name' => 'is_html', 'required' => true, 'options' => array(0 => AO::helper('checkout')->__('Text'), 1 => AO::helper('checkout')->__('HTML')))); if (!AO::app()->isSingleStoreMode()) { $fieldset->addField('store_id', 'multiselect', array('name' => 'stores[]', 'label' => AO::helper('checkout')->__('Store View'), 'title' => AO::helper('checkout')->__('Store View'), 'required' => true, 'values' => AO::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true))); } else { $fieldset->addField('store_id', 'hidden', array('name' => 'stores[]', 'value' => AO::app()->getStore(true)->getId())); $model->setStoreId(AO::app()->getStore(true)->getId()); } $fieldset->addField('checkbox_text', 'editor', array('name' => 'checkbox_text', 'label' => AO::helper('checkout')->__('Checkbox text'), 'title' => AO::helper('checkout')->__('Checkbox text'), 'rows' => '5', 'cols' => '30', 'wysiwyg' => false, 'required' => true)); $fieldset->addField('content', 'editor', array('name' => 'content', 'label' => AO::helper('checkout')->__('Content'), 'title' => AO::helper('checkout')->__('Content'), 'style' => 'height:24em;', 'wysiwyg' => false, 'required' => true)); $fieldset->addField('content_height', 'text', array('name' => 'content_height', 'label' => AO::helper('checkout')->__('Content Height (css)'), 'title' => AO::helper('checkout')->__('Content Height'), 'maxlength' => 25, 'class' => 'validate-css-length')); $form->setValues($model->getData()); $form->setUseContainer(true); $this->setForm($form); return parent::_prepareForm(); }
public function __construct() { $this->_addButtonLabel = AO::helper('review')->__('Add New Review'); parent::__construct(); $this->_controller = 'review'; // lookup customer, if id is specified $customerId = $this->getRequest()->getParam('customerId', false); $customerName = ''; if ($customerId) { $customer = AO::getModel('customer/customer')->load($customerId); $customerName = $customer->getFirstname() . ' ' . $customer->getLastname(); } if (AO::registry('usePendingFilter') === true) { if ($customerName) { $this->_headerText = AO::helper('review')->__('Pending reviews of customer `%s`', $customerName); } else { $this->_headerText = AO::helper('review')->__('Pending reviews'); } $this->_removeButton('add'); } else { if ($customerName) { $this->_headerText = AO::helper('review')->__('All reviews of customer `%s`', $customerName); } else { $this->_headerText = AO::helper('review')->__('All Reviews'); } } }
protected function _toHtml() { $rssObj = AO::getModel('rss/rss'); $order = AO::registry('current_order'); $title = AO::helper('rss')->__('Order # %s Notification(s)', $order->getIncrementId()); $newurl = AO::getUrl('sales/order/view', array('order_id' => $order->getId())); $data = array('title' => $title, 'description' => $title, 'link' => $newurl, 'charset' => 'UTF-8'); $rssObj->_addHeader($data); $resourceModel = AO::getResourceModel('rss/order'); $results = $resourceModel->getAllCommentCollection($order->getId()); $entityTypes = $resourceModel->getEntityTypeIdsToTypes(); $incrementIds = $resourceModel->getEntityIdsToIncrementIds(); if ($results) { foreach ($results as $result) { $urlAppend = 'view'; $type = $entityTypes[$result['entity_type_id']]; if ($type && $type != 'order') { $urlAppend = $type; } $title = AO::helper('rss')->__('Details for %s #%s', ucwords($type), $incrementIds[$result['parent_id']]); $description = '<p>' . AO::helper('rss')->__('Notified Date: %s<br/>', $this->formatDate($result['created_at'])) . AO::helper('rss')->__('Comment: %s<br/>', $result['comment']) . '</p>'; $url = AO::getUrl('sales/order/' . $urlAppend, array('order_id' => $order->getId())); $data = array('title' => $title, 'link' => $url, 'description' => $description); $rssObj->_addEntry($data); } } $title = AO::helper('rss')->__('Order #%s created at %s', $order->getIncrementId(), $this->formatDate($order->getCreatedAt())); $url = AO::getUrl('sales/order/view', array('order_id' => $order->getId())); $description = '<p>' . AO::helper('rss')->__('Current Status: %s<br/>', $order->getStatusLabel()) . AO::helper('rss')->__('Total: %s<br/>', $order->formatPrice($order->getGrandTotal())) . '</p>'; $data = array('title' => $title, 'link' => $url, 'description' => $description); $rssObj->_addEntry($data); return $rssObj->createRssXml(); }
protected function _prepareForm() { /** @var Cms_Model_Page */ $model = AO::registry('cms_page'); $form = new Varien_Data_Form(); $form->setHtmlIdPrefix('page_'); $fieldset = $form->addFieldset('base_fieldset', array('legend' => AO::helper('cms')->__('General Information'), 'class' => 'fieldset-wide')); if ($model->getPageId()) { $fieldset->addField('page_id', 'hidden', array('name' => 'page_id')); } $fieldset->addField('title', 'text', array('name' => 'title', 'label' => AO::helper('cms')->__('Page Title'), 'title' => AO::helper('cms')->__('Page Title'), 'required' => true)); $fieldset->addField('identifier', 'text', array('name' => 'identifier', 'label' => AO::helper('cms')->__('SEF URL Identifier'), 'title' => AO::helper('cms')->__('SEF URL Identifier'), 'required' => true, 'class' => 'validate-identifier', 'after_element_html' => '<p class="nm"><small>' . AO::helper('cms')->__('(eg: domain.com/identifier)') . '</small></p>')); /** * Check is single store mode */ if (!AO::app()->isSingleStoreMode()) { $fieldset->addField('store_id', 'multiselect', array('name' => 'stores[]', 'label' => AO::helper('cms')->__('Store View'), 'title' => AO::helper('cms')->__('Store View'), 'required' => true, 'values' => AO::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true))); } else { $fieldset->addField('store_id', 'hidden', array('name' => 'stores[]', 'value' => AO::app()->getStore(true)->getId())); $model->setStoreId(AO::app()->getStore(true)->getId()); } $fieldset->addField('is_active', 'select', array('label' => AO::helper('cms')->__('Status'), 'title' => AO::helper('cms')->__('Page Status'), 'name' => 'is_active', 'required' => true, 'options' => array('1' => AO::helper('cms')->__('Enabled'), '0' => AO::helper('cms')->__('Disabled')))); $fieldset->addField('content', 'editor', array('name' => 'content', 'label' => AO::helper('cms')->__('Content'), 'title' => AO::helper('cms')->__('Content'), 'style' => 'height:36em;', 'wysiwyg' => false, 'required' => true)); $form->setValues($model->getData()); $this->setForm($form); return parent::_prepareForm(); }
protected function _prepareCollection() { $tagId = AO::registry('tagId'); $collection = AO::getModel('tag/tag')->getResourceCollection()->addProductFilter($this->getProductId())->addPopularity($tagId); $this->setCollection($collection); return parent::_prepareCollection(); }
protected function _prepareColumns() { $baseUrl = $this->getUrl(); $this->addColumn('name', array('header' => AO::helper('tag')->__('Tag'), 'index' => 'name')); $this->addColumn('total_used', array('header' => AO::helper('tag')->__('Uses'), 'width' => '140px', 'align' => 'right', 'index' => 'uses', 'type' => 'number')); $this->addColumn('products', array('header' => AO::helper('tag')->__('Products'), 'width' => '140px', 'align' => 'right', 'index' => 'products', 'type' => 'number')); $this->addColumn('customers', array('header' => AO::helper('tag')->__('Customers'), 'width' => '140px', 'align' => 'right', 'index' => 'customers', 'type' => 'number')); $this->addColumn('popularity', array('header' => AO::helper('tag')->__('Popularity'), 'width' => '140px', 'align' => 'right', 'index' => 'popularity', 'type' => 'number')); /* $this->addColumn('status', array( 'header' => AO::helper('tag')->__('Status'), 'width' => '90px', 'index' => 'status', 'type' => 'options', 'filter' => false, 'sortable' => false, 'options' => array( Mage_Tag_Model_Tag::STATUS_DISABLED => AO::helper('tag')->__('Disabled'), Mage_Tag_Model_Tag::STATUS_PENDING => AO::helper('tag')->__('Pending'), Mage_Tag_Model_Tag::STATUS_APPROVED => AO::helper('tag')->__('Approved'), ), )); */ // Collection for stores filters if (!($collection = AO::registry('stores_select_collection'))) { $collection = AO::app()->getStore()->getResourceCollection()->load(); AO::register('stores_select_collection', $collection); } if (!AO::app()->isSingleStoreMode()) { $this->addColumn('visible_in', array('header' => AO::helper('tag')->__('Visible In'), 'type' => 'store', 'index' => 'stores', 'sortable' => false, 'store_view' => true)); } $this->addColumn('actions', array('header' => AO::helper('tag')->__('Actions'), 'width' => '100px', 'type' => 'action', 'sortable' => false, 'filter' => false, 'actions' => array(array('caption' => AO::helper('tag')->__('Edit Tag'), 'url' => $this->getUrl('*/*/edit', array('ret' => 'pending', 'tag_id' => '$tag_id'))), array('caption' => AO::helper('tag')->__('View Products'), 'url' => $this->getUrl('*/*/product', array('ret' => 'pending', 'tag_id' => '$tag_id'))), array('caption' => AO::helper('tag')->__('View Customers'), 'url' => $this->getUrl('*/*/customer', array('ret' => 'pending', 'tag_id' => '$tag_id')))))); return parent::_prepareColumns(); }
protected function _prepareCollection() { $tagId = AO::registry('tagId'); $collection = AO::getModel('tag/tag')->getEntityCollection()->addTagFilter($tagId)->addPopularity($tagId); $this->setCollection($collection); return parent::_prepareCollection(); }
function initForm() { $model = AO::registry('oscommerce_adminhtml_import'); $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post')); if ($model->getId()) { $form->addField('import_id', 'hidden', array('name' => 'import_id')); } $fieldset = $form->addFieldset('base_fieldset', array('legend' => AO::helper('oscommerce')->__('General Information'))); $fieldset->addField('name', 'text', array('label' => $this->__('Name'), 'title' => $this->__('Name'), 'name' => 'name', 'required' => true)); $fieldset->addField('host', 'text', array('label' => $this->__('IP or Hostname'), 'title' => $this->__('IP or Hostname'), 'name' => 'host', 'required' => true)); // $fieldset->addField('port', 'text', array( // 'label' => $this->__('Port (Default as 3306)'), // 'title' => $this->__('Port (Default as 3306)'), // 'name' => 'port', // 'required' => true, // 'value' => $model->getData('port') ? $model->getData('port'): Mage_Oscommerce_Model_Oscommerce::DEFAULT_PORT // )); $fieldset->addField('db_name', 'text', array('label' => $this->__('DB Name'), 'title' => $this->__('DB Name'), 'name' => 'db_name', 'required' => true)); $fieldset->addField('db_user', 'text', array('label' => $this->__('DB Username'), 'title' => $this->__('DB Username'), 'name' => 'db_user', 'required' => true)); $fieldset->addField('db_password', 'password', array('label' => $this->__('DB Password'), 'title' => $this->__('DB Password'), 'name' => 'db_password')); $fieldset->addField('table_prefix', 'text', array('label' => $this->__('Prefix'), 'title' => $this->__('Prefix'), 'name' => 'table_prefix')); $fieldset->addField('send_subscription', 'checkbox', array('label' => $this->__('Send subscription notify to customers'), 'title' => $this->__('Send subscription notify to customers'), 'name' => 'send_subscription', 'values' => $this->getData('send_subscription'), 'checked' => $this->getData('send_subscription'))); $form->setValues($model->getData()); $this->setForm($form); return $this; }
public function getParseType() { $data = AO::registry('current_convert_profile')->getGuiData(); if ($data) { return $data['parse']['type'] == 'excel_xml' ? 'xml' : $data['parse']['type']; } }
function getProduct() { if (!$this->_product) { $this->_product = AO::registry('product'); } return $this->_product; }
protected function _prepareCollection() { //TODO: add full name logic $collection = AO::getResourceModel('sales/order_collection')->addAttributeToSelect('increment_id')->addAttributeToSelect('created_at')->addAttributeToSelect('grand_total')->addAttributeToSelect('order_currency_code')->addAttributeToSelect('store_id')->joinAttribute('shipping_firstname', 'order_address/firstname', 'shipping_address_id')->joinAttribute('shipping_lastname', 'order_address/lastname', 'shipping_address_id')->addAttributeToFilter('customer_id', AO::registry('current_customer')->getId()); $this->setCollection($collection); return parent::_prepareCollection(); }
/** * Retrieve Product object * * @return Mage_Catalog_Model_Product */ public function getProduct() { if (!$this->getData('product')) { $this->setData('product', AO::registry('product')); } return $this->getData('product'); }
protected function _prepareCollection() { $tagId = AO::registry('tagId'); $collection = AO::getModel('tag/tag')->getCustomerCollection()->addTagFilter($tagId)->setCountAttribute('tr.tag_relation_id')->addGroupByCustomerProduct(); $this->setCollection($collection); return parent::_prepareCollection(); }