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


PHP mage类代码示例

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


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

示例1: getProduct

 /**
  * Retourne le du produit courant
  *
  * @return unknown
  */
 public function getProduct()
 {
     if ($this->_product == null) {
         $this->_product = mage::getModel('catalog/product')->load($this->_productId);
     }
     return $this->_product;
 }
开发者ID:TrygveSkogsholm,项目名称:Magento-Patch,代码行数:12,代码来源:Graph.php

示例2: checkPassword

 /**
  * check password
  *
  */
 private function checkPassword()
 {
     $password = $this->getRequest()->getParam('password');
     if ($password != mage::getStoreConfig('clientcomputer/general/password')) {
         die('Access denied');
     }
 }
开发者ID:TrygveSkogsholm,项目名称:Magento-Patch,代码行数:11,代码来源:FrontController.php

示例3: sales_shipment_add_tracking

 /**
  * Function to update waybill if order tracking is of Delhivery Lastmile
  */
 public function sales_shipment_add_tracking($observer)
 {
     $track = $observer->getEvent()->getTrack();
     $order = $track->getShipment()->getOrder();
     $shippingMethod = $order->getShippingMethod();
     // String in format of 'carrier_method'
     if (!$shippingMethod) {
         return;
     }
     // Process only Delhivery Lastmile methods
     if ($track->getCarrierCode() != 'dlastmile') {
         return;
     }
     //mage::log($track->getNumber());
     //mage::log($track->getCarrierCode());
     $model = Mage::getModel('lastmile/lastmile');
     $awbobj = $model->loadByAwb($track->getNumber());
     $data = array();
     $status = 'Assigned';
     $data['state'] = 1;
     $data['status'] = "Assigned";
     $data['orderid'] = $order->getId();
     $data['shipment_to'] = $order->getShippingAddress()->getName();
     $data['shipment_id'] = $track->getShipment()->getIncrementId();
     mage::log($data);
     $model->setData($data);
     $model->setId($awbobj);
     $model->save();
     return;
 }
开发者ID:gkbaghel,项目名称:dv-utils,代码行数:33,代码来源:Observer.php

示例4: _prepareForm

 protected function _prepareForm()
 {
     $model = mage::registry('pdfgenerator_template');
     $form = new Varien_Data_Form();
     $fieldset = $form->addFieldset('general_fieldset', array('legend' => Mage::helper('pdfgenerator')->__('Template Information'), 'class' => 'fieldset'));
     $fieldset->addField('orig_template_variables', 'hidden', array('name' => 'orig_template_variables'));
     $fieldset->addField('variables', 'hidden', array('name' => 'variables', 'value' => Zend_Json::encode($this->getVariables())));
     $fieldset->addField('template_variables', 'hidden', array('name' => 'template_variables'));
     /*
      * We will use this when needed.
      */
     $insertVariableButton = $this->getLayout()->createBlock('adminhtml/widget_button', '', array('type' => 'button', 'label' => Mage::helper('pdfgenerator')->__('Insert Variable...'), 'onclick' => 'MagentovariablePlugin.loadChooser(\'' . $this->getVariablesWysiwygActionUrl() . '\', \'pdft_filename\');'));
     $fieldset->addField('insert_variable', 'note', array('text' => $insertVariableButton->toHtml()));
     $fieldset->addField('pdft_filename', 'text', array('name' => 'pdft_filename', 'label' => Mage::helper('pdfgenerator')->__('File Name'), 'required' => true));
     $fieldset->addField('pdftp_format', 'select', array('label' => Mage::helper('pdfgenerator')->__('Page format'), 'title' => Mage::helper('pdfgenerator')->__('Page format'), 'name' => 'pdftp_format', 'required' => true, 'options' => array('5' => Mage::helper('pdfgenerator')->__('Legal'), '4' => Mage::helper('pdfgenerator')->__('Letter'), '3' => Mage::helper('pdfgenerator')->__('A6'), '2' => Mage::helper('pdfgenerator')->__('A5'), '1' => Mage::helper('pdfgenerator')->__('A3'), '0' => Mage::helper('pdfgenerator')->__('A4'))));
     $fieldset->addField('pdftc_customchek', 'select', array('label' => Mage::helper('pdfgenerator')->__('Custom format'), 'name' => 'pdftc_customchek', 'options' => array('1' => Mage::helper('pdfgenerator')->__('Yes'), '0' => Mage::helper('pdfgenerator')->__('No')), 'onclick' => "", 'onchange' => "", 'disabled' => false));
     $fieldset->addField('pdft_customwidth', 'text', array('name' => 'pdft_customwidth', 'class' => 'validate-zero-or-greater', 'label' => Mage::helper('pdfgenerator')->__('Width (mm)'), 'required' => false));
     $fieldset->addField('pdft_customheight', 'text', array('name' => 'pdft_customheight', 'class' => 'validate-zero-or-greater', 'label' => Mage::helper('pdfgenerator')->__('Height (mm)'), 'required' => false));
     $fieldset->addField('pdft_orientation', 'select', array('label' => Mage::helper('pdfgenerator')->__('Page orientation'), 'title' => Mage::helper('pdfgenerator')->__('Page orientation'), 'name' => 'pdft_orientation', 'required' => true, 'options' => array('portrait' => Mage::helper('pdfgenerator')->__('Portrait'), 'landscape' => Mage::helper('pdfgenerator')->__('Landscape'))));
     $fieldset->addField('pdftm_top', 'text', array('name' => 'pdftm_top', 'class' => 'validate-greater-than-zero', 'label' => Mage::helper('pdfgenerator')->__('Top (mm)'), 'required' => true));
     $fieldset->addField('pdftm_bottom', 'text', array('name' => 'pdftm_bottom', 'class' => 'validate-greater-than-zero', 'label' => Mage::helper('pdfgenerator')->__('Bottom (mm)'), 'required' => true));
     $fieldset->addField('pdftm_left', 'text', array('name' => 'pdftm_left', 'class' => 'validate-greater-than-zero', 'label' => Mage::helper('pdfgenerator')->__('Left (mm)'), 'required' => true));
     $fieldset->addField('pdftm_right', 'text', array('name' => 'pdftm_right', 'class' => 'validate-greater-than-zero', 'label' => Mage::helper('pdfgenerator')->__('Right (mm)'), 'required' => true));
     $form->setValues($model->getData());
     $this->setForm($form);
     return parent::_prepareForm();
 }
开发者ID:xiaoguizhidao,项目名称:devfashion,代码行数:27,代码来源:Settings.php

示例5: render

 public function render(Varien_Object $row)
 {
     //retrieve information
     $productId = $this->getColumn()->getproduct_id();
     $collection = mage::getModel('sales/order_item')->getCollection()->addFieldToFilter('order_id', $row->getId())->addFieldToFilter('product_id', $productId);
     //return value
     $retour = 0;
     switch ($this->getColumn()->getfield_name()) {
         case 'ordered_qty':
             foreach ($collection as $item) {
                 $retour += (int) $item->getqty_ordered();
             }
             break;
         case 'shipped_qty':
             foreach ($collection as $item) {
                 $retour += (int) $item->getRealShippedQty();
             }
             break;
         case 'remaining_qty':
             foreach ($collection as $item) {
                 $retour += $item->getRemainToShipQty();
             }
             break;
         case 'reserved_qty':
             foreach ($collection as $item) {
                 $retour += (int) $item->getreserved_qty();
             }
             break;
     }
     if ($retour == '') {
         $retour = '0';
     }
     return $retour;
 }
开发者ID:TrygveSkogsholm,项目名称:Magento-Patch,代码行数:34,代码来源:OrderItemQty.php

示例6: load

 /**
  * Load product collection Id(s)
  *
  */
 public function load()
 {
     //Charge les commandes fournisseur
     $this->_collection = mage::getModel('Purchase/SupplyNeeds')->getCollection()->setOrder('sn_id', 'asc');
     //Affiche le nombre de commande chargée
     $this->addException(Mage::helper('dataflow')->__('Loaded %s rows', $this->_collection->getSize()), Mage_Dataflow_Model_Convert_Exception::NOTICE);
 }
开发者ID:TrygveSkogsholm,项目名称:Magento-Patch,代码行数:11,代码来源:Supplyneeds.php

示例7: getProduct

 /**
  * Retourne le produit concerné
  *
  * @param unknown_type $value
  */
 public function getProduct()
 {
     if ($this->_product == null) {
         $this->_product = mage::getModel('catalog/product')->load($this->getRequest()->getParam('product_id'));
     }
     return $this->_product;
 }
开发者ID:TrygveSkogsholm,项目名称:Magento-Patch,代码行数:12,代码来源:Edit.php

示例8: _getLevels

 protected function _getLevels()
 {
     if (!$this->_levels) {
         $this->_levels = mage::getModel('ebayenterprise_magelog/system_config_source_log_levels');
     }
     return $this->_levels;
 }
开发者ID:kojiromike,项目名称:magento-log,代码行数:7,代码来源:LevelsTest.php

示例9: 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

示例10: getOrder

 public function getOrder()
 {
     if ($this->_order == null) {
         $this->_order = mage::getModel('Purchase/Order')->load($this->getRequest()->getParam('po_num'));
     }
     return $this->_order;
 }
开发者ID:TrygveSkogsholm,项目名称:Magento-Patch,代码行数:7,代码来源:Edit.php

示例11: RefreshList

 /**
  * Refresh list
  *
  */
 public function RefreshList()
 {
     //truncate table
     Mage::getResourceModel('ExtensionConflict/ExtensionConflict')->TruncateTable();
     //retrieve all config.xml
     $tConfigFiles = $this->getConfigFilesList();
     //parse all config.xml
     $rewrites = array();
     foreach ($tConfigFiles as $configFile) {
         $rewrites = $this->getRewriteForFile($configFile, $rewrites);
     }
     //insert in database
     foreach ($rewrites as $key => $value) {
         $t = explode('/', $key);
         $moduleName = $t[0];
         $className = $t[1];
         $record = mage::getModel('ExtensionConflict/ExtensionConflict');
         $record->setec_core_module($moduleName);
         $record->setec_core_class($className);
         $rewriteClasses = join(', ', $value);
         $record->setec_rewrite_classes($rewriteClasses);
         if (count($value) > 1) {
             $record->setec_is_conflict(1);
         }
         $record->save();
     }
 }
开发者ID:praxigento,项目名称:mage_app_prxgt_store,代码行数:31,代码来源:Data.php

