• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP mage类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: getRealShippedQtyForItem

 /**
  * Return real shipped qty for an item
  * Welcome in magento.....
  *
  * @param unknown_type $item
  */
 public function getRealShippedQtyForItem($item)
 {
     //init vars
     $qty = $item->getQty();
     $orderItem = $item->getOrderItem();
     $orderItemParentId = $orderItem->getparent_item_id();
     //define if we have to multiply qty by parent qty
     $mustMultiplyByParentQty = false;
     if ($orderItemParentId > 0) {
         $parentOrderItem = mage::getmodel('sales/order_item')->load($orderItemParentId);
         if ($parentOrderItem->getId()) {
             //if shipped together
             if ($parentOrderItem->getproduct_type() == 'bundle' && !$parentOrderItem->isShipSeparately()) {
                 $mustMultiplyByParentQty = true;
                 $qty = $orderItem->getqty_ordered() / $parentOrderItem->getqty_ordered();
             }
         }
     }
     //if multiply by parent qty
     if ($mustMultiplyByParentQty) {
         $parentShipmentItem = null;
         foreach ($item->getShipment()->getAllItems() as $ShipmentItem) {
             if ($ShipmentItem->getorder_item_id() == $orderItemParentId) {
                 $parentShipmentItem = $ShipmentItem;
             }
         }
         if ($parentShipmentItem) {
             $qty = $qty * $parentShipmentItem->getQty();
         }
     }
     return $qty;
 }
开发者ID:TrygveSkogsholm,项目名称:Magento-Patch,代码行数:38,代码来源:Shipment.php


示例17: changeQty

 public function changeQty($observer)
 {
     $event = $observer->getEvent();
     //        $observer->getData();
     //        $quoteItem = $observer->getQuoteItem();
     $model = Mage::getModel('itdelight_first/quantity');
     $model->getCollection();
     //        Zend_Debug::dump($observer);
     //        die;
     //        $observer->getData('cart')->getData();
     //        $observer->getData('cart')->getData('quote')->setData(array('cart_qty'=>'20'));
     //        $_POST['qty'] = "4";
     //        Zend_Debug::dump($_POST);
     //        $quoteItem = $observer->getEvent()->getQuoteItem()->setQty('15');
     try {
         $quoteItem = $observer->getQuoteItem();
         if (is_null($quoteItem->getParentItem())) {
             $qty_my = $quoteItem->getQty();
             $qty = $qty_my * 2;
             $quoteItem->setQty($qty);
             $quoteItem->setQtyToAdd($qty);
         } else {
             $qty_my = $quoteItem->getParentItem()->getQty();
             $qty = $qty_my * 2;
             $quoteItem->getParentItem()->setQty($qty);
             $quoteItem->getParentItem()->setQtyToAdd($qty);
         }
     } catch (Exception $e) {
         mage::logException($e);
     }
 }
开发者ID:AleksLi,项目名称:magento_school,代码行数:31,代码来源:Observer.php


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


示例19: getSupplier

 /**
  * 
  *
  * @return Mage_Catalog_Model_Product
  */
 public function getSupplier()
 {
     if ($this->_supplier == null) {
         $this->_supplier = mage::getModel('Purchase/Supplier')->load($this->getRequest()->getParam('sup_id'));
     }
     return $this->_supplier;
 }
开发者ID:TrygveSkogsholm,项目名称:Magento-Patch,代码行数:12,代码来源:Tabs.php


示例20: load

 /**
  * Load product collection Id(s)
  *
  */
 public function load()
 {
     //Charge les commandes fournisseur
     $this->_collection = mage::getModel('Orderpreparation/ordertoprepareitem')->getCollection()->join('sales/order_item', 'order_item_id=item_id');
     //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,代码来源:OrderToPrepareItems.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP mail类代码示例发布时间:2022-05-23
下一篇:
PHP mPDF类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap