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


PHP Mage::GetModel方法代码示例

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


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

示例1: AddAction

 /**
  * Ajouter un movement de stock
  *
  */
 public function AddAction()
 {
     $response = false;
     $product_id = $this->getRequest()->getParam('sm_product_id');
     try {
         //Cree le movement
         mage::getModel('Purchase/StockMovement')->setsm_product_id($product_id)->setsm_qty($this->getRequest()->getParam('sm_qty'))->setsm_coef(mage::getModel('Purchase/StockMovement')->GetTypeCoef($this->getRequest()->getParam('sm_type')))->setsm_description($this->getRequest()->getParam('sm_description'))->setsm_type($this->getRequest()->getParam('sm_type'))->setsm_date($this->getRequest()->getParam('sm_date'))->save();
         Mage::GetModel('Purchase/StockMovement')->ComputeProductStock($product_id);
         //Confirme
         Mage::getSingleton('adminhtml/session')->addSuccess($this->__('Stock movement created'));
     } catch (Exception $ex) {
         Mage::getSingleton('adminhtml/session')->addError($this->__('Error'));
     }
     //redirect to purchase product sheet
     $this->_redirect('Purchase/Products/Edit', array('product_id' => $product_id, 'tab' => 'tab_stock_movements'));
 }
开发者ID:TrygveSkogsholm,项目名称:Magento-Patch,代码行数:20,代码来源:StockMovementController.php

示例2: getOtherManufacturesAsCombo

 /**
  * Retourne un combo avec les manufactures pas encore associés
  *
  */
 public function getOtherManufacturesAsCombo($name)
 {
     //cree un tableau avec les id des manufacturers déja géré
     $collection = Mage::GetModel('Purchase/ManufacturerSupplier')->getCollection()->addFieldToFilter('pms_supplier_id', $this->_supplier_id);
     $t_ids = array();
     $t_ids[] = '-1';
     foreach ($collection as $item) {
         $t_ids[] = $item->getpms_manufacturer_id();
     }
     //Charge les manufacturers pas gérés
     $collection = Mage::GetModel('Purchase/Manufacturer')->getCollection()->addFieldToFilter('man_id', array('nin' => $t_ids));
     $retour = '<select id="' . $name . '"  name="' . $name . '">';
     $retour .= '<option value=""></option>';
     foreach ($collection as $item) {
         $retour .= '<option value="' . $item->getman_id() . '">' . $item->getman_name() . '</option>';
     }
     $retour .= '</select>';
     return $retour;
 }
开发者ID:TrygveSkogsholm,项目名称:Magento-Patch,代码行数:23,代码来源:Manufacturers.php

示例3: SaveAction

 /**
  * Enregistre les modifs faite
  *
  */
 public function SaveAction()
 {
     //Charge le manufacturer
     $Supplier = Mage::getModel('Purchase/Supplier')->load($this->getRequest()->getParam('sup_id'));
     //Enregistre les modifs
     $Supplier->setsup_name($this->getRequest()->getParam('sup_name'));
     $Supplier->setsup_contact($this->getRequest()->getParam('sup_contact'));
     $Supplier->setsup_address1($this->getRequest()->getParam('sup_address1'));
     $Supplier->setsup_address2($this->getRequest()->getParam('sup_address2'));
     $Supplier->setsup_zipcode($this->getRequest()->getParam('sup_zipcode'));
     $Supplier->setsup_city($this->getRequest()->getParam('sup_city'));
     $Supplier->setsup_country($this->getRequest()->getParam('sup_country'));
     $Supplier->setsup_tel($this->getRequest()->getParam('sup_tel'));
     $Supplier->setsup_fax($this->getRequest()->getParam('sup_fax'));
     $Supplier->setsup_mail($this->getRequest()->getParam('sup_mail'));
     $Supplier->setsup_website($this->getRequest()->getParam('sup_website'));
     $Supplier->setsup_comments($this->getRequest()->getParam('sup_comments'));
     if ($this->getRequest()->getParam('sup_sale_online')) {
         if ($this->getRequest()->getParam('sup_sale_online') == 1) {
             $Supplier->setsup_sale_online(1);
         } else {
             $Supplier->setsup_sale_online(0);
         }
     } else {
         $Supplier->setsup_sale_online(0);
     }
     $Supplier->setsup_account_login($this->getRequest()->getParam('sup_account_login'));
     $Supplier->setsup_account_password($this->getRequest()->getParam('sup_account_password'));
     $Supplier->setsup_order_mini($this->getRequest()->getParam('sup_order_mini'));
     $Supplier->setsup_supply_delay($this->getRequest()->getParam('sup_supply_delay'));
     $Supplier->setsup_supply_delay_max($this->getRequest()->getParam('sup_supply_delay_max'));
     $Supplier->setsup_carrier($this->getRequest()->getParam('sup_carrier'));
     $Supplier->setsup_rma_tel($this->getRequest()->getParam('sup_rma_tel'));
     $Supplier->setsup_rma_mail($this->getRequest()->getParam('sup_rma_mail'));
     $Supplier->setsup_rma_comments($this->getRequest()->getParam('sup_rma_comments'));
     $Supplier->save();
     //verifie si on doit en ajouter un
     $sup_id = $Supplier->getId();
     if ($this->getRequest()->getParam('add_pms_manufacturer_id') != '') {
         $NewManufacturer = mage::getModel('Purchase/ManufacturerSupplier');
         $NewManufacturer->setpms_supplier_id($sup_id);
         $NewManufacturer->setpms_manufacturer_id($this->getRequest()->getParam('add_pms_manufacturer_id'));
         $NewManufacturer->setpms_official($this->getRequest()->getParam('add_pms_official'));
         $NewManufacturer->setpms_price_position($this->getRequest()->getParam('add_pms_price_position'));
         $NewManufacturer->setpms_gamme($this->getRequest()->getParam('add_pms_gamme'));
         $NewManufacturer->save();
     }
     //Met a jour les autres
     $collection = Mage::GetModel('Purchase/ManufacturerSupplier')->getCollection()->addFieldToFilter('pms_supplier_id', $sup_id);
     foreach ($collection as $item) {
         if ($this->getRequest()->getParam('pms_official_' . $item->getpms_num()) == '1') {
             $item->setpms_official(1);
         } else {
             $item->setpms_official(0);
         }
         $item->setpms_price_position($this->getRequest()->getParam('pms_price_position_' . $item->getpms_num()));
         $item->setpms_gamme($this->getRequest()->getParam('pms_gamme_' . $item->getpms_num()));
         $item->save();
     }
     //confirme
     Mage::getSingleton('adminhtml/session')->addSuccess($this->__('Supplier Saved'));
     //Redirige vers la fiche créée
     $this->_redirect('Purchase/Suppliers/Edit/sup_id/' . $Supplier->getId());
 }
开发者ID:TrygveSkogsholm,项目名称:Magento-Patch,代码行数:68,代码来源:SuppliersController.php

示例4: insertItemToCartDirect

 /**
  * this function takes a single item from the request and evaluates
  * the single item data to figure out the insert.
  *
  * @param $item
  * @param Mage_Checkout_Model_Cart $cartObj
  */
 public function insertItemToCartDirect($item, Mage_Checkout_Model_Cart $cartObj)
 {
     $quote = $cartObj->getQuote();
     $id = $item->get('secondaryId');
     if (is_numeric($id)) {
         $product = Mage::GetModel('catalog/product')->load($id);
         $this->addCatalogProductToQuote($quote, $product, (int) $item->get('quantity'));
     } else {
         try {
             $idData = Zend_Json::decode($id);
             $parentItem = null;
             $parentProductId = null;
             foreach ($idData as $id => $data) {
                 //                    echo $id;
                 $product = Mage::GetModel('catalog/product')->load($id);
                 $product->setIsInStock(1);
                 $product->setIsSalable(1);
                 //$product->setWebsiteIds
                 $product->setCartQty($item->get('quantity'));
                 $product->setQty($item->get('quantity'));
                 if ($parentProductId != null) {
                     $product->setParentProductId($parentProductId);
                     $product->setStickWithinParent($parentItem);
                 }
                 //                    print_r($product->debug());
                 $item = $this->addCatalogProductToQuote($quote, $product, $parentProductId == null ? (int) $item->get('quantity') : 1);
                 if ($parentItem == null) {
                     $parentItem = $item;
                     $parentProductId = $product->getId();
                     $item->addQty((int) $item->get('quantity'));
                 } else {
                     $item->setParentItem($parentItem);
                 }
             }
             //                exit;
         } catch (Exception $e) {
             // the data was invalid.
         }
     }
 }
开发者ID:Eximagen,项目名称:pfizer,代码行数:47,代码来源:Session.php

示例5: getCategoryEntityAttributes

 /**
  * @depricated
  * @return object
  */
 public function getCategoryEntityAttributes()
 {
     $entity = $this->getEntityCatalog();
     $coll = Mage::GetModel('eav/eav_entity_attribute')->getCollection();
     $coll->setEntityTypeFilter($entity->getId());
     //$setId       = (int) $object->getAttributeSetId();
     //$groupId     = (int) $object->getAttributeGroupId();
     return $coll;
 }
开发者ID:Eximagen,项目名称:pfizer,代码行数:13,代码来源:Attributes.php

示例6: UpdateProductStock

 public function UpdateProductStock($ProductId)
 {
     Mage::GetModel('Purchase/StockMovement')->ComputeProductStock($ProductId);
 }
开发者ID:TrygveSkogsholm,项目名称:Magento-Patch,代码行数:4,代码来源:Data.php


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