Version Notes
Jakiś opis
Download this release
Release Info
| Developer | Jaroslaw |
| Extension | Centerkom_Fcp |
| Version | 0.2.0 |
| Comparing to | |
| See all releases | |
Version 0.2.0
- app/code/community/Centerkom/Fcp/Block/Adminhtml/Catalog/Product.php +25 -0
- app/code/community/Centerkom/Fcp/Block/Adminhtml/Catalog/Product/Grid.php +13 -0
- app/code/community/Centerkom/Fcp/Block/Adminhtml/Widget/Grid/Column.php +17 -0
- app/code/community/Centerkom/Fcp/Block/Adminhtml/Widget/Grid/Column/Renderer/Inputprice.php +61 -0
- app/code/community/Centerkom/Fcp/controllers/Adminhtml/IndexController.php +41 -0
- app/code/community/Centerkom/Fcp/etc/config.xml +50 -0
- app/etc/modules/Centerkom_Fcp.xml +9 -0
- js/centerkom/fcp.js +18 -0
- package.xml +18 -0
app/code/community/Centerkom/Fcp/Block/Adminhtml/Catalog/Product.php
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class Centerkom_Fcp_Block_Adminhtml_Catalog_Product extends Mage_Adminhtml_Block_Catalog_Product
|
| 3 |
+
{
|
| 4 |
+
/**
|
| 5 |
+
* Prepare button and grid
|
| 6 |
+
*
|
| 7 |
+
* @return Mage_Adminhtml_Block_Catalog_Product
|
| 8 |
+
*/
|
| 9 |
+
protected function _prepareLayout()
|
| 10 |
+
{
|
| 11 |
+
$headBlockJs = $this->getLayout()->getBlock('head');
|
| 12 |
+
$headBlockJs->addJs("centerkom/fcp.js");
|
| 13 |
+
|
| 14 |
+
$this->_addButton('upgrade_price', array(
|
| 15 |
+
'label' => Mage::helper('catalog')->__('Upgrade prices'),
|
| 16 |
+
'onclick' => "updatePrice('".Mage::helper("adminhtml")->getUrl("fcp/adminhtml_index/index/", array('store'=>$this->getRequest()->getParam('store', 0)))."')",
|
| 17 |
+
'class' => 'upgrade_price'
|
| 18 |
+
));
|
| 19 |
+
|
| 20 |
+
$this->setChild('grid', $this->getLayout()->createBlock('adminhtml/catalog_product_grid', 'product.grid'));
|
| 21 |
+
return parent::_prepareLayout();
|
| 22 |
+
}
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
?>
|
app/code/community/Centerkom/Fcp/Block/Adminhtml/Catalog/Product/Grid.php
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class Centerkom_Fcp_Block_Adminhtml_Catalog_Product_Grid extends Mage_Adminhtml_Block_Catalog_Product_Grid
|
| 3 |
+
{
|
| 4 |
+
protected function _prepareColumns()
|
| 5 |
+
{
|
| 6 |
+
parent::_prepareColumns();
|
| 7 |
+
$this->getColumn('price')->setType("inputprice");
|
| 8 |
+
//echo $this->getColumn('price')->getType();
|
| 9 |
+
return $this;
|
| 10 |
+
}
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
?>
|
app/code/community/Centerkom/Fcp/Block/Adminhtml/Widget/Grid/Column.php
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class Centerkom_Fcp_Block_Adminhtml_Widget_Grid_Column extends Mage_Adminhtml_Block_Widget_Grid_Column
|
| 3 |
+
{
|
| 4 |
+
|
| 5 |
+
protected function _getRendererByType()
|
| 6 |
+
{
|
| 7 |
+
switch (strtolower($this->getType())){
|
| 8 |
+
case 'inputprice':
|
| 9 |
+
return 'fcp/adminhtml_widget_grid_column_renderer_inputprice';
|
| 10 |
+
break;
|
| 11 |
+
default:
|
| 12 |
+
return parent::_getRendererByType();
|
| 13 |
+
break;
|
| 14 |
+
}
|
| 15 |
+
}
|
| 16 |
+
}
|
| 17 |
+
?>
|
app/code/community/Centerkom/Fcp/Block/Adminhtml/Widget/Grid/Column/Renderer/Inputprice.php
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* DISCLAIMER
|
| 16 |
+
*
|
| 17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 18 |
+
* versions in the future. If you wish to customize Magento for your
|
| 19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
| 20 |
+
*
|
| 21 |
+
* @category Mage
|
| 22 |
+
* @package Mage_Adminhtml
|
| 23 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
| 24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 25 |
+
*/
|
| 26 |
+
|
| 27 |
+
/**
|
| 28 |
+
* Grid input column renderer
|
| 29 |
+
*
|
| 30 |
+
* @category Mage
|
| 31 |
+
* @package Mage_Adminhtml
|
| 32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
| 33 |
+
*/
|
| 34 |
+
class Centerkom_Fcp_Block_Adminhtml_Widget_Grid_Column_Renderer_Inputprice extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Price
|
| 35 |
+
{
|
| 36 |
+
protected $_values;
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
public function render(Varien_Object $row)
|
| 41 |
+
{
|
| 42 |
+
if ($data = $row->getData($this->getColumn()->getIndex())) {
|
| 43 |
+
$currency_code = $this->_getCurrencyCode($row);
|
| 44 |
+
|
| 45 |
+
if ($currency_code) {
|
| 46 |
+
|
| 47 |
+
$data = floatval($data) * $this->_getRate($row);
|
| 48 |
+
$data = sprintf("%f", $data);
|
| 49 |
+
//$data = Mage::app()->getLocale()->currency($currency_code)->toCurrency($data);
|
| 50 |
+
}
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
$html = '<input type="text" ';
|
| 54 |
+
$html .= 'name="' . $row->getData("sku") . '" ';
|
| 55 |
+
$html .= 'id="' . $this->getColumn()->getId()."_".$row->getData("sku") . '" ';
|
| 56 |
+
$html .= 'value="' . $data . '"';
|
| 57 |
+
$html .= 'class="input-text inputprice' . $this->getColumn()->getInlineCss() . '"/>';
|
| 58 |
+
$html .= "<strong>".$currency_code."</strong>";
|
| 59 |
+
return $html;
|
| 60 |
+
}
|
| 61 |
+
}
|
app/code/community/Centerkom/Fcp/controllers/Adminhtml/IndexController.php
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class Centerkom_Fcp_Adminhtml_IndexController extends Mage_Adminhtml_Controller_Action
|
| 3 |
+
{
|
| 4 |
+
|
| 5 |
+
public function indexAction(){
|
| 6 |
+
try {
|
| 7 |
+
|
| 8 |
+
$postData = Mage::app()->getRequest()->getPost();
|
| 9 |
+
$storeId = $this->getRequest()->getParam('store', 0);
|
| 10 |
+
foreach (json_decode($postData['dane']) as $key=>$val)
|
| 11 |
+
{
|
| 12 |
+
if(!is_numeric($val)) die ("Cena ".$key." musi byc liczba");
|
| 13 |
+
// retrieve product id using sku
|
| 14 |
+
$product_id = Mage::getModel('catalog/product')
|
| 15 |
+
->getIdBySku($key);
|
| 16 |
+
|
| 17 |
+
// call product model and create product object
|
| 18 |
+
$product = Mage::getModel('catalog/product')
|
| 19 |
+
->setStoreId($storeId);
|
| 20 |
+
// Load product using product id
|
| 21 |
+
$product ->load($product_id);
|
| 22 |
+
|
| 23 |
+
$productInfoData = $product->getData();
|
| 24 |
+
$productInfoData['price'] = $val;
|
| 25 |
+
$product->setData($productInfoData);
|
| 26 |
+
|
| 27 |
+
// Save you product with all tier prices
|
| 28 |
+
$product->save();
|
| 29 |
+
}
|
| 30 |
+
$data = array("result"=>"OK");
|
| 31 |
+
|
| 32 |
+
echo Zend_Json::encode($data);
|
| 33 |
+
}
|
| 34 |
+
catch (Exception $e)
|
| 35 |
+
{
|
| 36 |
+
echo $e;
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
}
|
| 40 |
+
}
|
| 41 |
+
?>
|
app/code/community/Centerkom/Fcp/etc/config.xml
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<Centerkom_Fcp><!-- fast change price -->
|
| 5 |
+
<version>0.2.0</version>
|
| 6 |
+
</Centerkom_Fcp>
|
| 7 |
+
</modules>
|
| 8 |
+
<global>
|
| 9 |
+
<blocks>
|
| 10 |
+
<fcp>
|
| 11 |
+
<class>Centerkom_Fcp_Block</class>
|
| 12 |
+
</fcp>
|
| 13 |
+
<adminhtml>
|
| 14 |
+
<rewrite>
|
| 15 |
+
<catalog_product>Centerkom_Fcp_Block_Adminhtml_Catalog_Product</catalog_product>
|
| 16 |
+
<catalog_product_grid>Centerkom_Fcp_Block_Adminhtml_Catalog_Product_Grid</catalog_product_grid>
|
| 17 |
+
<widget_grid_column>Centerkom_Fcp_Block_Adminhtml_Widget_Grid_Column</widget_grid_column>
|
| 18 |
+
</rewrite>
|
| 19 |
+
</adminhtml>
|
| 20 |
+
</blocks>
|
| 21 |
+
</global>
|
| 22 |
+
<admin>
|
| 23 |
+
<routers>
|
| 24 |
+
<fcp>
|
| 25 |
+
<use>admin</use>
|
| 26 |
+
<args>
|
| 27 |
+
<module>Centerkom_Fcp</module>
|
| 28 |
+
<frontName>fcp</frontName>
|
| 29 |
+
</args>
|
| 30 |
+
</fcp>
|
| 31 |
+
</routers>
|
| 32 |
+
</admin>
|
| 33 |
+
<adminhtml>
|
| 34 |
+
<acl>
|
| 35 |
+
<resources>
|
| 36 |
+
<admin>
|
| 37 |
+
<children>
|
| 38 |
+
<system>
|
| 39 |
+
<children>
|
| 40 |
+
<fcp_adminform>
|
| 41 |
+
<title>Fast change price</title>
|
| 42 |
+
</fcp_adminform>
|
| 43 |
+
</children>
|
| 44 |
+
</system>
|
| 45 |
+
</children>
|
| 46 |
+
</admin>
|
| 47 |
+
</resources>
|
| 48 |
+
</acl>
|
| 49 |
+
</adminhtml>
|
| 50 |
+
</config>
|
app/etc/modules/Centerkom_Fcp.xml
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<Centerkom_Fcp>
|
| 5 |
+
<active>true</active>
|
| 6 |
+
<codePool>community</codePool>
|
| 7 |
+
</Centerkom_Fcp>
|
| 8 |
+
</modules>
|
| 9 |
+
</config>
|
js/centerkom/fcp.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
function updatePrice(url)
|
| 2 |
+
{
|
| 3 |
+
var data = {};
|
| 4 |
+
$$(".inputprice").each(function(elmt)
|
| 5 |
+
{
|
| 6 |
+
data[elmt.name] =elmt.value;
|
| 7 |
+
});
|
| 8 |
+
new Ajax.Request(url, {
|
| 9 |
+
method: 'post',
|
| 10 |
+
parameters: {'dane' : Object.toJSON(data)},
|
| 11 |
+
onSuccess: function(transport) {
|
| 12 |
+
var jsondata=eval("("+transport.responseText+")") //retrieve result as an JavaScript object
|
| 13 |
+
var result=jsondata.result
|
| 14 |
+
if (result != "OK")
|
| 15 |
+
alert('Error : '+result);
|
| 16 |
+
}
|
| 17 |
+
});
|
| 18 |
+
}
|
package.xml
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<package>
|
| 3 |
+
<name>Centerkom_Fcp</name>
|
| 4 |
+
<version>0.2.0</version>
|
| 5 |
+
<stability>stable</stability>
|
| 6 |
+
<license uri="http://www.opensource.org/licenses/gpl-license.php">GPL</license>
|
| 7 |
+
<channel>community</channel>
|
| 8 |
+
<extends/>
|
| 9 |
+
<summary>jakis opis</summary>
|
| 10 |
+
<description>jakis opis</description>
|
| 11 |
+
<notes>Jakiś opis</notes>
|
| 12 |
+
<authors><author><name>Jaroslaw</name><user>Herisz</user><email>jarek@herisz.pl</email></author></authors>
|
| 13 |
+
<date>2012-10-12</date>
|
| 14 |
+
<time>09:07:53</time>
|
| 15 |
+
<contents><target name="magecommunity"><dir name="Centerkom"><dir name="Fcp"><dir name="Block"><dir name="Adminhtml"><dir name="Catalog"><dir name="Product"><file name="Grid.php" hash="ce1cf098215c59059a6e95d2798bea68"/></dir><file name="Product.php" hash="8eb1552bdb5684fa1f0458b8820fab4d"/></dir><dir name="Widget"><dir name="Grid"><dir name="Column"><dir name="Renderer"><file name="Inputprice.php" hash="0cfe2c57cd6d69381ec6c3910ebc8854"/></dir></dir><file name="Column.php" hash="30e6110d9af1bd9087fd704f5a774df2"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="IndexController.php" hash="16013719a1e41d891d065b871069a91e"/></dir></dir><dir name="etc"><file name="config.xml" hash="1f7310406864baeef86cd85e99a3e280"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Centerkom_Fcp.xml" hash="c47ab4314826c32b7590bc35fd96d819"/></dir></target><target name="mageweb"><dir name="js"><dir name="centerkom"><file name="fcp.js" hash="73a4b77886ce80cbadcf7cdc2e42a4a0"/></dir></dir></target></contents>
|
| 16 |
+
<compatible/>
|
| 17 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0.</max></php></required></dependencies>
|
| 18 |
+
</package>
|
