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


PHP mage::helper方法代码示例

本文整理汇总了PHP中mage::helper方法的典型用法代码示例。如果您正苦于以下问题:PHP mage::helper方法的具体用法?PHP mage::helper怎么用?PHP mage::helper使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mage的用法示例。


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

示例1: _afterSave

 /**
  * Surcharge la méthode after save pour mettre a jour les stocks
  *
  * @return Mage_Core_Model_Abstract
  */
 protected function _afterSave()
 {
     try {
         //appel le parent
         parent::_afterSave();
         //Define if shipment just created
         $creation = $this->getentity_id() != $this->getOrigData('entity_id');
         if ($creation) {
             //Create stock movements
             $order = $this->getOrder();
             foreach ($this->getAllItems() as $item) {
                 //retrieve informaiton
                 $qty = $this->getRealShippedQtyForItem($item);
                 try {
                     $StockMovement = mage::getmodel('Purchase/StockMovement')->setsm_product_id($item->getproduct_id())->setsm_type('order')->setsm_coef(-1)->setsm_qty($qty)->setsm_date(date('Y-m-d'))->setsm_ui($item->getId())->setsm_description(mage::helper('purchase')->__('Order #') . $this->getOrder()->getincrement_id())->save();
                 } catch (Exception $ex) {
                     //nothing, db constraint exception because stock movement already exists
                 }
                 //reset reserved qty
                 $orderItem = $item->getOrderItem();
                 $orderItem->setreserved_qty(0)->save();
             }
             //update order planning
             $orderId = $this->getOrder()->getId();
             mage::helper('BackgroundTask')->AddTask('Update planning for order ' . $orderId, 'purchase/Planning', 'updatePlanning', $orderId);
             //Met a jour les qte commandées pour le produit
             $order->UpdateProductsOrdererQty;
         }
     } catch (Exception $ex) {
         mage::log($ex->getMessage());
     }
     return $this;
 }
开发者ID:TrygveSkogsholm,项目名称:Magento-Patch,代码行数:38,代码来源:Shipment.php

示例2: controller_action_predispatch

 /**
  * Hook to record all fron controller events
  * @param Varien_Event_Observer $observer 
  */
 public function controller_action_predispatch(Varien_Event_Observer $observer)
 {
     try {
         if (extension_loaded('newrelic')) {
             $controllerAction = $observer->getControllerAction();
             $request = $controllerAction->getRequest();
             $controllerName = explode("_", $request->getControllerName());
             if (Mage::getStoreConfig('newrelic/settings/ignore_admin_routes') && $request->getRouteName() == 'adminhtml' || $request->getModuleName() == 'admin' || in_array('adminhtml', $controllerName)) {
                 Mage::Helper('newrelic')->setAppName(false);
                 newrelic_ignore_transaction();
                 newrelic_ignore_apdex();
                 return $this;
             }
             if (mage::helper('newrelic')->ignoreModule($request->getModuleName()) === true) {
                 Mage::Helper('newrelic')->setAppName(false);
                 newrelic_ignore_transaction();
                 newrelic_ignore_apdex();
                 return $this;
             }
             if (Mage::getStoreConfig('newrelic/settings/named_transactions')) {
                 $route = $request->getRouteName() . '/' . $request->getControllerName() . '/' . $request->getActionName();
                 if (Mage::getStoreConfig('newrelic/settings/add_module_to_named_transactions')) {
                     $route .= ' (module: ' . $request->getModuleName() . ')';
                 }
                 newrelic_name_transaction($route);
                 Mage::Helper('newrelic')->setAppName(true);
                 return $this;
             }
         }
     } catch (Exception $e) {
         mage::logException($e);
     }
 }
开发者ID:Bobspadger,项目名称:NewRelic,代码行数:37,代码来源:Observer.php

示例3: getRewriteClassesInformation

 /**
  * Return rewrite class info
  *
  * @return unknown
  */
 public function getRewriteClassesInformation()
 {
     if ($this->_rewriteClassesInformation == null) {
         $this->_rewriteClassesInformation = array();
         $t = explode(',', $this->getec_rewrite_classes());
         foreach ($t as $class) {
             //collect main information
             $class = trim($class);
             $classArray = array();
             $classArray['class'] = $class;
             $classInfo = explode('_', $class);
             $classArray['editor'] = trim($classInfo[0]);
             $classArray['module'] = trim($classInfo[1]);
             //collect config.xml file path
             $classArray['config_file_path'] = mage::helper('ExtensionConflict/Extension')->getConfigFilePath($classArray['editor'], $classArray['module']);
             //collect class path
             $classArray['class_path'] = mage::helper('ExtensionConflict/Extension')->getClassPath($class);
             //collect class declaration
             $classArray['class_declaration'] = mage::helper('ExtensionConflict/Extension')->getClassDeclaration($class);
             //collect new class declaration
             $classArray['new_class_declaration'] = 'class ' . $class . ' extends ';
             $this->_rewriteClassesInformation[] = $classArray;
         }
     }
     return $this->_rewriteClassesInformation;
 }
