コード例 #1
0
 public function __construct()
 {
     $this->_controller = 'report_shopcart_product';
     $this->_headerText = AO::helper('reports')->__('Products in carts');
     parent::__construct();
     $this->_removeButton('add');
 }
コード例 #2
0
 public function __construct()
 {
     $this->_controller = 'system_convert_profile';
     $this->_headerText = AO::helper('adminhtml')->__('Advanced Profiles');
     $this->_addButtonLabel = AO::helper('adminhtml')->__('Add New Profile');
     parent::__construct();
 }
コード例 #3
0
ファイル: Onepage_Login.php プロジェクト: ronseigel/agent-ohm
 protected function _construct()
 {
     if (!$this->isCustomerLoggedIn()) {
         $this->getCheckout()->setStepData('login', array('label' => AO::helper('checkout')->__('Checkout method'), 'allow' => true));
     }
     parent::_construct();
 }
コード例 #4
0
 public function render(Varien_Object $row)
 {
     if (!$row->getData($this->getColumn()->getIndex())) {
         return null;
     }
     return '<a title="' . AO::helper('core')->__('Edit Store') . '" href="' . $this->getUrl('*/*/editGroup', array('group_id' => $row->getGroupId())) . '">' . $row->getData($this->getColumn()->getIndex()) . '</a>';
 }
コード例 #5
0
ファイル: Profiler.php プロジェクト: ronseigel/agent-ohm
 protected function _toHtml()
 {
     if (!$this->_beforeToHtml() || !AO::getStoreConfig('dev/debug/profiler') || !AO::helper('core')->isDevAllowed()) {
         return '';
     }
     $timers = Varien_Profiler::getTimers();
     #$out = '<div style="position:fixed;bottom:5px;right:5px;opacity:.1;background:white" onmouseover="this.style.opacity=1" onmouseout="this.style.opacity=.1">';
     #$out = '<div style="opacity:.1" onmouseover="this.style.opacity=1" onmouseout="this.style.opacity=.1">';
     $out = "<a href=\"javascript:void(0)\" onclick=\"\$('profiler_section').style.display=\$('profiler_section').style.display==''?'none':''\">[profiler]</a>";
     $out .= '<div id="profiler_section" style="background:white; display:block">';
     $out .= '<pre>Memory usage: real: ' . memory_get_usage(true) . ', emalloc: ' . memory_get_usage() . '</pre>';
     $out .= '<table border="1" cellspacing="0" cellpadding="2" style="width:auto">';
     $out .= '<tr><th>Code Profiler</th><th>Time</th><th>Cnt</th><th>Emalloc</th><th>RealMem</th></tr>';
     foreach ($timers as $name => $timer) {
         $sum = Varien_Profiler::fetch($name, 'sum');
         $count = Varien_Profiler::fetch($name, 'count');
         $realmem = Varien_Profiler::fetch($name, 'realmem');
         $emalloc = Varien_Profiler::fetch($name, 'emalloc');
         if ($sum < 0.001 && $count < 10 && $emalloc < 10000) {
             continue;
         }
         $out .= '<tr>' . '<td align="left">' . $name . '</td>' . '<td>' . number_format($sum, 4) . '</td>' . '<td align="right">' . $count . '</td>' . '<td align="right">' . number_format($emalloc) . '</td>' . '<td align="right">' . number_format($realmem) . '</td>' . '</tr>';
     }
     $out .= '</table>';
     $out .= '<pre>';
     $out .= print_r(Varien_Profiler::getSqlProfiler(AO::getSingleton('core/resource')->getConnection('core_write')), 1);
     $out .= '</pre>';
     $out .= '</div>';
     return $out;
 }
コード例 #6
0
 public function __construct()
 {
     $this->_controller = 'report_sales_coupons';
     $this->_headerText = AO::helper('reports')->__('Coupons');
     parent::__construct();
     $this->_removeButton('add');
 }
コード例 #7
0
ファイル: Api_Role.php プロジェクト: ronseigel/agent-ohm
 public function __construct()
 {
     $this->_controller = 'api_role';
     $this->_headerText = AO::helper('adminhtml')->__('Roles');
     $this->_addButtonLabel = AO::helper('adminhtml')->__('Add New Role');
     parent::__construct();
 }
