Version Notes
New functionality : open in new window to sort easily more products
Download this release
Release Info
| Developer | Ilan PARMENTIER |
| Extension | Mageho_Sortproducts |
| Version | 1.1.0 |
| Comparing to | |
| See all releases | |
Code changes from version 1.0.3 to 1.1.0
- app/code/local/Mageho/Sortproducts/Block/Adminhtml/Info.php +7 -4
- app/code/local/Mageho/Sortproducts/Helper/Data.php.LCK +0 -1
- app/code/local/Mageho/Sortproducts/Model/Resource/Position.php +32 -10
- app/code/local/Mageho/Sortproducts/controllers/Adminhtml/Mageho/SortproductsController.php +48 -40
- app/code/local/Mageho/Sortproducts/etc/config.xml +1 -1
- app/code/local/Mageho/Sortproducts/etc/system.xml +13 -6
- app/design/adminhtml/default/default/template/mageho/sortproducts/sortgrid.phtml +65 -40
- package.xml +5 -5
app/code/local/Mageho/Sortproducts/Block/Adminhtml/Info.php
CHANGED
|
@@ -17,11 +17,12 @@ class Mageho_Sortproducts_Block_Adminhtml_Info extends Mage_Adminhtml_Block_Temp
|
|
| 17 |
|
| 18 |
public function getSavePercentage($product)
|
| 19 |
{
|
| 20 |
-
if ($product->
|
| 21 |
-
|
| 22 |
-
return '-' . $save . '%';
|
| 23 |
}
|
| 24 |
-
|
|
|
|
|
|
|
| 25 |
}
|
| 26 |
|
| 27 |
public function getAttributesToShow()
|
|
@@ -41,9 +42,11 @@ class Mageho_Sortproducts_Block_Adminhtml_Info extends Mage_Adminhtml_Block_Temp
|
|
| 41 |
if ($countColumnSettings < 1) {
|
| 42 |
return false;
|
| 43 |
}
|
|
|
|
| 44 |
if ($countColumnSettings == 1 && current($columnSettings) == '') {
|
| 45 |
return false;
|
| 46 |
}
|
|
|
|
| 47 |
return $columnSettings;
|
| 48 |
}
|
| 49 |
|
| 17 |
|
| 18 |
public function getSavePercentage($product)
|
| 19 |
{
|
| 20 |
+
if ($product->getPrice() == $product->getFinalPrice()) {
|
| 21 |
+
return false;
|
|
|
|
| 22 |
}
|
| 23 |
+
|
| 24 |
+
$save = number_format( (100 - ( $product->getFinalPrice() / $product->getPrice() ) * 100) );
|
| 25 |
+
return '-' . $save . '%';
|
| 26 |
}
|
| 27 |
|
| 28 |
public function getAttributesToShow()
|
| 42 |
if ($countColumnSettings < 1) {
|
| 43 |
return false;
|
| 44 |
}
|
| 45 |
+
|
| 46 |
if ($countColumnSettings == 1 && current($columnSettings) == '') {
|
| 47 |
return false;
|
| 48 |
}
|
| 49 |
+
|
| 50 |
return $columnSettings;
|
| 51 |
}
|
| 52 |
|
app/code/local/Mageho/Sortproducts/Helper/Data.php.LCK
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
Ilan Parmentier||ilan.parmentier@artbambou.com
|
|
|
app/code/local/Mageho/Sortproducts/Model/Resource/Position.php
CHANGED
|
@@ -6,8 +6,6 @@
|
|
| 6 |
* @copyright Copyright (c) 2012 Mageho (http://www.mageho.com)
|
| 7 |
* @license http://www.mageho.com/license Proprietary License
|
| 8 |
*/
|
| 9 |
-
|
| 10 |
-
#class Mageho_Sortproducts_Model_Mysql4_Position extends Mage_Catalog_Model_Resource_Eav_Mysql4_Category
|
| 11 |
|
| 12 |
class Mageho_Sortproducts_Model_Resource_Position extends Mage_Catalog_Model_Resource_Category
|
| 13 |
{
|
|
@@ -27,17 +25,41 @@ class Mageho_Sortproducts_Model_Resource_Position extends Mage_Catalog_Model_Res
|
|
| 27 |
$this->_productCategoryTable = $resource->getTableName('catalog/category_product');
|
| 28 |
$this->_productCategoryIndexTable = $resource->getTableName('catalog/category_product_index');
|
| 29 |
}
|
| 30 |
-
|
| 31 |
public function save($position, $productId, $categoryId)
|
| 32 |
{
|
| 33 |
-
$
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
-
$db = $this->_getWriteAdapter();
|
| 39 |
-
$db->update($this->_productCategoryTable, array('position' => $position), $condition);
|
| 40 |
-
$db->update($this->_productCategoryIndexTable, array('position' => $position), $condition);
|
| 41 |
return $this;
|
| 42 |
}
|
| 43 |
}
|
| 6 |
* @copyright Copyright (c) 2012 Mageho (http://www.mageho.com)
|
| 7 |
* @license http://www.mageho.com/license Proprietary License
|
| 8 |
*/
|
|
|
|
|
|
|
| 9 |
|
| 10 |
class Mageho_Sortproducts_Model_Resource_Position extends Mage_Catalog_Model_Resource_Category
|
| 11 |
{
|
| 25 |
$this->_productCategoryTable = $resource->getTableName('catalog/category_product');
|
| 26 |
$this->_productCategoryIndexTable = $resource->getTableName('catalog/category_product_index');
|
| 27 |
}
|
| 28 |
+
|
| 29 |
public function save($position, $productId, $categoryId)
|
| 30 |
{
|
| 31 |
+
$adapter = $this->_getWriteAdapter();
|
| 32 |
+
|
| 33 |
+
$eventParams = array(
|
| 34 |
+
'object' => $this,
|
| 35 |
+
'position' => $position,
|
| 36 |
+
'product_id' => $productId,
|
| 37 |
+
'category_id' => $categoryId
|
| 38 |
+
);
|
| 39 |
+
|
| 40 |
+
$moveComplete = false;
|
| 41 |
+
|
| 42 |
+
$adapter->beginTransaction();
|
| 43 |
+
try {
|
| 44 |
+
$condition = array(
|
| 45 |
+
$adapter->quoteInto("product_id=?", $productId),
|
| 46 |
+
$adapter->quoteInto("category_id=?", $categoryId)
|
| 47 |
+
);
|
| 48 |
+
|
| 49 |
+
$adapter->update($this->_productCategoryTable, array('position' => $position), $condition);
|
| 50 |
+
$adapter->update($this->_productCategoryIndexTable, array('position' => $position), $condition);
|
| 51 |
+
$adapter->commit();
|
| 52 |
+
|
| 53 |
+
$moveComplete = true;
|
| 54 |
+
} catch (Exception $e) {
|
| 55 |
+
$adapter->rollBack();
|
| 56 |
+
Mage::logException($e->getMessage());
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
if ($moveComplete) {
|
| 60 |
+
Mage::dispatchEvent('sortproducts_move', $eventParams);
|
| 61 |
+
}
|
| 62 |
|
|
|
|
|
|
|
|
|
|
| 63 |
return $this;
|
| 64 |
}
|
| 65 |
}
|
app/code/local/Mageho/Sortproducts/controllers/Adminhtml/Mageho/SortproductsController.php
CHANGED
|
@@ -2,9 +2,9 @@
|
|
| 2 |
/*
|
| 3 |
* @category Mageho
|
| 4 |
* @package Mageho_Sortproducts
|
| 5 |
-
* @version
|
| 6 |
* @copyright Copyright (c) 2012 Mageho (http://www.mageho.com)
|
| 7 |
-
* @license
|
| 8 |
*/
|
| 9 |
|
| 10 |
class Mageho_Sortproducts_Adminhtml_Mageho_SortproductsController extends Mage_Adminhtml_Controller_Action
|
|
@@ -25,58 +25,66 @@ class Mageho_Sortproducts_Adminhtml_Mageho_SortproductsController extends Mage_A
|
|
| 25 |
public function infoAction()
|
| 26 |
{
|
| 27 |
$productId = $this->getRequest()->getParam('id', false);
|
| 28 |
-
$product = Mage::getModel('catalog/product')
|
| 29 |
-
->setStoreId($this->getRequest()->getParam('store', 0));
|
| 30 |
-
|
| 31 |
if ($productId) {
|
| 32 |
-
$product
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
}
|
| 41 |
}
|
| 42 |
|
| 43 |
public function saveAction()
|
| 44 |
{
|
| 45 |
$data = $this->getRequest()->getPost('data');
|
|
|
|
| 46 |
$categoryId = $this->getRequest()->getParam('id', false);
|
| 47 |
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
if ($category->getId()) {
|
| 59 |
-
parse_str($data);
|
| 60 |
-
for ($i = 0; $i < count($sortlist); $i++) {
|
| 61 |
-
$position = $i;
|
| 62 |
-
$productId = $sortlist[$i];
|
| 63 |
|
| 64 |
-
|
| 65 |
-
|
|
|
|
|
|
|
| 66 |
|
| 67 |
-
|
|
|
|
| 68 |
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
|
|
|
| 76 |
}
|
| 77 |
|
| 78 |
-
|
| 79 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
}
|
| 81 |
|
| 82 |
/**
|
| 2 |
/*
|
| 3 |
* @category Mageho
|
| 4 |
* @package Mageho_Sortproducts
|
| 5 |
+
* @version 1.0.0
|
| 6 |
* @copyright Copyright (c) 2012 Mageho (http://www.mageho.com)
|
| 7 |
+
* @license http://www.mageho.com/license Proprietary License
|
| 8 |
*/
|
| 9 |
|
| 10 |
class Mageho_Sortproducts_Adminhtml_Mageho_SortproductsController extends Mage_Adminhtml_Controller_Action
|
| 25 |
public function infoAction()
|
| 26 |
{
|
| 27 |
$productId = $this->getRequest()->getParam('id', false);
|
|
|
|
|
|
|
|
|
|
| 28 |
if ($productId) {
|
| 29 |
+
$product = Mage::getModel('catalog/product')
|
| 30 |
+
->setStoreId($this->getRequest()->getParam('store', 0))
|
| 31 |
+
->load($productId);
|
| 32 |
+
|
| 33 |
+
if ($product) {
|
| 34 |
+
Mage::register('product', $product);
|
| 35 |
+
Mage::register('current_product', $product);
|
| 36 |
+
|
| 37 |
+
$this->getResponse()->setBody(
|
| 38 |
+
$this->getLayout()->createBlock('mageho_sortproducts/adminhtml_info')->toHtml()
|
| 39 |
+
);
|
| 40 |
+
}
|
| 41 |
}
|
| 42 |
}
|
| 43 |
|
| 44 |
public function saveAction()
|
| 45 |
{
|
| 46 |
$data = $this->getRequest()->getPost('data');
|
| 47 |
+
$iframe = $this->getRequest()->getPost('iframe');
|
| 48 |
$categoryId = $this->getRequest()->getParam('id', false);
|
| 49 |
|
| 50 |
+
$saved = false;
|
| 51 |
+
|
| 52 |
+
if ($categoryId && ctype_digit($categoryId))
|
| 53 |
+
{
|
| 54 |
+
parse_str($data);
|
| 55 |
+
for ($i = 0; $i < count($sortlist); $i++)
|
| 56 |
+
{
|
| 57 |
+
$position = $i;
|
| 58 |
+
$productId = $sortlist[$i];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
|
| 60 |
+
Mage::getResourceModel('mageho_sortproducts/position')->save($position, $productId, $categoryId);
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
// Disable below because too slow to process
|
| 64 |
|
| 65 |
+
// Delete all cache for all categories
|
| 66 |
+
// Mage::app()->cleanCache(array(Mage_Catalog_Model_Category::CACHE_TAG));
|
| 67 |
|
| 68 |
+
// Delete current category cache
|
| 69 |
+
Mage::app()->cleanCache(array(Mage_Catalog_Model_Category::CACHE_TAG.'_'.$categoryId));
|
| 70 |
+
|
| 71 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
| 72 |
+
Mage::helper('mageho_sortproducts')->__('The position of products has been saved with success.')
|
| 73 |
+
);
|
| 74 |
+
|
| 75 |
+
$saved = true;
|
| 76 |
}
|
| 77 |
|
| 78 |
+
if ($saved)
|
| 79 |
+
{
|
| 80 |
+
if ($iframe == 'true') {
|
| 81 |
+
$resetUrl = Mage::helper('adminhtml')->getUrl('adminhtml/catalog_category/edit', array('active_tab_id' => 'category_info_tabs_sortproducts', '_current' => true));
|
| 82 |
+
$this->getResponse()->setBody("window.top.categoryReset('{$resetUrl}', true);");
|
| 83 |
+
} else {
|
| 84 |
+
$stringLocalSavedPosition = Mage::helper('core')->jsQuoteEscape($this->__('The position of products has been saved with success.'));
|
| 85 |
+
$this->getResponse()->setBody("window.opener.location.reload(true); alert('{$stringLocalSavedPosition}');");
|
| 86 |
+
}
|
| 87 |
+
}
|
| 88 |
}
|
| 89 |
|
| 90 |
/**
|
app/code/local/Mageho/Sortproducts/etc/config.xml
CHANGED
|
@@ -11,7 +11,7 @@
|
|
| 11 |
<config>
|
| 12 |
<modules>
|
| 13 |
<Mageho_Sortproducts>
|
| 14 |
-
<version>1.
|
| 15 |
</Mageho_Sortproducts>
|
| 16 |
</modules>
|
| 17 |
<global>
|
| 11 |
<config>
|
| 12 |
<modules>
|
| 13 |
<Mageho_Sortproducts>
|
| 14 |
+
<version>1.1.0</version>
|
| 15 |
</Mageho_Sortproducts>
|
| 16 |
</modules>
|
| 17 |
<global>
|
app/code/local/Mageho/Sortproducts/etc/system.xml
CHANGED
|
@@ -16,7 +16,7 @@
|
|
| 16 |
<frontend_type>text</frontend_type>
|
| 17 |
<sort_order>45</sort_order>
|
| 18 |
<show_in_default>1</show_in_default>
|
| 19 |
-
<show_in_website>
|
| 20 |
<show_in_store>0</show_in_store>
|
| 21 |
<groups>
|
| 22 |
<general translate="label">
|
|
@@ -31,14 +31,16 @@
|
|
| 31 |
<frontend_type>text</frontend_type>
|
| 32 |
<sort_order>0</sort_order>
|
| 33 |
<show_in_default>1</show_in_default>
|
| 34 |
-
|
|
|
|
| 35 |
</limit_products>
|
| 36 |
<image_width translate="label">
|
| 37 |
<label>Image Width</label>
|
| 38 |
<frontend_type>text</frontend_type>
|
| 39 |
<sort_order>10</sort_order>
|
| 40 |
<show_in_default>1</show_in_default>
|
| 41 |
-
|
|
|
|
| 42 |
</image_width>
|
| 43 |
<show_attributes translate="label">
|
| 44 |
<label>Show Attributes</label>
|
|
@@ -46,21 +48,26 @@
|
|
| 46 |
<source_model>Mageho_Sortproducts_Model_System_Config_Source_Attributes</source_model>
|
| 47 |
<sort_order>20</sort_order>
|
| 48 |
<show_in_default>1</show_in_default>
|
| 49 |
-
|
|
|
|
| 50 |
</show_attributes>
|
| 51 |
<display_only_enabled_products translate="label">
|
| 52 |
<label>Display Only Enabled Products</label>
|
| 53 |
<frontend_type>select</frontend_type>
|
|
|
|
| 54 |
<sort_order>30</sort_order>
|
| 55 |
<show_in_default>1</show_in_default>
|
| 56 |
-
<
|
|
|
|
| 57 |
</display_only_enabled_products>
|
| 58 |
<display_out_stock_products translate="label">
|
| 59 |
<label>Display Out of Stock Products</label>
|
| 60 |
<frontend_type>select</frontend_type>
|
|
|
|
| 61 |
<sort_order>40</sort_order>
|
| 62 |
<show_in_default>1</show_in_default>
|
| 63 |
-
<
|
|
|
|
| 64 |
</display_out_stock_products>
|
| 65 |
</fields>
|
| 66 |
</general>
|
| 16 |
<frontend_type>text</frontend_type>
|
| 17 |
<sort_order>45</sort_order>
|
| 18 |
<show_in_default>1</show_in_default>
|
| 19 |
+
<show_in_website>0</show_in_website>
|
| 20 |
<show_in_store>0</show_in_store>
|
| 21 |
<groups>
|
| 22 |
<general translate="label">
|
| 31 |
<frontend_type>text</frontend_type>
|
| 32 |
<sort_order>0</sort_order>
|
| 33 |
<show_in_default>1</show_in_default>
|
| 34 |
+
<show_in_website>0</show_in_website>
|
| 35 |
+
<show_in_store>0</show_in_store>
|
| 36 |
</limit_products>
|
| 37 |
<image_width translate="label">
|
| 38 |
<label>Image Width</label>
|
| 39 |
<frontend_type>text</frontend_type>
|
| 40 |
<sort_order>10</sort_order>
|
| 41 |
<show_in_default>1</show_in_default>
|
| 42 |
+
<show_in_website>0</show_in_website>
|
| 43 |
+
<show_in_store>0</show_in_store>
|
| 44 |
</image_width>
|
| 45 |
<show_attributes translate="label">
|
| 46 |
<label>Show Attributes</label>
|
| 48 |
<source_model>Mageho_Sortproducts_Model_System_Config_Source_Attributes</source_model>
|
| 49 |
<sort_order>20</sort_order>
|
| 50 |
<show_in_default>1</show_in_default>
|
| 51 |
+
<show_in_website>0</show_in_website>
|
| 52 |
+
<show_in_store>0</show_in_store>
|
| 53 |
</show_attributes>
|
| 54 |
<display_only_enabled_products translate="label">
|
| 55 |
<label>Display Only Enabled Products</label>
|
| 56 |
<frontend_type>select</frontend_type>
|
| 57 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 58 |
<sort_order>30</sort_order>
|
| 59 |
<show_in_default>1</show_in_default>
|
| 60 |
+
<show_in_website>0</show_in_website>
|
| 61 |
+
<show_in_store>0</show_in_store>
|
| 62 |
</display_only_enabled_products>
|
| 63 |
<display_out_stock_products translate="label">
|
| 64 |
<label>Display Out of Stock Products</label>
|
| 65 |
<frontend_type>select</frontend_type>
|
| 66 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 67 |
<sort_order>40</sort_order>
|
| 68 |
<show_in_default>1</show_in_default>
|
| 69 |
+
<show_in_website>0</show_in_website>
|
| 70 |
+
<show_in_store>0</show_in_store>
|
| 71 |
</display_out_stock_products>
|
| 72 |
</fields>
|
| 73 |
</general>
|
app/design/adminhtml/default/default/template/mageho/sortproducts/sortgrid.phtml
CHANGED
|
@@ -8,44 +8,14 @@
|
|
| 8 |
*/
|
| 9 |
?>
|
| 10 |
<?php if (($_products = $this->getProductsCollection()) && $_products->getSize()): ?>
|
| 11 |
-
<script type="text/javascript">
|
| 12 |
-
//<![CDATA[
|
| 13 |
-
document.observe('dom:loaded', function() {
|
| 14 |
-
Sortable.create('sortlist', {
|
| 15 |
-
tag: 'li',
|
| 16 |
-
only: 'sorting',
|
| 17 |
-
hoverclass: 'over',
|
| 18 |
-
overlap: 'horizontal',
|
| 19 |
-
ghosting: false,
|
| 20 |
-
constraint: false,
|
| 21 |
-
scroll: window,
|
| 22 |
-
scrollSensitivity: 30,
|
| 23 |
-
scrollSpeed: 25
|
| 24 |
-
})
|
| 25 |
-
|
| 26 |
-
$$('button.button-save-sortable').each(function(el) {
|
| 27 |
-
el.onclick = function() {
|
| 28 |
-
new Ajax.Request("<?php echo $this->getSaveUrl(); ?>", {
|
| 29 |
-
method: "post",
|
| 30 |
-
evalScripts: true,
|
| 31 |
-
onLoading: function() { parent.$('loading-mask').show() },
|
| 32 |
-
onSuccess: function(transport) { parent.$('loading-mask').hide() },
|
| 33 |
-
onComplete:function(transport) { eval(transport.responseText) },
|
| 34 |
-
parameters: {
|
| 35 |
-
data: Sortable.serialize('sortlist'),
|
| 36 |
-
form_key: '<?php echo $this->getFormKey(); ?>'
|
| 37 |
-
}
|
| 38 |
-
})
|
| 39 |
-
}
|
| 40 |
-
})
|
| 41 |
-
})
|
| 42 |
-
//]]>
|
| 43 |
-
</script>
|
| 44 |
-
|
| 45 |
<div id="messages"></div>
|
| 46 |
-
|
| 47 |
<div class="content-header">
|
| 48 |
-
<div class="content-buttons-placeholder"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
</div>
|
| 50 |
|
| 51 |
<div id="sortlist-wrapper">
|
|
@@ -72,12 +42,67 @@ document.observe('dom:loaded', function() {
|
|
| 72 |
<?php endforeach; ?>
|
| 73 |
</ul>
|
| 74 |
</div>
|
| 75 |
-
|
| 76 |
-
<script type="text/javascript">
|
| 77 |
//<![CDATA[
|
| 78 |
-
|
| 79 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
//]]>
|
| 82 |
</script>
|
| 83 |
<?php endif; ?>
|
| 8 |
*/
|
| 9 |
?>
|
| 10 |
<?php if (($_products = $this->getProductsCollection()) && $_products->getSize()): ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
<div id="messages"></div>
|
|
|
|
| 12 |
<div class="content-header">
|
| 13 |
+
<div class="content-buttons-placeholder">
|
| 14 |
+
<p class="content-buttons form-buttons">
|
| 15 |
+
<button type="button" class="scalable button-open-new-window"><span><?php echo $this->__('Open in New Window'); ?></span></button>
|
| 16 |
+
<button type="button" class="scalable button-save-sortable"><span><?php echo $this->__('Save Products Position'); ?></span></button>
|
| 17 |
+
</p>
|
| 18 |
+
</div>
|
| 19 |
</div>
|
| 20 |
|
| 21 |
<div id="sortlist-wrapper">
|
| 42 |
<?php endforeach; ?>
|
| 43 |
</ul>
|
| 44 |
</div>
|
| 45 |
+
<script>
|
|
|
|
| 46 |
//<![CDATA[
|
| 47 |
+
document.observe('dom:loaded', function() {
|
| 48 |
+
Sortable.create('sortlist', {
|
| 49 |
+
tag: 'li',
|
| 50 |
+
only: 'sorting',
|
| 51 |
+
hoverclass: 'over',
|
| 52 |
+
overlap: 'horizontal',
|
| 53 |
+
ghosting: false,
|
| 54 |
+
constraint: false,
|
| 55 |
+
scroll: window,
|
| 56 |
+
scrollSensitivity: 30,
|
| 57 |
+
scrollSpeed: 25
|
| 58 |
+
})
|
| 59 |
+
|
| 60 |
+
$$('.sorting-image').each(function(image) {
|
| 61 |
+
image.addTip({
|
| 62 |
+
title: image.alt,
|
| 63 |
+
style: 'slick',
|
| 64 |
+
ajax: {
|
| 65 |
+
url: image.readAttribute('longdesc'),
|
| 66 |
+
options: {
|
| 67 |
+
parameters: { form_key: '<?php echo $this->getFormKey(); ?>'}
|
| 68 |
+
}
|
| 69 |
+
}
|
| 70 |
+
});
|
| 71 |
});
|
| 72 |
+
|
| 73 |
+
var $isInIFrame = (window.location !== window.parent.location);
|
| 74 |
+
var $window = $isInIFrame ? parent : self;
|
| 75 |
+
var $buttonSave = $$('button.button-save-sortable')[0];
|
| 76 |
+
var $buttonOpenNewWindow = $$('button.button-open-new-window')[0];
|
| 77 |
+
|
| 78 |
+
if (! $isInIFrame) {
|
| 79 |
+
$buttonOpenNewWindow.hide();
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
$buttonOpenNewWindow.onclick = function () {
|
| 83 |
+
var $win = window.open(window.location.href, '_blank', '');
|
| 84 |
+
$win.focus();
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
$buttonSave.onclick = function() {
|
| 88 |
+
new Ajax.Request("<?php echo $this->getSaveUrl(); ?>", {
|
| 89 |
+
method: "post",
|
| 90 |
+
evalScripts: true,
|
| 91 |
+
onLoading: function() {
|
| 92 |
+
$window.$('loading-mask').show()
|
| 93 |
+
},
|
| 94 |
+
onSuccess: function(transport) {
|
| 95 |
+
$window.$('loading-mask').hide()
|
| 96 |
+
},
|
| 97 |
+
onComplete:function(transport) { eval(transport.responseText) },
|
| 98 |
+
parameters: {
|
| 99 |
+
data: Sortable.serialize('sortlist'),
|
| 100 |
+
iframe: $isInIFrame,
|
| 101 |
+
form_key: '<?php echo $this->getFormKey(); ?>'
|
| 102 |
+
}
|
| 103 |
+
})
|
| 104 |
+
}
|
| 105 |
+
})
|
| 106 |
//]]>
|
| 107 |
</script>
|
| 108 |
<?php endif; ?>
|
package.xml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Mageho_Sortproducts</name>
|
| 4 |
-
<version>1.0
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0 : Open Software License</license>
|
| 7 |
<channel>community</channel>
|
|
@@ -54,11 +54,11 @@
|
|
| 54 |
</ul>
|
| 55 |
</li>
|
| 56 |
</ul></description>
|
| 57 |
-
<notes>
|
| 58 |
<authors><author><name>Ilan PARMENTIER</name><user>Mageho</user><email>ilan.parmentier@mageho.com</email></author></authors>
|
| 59 |
-
<date>2013-
|
| 60 |
-
<time>
|
| 61 |
-
<contents><target name="magelocale"><dir name="fr_FR"><file name="Mageho_Sortproducts.csv" hash="9b45622871c0b6ae37a7f900d2b3783a"/></dir></target><target name="mageetc"><dir name="modules"><file name="Mageho_Sortproducts.xml" hash="777c7b7f72d78e719eda6c2bbe36b690"/></dir></target><target name="magelocal"><dir name="Mageho"><dir name="Sortproducts"><dir name="Block"><dir name="Adminhtml"><file name="Info.php" hash="
|
| 62 |
<compatible/>
|
| 63 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
| 64 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Mageho_Sortproducts</name>
|
| 4 |
+
<version>1.1.0</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0 : Open Software License</license>
|
| 7 |
<channel>community</channel>
|
| 54 |
</ul>
|
| 55 |
</li>
|
| 56 |
</ul></description>
|
| 57 |
+
<notes>New functionality : open in new window to sort easily more products</notes>
|
| 58 |
<authors><author><name>Ilan PARMENTIER</name><user>Mageho</user><email>ilan.parmentier@mageho.com</email></author></authors>
|
| 59 |
+
<date>2013-11-30</date>
|
| 60 |
+
<time>17:17:41</time>
|
| 61 |
+
<contents><target name="magelocale"><dir name="fr_FR"><file name="Mageho_Sortproducts.csv" hash="9b45622871c0b6ae37a7f900d2b3783a"/></dir></target><target name="mageetc"><dir name="modules"><file name="Mageho_Sortproducts.xml" hash="777c7b7f72d78e719eda6c2bbe36b690"/></dir></target><target name="magelocal"><dir name="Mageho"><dir name="Sortproducts"><dir name="Block"><dir name="Adminhtml"><file name="Info.php" hash="43e9c43e118fe04a348e31b7fabdd5ea"/><file name="Sortgrid.php" hash="28867799eb7102ed03f9d2ad7568c010"/><file name="Tab.php" hash="4467d5a3fae44d8f9bf74a6769d2c6a8"/></dir></dir><dir name="Helper"><file name="Data.php" hash="9e24dbfee79b96f5a29692bf132e2ac8"/></dir><dir name="Model"><file name="Observer.php" hash="82f727e0ae154da87afceb6738313945"/><dir name="Resource"><file name="Position.php" hash="55174d013769b6dbae0e3e7c9b9c0fd7"/></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="Attributes.php" hash="c744040d3855d9c821371f0daabdee6f"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Mageho"><file name="SortproductsController.php" hash="a02648b4516c74749469b48f7808e9b7"/></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="732d750e132a184dd0027d49fd4f2de0"/><file name="config.xml" hash="5c3d5132c5257c1081b88f9413f03499"/><file name="system.xml" hash="984e8acbe3c3cac61804abee0bb14513"/></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="mageho"><dir name="sortproducts"><file name="placeholder.jpg" hash="b2b682d28a08a748a73d2cda70ab5a57"/><file name="sortproducts.css" hash="0939b00bf328fcb7f6b7f85e61876a3f"/></dir></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="mageho"><file name="sortproducts.xml" hash="e87237697705cb433ea5705656162b75"/></dir></dir><dir name="template"><dir name="mageho"><dir name="sortproducts"><file name="info.phtml" hash="f03b0609338ad1b69bd90efe64bf4c02"/><file name="sortgrid.phtml" hash="f27eec71118344440fccbc7e3532341f"/><file name="tab.phtml" hash="d55081f3fcbe8ef3d0faba8ec50debe2"/></dir></dir></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="mageho"><dir name="sortproducts"><file name="builder.js" hash="c6321f204481f259724bd6455c0fdded"/><file name="controls.js" hash="03b502fd8ae202eb164b348749392720"/><file name="dragdrop.js" hash="046759400db7a6096376e50110104edd"/><file name="effects.js" hash="0dea24894889a4c537e1a451a35f03ca"/><file name="excanvas.js" hash="9d9cbb230cf8d560faf6f6b0f6b5a7ce"/><file name="loading.gif" hash="505aa41462b8840208e1a7d810eb6f48"/><file name="opentip.css" hash="27c49d652671d27a22d91ba32f22ba42"/><file name="opentip.js" hash="5ed35816281e22b7e8b84ba7fdee9485"/><file name="prototype.js" hash="007ae2fe795811f80cedf92fdb591c1b"/><file name="scriptaculous.js" hash="bb679d586e7fccb154156baaef9dfde5"/><file name="slider.js" hash="a9e58cc5f8dd281daa8d8dfee6a78834"/><file name="sound.js" hash="0b22e4379d79b33b696ee3cccf2827b5"/><file name="unittest.js" hash="07c049c24cb838939925425bb555cdf6"/></dir></dir></dir></target></contents>
|
| 62 |
<compatible/>
|
| 63 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
| 64 |
</package>
|