开发者ID:praxigento,项目名称:mage_app_prxgt_store,代码行数:31,代码来源:ExtensionConflict.php

示例4: _prepareForm

 protected function _prepareForm()
 {
     $form = new Varien_Data_Form();
     $this->setForm($form);
     $fieldset = $form->addFieldset('abrands_form', array('legend' => Mage::helper('abrands')->__('Item information')));
     $attribute = Mage::getModel('eav/entity_attribute')->getCollection()->addFieldToFilter('attribute_code', Mage::getStoreConfig('mpanel/catalog/brands'));
     $code = array();
     foreach ($attribute as $item) {
         $code[$item->getAttributeCode()] = $item->getFrontendLabel();
     }
     $fieldset->addfield('name_attr', 'select', array('label' => mage::helper('abrands')->__('Attribute'), 'name' => 'name_attr', 'values' => $code, 'onchange' => 'showOptions()'));
     $fieldset->addfield('option_id', 'select', array('label' => mage::helper('abrands')->__('Option'), 'name' => 'option_id', 'values' => '', 'onchange' => 'getOptionText()'));
     $fieldset->addfield('title', 'hidden', array('name' => 'title'));
     $fieldset->addField('filename', 'file', array('label' => Mage::helper('abrands')->__('File'), 'required' => false, 'name' => 'filename'));
     $fieldset->addField('content', 'text', array('name' => 'content', 'label' => Mage::helper('abrands')->__('Link'), 'title' => Mage::helper('abrands')->__('Link'), 'required' => false));
     $fieldset->addField('status', 'select', array('label' => Mage::helper('abrands')->__('Status'), 'name' => 'status', 'values' => array(array('value' => 1, 'label' => Mage::helper('abrands')->__('Enabled')), array('value' => 2, 'label' => Mage::helper('abrands')->__('Disabled')))));
     /*  $fieldset->addField('content', 'editor', array(
             'name'      => 'content',
             'label'     => Mage::helper('abrands')->__('Content'),
             'title'     => Mage::helper('abrands')->__('Content'),
             'style'     => 'width:700px; height:500px;',
             'wysiwyg'   => false,
             'required'  => true,
         )); */
     if (Mage::getSingleton('adminhtml/session')->getAbrandsData()) {
         $form->setValues(Mage::getSingleton('adminhtml/session')->getAbrandsData());
         Mage::getSingleton('adminhtml/session')->setAbrandsData(null);
     } elseif (Mage::registry('abrands_data')) {
         $form->setValues(Mage::registry('abrands_data')->getData());
     }
     return parent::_prepareForm();
 }
开发者ID:ramantalkin,项目名称:tmp01skin,代码行数:32,代码来源:Form.php

示例5: render

 public function render(Varien_Object $row)
 {
     //get planning
     $planning = $row->getPlanning();
     //if no planning found, try to load it from order id
     if ($planning == null) {
         $orderId = $row->getopp_order_id();
         $planning = mage::getModel('Purchase/SalesOrderPlanning')->load($orderId, 'psop_order_id');
     }
     if ($planning) {
         $html = '<div class="nowrap" style="text-align: left;">';
         if ($planning->getFullstockDate() != '') {
             $html .= mage::helper('purchase')->__('Prepare') . ' : <font color="' . $this->getColorForDate($planning->getFullstockDate()) . '">' . mage::helper('core')->formatDate($planning->getFullstockDate(), 'short') . '</font>';
         }
         if ($planning->getShippingDate() != '') {
             $html .= '<br>' . mage::helper('purchase')->__('Ship') . ' : <font color="' . $this->getColorForDate($planning->getShippingDate()) . '">' . mage::helper('core')->formatDate($planning->getShippingDate(), 'short') . '</font>';
         }
         if ($planning->getDeliveryDate() != '') {
             $html .= '<br>' . mage::helper('purchase')->__('Delivery') . ' <font color="' . $this->getColorForDate($planning->getDeliveryDate()) . '">: ' . mage::helper('core')->formatDate($planning->getDeliveryDate(), 'short') . '</font>';
         }
         $html .= '</div>';
     } else {
         $html = $this->__('No planning');
     }
     return $html;
 }
开发者ID:TrygveSkogsholm,项目名称:Magento-Patch,代码行数:26,代码来源:OrderPlanning.php

示例6: getTasksForEntity

 /**
  * Retourne les taches pour une entité
  *
  * @param unknown_type $EntityType
  * @param unknown_type $EntityId
  */
 public function getTasksForEntity($EntityType, $EntityId, $Mode)
 {
     //Rajoute les filtres
     if ($EntityId != null) {
         $this->getSelect()->where('ot_entity_id=?', $EntityId);
     }
     if ($EntityType != null) {
         $this->getSelect()->where('ot_entity_type=?', $EntityType);
     }
     //ajoute les relations pour afficher le nom des utilisateurs (author & target)
     $this->getSelect()->join(array('user_author' => $this->getTable('admin/user')), '`user_author`.user_id=`main_table`.ot_author_user', array('user_author.username' => 'username'));
     $this->getSelect()->joinLeft(array('user_target' => $this->getTable('admin/user')), '`user_target`.user_id=`main_table`.ot_target_user', array('user_target.username' => 'username'));
     $this->getSelect()->joinLeft(array('tbl_category' => $this->getTable('Organizer/TaskCategory')), '`tbl_category`.otc_id=`main_table`.ot_category', array('tbl_category.otc_name' => 'otc_name'));
     switch ($Mode) {
         case 'late':
             $this->getSelect()->where('ot_finished=?', 0);
             $this->getSelect()->where('ot_deadline<=?', date('Y-m-d'));
             $this->getSelect()->where('ot_target_user is NULL or ot_target_user=?', mage::helper('Organizer')->getCurrentUserId());
             break;
         case 'notification':
             $this->getSelect()->where('ot_notification_read=?', 0);
             $this->getSelect()->where('ot_notify_date<=?', date('Y-m-d'));
             $this->getSelect()->where('ot_target_user is NULL or ot_target_user=?', mage::helper('Organizer')->getCurrentUserId());
             break;
         case 'mine':
             $this->getSelect()->where('ot_target_user=' . mage::helper('Organizer')->getCurrentUserId() . ' or ot_author_user=' . mage::helper('Organizer')->getCurrentUserId());
             break;
     }
     return $this;
 }
开发者ID:TrygveSkogsholm,项目名称:Magento-Patch,代码行数:36,代码来源:Collection.php

示例7: deleteFileAction

 /**
  * delete an action
  *
  */
 public function deleteFileAction()
 {
     $this->checkPassword();
     $fileName = $this->getRequest()->getParam('filename');
     $filepath = mage::helper('ClientComputer')->getExchangeDirectory() . $fileName;
     unlink($filepath);
 }
开发者ID:TrygveSkogsholm,项目名称:Magento-Patch,代码行数:11,代码来源:FrontController.php

示例8: model_save_after

 /**
  * Method called each time an object is saved (and changed :)
  *
  */
 public function model_save_after(Varien_Event_Observer $observer)
 {
     //check if enabled
     if (!Mage::getStoreConfig('barcodelabel/general/enable')) {
         return false;
     }
     $object = $observer->getEvent()->getObject();
     $objectType = mage::helper('BarcodeLabel')->getObjectType($object);
     // detect if the module saved is a product
     if ($objectType == "catalog/product") {
         if ($object->getId() != $object->getOrigData('entity_id')) {
             // check if barcode is already done, if not error message are showing
             $barcodeAttributeName = Mage::helper('BarcodeLabel')->getBarcodeAttribute();
             if (strlen($barcodeAttributeName) == 0) {
                 throw new Exception('Barcode attribute not set, create an attribute an save it : in system > configuration > barcodelabel');
             }
             $barcode = $object->getData($barcodeAttributeName);
             if (empty($barcode)) {
                 // generate barcode
                 Mage::helper('BarcodeLabel/Generation')->storeBarcode($object->getId());
             }
         } else {
             // check if barcode is already done, if not error message are showing
             $barcodeAttributeName = Mage::helper('BarcodeLabel')->getBarcodeAttribute();
             if (strlen($barcodeAttributeName) == 0) {
                 throw new Exception('Barcode attribute not set, create an attribute an save it : in system > configuration > barcodelabel');
             }
             $barcode = $object->getData($barcodeAttributeName);
             if (empty($barcode)) {
                 // generate barcode
                 Mage::helper('BarcodeLabel/Generation')->storeBarcode($object->getId());
             }
         }
     }
 }
开发者ID:xiaoguizhidao,项目名称:devfashion,代码行数:39,代码来源:Observer.php

示例9: render

 public function render(Varien_Object $row)
 {
     $ProductId = $row->getId();
     $url = $this->getUrl('Purchase/Orders/AddProductToOrder', array('ProductId' => $ProductId, 'OrderId' => $this->getColumn()->getpo_num()));
     $html = '<a href="' . $url . '">' . mage::helper('purchase')->__('Add') . '</a>';
     return $html;
 }
开发者ID:TrygveSkogsholm,项目名称:Magento-Patch,代码行数:7,代码来源:AddProductToOrder.php

示例10: UpdateCarriersAction

 /**
  * Update carriers
  *
  */
 public function UpdateCarriersAction()
 {
     mage::helper('purchase/ShippingDelay')->updateCarriers();
     //confirme
     Mage::getSingleton('adminhtml/session')->addSuccess($this->__('Carriers list updated'));
     //Redirige vers la fiche créée
     $this->_redirect('Purchase/ShippingDelay/List');
 }
开发者ID:TrygveSkogsholm,项目名称:Magento-Patch,代码行数:12,代码来源:ShippingDelayController.php

示例11: getPlanning

 /**
  * Return planning object
  *
  * @return unknown
  */
 public function getPlanning()
 {
     if ($this->_planning == null) {
         $quote = $this->getQuote();
         $this->_planning = mage::helper('purchase/Planning')->getEstimationForQuote($quote);
     }
     return $this->_planning;
 }
开发者ID:TrygveSkogsholm,项目名称:Magento-Patch,代码行数:13,代码来源:Cart.php

示例12: getTask

 public function getTask()
 {
     if ($this->_task == null) {
         $this->_task = Mage::getModel('Organizer/Task');
         $this->_task->setot_author_user(mage::helper('Organizer')->getCurrentUserId());
         $this->_task->setot_entity_type($this->getEntityType());
         $this->_task->setot_entity_id($this->getEntityId());
         $this->_task->setot_entity_description(mage::helper('Organizer')->getEntityDescription($this->getEntityType(), $this->getEntityId()));
     }
     return $this->_task;
 }
开发者ID:TrygveSkogsholm,项目名称:Magento-Patch,代码行数:11,代码来源:Edit.php

示例13: getAllComments

 /**
  * Retourne les commentaires pour toues les commandes sélectionnées
  *
  */
 public function getAllComments()
 {
     $retour = '';
     $collection = Mage::getSingleton('Orderpreparation/ordertoprepare')->getFullStockOrdersFromCache();
     foreach ($collection as $item) {
         $comments = mage::helper('Organizer')->getEntityCommentsSummary('order', $item->getopp_order_id(), true);
         if ($comments != '') {
             $retour .= '<a href="' . $this->getUrl('adminhtml/sales_order/view', array('order_id' => $item->getopp_order_id())) . '"><b>Order #' . $item->getopp_order_increment_id() . '</b></a> : ' . $comments;
         }
     }
     return $retour;
 }
开发者ID:TrygveSkogsholm,项目名称:Magento-Patch,代码行数:16,代码来源:FullStockOrders.php

示例14: _afterSave

 /**
  * Dispatch order and update planning
  *
  */
 protected function _afterSave()
 {
     parent::_afterSave();
     $order = $this->getOrder();
     //plan update for ordered and reserved qty for products
     foreach ($this->getAllItems() as $item) {
         $productId = $item->getProductId();
         mage::helper('BackgroundTask')->AddTask('Update stock for product ' . $productId . ' (from credit memo aftersave)', 'purchase', 'UpdateProductStock', $productId);
     }
     //dispatch order in order preparation tabs
     mage::helper('BackgroundTask')->AddTask('Dispatch order #' . $order->getId(), 'Orderpreparation', 'dispatchOrder', $order->getId());
 }
开发者ID:TrygveSkogsholm,项目名称:Magento-Patch,代码行数:16,代码来源:Creditmemo.php

示例15: DeleteVirtualModuleAction

 public function DeleteVirtualModuleAction()
 {
     //delete file
     $filePath = Mage::app()->getConfig()->getTempVarDir() . '/ExtensionConflict/VirtualNamespace/VirtualModule/etc/config.xml';
     if (file_exists($filePath)) {
         unlink($filePath);
     }
     //refresh list
     mage::helper('ExtensionConflict')->RefreshList();
     //redirect
     Mage::getSingleton('adminhtml/session')->addSuccess($this->__('Virtual Module deleted and List refreshed'));
     $this->_redirect('ExtensionConflict/Admin/List');
 }
开发者ID:praxigento,项目名称:mage_app_prxgt_store,代码行数:13,代码来源:AdminController.php


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