Mage_Adminhtml_Block_Sales_Order_Create_Items_Grid Class Reference

Inheritance diagram for Mage_Adminhtml_Block_Sales_Order_Create_Items_Grid:

Mage_Adminhtml_Block_Sales_Order_Create_Abstract Mage_Adminhtml_Block_Widget Mage_Adminhtml_Block_Template Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object

List of all members.

Public Member Functions

 __construct ()
 getItems ()
 getSession ()
 getItemEditablePrice ($item)
 getOriginalEditablePrice ($item)
 getItemOrigPrice ($item)
 isGiftMessagesAvailable ($item=null)
 isAllowedForGiftMessage ($item)
 getSubtotal ()
 getSubtotalWithDiscount ()
 getDiscountAmount ()
 usedCustomPriceForItem ($item)
 getQtyTitle ($item)
 getTierHtml ($item)
 getCustomOptions (Mage_Sales_Model_Quote_Item $item)
 getMoveToCustomerStorage ()
 displaySubtotalInclTax ($item)
 displayOriginalPriceInclTax ($item)
 displayRowTotalWithDiscountInclTax ($item)
 getInclExclTaxMessage ()
 getStore ()

Protected Attributes

 $_moveToCustomerStorage = true


Detailed Description

Definition at line 34 of file Grid.php.


Constructor & Destructor Documentation

__construct (  ) 

Constructor

By default is looking for first argument as array and assignes it as object attributes This behaviour may change in child classes

Reimplemented from Varien_Object.

Definition at line 43 of file Grid.php.

00044     {
00045         parent::__construct();
00046         $this->setId('sales_order_create_search_grid');
00047     }


Member Function Documentation

displayOriginalPriceInclTax ( item  ) 

Definition at line 212 of file Grid.php.

00213     {
00214         $tax = 0;
00215         if ($item->getTaxPercent()) {
00216             $tax = $item->getPrice()*($item->getTaxPercent()/100);
00217         }
00218         return $this->convertPrice($item->getPrice()+($tax/$item->getQty()));
00219     }

displayRowTotalWithDiscountInclTax ( item  ) 

Definition at line 221 of file Grid.php.

00222     {
00223         $tax = ($item->getTaxAmount() ? $item->getTaxAmount() : 0);
00224         return $this->formatPrice($item->getRowTotalWithDiscount()+$tax);
00225     }

displaySubtotalInclTax ( item  ) 

Definition at line 206 of file Grid.php.

00207     {
00208         $tax = ($item->getTaxBeforeDiscount() ? $item->getTaxBeforeDiscount() : ($item->getTaxAmount() ? $item->getTaxAmount() : 0));
00209         return $this->formatPrice($item->getRowTotal()+$tax);
00210     }

getCustomOptions ( Mage_Sales_Model_Quote_Item item  ) 

Get Custom Options of item

Parameters:
Mage_Sales_Model_Quote_Item $item
Returns:
array

Definition at line 172 of file Grid.php.

00173     {
00174         $optionStr = '';
00175         $this->_moveToCustomerStorage = true;
00176         if ($optionIds = $item->getOptionByCode('option_ids')) {
00177             foreach (explode(',', $optionIds->getValue()) as $optionId) {
00178                 if ($option = $item->getProduct()->getOptionById($optionId)) {
00179                     $optionValue = $item->getOptionByCode('option_' . $option->getId())->getValue();
00180 
00181                     $optionStr .= $option->getTitle() . ':';
00182 
00183                     $quoteItemOption = $item->getOptionByCode('option_' . $option->getId());
00184                     $group = $option->groupFactory($option->getType())
00185                         ->setOption($option)
00186                         ->setQuoteItemOption($quoteItemOption);
00187 
00188                     $optionStr .= $group->getEditableOptionValue($quoteItemOption->getValue());
00189                     $optionStr .= "\n";
00190                 }
00191             }
00192         }
00193         return $optionStr;
00194     }

getDiscountAmount (  ) 

Definition at line 126 of file Grid.php.

00127     {
00128         return $this->getQuote()->getShippingAddress()->getDiscountAmount();
00129     }

getInclExclTaxMessage (  ) 

Definition at line 227 of file Grid.php.

00228     {
00229         if (Mage::helper('tax')->priceIncludesTax($this->getStore())) {
00230             return Mage::helper('sales')->__('* - Enter custom price including tax');
00231         } else {
00232             return Mage::helper('sales')->__('* - Enter custom price excluding tax');
00233         }
00234     }

getItemEditablePrice ( item  ) 

Definition at line 70 of file Grid.php.

00071     {
00072         return $item->getCalculationPrice()*1;
00073     }

getItemOrigPrice ( item  ) 

Definition at line 88 of file Grid.php.