コード例 #8
0
 /**
  * Display search result
  */
 public function indexAction()
 {
     $query = AO::helper('catalogSearch')->getQuery();
     /* @var $query Mage_CatalogSearch_Model_Query */
     $query->setStoreId(AO::app()->getStore()->getId());
     if ($query->getQueryText()) {
         if (AO::helper('catalogSearch')->isMinQueryLength()) {
             $query->setId(0)->setIsActive(1)->setIsProcessed(1);
         } else {
             if ($query->getId()) {
                 $query->setPopularity($query->getPopularity() + 1);
             } else {
                 $query->setPopularity(1);
             }
             if ($query->getRedirect()) {
                 $query->save();
                 $this->getResponse()->setRedirect($query->getRedirect());
                 return;
             } else {
                 $query->prepare();
             }
         }
         AO::helper('catalogSearch')->checkNotes();
         $this->loadLayout();
         $this->_initLayoutMessages('catalog/session');
         $this->renderLayout();
         if (!AO::helper('catalogSearch')->isMinQueryLength()) {
             $query->save();
         }
     } else {
         $this->_redirectReferer();
     }
 }
コード例 #9
0
ファイル: Sales_Order.php プロジェクト: ronseigel/agent-ohm
 public function checkRelation(Mage_Sales_Model_Order $order)
 {
     /**
      * Check customer existing
      */
     $customer = AO::getModel('customer/customer')->load($order->getCustomerId());
     if (!$customer->getId()) {
         $this->_getSession()->addNotice(AO::helper('adminhtml')->__(' The customer doesn\'t exist in the system anymore'));
     }
     /**
      * Check Item products existing
      */
     $productIds = array();
     foreach ($order->getAllItems() as $item) {
         $productIds[] = $item->getProductId();
     }
     $productCollection = AO::getModel('catalog/product')->getCollection()->addIdFilter($productIds)->load();
     $hasBadItems = false;
     foreach ($order->getAllItems() as $item) {
         if (!$productCollection->getItemById($item->getProductId())) {
             $this->_getSession()->addError(AO::helper('adminhtml')->__('The item %s (SKU %s) doesn\'t exist in the catalog anymore', $item->getName(), $item->getSku()));
             $hasBadItems = true;
         }
     }
     if ($hasBadItems) {
         $this->_getSession()->addError(AO::helper('adminhtml')->__('Some of the ordered items don\'t exist in the catalog anymore and will be removed if you try to edit the order.'));
     }
     return $this;
 }
コード例 #10
0
ファイル: Session.php プロジェクト: ronseigel/agent-ohm
 /**
  * Retrieve Session Form Key
  *
  * @return string A 16 bit unique key for forms
  */
 public function getFormKey()
 {
     if (!$this->getData('_form_key')) {
         $this->setData('_form_key', AO::helper('core')->getRandomString(16));
     }
     return $this->getData('_form_key');
 }
コード例 #11
0
 public function __construct()
 {
     $this->_controller = 'report_product_viewed';
     $this->_headerText = AO::helper('reports')->__('Most Viewed');
     parent::__construct();
     $this->_removeButton('add');
 }
コード例 #12
0
 /**
  * Retrieve all options array
  *
  * @return array
  */
 public function getAllOptions()
 {
     if (is_null($this->_options)) {
         $this->_options = array(array('label' => AO::helper('eav')->__('Yes'), 'value' => 1), array('label' => AO::helper('eav')->__('No'), 'value' => 0));
     }
     return $this->_options;
 }
コード例 #13
0
 public function __construct()
 {
     $this->_controller = 'report_review_customer';
     $this->_headerText = AO::helper('reports')->__('Customers Reviews');
     parent::__construct();
     $this->_removeButton('add');
 }
コード例 #14
0
 public function render(Varien_Data_Form_Element_Abstract $element)
 {
     if ($country = $element->getForm()->getElement('country_id')) {
         $countryId = $country->getValue();
     } else {
         return $element->getDefaultHtml();
     }
     $regionId = $element->getForm()->getElement('region_id')->getValue();
     $html = '<tr>';
     $element->setClass('input-text');
     $html .= '<td class="label">' . $element->getLabelHtml() . '</td><td class="value">';
     $html .= $element->getElementHtml();
     $selectName = str_replace('region', 'region_id', $element->getName());
     $selectId = $element->getHtmlId() . '_id';
     $html .= '<select id="' . $selectId . '" name="' . $selectName . '" class="select required-entry" style="display:none">';
     $html .= '<option value="">' . AO::helper('customer')->__('Please select') . '</option>';
     $html .= '</select>';
     $html .= '<script type="text/javascript">
     if ($("' . $country->getHtmlId() . '") != undefined) {
         new regionUpdater("' . $country->getHtmlId() . '", "' . $element->getHtmlId() . '", "' . $selectId . '", ' . $this->helper('directory')->getRegionJson() . ');
     }
     </script>';
     $html .= '</td></tr>' . "\n";
     return $html;
 }
コード例 #15
0
 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;
 }
コード例 #16
0
 public function __construct()
 {
     $this->_controller = 'report_shopcart_abandoned';
     $this->_headerText = AO::helper('reports')->__('Abandoned carts');
     parent::__construct();
     $this->_removeButton('add');
 }
コード例 #17
0
ファイル: Product_Price.php プロジェクト: ronseigel/agent-ohm
 /**
  * Get tier prices (formatted)
  *
  * @param Mage_Catalog_Model_Product $product
  * @return array
  */
 public function getTierPrices($product = null)
 {
     if (is_null($product)) {
         $product = $this->getProduct();
     }
     $prices = $product->getFormatedTierPrice();
     $res = array();
     if (is_array($prices)) {
         foreach ($prices as $price) {
             $price['price_qty'] = $price['price_qty'] * 1;
             if ($product->getPrice() != $product->getFinalPrice()) {
                 $productPrice = $product->getFinalPrice();
             } else {
                 $productPrice = $product->getPrice();
             }
             if ($price['price'] < $productPrice) {
                 $price['savePercent'] = ceil(100 - 100 / $productPrice * $price['price']);
                 $price['formated_price'] = AO::app()->getStore()->formatPrice(AO::app()->getStore()->convertPrice(AO::helper('tax')->getPrice($product, $price['website_price'])));
                 $price['formated_price_incl_tax'] = AO::app()->getStore()->formatPrice(AO::app()->getStore()->convertPrice(AO::helper('tax')->getPrice($product, $price['website_price'], true)));
                 $res[] = $price;
             }
         }
     }
     return $res;
 }
コード例 #18
0
 public function getAllOptions()
 {
     if (!$this->_options) {
         $this->_options = array(array('value' => Mage_Catalog_Model_Category::DM_PRODUCT, 'label' => AO::helper('catalog')->__('Products only')), array('value' => Mage_Catalog_Model_Category::DM_PAGE, 'label' => AO::helper('catalog')->__('Static block only')), array('value' => Mage_Catalog_Model_Category::DM_MIXED, 'label' => AO::helper('catalog')->__('Static block and products')));
     }
     return $this->_options;
 }
コード例 #19
0
 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();
 }
コード例 #20
0
 protected function _prepareColumns()
 {
     $this->addColumn('in_role_users', array('header_css_class' => 'a-center', 'type' => 'checkbox', 'name' => 'in_role_users', 'values' => $this->_getUsers(), 'align' => 'center', 'index' => 'user_id'));
     $this->addColumn('role_user_id', array('header' => AO::helper('adminhtml')->__('User ID'), 'width' => 5, 'align' => 'left', 'sortable' => true, 'index' => 'user_id'));
     $this->addColumn('role_user_username', array('header' => AO::helper('adminhtml')->__('User Name'), 'align' => 'left', 'index' => 'username'));
     $this->addColumn('role_user_firstname', array('header' => AO::helper('adminhtml')->__('First Name'), 'align' => 'left', 'index' => 'firstname'));
     $this->addColumn('role_user_lastname', array('header' => AO::helper('adminhtml')->__('Last Name'), 'align' => 'left', 'index' => 'lastname'));
     $this->addColumn('role_user_email', array('header' => AO::helper('adminhtml')->__('Email'), 'width' => 40, 'align' => 'left', 'index' => 'email'));
     $this->addColumn('role_user_is_active', array('header' => AO::helper('adminhtml')->__('Status'), 'index' => 'is_active', 'align' => 'left', 'type' => 'options', 'options' => array('1' => AO::helper('adminhtml')->__('Active'), '0' => AO::helper('adminhtml')->__('Inactive'))));
     /*
     $this->addColumn('grid_actions',
         array(
             'header'=>AO::helper('adminhtml')->__('Actions'),
             'width'=>5,
             'sortable'=>false,
             'filter'    =>false,
             'type' => 'action',
             'actions'   => array(
                                 array(
                                     'caption' => AO::helper('adminhtml')->__('Remove'),
                                     'onClick' => 'role.deleteFromRole($role_id);'
                                 )
                             )
         )
     );
     */
     return parent::_prepareColumns();
 }
