diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tab/Product.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tab/Product.php
index 737c1b09b18..77aa89f61a8 100644
--- a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tab/Product.php
+++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tab/Product.php
@@ -71,11 +71,11 @@ protected function _prepareCollection()
if ($this->getCategory()->getId()) {
$this->setDefaultFilter(['in_category' => 1]);
}
+
+ $store = (int) $this->getRequest()->getParam('store', 0);
$collection = Mage::getModel('catalog/product')->getCollection()
- ->addAttributeToSelect('name')
- ->addAttributeToSelect('sku')
+ ->addStoreFilter($store)
->addAttributeToSelect('price')
- ->addStoreFilter($this->getRequest()->getParam('store'))
->joinField(
'position',
'catalog/category_product',
@@ -83,7 +83,12 @@ protected function _prepareCollection()
'product_id=entity_id',
'category_id=' . (int) $this->getRequest()->getParam('id', 0),
'left'
- );
+ )
+ ->joinAttribute('name', 'catalog_product/name', 'entity_id', null, 'left', $store)
+ ->joinAttribute('price', 'catalog_product/price', 'entity_id', null, 'left', $store)
+ ->joinAttribute('status', 'catalog_product/status', 'entity_id', null, 'left', $store)
+ ->joinAttribute('visibility', 'catalog_product/visibility', 'entity_id', null, 'left', $store);
+
$this->setCollection($collection);
if ($this->getCategory()->getProductsReadonly()) {
@@ -113,28 +118,49 @@ protected function _prepareColumns()
'index' => 'entity_id'
]);
}
+
$this->addColumn('entity_id', [
'header' => Mage::helper('catalog')->__('ID'),
'sortable' => true,
'width' => '60',
'index' => 'entity_id'
]);
+
$this->addColumn('name', [
'header' => Mage::helper('catalog')->__('Name'),
'index' => 'name'
]);
+
$this->addColumn('sku', [
'header' => Mage::helper('catalog')->__('SKU'),
'width' => '80',
'index' => 'sku'
]);
+
$this->addColumn('price', [
'header' => Mage::helper('catalog')->__('Price'),
- 'type' => 'currency',
+ 'type' => 'currency',
'width' => '1',
'currency_code' => (string) Mage::getStoreConfig(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_BASE),
'index' => 'price'
]);
+
+ $this->addColumn('visibility', [
+ 'header' => Mage::helper('catalog')->__('Visibility'),
+ 'width' => '70',
+ 'index' => 'visibility',
+ 'type' => 'options',
+ 'options' => Mage::getModel('catalog/product_visibility')->getOptionArray()
+ ]);
+
+ $this->addColumn('status', [
+ 'header' => Mage::helper('catalog')->__('Status'),
+ 'width' => '70',
+ 'index' => 'status',
+ 'type' => 'options',
+ 'options' => Mage::getSingleton('catalog/product_status')->getOptionArray()
+ ]);
+
$this->addColumn('position', [
'header' => Mage::helper('catalog')->__('Position'),
'width' => '1',
@@ -144,15 +170,43 @@ protected function _prepareColumns()
//'renderer' => 'adminhtml/widget_grid_column_renderer_input'
]);
+ $this->addColumn('action', [
+ 'header' => Mage::helper('catalog')->__('Action'),
+ 'type' => 'action',
+ 'getter' => 'getId',
+ 'actions' => [
+ [
+ 'caption' => Mage::helper('catalog')->__('Edit'),
+ 'url' => [
+ 'base' => '*/catalog_product/edit',
+ 'params' => [
+ 'store' => (int) $this->getRequest()->getParam('store', 0),
+ 'popup' => 1,
+ 'popin' => 0
+ ]
+ ],
+ 'field' => 'id',
+ 'onclick' => 'superProduct = new Product.EditWin('.$this->getJsObjectName().'); superProduct.createPopup(this.href); superProduct.links = '.$this->getJsObjectProductsName().'; return false;'
+ ]
+ ],
+ 'filter' => false,
+ 'sortable' => false
+ ]);
+
return parent::_prepareColumns();
}
+ public function getJsObjectProductsName()
+ {
+ return 'categoryProducts';
+ }
+
/**
* @return string
*/
public function getGridUrl()
{
- return $this->getUrl('*/*/grid', ['_current' => true]);
+ return $this->getUrl('*/*/grid', ['_current' => true, 'store' => (int) $this->getRequest()->getParam('store', 0)]);
}
/**
@@ -161,8 +215,8 @@ public function getGridUrl()
*/
protected function _getSelectedProducts()
{
- $products = $this->getRequest()->getPost('selected_products');
- if (is_null($products)) {
+ $products = $this->getProductsCategory();
+ if (!is_array($products)) {
$products = $this->getCategory()->getProductsPosition();
return array_keys($products);
}
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit.php
index 1fcdd0312db..5072f68679f 100644
--- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit.php
+++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit.php
@@ -50,9 +50,19 @@ protected function _prepareLayout()
'back_button',
$this->getLayout()->createBlock('adminhtml/widget_button')
->setData([
- 'label' => Mage::helper('catalog')->__('Back'),
- 'onclick' => Mage::helper('core/js')->getSetLocationJs($this->getUrl('*/*/', ['store' => $this->getRequest()->getParam('store', 0)])),
- 'class' => 'back'
+ 'label' => Mage::helper('catalog')->__('Back'),
+ 'onclick' => Mage::helper('core/js')->getSetLocationJs($this->getUrl('*/*/', ['store' => $this->getRequest()->getParam('store', 0)])),
+ 'class' => 'back'
+ ])
+ );
+ } elseif (!$this->getRequest()->getParam('popin')) {
+ $this->setChild(
+ 'back_button',
+ $this->getLayout()->createBlock('adminhtml/widget_button')
+ ->setData([
+ 'label' => Mage::helper('catalog')->__('Close Window'),
+ 'onclick' => 'window.close()',
+ 'class' => 'cancel'
])
);
} else {
@@ -60,9 +70,9 @@ protected function _prepareLayout()
'back_button',
$this->getLayout()->createBlock('adminhtml/widget_button')
->setData([
- 'label' => Mage::helper('catalog')->__('Close Window'),
- 'onclick' => 'window.close()',
- 'class' => 'cancel'
+ 'label' => Mage::helper('catalog')->__('Close Window'),
+ 'onclick' => 'window.parent.superProduct.closePopup()',
+ 'class' => 'cancel'
])
);
}
@@ -72,8 +82,8 @@ protected function _prepareLayout()
'reset_button',
$this->getLayout()->createBlock('adminhtml/widget_button')
->setData([
- 'label' => Mage::helper('catalog')->__('Reset'),
- 'onclick' => Mage::helper('core/js')->getSetLocationJs($this->getUrl('*/*/*', ['_current' => true]))
+ 'label' => Mage::helper('catalog')->__('Reset'),
+ 'onclick' => Mage::helper('core/js')->getSetLocationJs($this->getUrl('*/*/*', ['_current' => true]))
])
);
@@ -81,9 +91,9 @@ protected function _prepareLayout()
'save_button',
$this->getLayout()->createBlock('adminhtml/widget_button')
->setData([
- 'label' => Mage::helper('catalog')->__('Save'),
- 'onclick' => 'productForm.submit()',
- 'class' => 'save'
+ 'label' => Mage::helper('catalog')->__('Save'),
+ 'onclick' => 'productForm.submit()',
+ 'class' => 'save'
])
);
}
@@ -94,9 +104,9 @@ protected function _prepareLayout()
'save_and_edit_button',
$this->getLayout()->createBlock('adminhtml/widget_button')
->setData([
- 'label' => Mage::helper('catalog')->__('Save and Continue Edit'),
- 'onclick' => Mage::helper('core/js')->getSaveAndContinueEditJs($this->getSaveAndContinueUrl()),
- 'class' => 'save'
+ 'label' => Mage::helper('catalog')->__('Save and Continue Edit'),
+ 'onclick' => Mage::helper('core/js')->getSaveAndContinueEditJs($this->getSaveAndContinueUrl()),
+ 'class' => 'save'
])
);
}
@@ -105,9 +115,9 @@ protected function _prepareLayout()
'delete_button',
$this->getLayout()->createBlock('adminhtml/widget_button')
->setData([
- 'label' => Mage::helper('catalog')->__('Delete'),
- 'onclick' => Mage::helper('core/js')->getConfirmSetLocationJs($this->getDeleteUrl()),
- 'class' => 'delete'
+ 'label' => Mage::helper('catalog')->__('Delete'),
+ 'onclick' => Mage::helper('core/js')->getConfirmSetLocationJs($this->getDeleteUrl()),
+ 'class' => 'delete'
])
);
}
@@ -117,9 +127,9 @@ protected function _prepareLayout()
'duplicate_button',
$this->getLayout()->createBlock('adminhtml/widget_button')
->setData([
- 'label' => Mage::helper('catalog')->__('Duplicate'),
- 'onclick' => Mage::helper('core/js')->getSetLocationJs($this->getDuplicateUrl()),
- 'class' => 'add'
+ 'label' => Mage::helper('catalog')->__('Duplicate'),
+ 'onclick' => Mage::helper('core/js')->getSetLocationJs($this->getDuplicateUrl()),
+ 'class' => 'add'
])
);
}
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Grid.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Grid.php
index 7de092f453c..2505d113561 100644
--- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Grid.php
+++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Grid.php
@@ -260,13 +260,13 @@ protected function _prepareColumns()
[
'header' => Mage::helper('catalog')->__('Action'),
'type' => 'action',
- 'getter' => 'getId',
+ 'getter' => 'getId',
'actions' => [
[
'caption' => Mage::helper('catalog')->__('Edit'),
'url' => $this->getEditParamsForAssociated(),
'field' => 'id',
- 'onclick' => 'superProduct.createPopup(this.href);return false;'
+ 'onclick' => 'superProduct.createPopup(this.href);return false;'
]
],
'filter' => false,
@@ -283,10 +283,12 @@ protected function _prepareColumns()
public function getEditParamsForAssociated()
{
return [
- 'base' => '*/*/edit',
- 'params' => [
+ 'base' => '*/*/edit',
+ 'params' => [
'required' => $this->_getRequiredAttributesIds(),
+ 'store' => (int) $this->getRequest()->getParam('store', 0),
'popup' => 1,
+ 'popin' => 0,
'product' => $this->_getProduct()->getId()
]
];
diff --git a/app/code/core/Mage/Adminhtml/controllers/Catalog/CategoryController.php b/app/code/core/Mage/Adminhtml/controllers/Catalog/CategoryController.php
index bd52b347e44..41900b2c796 100644
--- a/app/code/core/Mage/Adminhtml/controllers/Catalog/CategoryController.php
+++ b/app/code/core/Mage/Adminhtml/controllers/Catalog/CategoryController.php
@@ -101,7 +101,7 @@ public function editAction()
$_prevStoreId = Mage::getSingleton('admin/session')
->getLastViewedStore(true);
- if (!empty($_prevStoreId) && !$this->getRequest()->getQuery('isAjax')) {
+ if (is_numeric($_prevStoreId) && !$this->getRequest()->getQuery('isAjax')) {
$params['store'] = $_prevStoreId;
$redirect = true;
}
@@ -164,7 +164,7 @@ public function editAction()
}
Mage::getSingleton('admin/session')
- ->setLastViewedStore($this->getRequest()->getParam('store'));
+ ->setLastViewedStore($storeId);
Mage::getSingleton('admin/session')
->setLastEditedCategory($category->getId());
$this->loadLayout();
@@ -423,6 +423,7 @@ public function gridAction()
}
$this->getResponse()->setBody(
$this->getLayout()->createBlock('adminhtml/catalog_category_tab_product', 'category.product.grid')
+ ->setProductsCategory($this->getRequest()->getPost('selected_products', []))
->toHtml()
);
}
diff --git a/app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php b/app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php
index 58e5634d4f1..f2702caa75e 100644
--- a/app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php
+++ b/app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php
@@ -281,6 +281,14 @@ public function editAction()
$block->setStoreId($product->getStoreId());
}
+ if ($this->getRequest()->getParam('popin')) {
+ /** @var Mage_Adminhtml_Block_Page $root */
+ $root = $this->getLayout()->getBlock('root');
+ if ($root) {
+ $root->addBodyClass('popup-nohead-nofoot');
+ }
+ }
+
$this->renderLayout();
}
diff --git a/app/design/adminhtml/default/default/template/catalog/category/edit.phtml b/app/design/adminhtml/default/default/template/catalog/category/edit.phtml
index 560b7c20913..dd8da604631 100644
--- a/app/design/adminhtml/default/default/template/catalog/category/edit.phtml
+++ b/app/design/adminhtml/default/default/template/catalog/category/edit.phtml
@@ -25,23 +25,25 @@