00089     {
00090 //        return $this->convertPrice($item->getProduct()->getPrice());
00091         return $this->convertPrice($item->getPrice());
00092     }

getItems (  ) 

Definition at line 49 of file Grid.php.

00050     {
00051         $items = $this->getParentBlock()->getItems();
00052         foreach ($items as $item) {
00053             $stockItem = $item->getProduct()->getStockItem();
00054             $check = $stockItem->checkQuoteItemQty($item->getQty(), $item->getQty(), $item->getQty());
00055             $item->setMessage($check->getMessage());
00056             $item->setHasError($check->getHasError());
00057             if ($item->getProduct()->getStatus() == Mage_Catalog_Model_Product_Status::STATUS_DISABLED) {
00058                 $item->setMessage(Mage::helper('adminhtml')->__('This product is currently disabled'));
00059                 $item->setHasError(true);
00060             }
00061         }
00062         return $items;
00063     }

getMoveToCustomerStorage (  ) 

Get flag for rights to move items to customer storage

Returns:
bool

Definition at line 201 of file Grid.php.

00202     {
00203         return $this->_moveToCustomerStorage;
00204     }

getOriginalEditablePrice ( item  ) 

Definition at line 75 of file Grid.php.

00076     {
00077         if ($item->hasOriginalCustomPrice()) {
00078             return $item->getOriginalCustomPrice()*1;
00079         } else {
00080             $result = $item->getCalculationPrice()*1;
00081             if (Mage::helper('tax')->priceIncludesTax($this->getStore()) && $item->getTaxPercent()) {
00082                 $result = $result + ($result*($item->getTaxPercent()/100));
00083             }
00084             return $result;
00085         }
00086     }

getQtyTitle ( item  ) 

Definition at line 136 of file Grid.php.

00137     {
00138         if ($prices = $item->getProduct()->getTierPrice()) {
00139             $info = array();
00140             foreach ($prices as $data) {
00141                 $qty    = $data['price_qty']*1;
00142                 $price  = $this->convertPrice($data['price']);
00143                 $info[] = $this->helper('sales')->__('Buy %s for price %s', $qty, $price);
00144             }
00145             return implode(', ', $info);
00146         }
00147         else {
00148             return $this->helper('sales')->__('Item ordered qty');
00149         }
00150     }

getSession (  ) 

Definition at line 65 of file Grid.php.

00066     {
00067         return $this->getParentBlock()->getSession();
00068     }

getStore (  ) 

Retrieve store model object

Returns:
Mage_Core_Model_Store

Reimplemented from Mage_Adminhtml_Block_Sales_Order_Create_Abstract.

Definition at line 236 of file Grid.php.

00237     {
00238         return $this->getQuote()->getStore();
00239     }

getSubtotal (  ) 

Definition at line 112 of file Grid.php.

00113     {
00114         $totals = $this->getQuote()->getTotals();
00115         if (isset($totals['subtotal'])) {
00116             return $totals['subtotal']->getValue();
00117         }
00118         return false;
00119     }

getSubtotalWithDiscount (  ) 

Definition at line 121 of file Grid.php.

00122     {
00123         return $this->getQuote()->getShippingAddress()->getSubtotalWithDiscount();
00124     }

getTierHtml ( item  ) 

Definition at line 152 of file Grid.php.

00153     {
00154         $html = '';
00155         if ($prices = $item->getProduct()->getTierPrice()) {
00156             foreach ($prices as $data) {
00157                 $qty    = $data['price_qty']*1;
00158                 $price  = $this->convertPrice($data['price']);
00159                 $info[] = $this->helper('sales')->__('%s for %s', $qty, $price);
00160             }
00161             $html = implode('<br/>', $info);
00162         }
00163         return $html;
00164     }

isAllowedForGiftMessage ( item  ) 

Definition at line 107 of file Grid.php.

00108     {
00109         return Mage::getSingleton('adminhtml/giftmessage_save')->getIsAllowedQuoteItem($item);
00110     }

isGiftMessagesAvailable ( item = null  ) 

Definition at line 94 of file Grid.php.

00095     {
00096         if(is_null($item)) {
00097             return $this->helper('giftmessage/message')->getIsMessagesAvailable(
00098                 'items', $this->getQuote(), $this->getStore()
00099             );
00100         }
00101 
00102         return $this->helper('giftmessage/message')->getIsMessagesAvailable(
00103             'item', $item, $this->getStore()
00104         );
00105     }

usedCustomPriceForItem ( item  ) 

Definition at line 131 of file Grid.php.

00132     {
00133         return $item->hasCustomPrice();
00134     }


Member Data Documentation

$_moveToCustomerStorage = true [protected]

Definition at line 41 of file Grid.php.


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:22:59 2009 for Magento by  doxygen 1.5.8