コード例 #21
0
ファイル: Layer.php プロジェクト: ronseigel/agent-ohm
 /**
  * Get layer state key
  *
  * @return string
  */
 public function getStateKey()
 {
     if ($this->_stateKey === null) {
         $this->_stateKey = 'Q_' . AO::helper('catalogSearch')->getQuery()->getId() . '_' . parent::getStateKey();
     }
     return $this->_stateKey;
 }
コード例 #22
0
ファイル: Sales_Invoice.php プロジェクト: ronseigel/agent-ohm
 public function __construct()
 {
     $this->_controller = 'sales_invoice';
     $this->_headerText = AO::helper('sales')->__('Invoices');
     parent::__construct();
     $this->_removeButton('add');
 }
コード例 #23
0
 public function __construct()
 {
     parent::__construct();
     $this->setTemplate('widget/view/container.phtml');
     $this->_addButton('back', array('label' => AO::helper('adminhtml')->__('Back'), 'onclick' => 'window.location.href=\'' . $this->getUrl('*/*/') . '\'', 'class' => 'back'));
     $this->_addButton('edit', array('label' => AO::helper('adminhtml')->__('Edit'), 'class' => 'edit', 'onclick' => 'window.location.href=\'' . $this->getEditUrl() . '\''));
 }
コード例 #24
0
ファイル: Tag_Tag.php プロジェクト: ronseigel/agent-ohm
 public function __construct()
 {
     $this->_controller = 'tag_tag';
     $this->_headerText = AO::helper('tag')->__('All Tags');
     $this->_addButtonLabel = AO::helper('tag')->__('Add New Tag');
     parent::__construct();
 }
コード例 #25
0
 public function getErrorMessage()
 {
     if (!$this->getData('error_message')) {
         $this->setData('error_message', AO::helper('shipping')->__('This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.'));
     }
     return $this->getData('error_message');
 }
コード例 #26
0
 public function __construct()
 {
     $this->_controller = 'report_customer_totals';
     $this->_headerText = AO::helper('reports')->__('Customers by orders total');
     parent::__construct();
     $this->_removeButton('add');
 }
コード例 #27
0
 protected function _prepareLayout()
 {
     if ($headBlock = $this->getLayout()->getBlock('head')) {
         $headBlock->setTitle(AO::helper('checkout')->__('Ship to Multiple Addresses') . ' - ' . $headBlock->getDefaultTitle());
     }
     return parent::_prepareLayout();
 }
コード例 #28
0
ファイル: Session.php プロジェクト: ronseigel/agent-ohm
 /**
  * Try to login user in admin
  *
  * @param  string $username
  * @param  string $password
  * @param  Mage_Core_Controller_Request_Http $request
  * @return Mage_Admin_Model_User|null
  */
 public function login($username, $password, $request = null)
 {
     if (empty($username) || empty($password)) {
         return;
     }
     try {
         /* @var $user Mage_Admin_Model_User */
         $user = AO::getModel('admin/user');
         $user->login($username, $password);
         if ($user->getId()) {
             if (AO::getSingleton('adminhtml/url')->useSecretKey()) {
                 AO::getSingleton('adminhtml/url')->renewSecretUrls();
             }
             $session = AO::getSingleton('admin/session');
             $session->setIsFirstVisit(true);
             $session->setUser($user);
             $session->setAcl(AO::getResourceModel('admin/acl')->loadAcl());
             if ($requestUri = $this->_getRequestUri($request)) {
                 header('Location: ' . $requestUri);
                 exit;
             }
         } else {
             AO::throwException(AO::helper('adminhtml')->__('Invalid Username or Password.'));
         }
     } catch (Mage_Core_Exception $e) {
         if ($request && !$request->getParam('messageSent')) {
             AO::getSingleton('adminhtml/session')->addError($e->getMessage());
             $request->setParam('messageSent', true);
         }
     }
     return $user;
 }
コード例 #29
0
 public function __construct()
 {
     $this->_controller = 'catalog_product_attribute';
     $this->_headerText = AO::helper('catalog')->__('Manage Attributes');
     $this->_addButtonLabel = AO::helper('catalog')->__('Add New Attribute');
     parent::__construct();
 }
コード例 #30
0
 public function viewAction()
 {
     $pageId = $this->getRequest()->getParam('page_id', $this->getRequest()->getParam('id', false));
     if (!AO::helper('cms/page')->renderPage($this, $pageId)) {
         $this->_forward('noRoute');
     }
 }