Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Easylife_Vendor_Block_Adminhtml_Order_Grid extends Mage_Adminhtml_Block_Widget_Grid {
- public function __construct() {
- parent::__construct();
- $this->setId('orderGrid');
- $this->setDefaultSort('id');
- }
- protected function _prepareCollection() {
- $roleId = Mage::helper('vendor')->getConfig('general', 'vendor_role');
- // $role = Mage::getModel('admin/roles')->load($roleId);
- $current_user = Mage::getSingleton('admin/session')->getUser();
- if ($current_user->getRole()->getRoleId() == $roleId) {
- $productIds = Mage::getModel('catalog/product')->getCollection()
- ->addAttributeToFilter('status', 1)
- ->addAttributeToFilter('vendor', $current_user->getId())->getAllIds();
- $collection = Mage::getResourceModel($this->_getCollectionClass());
- foreach ($collection as $order) {
- foreach ($order->getAllItems() as $item) {
- $productId = $item->getData('product_id');
- if (in_array($productId, $productIds)) {
- Mage::log($order);
- Mage::log($order->getDropShipVendor());
- $orderIds[] = $order->getId();
- break;
- }
- }
- }
- $collection = Mage::getResourceModel($this->_getCollectionClass())
- ->addFieldToFilter('entity_id', array('in' => $orderIds));
- }
- else
- $collection = Mage::getResourceModel($this->_getCollectionClass());
- $this->setCollection($collection);
- return parent::_prepareCollection();
- }
- protected function _getCollectionClass() {
- return 'sales/order_grid_collection';
- }
- protected function _prepareColumns() {
- ......
- return parent::_prepareColumns();
- }
- public function getRowUrl($row) {
- return $this->getUrl('*/*/view', array('order_id' => $row->getId()));
- }
- }
- [item_id] => 57
- [order_id] => 45
- [parent_item_id] =>
- [quote_item_id] => 91
- [store_id] => 1
- [created_at] => 2014-12-18 10:46:07
- [updated_at] => 2014-12-18 10:46:07
- [product_id] => 9
- [product_type] => simple
- [product_options] => a:1:{s:15:"info_buyRequest";a:3:{s:4:"uenc";s:100:"aHR0cDovLzEwLjEwLjEwLjE4NC9tYWdlbnRvbGVhcm5pbmcvaW5kZXgucGhwL2VsZWN0cm9uaWNzL2NlbGwtcGhvbmVzLmh0bWw,";s:7:"product";s:1:"9";s:3:"qty";i:1;}}
- [weight] => 1.0000
- [is_virtual] => 0
- [sku] => 123123
- [name] => Iphone 6s
- [description] =>
- [applied_rule_ids] =>
- [additional_data] =>
- [free_shipping] => 0
- [is_qty_decimal] => 0
- [no_discount] => 0
- [qty_backordered] =>
- [qty_canceled] => 0.0000
- [qty_invoiced] => 0.0000
- [qty_ordered] => 1.0000
- [qty_refunded] => 0.0000
- [qty_shipped] => 0.0000
- [base_cost] =>
- [price] => 30.0000
- [base_price] => 30.0000
- [original_price] => 30.0000
- [base_original_price] => 30.0000
- [tax_percent] => 0.0000
- [tax_amount] => 0.0000
- [base_tax_amount] => 0.0000
- [tax_invoiced] => 0.0000
- [base_tax_invoiced] => 0.0000
- [discount_percent] => 0.0000
- [discount_amount] => 0.0000
- [base_discount_amount] => 0.0000
- [discount_invoiced] => 0.0000
- [base_discount_invoiced] => 0.0000
- [amount_refunded] => 0.0000
- [base_amount_refunded] => 0.0000
- [row_total] => 30.0000
- [base_row_total] => 30.0000
- [row_invoiced] => 0.0000
- [base_row_invoiced] => 0.0000
- [row_weight] => 1.0000
- [base_tax_before_discount] =>
- [tax_before_discount] =>
- [ext_order_item_id] =>
- [locked_do_invoice] =>
- [locked_do_ship] =>
- [price_incl_tax] => 30.0000
- [base_price_incl_tax] => 30.0000
- [row_total_incl_tax] => 30.0000
- [base_row_total_incl_tax] => 30.0000
- [hidden_tax_amount] =>
- [base_hidden_tax_amount] =>
- [hidden_tax_invoiced] =>
- [base_hidden_tax_invoiced] =>
- [hidden_tax_refunded] =>
- [base_hidden_tax_refunded] =>
- [is_nominal] => 0
- [tax_canceled] =>
- [hidden_tax_canceled] =>
- [tax_refunded] =>
- [base_tax_refunded] =>
- [discount_refunded] =>
- [base_discount_refunded] =>
- [gift_message_id] =>
- [gift_message_available] => 0
- [base_weee_tax_applied_amount] => 0.0000
- [base_weee_tax_applied_row_amnt] => 0.0000
- [base_weee_tax_applied_row_amount] => 0.0000
- [weee_tax_applied_amount] => 0.0000
- [weee_tax_applied_row_amount] => 0.0000
- [weee_tax_applied] => a:0:{}
- [weee_tax_disposition] => 0.0000
- [weee_tax_row_disposition] => 0.0000
- [base_weee_tax_disposition] => 0.0000
- [base_weee_tax_row_disposition] => 0.0000
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement