Guest User

Untitled

a guest
Jan 13th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. <?php
  2.  
  3. /*
  4. * To change this license header, choose License Headers in Project Properties.
  5. * To change this template file, choose Tools | Templates
  6. * and open the template in the editor.
  7. */
  8.  
  9. /**
  10. * Description of Grid
  11. *
  12. * @author pramod
  13. */
  14.  
  15. namespace CustomSalesBlockAdminhtmlOrderCreateSearch;
  16.  
  17. class Grid extends MagentoSalesBlockAdminhtmlOrderCreateSearchGrid {
  18.  
  19. /**
  20. * Constructor
  21. *
  22. * @return void
  23. */
  24. protected function _construct() {
  25. parent::_construct();
  26. $this->setId('sales_order_create_search_grid');
  27. $this->setRowClickCallback('order.productGridRowClick.bind(order)');
  28. $this->setCheckboxCheckCallback('order.productGridCheckboxCheck.bind(order)');
  29. $this->setRowInitCallback('order.productGridRowInit.bind(order)');
  30. $this->setDefaultSort('entity_id');
  31. $this->setUseAjax(true);
  32. if ($this->getRequest()->getParam('collapse')) {
  33. $this->setIsCollapsed(true);
  34. }
  35. }
  36.  
  37. /**
  38. * Prepare collection to be displayed in the grid
  39. *
  40. * @return $this
  41. */
  42. protected function _prepareCollection() {
  43. $attributes = $this->_catalogConfig->getProductAttributes();
  44. /* @var $collection MagentoCatalogModelResourceModelProductCollection */
  45. $collection = $this->_productFactory->create()->getCollection();
  46. $collection->setStore(
  47. $this->getStore()
  48. )->addAttributeToSelect(
  49. $attributes
  50. )->addAttributeToSelect(
  51. 'sku'
  52. )->addStoreFilter()->addAttributeToFilter(
  53. 'type_id', $this->_salesConfig->getAvailableProductTypes()
  54. )->addAttributeToSelect(
  55. 'gift_message_available'
  56. )->addAttributeToFilter('status', array('eq' => 1));
  57. $this->setCollection($collection);
  58. return $this->setCollection($collection);
  59. }
  60.  
  61. }
Add Comment
Please, Sign In to add comment