示例12: addAction

 public function addAction()
 {
     $response = array();
     if (!Mage::getStoreConfigFlag('wishlist/general/active')) {
         $response['status'] = 'ERROR';
         $response['message'] = $this->__('Wishlist Has Been Disabled By Admin');
     }
     if (!Mage::getSingleton('customer/session')->isLoggedIn()) {
         $response['status'] = 'ERROR';
         $response['message'] = $this->__('Please Login First');
     }
     if (empty($response)) {
         $session = Mage::getSingleton('customer/session');
         $wishlist = $this->_getWishlist();
         if (!$wishlist) {
             $response['status'] = 'ERROR';
             $response['message'] = $this->__('Unable to Create Wishlist');
         } else {
             $productId = (int) $this->getRequest()->getParam('product');
             if (!$productId) {
                 $response['status'] = 'ERROR';
                 $response['message'] = $this->__('Product Not Found');
             } else {
                 $product = Mage::getModel('catalog/product')->load($productId);
                 if (!$product->getId() || !$product->isVisibleInCatalog()) {
                     $response['status'] = 'ERROR';
                     $response['message'] = $this->__('Cannot specify product.');
                 } else {
                     try {
                         $requestParams = $this->getRequest()->getParams();
                         $buyRequest = new Varien_Object($requestParams);
                         $result = $wishlist->addNewItem($product, $buyRequest);
                         if (is_string($result)) {
                             Mage::throwException($result);
                         }
                         $wishlist->save();
                         Mage::dispatchEvent('wishlist_add_product', array('wishlist' => $wishlist, 'product' => $product, 'item' => $result));
                         Mage::helper('wishlist')->calculate();
                         $message = $this->__('%1$s has been added to your wishlist.', $product->getName());
                         $response['status'] = 'SUCCESS';
                         $response['message'] = $message;
                         Mage::unregister('wishlist');
                         $this->loadLayout();
                         $response['toplink'] = $this->getLayout()->getBlock('top.links')->toHtml();
                         $response['sidebar'] = $this->getLayout()->getBlock('wishlist_sidebar')->toHtml();
                     } catch (Mage_Core_Exception $e) {
                         $response['status'] = 'ERROR';
                         $response['message'] = $this->__('An error occurred while adding item to wishlist: %s', $e->getMessage());
                     } catch (Exception $e) {
                         mage::log($e->getMessage());
                         $response['status'] = 'ERROR';
                         $response['message'] = $this->__('An error occurred while adding item to wishlist.');
                     }
                 }
             }
         }
     }
     $this->_sendJson($response);
     return;
 }
开发者ID:bigtailbear14,项目名称:rosstheme,代码行数:60,代码来源:WishlistController.php

示例13: cleanCanceledOrders

 /**
  * Set stocks updated to 1 for canceled orders
  *
  */
 public function cleanCanceledOrders()
 {
     $collection = mage::getModel('sales/order')->getCollection()->addFieldToFilter('stocks_updated', 0)->addAttributeToFilter('status', 'canceled');
     foreach ($collection as $order) {
         $order->setstocks_updated(1)->save();
     }
 }
开发者ID:TrygveSkogsholm,项目名称:Magento-Patch,代码行数:11,代码来源:Data.php

示例14: render

 public function render(Varien_Object $row)
 {
     //recupere les infos
     $orderItem = $row;
     $value = $orderItem->getreserved_qty();
     //recupere le produit
     $product = mage::getModel('catalog/product')->load($orderItem->getproduct_id());
     //si le produit ne gere pas les stocks
     if ($product->getStockItem()->getManageStock()) {
         if ($orderItem->getqty_ordered() - $orderItem->getRealShippedQty() == 0) {
             $retour = $this->__('Shipped');
         } else {
             //si la qté est suffisante pour réserver ou déja réservé
             if ($product->CanReserveQty($orderItem->getqty_ordered()) || $value == $orderItem->getqty_ordered()) {
                 if ($value > 0) {
                     $checked = " checked ";
                 } else {
                     $checked = "";
                 }
                 $retour = "<input type=\"checkbox\" name=\"qty_reserved_" . $orderItem->getId() . "\" values=\"1\" {$checked}>";
             } else {
                 $retour = "<font color=\"red\">" . $this->__('Stock Insufficient') . "</font>";
             }
         }
     } else {
         $retour = "<font color=\"red\">" . $this->__('No Stock Management') . "</font>";
     }
     //retourne
     return $retour;
 }
开发者ID:TrygveSkogsholm,项目名称:Magento-Patch,代码行数:30,代码来源:QtyReserved.php

示例15: GetOrderPaymentValidatedAttributeId

 public function GetOrderPaymentValidatedAttributeId()
 {
     if ($this->_OrderPaymentValidatedAttributeId == null) {
         $this->_OrderPaymentValidatedAttributeId = mage::getModel('eav/entity_attribute')->loadByCode('order', 'payment_validated')->getId();
     }
     return $this->_OrderPaymentValidatedAttributeId;
 }
开发者ID:TrygveSkogsholm,项目名称:Magento-Patch,代码行数:7,代码来源:Constant.php


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