当前位置: 首页>>代码示例>>PHP>>正文


PHP Varien_Object类代码示例

本文整理汇总了PHP中Varien_Object的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Object类的具体用法?PHP Varien_Object怎么用?PHP Varien_Object使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Varien_Object类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: beforeSave

 /**
  * Set new increment id
  *
  * @param Varien_Object $object
  * @return Mage_Eav_Model_Entity_Attribute_Backend_Increment
  */
 public function beforeSave($object)
 {
     if (!$object->getId()) {
         $this->getAttribute()->getEntity()->setNewIncrementId($object);
     }
     return $this;
 }
开发者ID:Airmal,项目名称:Magento-Em,代码行数:13,代码来源:Increment.php

示例2: _prepareForm

 protected function _prepareForm()
 {
     $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post'));
     $form->setHtmlIdPrefix("template");
     $form->setFieldNameSuffix("template");
     /* @var $template Mzax_Emarketing_Model_Template */
     $template = Mage::registry('current_template');
     if ($template->getId()) {
         $form->addField('template_id', 'hidden', array('name' => 'template_id', 'value' => $template->getId()));
     }
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => $this->__('Template Option'), 'class' => 'fieldset-wide'))->addType('editor', Mage::getConfig()->getModelClassName('mzax_emarketing/form_element_templateEditor'))->addType('credits', Mage::getConfig()->getModelClassName('mzax_emarketing/form_element_credits'));
     $fieldset->addField('credits', 'credits', array('name' => 'credits', 'required' => true));
     $fieldset->addField('name', 'text', array('name' => 'name', 'required' => true, 'label' => $this->__('Template Name'), 'title' => $this->__('Template Name')));
     $fieldset->addField('description', 'textarea', array('name' => 'description', 'required' => true, 'label' => $this->__('Description'), 'title' => $this->__('Description'), 'style' => 'height:4em;', 'note' => "For internal use only"));
     $snippets = new Mzax_Emarketing_Model_Medium_Email_Snippets();
     Mage::getSingleton('mzax_emarketing/medium_email')->prepareSnippets($snippets);
     $editorConfig = new Varien_Object();
     $editorConfig->setFilesBrowserWindowUrl($this->getUrl('adminhtml/cms_wysiwyg_images/index'));
     $editorConfig->setWidgetWindowUrl($this->getUrl('adminhtml/widget/index'));
     $editorConfig->setSnippets($snippets);
     $editor = $fieldset->addField('body', 'editor', array('name' => 'body', 'required' => true, 'label' => $this->__('Template HTML'), 'title' => $this->__('Template HTML'), 'logo' => $this->getSkinUrl('images/logo.gif'), 'fullscreen_title' => $this->__('Template %s', $template->getName()), 'style' => 'height:50em;', 'value' => '', 'config' => $editorConfig));
     // Setting custom renderer for content field to remove label column
     $renderer = $this->getLayout()->createBlock('adminhtml/widget_form_renderer_fieldset_element')->setTemplate('cms/page/edit/form/renderer/content.phtml');
     $editor->setRenderer($renderer);
     $form->addValues($template->getData());
     $this->setForm($form);
     $form->setUseContainer(true);
     return parent::_prepareForm();
 }
开发者ID:jsiefer,项目名称:emarketing,代码行数:29,代码来源:Form.php

示例3: validate

 /**
  * validate
  *
  * @param Varien_Object $object Quote
  * @return boolean
  */
 public function validate(Varien_Object $object)
 {
     $all = $this->getAggregator() === 'all';
     $true = (bool) $this->getValue();
     $found = false;
     foreach ($object->getAllItems() as $item) {
         $found = $all;
         foreach ($this->getConditions() as $cond) {
             $validated = $cond->validate($item);
             if ($all && !$validated || !$all && $validated) {
                 $found = $validated;
                 break;
             }
         }
         if ($found && $true || !$true && $found) {
             break;
         }
     }
     // found an item and we're looking for existing one
     if ($found && $true) {
         return true;
     } elseif (!$found && !$true) {
         return true;
     }
     return false;
 }
开发者ID:nemphys,项目名称:magento2,代码行数:32,代码来源:Found.php

示例4: isCategoryActive

 /**
  * Get active status of category
  *
  * @param   Varien_Object $category
  * @return  bool
  */
 function isCategoryActive($category)
 {
     if ($this->getCurrentCategory()) {
         return in_array($category->getId(), $this->getCurrentCategory()->getPathIds());
     }
     return false;
 }
开发者ID:ngagestudios,项目名称:Vehicle-Fits-Magento,代码行数:13,代码来源:Result.php

示例5: validate

 /**
  * Validate attribute data
  *
  * @param Varien_Object $object
  * @return boolean
  */
 public function validate($object)
 {
     // all attribute's options
     $optionsAllowed = array('0', '1', '2');
     $value = $object->getData($this->getAttribute()->getAttributeCode());
     return in_array($value, $optionsAllowed) ? true : false;
 }
开发者ID:evinw,项目名称:project_bloom_magento,代码行数:13,代码来源:Config.php

示例6: render

 /**
  * Renders Purchases value
  *
  * @param   Varien_Object $row
  * @return  string
  */
 public function render(Varien_Object $row)
 {
     if (($value = $row->getData($this->getColumn()->getIndex())) > 0) {
         return $value;
     }
     return $this->__('Unlimited');
 }
开发者ID:xiaoguizhidao,项目名称:blingjewelry-prod,代码行数:13,代码来源:Purchases.php

示例7: initControllerRouters

 /**
  *
  */
 public function initControllerRouters($observer)
 {
     $request = $observer->getEvent()->getFront()->getRequest();
     $identifier = trim($request->getPathInfo(), '/');
     $condition = new Varien_Object(array('identifier' => $identifier, 'continue' => true));
     Mage::dispatchEvent('brand_controller_router_match_before', array('router' => $this, 'condition' => $condition));
     $identifier = $condition->getIdentifier();
     if ($condition->getRedirectUrl()) {
         Mage::app()->getFrontController()->getResponse()->setRedirect($condition->getRedirectUrl())->sendResponse();
         $request->setDispatched(true);
         return true;
     }
     if (!$condition->getContinue()) {
         return false;
     }
     $route = trim(Mage::getStoreConfig('ves_brand/general_setting/route'));
     if ($identifier) {
         if (preg_match("#^" . $route . "(\\.html)?\$#", $identifier, $match)) {
             $request->setModuleName('venusbrand')->setControllerName('brand')->setActionName('index');
             $request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $identifier);
             return true;
         }
         return true;
     }
     return false;
 }
开发者ID:booklein,项目名称:bookle,代码行数:29,代码来源:Observer.php

示例8: getWysiwygPluginSettings

 /**
  * Prepare variable wysiwyg config
  *
  * @param Varien_Object $config
  * @return array
  */
 public function getWysiwygPluginSettings($config)
 {
     $configPlugins = $config->getData('plugins');
     $configPlugins[0]['options']['url'] = $this->getVariablesWysiwygActionUrl();
     $configPlugins[0]['options']['onclick']['subject'] = 'MagentovariablePlugin.loadChooser(\'' . $this->getVariablesWysiwygActionUrl() . '\', \'{{html_id}}\');';
     return $configPlugins;
 }
开发者ID:xiaoguizhidao,项目名称:mydigibits,代码行数:13,代码来源:Config.php

示例9: _prepareData

 /**
  * @param null|Varien_Object $dataObject
  * @return Xcom_Xfabric_Model_Message_Request
  */
 public function _prepareData(Varien_Object $dataObject = null)
 {
     $avroDataObject = Mage::getModel('xcom_chronicle/message_product', $dataObject->getProduct());
     $data = array('products' => array($avroDataObject->toArray()));
     $this->setMessageData($data);
     return parent::_prepareData($dataObject);
 }
开发者ID:ridhoq,项目名称:mxpi-twitter,代码行数:11,代码来源:Outbound.php

