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


PHP mage::getmodel方法代码示例

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


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

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

示例2: GetTypeCombo

 /**
  * Retourne un combo avec les types possible
  *
  */
 public function GetTypeCombo($name = 'type', $DefaultValue = null)
 {
     $types = mage::getmodel('Purchase/StockMovement')->GetTypes();
     $retour = '<select  id="' . $name . '" name="' . $name . '">';
     foreach ($types as $key => $value) {
         $selected = '';
         if ($DefaultValue == $key) {
             $selected = ' selected ';
         } else {
             $selected = '';
         }
         $retour .= '<option value="' . $key . '" ' . $selected . '>' . $this->__($value) . '</option>';
     }
     $retour .= '</select>';
     return $retour;
 }
开发者ID:TrygveSkogsholm,项目名称:Magento-Patch,代码行数:20,代码来源:StockMovement.php

示例3: GetProductsSummary

 public function GetProductsSummary()
 {
     $retour = array();
     $collection = Mage::getModel('Orderpreparation/ordertoprepareitem')->getCollection();
     foreach ($collection as $item) {
         //si le parent du produit est un bundle is_config, on ne l'affiche pas
         if ($item->getis_config() == 0) {
             //recupere les infos
             $product_id = $item->getproduct_id();
             $product = mage::getmodel('catalog/product')->load($product_id);
             $qty = $item->getqty();
             //si le produit est un virtual, on ne l'ajoute pas
             if (Mage::getModel('cataloginventory/stock_item')->loadByProduct($product_id)->getManageStock()) {
                 if (isset($retour[$product_id])) {
                     $retour[$product_id]->setqty_to_prepare($retour[$product_id]->getqty_to_prepare() + $qty);
                 } else {
                     $product->setqty_to_prepare($qty);
                     $retour[$product_id] = $product;
                 }
             }
         }
     }
     //tri la liste
     usort($retour, array("MDN_Orderpreparation_Model_OrderToPrepare", "sortProductPerManufacturer"));
     return $retour;
 }
开发者ID:TrygveSkogsholm,项目名称:Magento-Patch,代码行数:26,代码来源:Ordertoprepare.php

示例4: dispatchOrder

 /**
  * Dispatch pending order to fullstock or stockless tab
  *
  * @param unknown_type $orderId
  */
 public function dispatchOrder($orderId)
 {
     $order = mage::getModel('sales/order')->load($orderId);
     mage::getmodel('Orderpreparation/ordertoprepare')->DispatchOrder($order);
 }
开发者ID:TrygveSkogsholm,项目名称:Magento-Patch,代码行数:10,代码来源:Data.php

示例5: ImportProductsToCreateAction

 /**
  * Importer les produits à créer pour l'importation des 
  *
  */
 public function ImportProductsToCreateAction()
 {
     //definit le chemin
     $path = '/home/mdn/www/var/product_to_create.txt';
     if (!file_exists($path)) {
         die("Fichier introuvable");
     }
     //charge le fichier
     $f = fopen($path, 'r');
     $content = fread($f, filesize($path));
     fclose($f);
     $category_id = 516;
     //parse les lignes
     $lines = explode("\n", $content);
     for ($i = 0; $i < count($lines); $i++) {
         $t_fields = explode(';', $lines[$i]);
         if (count($t_fields) > 1) {
             //cree le produit
             $ref = $t_fields[0];
             $description = $t_fields[1];
             //verifie si le produit existe
             $id = mage::getmodel('catalog/product')->getIdBySku($ref);
             if (!$id) {
                 //cree le produit
                 $product = mage::getModel('catalog/product')->settype_id('simple')->setattribute_set_id('4')->setWebsiteIds(array(1))->setname($description)->setsku($ref)->settax_class_id(2)->setprice(0)->setstatus(2)->setvisibility(1)->setcategory_ids($category_id)->save();
                 //rajoute la gestion de stock
                 $my_stock = Mage::getModel('cataloginventory/stock_item');
                 $my_stock->setproduct_id($product->getId())->setuse_config_manage_stock(0)->setmanage_stock(1)->setqty(0)->setis_in_stock(1)->setstock_id(1)->setuse_config_notify_stock_qty(0)->setnotify_stock_qty(0)->setuse_config_backorders(0)->setbackorders(1)->save();
                 echo "<p>Creation produit " . $description;
             } else {
                 echo "<p>Produit " . $description . " existe déja";
             }
         }
     }
     die("<p>Import fini");
 }
开发者ID:TrygveSkogsholm,项目名称:Magento-Patch,代码行数:40,代码来源:ProductsController.php

示例6: getPdf

 public function getPdf($order = array())
 {
     $this->_beforeGetPdf();
     $this->_initRenderer('invoice');
     $this->pdf = new Zend_Pdf();
     $style = new Zend_Pdf_Style();
     $style->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA_BOLD), 10);
     //cree la nouvelle page
     $titre = mage::helper('purchase')->__('Order #') . $order->getincrement_id() . ' ' . mage::helper('purchase')->__('Comments');
     $settings = array();
     $settings['title'] = $titre;
     $settings['store_id'] = 0;
     $page = $this->NewPage($settings);
     //cartouche
     $txt_date = "Date :  " . mage::helper('core')->formatDate($order->getCreatedAt(), 'long');
     $txt_order = mage::helper('purchase')->__('Order #') . $order->getId();
     //$adresse_fournisseur = Mage::getStoreConfig('sales/identity/address');
     $customer = mage::getmodel('customer/customer')->load($order->getCustomerId());
     $adresse_client = mage::helper('purchase')->__('Shipping Address') . ":\n" . $this->FormatAddress($order->getShippingAddress(), '', false, $customer->gettaxvat());
     $adresse_fournisseur = mage::helper('purchase')->__('Billing Address') . ":\n" . $this->FormatAddress($order->getBillingAddress(), '', false, $customer->gettaxvat());
     $this->AddAddressesBlock($page, $adresse_fournisseur, $adresse_client, $txt_date, $txt_order);
     //Rajoute le carrier et la date d'expe prévue & les commentaires
     $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 10);
     $this->y -= 15;
     $page->drawText(mage::helper('purchase')->__('Shipping') . ' : ' . $order->getShippingDescription(), 15, $this->y, 'UTF-8');
     $this->y -= 15;
     $comments = $this->WrapTextToWidth($page, $order->getmdn_comments(), 550);
     $offset = $this->DrawMultilineText($page, $comments, 15, $this->y, 10, 0.2, 11);
     $this->y -= 10 + $offset;
     $page->drawLine(10, $this->y, $this->_BLOC_ENTETE_LARGEUR, $this->y);
     //affiche l'entete du tableau
     $this->drawTableHeader($page);
     $this->y -= 10;
     //Affiche le récap des produits
     $page->setFillColor(new Zend_Pdf_Color_GrayScale(0.2));
     $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 10);
     foreach ($order->getAllItems() as $item) {
         //recupere le produit
         $product = mage::getModel('catalog/product')->load($item->getproduct_id());
         //dessine
         $page->drawText((int) $item->getqty_ordered(), 15, $this->y, 'UTF-8');
         $page->drawText($product->getSku(), 70, $this->y, 'UTF-8');
         $page->drawText($product->getName(), 200, $this->y, 'UTF-8');
         $page->drawText($item->getreserved_qty(), 560, $this->y, 'UTF-8');
         //rajoute les commentaires
         $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA_ITALIC), 8);
         $this->y -= $this->_ITEM_HEIGHT;
         $caption = $this->WrapTextToWidth($page, $item->getcomments(), 300);
         $offset = $this->DrawMultilineText($page, $caption, 200, $this->y, 10, 0.2, 11);
         $this->y -= $offset;
         //rajoute une ligne de séparation
         $page->setLineWidth(0.5);
         $page->drawLine(10, $this->y - 4, $this->_BLOC_ENTETE_LARGEUR, $this->y - 4);
         $this->y -= $this->_ITEM_HEIGHT;
         //si on a plus la place de rajouter le footer, on change de page
         if ($this->y < $this->_BLOC_FOOTER_HAUTEUR + 40) {
             $this->drawFooter($page);
             $page = $this->NewPage($settings);
             $this->drawTableHeader($page);
         }
     }
     //dessine le pied de page
     $this->drawFooter($page);
     //rajoute la pagination
     $this->AddPagination($this->pdf);
     $this->_afterGetPdf();
     return $this->pdf;
 }
开发者ID:TrygveSkogsholm,项目名称:Magento-Patch,代码行数:68,代码来源:OrderPreparationCommentsPdf.php


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