示例10: getCategoryRequestPath

 /**
  * Get unique category request path
  *
  * @param Varien_Object $category
  * @param string $parentPath
  * @return string
  */
 public function getCategoryRequestPath($category, $parentPath)
 {
     $storeId = $category->getStoreId();
     $idPath = $this->generatePath('id', null, $category);
     $suffix = $this->getCategoryUrlSuffix($storeId);
     if (isset($this->_rewrites[$idPath])) {
         $this->_rewrite = $this->_rewrites[$idPath];
         $existingRequestPath = $this->_rewrites[$idPath]->getRequestPath();
     }
     if ($category->getUrlKey() == '') {
         $urlKey = $this->getCategoryModel()->formatUrlKey($category->getName());
     } else {
         $urlKey = $this->getCategoryModel()->formatUrlKey($category->getUrlKey());
     }
     $categoryUrlSuffix = $this->getCategoryUrlSuffix($category->getStoreId());
     if (null === $parentPath) {
         $parentPath = $this->getResource()->getCategoryParentPath($category);
     } elseif ($parentPath == '/') {
         $parentPath = '';
     }
     $parentPath = Mage::helper('catalog/category')->getCategoryUrlPath($parentPath, true, $category->getStoreId());
     // Only filter category URL paths when not in B2B store.
     if (Mage::helper("mey_b2b")->getStoreId() != $storeId) {
         $parentPath = $this->_filterCategoriesFromRequestPath($parentPath);
     }
     $requestPath = $parentPath . $urlKey . $categoryUrlSuffix;
     if (isset($existingRequestPath) && $existingRequestPath == $requestPath . $suffix) {
         return $existingRequestPath;
     }
     if ($this->_deleteOldTargetPath($requestPath, $idPath, $storeId)) {
         return $requestPath;
     }
     return $this->getUnusedPath($category->getStoreId(), $requestPath, $this->generatePath('id', null, $category));
 }
开发者ID:jronatay,项目名称:ultimo-magento-jron,代码行数:41,代码来源:Url.php

示例11: assign

 /**
  * Factory method to get proper action instance
  *
  * @param array $config
  * @throws \Exception
  */
 public function assign(array $config)
 {
     $action = $parameters = NULL;
     if (!isset($config[self::F_PARAMETERS]) && sizeof($config) >= 2) {
         $parameters = array_pop($config);
         if (!is_array($parameters)) {
             $parameters = (array) $parameters;
         }
     } elseif (isset($config[self::F_PARAMETERS])) {
         $parameters = $config[self::F_PARAMETERS];
     }
     $action = (string) array_shift($config);
     if (NULL === $action || NULL === $parameters) {
         throw new \Exception(sprintf('Invalid action entry - %s', var_export($config, TRUE)));
     }
     $raw = $action;
     list($scope, $action) = explode('/', $raw, 2);
     // drop all hard spaces
     $action = str_replace('_', '', $action);
     // unlike Mage::helper() this one returns FALSE when model is not found
     // change whole config to use new action name and remove this ugly hack
     // we can't have default namespace, but in config we have such entry
     $scope = $scope == 'default' ? $scope . 'scope' : $scope;
     $className = '\\Nexway\\SetupManager\\Util\\Processor\\Action\\' . ucfirst($scope) . '\\' . ucfirst($action);
     $base = new $className();
     if (FALSE === $base) {
         throw new \Exception(sprintf('Invalid action - %s/%s', $scope, $action));
     }
     $parametersObject = new \Varien_Object();
     $parametersObject->setData($parameters);
     return $base->setAction($action)->setScope($scope)->setParameters($parametersObject);
 }
开发者ID:pawlik,项目名称:magerun-addons,代码行数:38,代码来源:Action.php

示例12: beforeSave

 /**
  * Method is invoked before save
  *
  * @param Varien_Object $object
  * @return Mage_Eav_Model_Entity_Attribute_Backend_Abstract
  */
 public function beforeSave($object)
 {
     if ($object->getCreditmemo()) {
         $object->setParentId($object->getCreditmemo()->getId());
     }
     return parent::beforeSave($object);
 }
开发者ID:par-orillonsoft,项目名称:magento_work,代码行数:13,代码来源:Child.php

示例13: _prepareForm

 /**
  * prepare tab form's information
  *
  * @return Magestore_RewardPoints_Block_Adminhtml_Spending_Edit_Tab_Form
  */
 protected function _prepareForm()
 {
     $form = new Varien_Data_Form();
     if (Mage::getSingleton('adminhtml/session')->getFormData()) {
         $data = Mage::getSingleton('adminhtml/session')->getFormData();
         Mage::getSingleton('adminhtml/session')->setFormData(null);
     } elseif (Mage::registry('rate_data')) {
         $data = Mage::registry('rate_data')->getData();
     }
     $fieldset = $form->addFieldset('rewardpoints_form', array('legend' => Mage::helper('rewardpoints')->__('Rate information')));
     $dataObj = new Varien_Object($data);
     $data = $dataObj->getData();
     $fieldset->addField('points', 'text', array('label' => Mage::helper('rewardpoints')->__('Spending Point(s)'), 'title' => Mage::helper('rewardpoints')->__('Spending Point(s)'), 'required' => true, 'name' => 'points'));
     $fieldset->addField('money', 'text', array('name' => 'money', 'label' => Mage::helper('rewardpoints')->__('Discount received'), 'title' => Mage::helper('rewardpoints')->__('Discount received'), 'required' => true, 'after_element_html' => '<strong>[' . Mage::getStoreConfig(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_BASE) . ']</strong>', 'note' => Mage::helper('rewardpoints')->__('the equivalent value of points')));
     //Hai.Tran 12/11/2013 fix gioi han spend points
     $fieldset->addField('max_price_spended_type', 'select', array('label' => Mage::helper('rewardpoints')->__('Limit spending points based on'), 'title' => Mage::helper('rewardpoints')->__('Limit spending points based on'), 'name' => 'max_price_spended_type', 'options' => array('none' => Mage::helper('rewardpoints')->__('None'), 'by_price' => Mage::helper('rewardpoints')->__('A fixed amount of Total Order Value'), 'by_percent' => Mage::helper('rewardpoints')->__('A percentage of Total Order Value')), 'onchange' => 'toggleMaxPriceSpend()', 'note' => Mage::helper('rewardpoints')->__('Select the type to limit spending points')));
     $fieldset->addField('max_price_spended_value', 'text', array('label' => Mage::helper('rewardpoints')->__('Limit value allowed to spend points at'), 'title' => Mage::helper('rewardpoints')->__('Limit value allowed to spend points at'), 'name' => 'max_price_spended_value', 'note' => Mage::helper('rewardpoints')->__('If empty or zero, there is no limitation.')));
     //End Hai.Tran 12/11/2013
     if (!Mage::app()->isSingleStoreMode()) {
         $fieldset->addField('website_ids', 'multiselect', array('name' => 'website_ids[]', 'label' => Mage::helper('rewardpoints')->__('Websites'), 'title' => Mage::helper('rewardpoints')->__('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('rewardpoints')->__('Customer groups'), 'title' => Mage::helper('rewardpoints')->__('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('sort_order', 'text', array('label' => Mage::helper('rewardpoints')->__('Priority'), 'label' => Mage::helper('rewardpoints')->__('Priority'), 'required' => false, 'name' => 'sort_order', 'note' => Mage::helper('rewardpoints')->__('Higher priority Rate will be applied first')));
     $form->setValues($data);
     $this->setForm($form);
     Mage::dispatchEvent('rewardpoints_adminhtml_spending_rate_form', array('tab_form' => $this, 'form' => $form, 'data' => $dataObj));
     return parent::_prepareForm();
 }
开发者ID:kanotest15,项目名称:cbmagento,代码行数:36,代码来源:Form.php

示例14: render

 public function render(Varien_Object $value)
 {
     $code = $value->getData('item_value/code');
     $item = $value->getItem();
     $result = '';
     $itemRenderer = $this->getItemRendererBlock();
     if ($code !== '') {
         if ($code == 'name') {
             $result = $this->htmlEscape($item->getName());
         } elseif ($code == 'sku') {
             $result = implode('<br />', Mage::helper('catalog')->splitSku($this->htmlEscape($item->getSku())));
         } elseif ($code == 'quantity') {
             if ($value->hasOrder()) {
                 $result = $itemRenderer->getColumnHtml($item, 'qty');
             } else {
                 $result = $item->getQty() * 1;
             }
         } elseif ($code == 'original_price' || $code == 'tax_amount' || $code == 'discount_amount') {
             $result = $itemRenderer->displayPriceAttribute($code);
         } elseif ($code == 'tax_percent') {
             $result = $itemRenderer->displayTaxPercent($item);
         } elseif ($code == 'row_total') {
             if (Mage::helper('customgrid')->isMageVersionLesserThan(1, 6)) {
                 $result = $itemRenderer->displayPrices($item->getBaseRowTotal() - $item->getBaseDiscountAmount() + $item->getBaseTaxAmount() + $item->getBaseWeeeTaxAppliedRowAmount(), $item->getRowTotal() - $item->getDiscountAmount() + $item->getTaxAmount() + $item->getWeeeTaxAppliedRowAmount());
             } else {
                 $result = $itemRenderer->displayPrices($item->getBaseRowTotal() + $item->getBaseTaxAmount() + $item->getBaseHiddenTaxAmount() + $item->getBaseWeeeTaxAppliedRowAmount() - $item->getBaseDiscountAmount(), $item->getRowTotal() + $item->getTaxAmount() + $item->getHiddenTaxAmount() + $item->getWeeeTaxAppliedRowAmount() - $item->getDiscountAmount());
             }
         } else {
             $result = $item->getDataUsingMethod($code);
         }
     }
     return $result;
 }
开发者ID:xiaoguizhidao,项目名称:blingjewelry-prod,代码行数:33,代码来源:Default.php

示例15: load

 public function load($printQuery = false, $logQuery = false)
 {
     $this->_select = $this->_read->select();
     $entityTable = $this->getEntity()->getEntityTable();
     $paidTable = $this->getAttribute('grand_total')->getBackend()->getTable();
     $idField = $this->getEntity()->getIdFieldName();
     $this->getSelect()->from(array('sales' => $entityTable), array('store_id', 'lifetime' => 'sum(sales.base_grand_total)', 'avgsale' => 'avg(sales.base_grand_total)', 'num_orders' => 'count(sales.base_grand_total)'))->where('sales.entity_type_id=?', $this->getEntity()->getTypeId())->group('sales.store_id');
     if ($this->_customer instanceof Mage_Customer_Model_Customer) {
         $this->getSelect()->where('sales.customer_id=?', $this->_customer->getId());
     }
     $this->printLogQuery($printQuery, $logQuery);
     try {
         $values = $this->_read->fetchAll($this->getSelect()->__toString());
     } catch (Exception $e) {
         $this->printLogQuery(true, true, $this->getSelect()->__toString());
         throw $e;
     }
     $stores = Mage::getResourceModel('core/store_collection')->setWithoutDefaultFilter()->load()->toOptionHash();
     if (!empty($values)) {
         foreach ($values as $v) {
             $obj = new Varien_Object($v);
             $storeName = isset($stores[$obj->getStoreId()]) ? $stores[$obj->getStoreId()] : null;
             $this->_items[$v['store_id']] = $obj;
             $this->_items[$v['store_id']]->setStoreName($storeName);
             $this->_items[$v['store_id']]->setAvgNormalized($obj->getAvgsale() * $obj->getNumOrders());
             foreach ($this->_totals as $key => $value) {
                 $this->_totals[$key] += $obj->getData($key);
             }
         }
         if ($this->_totals['num_orders']) {
             $this->_totals['avgsale'] = $this->_totals['lifetime'] / $this->_totals['num_orders'];
         }
     }
     return $this;
 }
开发者ID:hunnybohara,项目名称:magento-chinese-localization,代码行数:35,代码来源:Collection.php


注:本文中的Varien_Object类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。