Version Notes
First Release
Download this release
Release Info
Developer | E-Commerce Web Design |
Extension | Creare_Optimised_Product_Addition |
Version | 0.1.0 |
Comparing to | |
See all releases |
Version 0.1.0
- app/code/local/Creare/Opa/controllers/AjaxController.php +19 -0
- app/code/local/Creare/Opa/etc/config.xml +54 -0
- app/design/adminhtml/default/default/layout/opa.xml +21 -0
- app/design/adminhtml/default/default/template/opa/opa.phtml +9 -0
- app/etc/modules/Creare_Opa.xml +17 -0
- js/opa/optimisedproductaddition.js +48 -0
- package.xml +20 -0
app/code/local/Creare/Opa/controllers/AjaxController.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Creare_Opa_AjaxController extends Mage_Core_Controller_Front_Action
|
4 |
+
{
|
5 |
+
|
6 |
+
public function indexAction()
|
7 |
+
{
|
8 |
+
$dbread = Mage::getSingleton('core/resource')->getConnection('core_read');
|
9 |
+
$sql = $dbread->query("SELECT * FROM catalog_product_entity WHERE attribute_set_id != '10' AND sku != '' ORDER BY CAST(sku AS SIGNED) DESC");
|
10 |
+
$res = $sql->fetch();
|
11 |
+
|
12 |
+
if(empty($res["sku"])){
|
13 |
+
$res["sku"] = "";
|
14 |
+
}
|
15 |
+
|
16 |
+
echo $res["sku"];
|
17 |
+
}
|
18 |
+
|
19 |
+
}
|
app/code/local/Creare/Opa/etc/config.xml
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category Creare
|
5 |
+
* @package Creare_Opa
|
6 |
+
* @author ModuleCreator
|
7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
<config>
|
11 |
+
<modules>
|
12 |
+
<Creare_Opa>
|
13 |
+
<version>0.1.0</version>
|
14 |
+
</Creare_Opa>
|
15 |
+
</modules>
|
16 |
+
<frontend>
|
17 |
+
<routers>
|
18 |
+
<opa>
|
19 |
+
<use>standard</use>
|
20 |
+
<args>
|
21 |
+
<module>Creare_Opa</module>
|
22 |
+
<frontName>opa</frontName>
|
23 |
+
</args>
|
24 |
+
</opa>
|
25 |
+
</routers>
|
26 |
+
<layout>
|
27 |
+
<updates>
|
28 |
+
<opa>
|
29 |
+
<file>opa.xml</file>
|
30 |
+
</opa>
|
31 |
+
</updates>
|
32 |
+
</layout>
|
33 |
+
</frontend>
|
34 |
+
<admin>
|
35 |
+
<routers>
|
36 |
+
<opa>
|
37 |
+
<use>admin</use>
|
38 |
+
<args>
|
39 |
+
<module>Creare_Opa</module>
|
40 |
+
<frontName>opa</frontName>
|
41 |
+
</args>
|
42 |
+
</opa>
|
43 |
+
</routers>
|
44 |
+
</admin>
|
45 |
+
<adminhtml>
|
46 |
+
<layout>
|
47 |
+
<updates>
|
48 |
+
<opa>
|
49 |
+
<file>opa.xml</file>
|
50 |
+
</opa>
|
51 |
+
</updates>
|
52 |
+
</layout>
|
53 |
+
</adminhtml>
|
54 |
+
</config>
|
app/design/adminhtml/default/default/layout/opa.xml
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<adminhtml_catalog_product_new>
|
4 |
+
<reference name="head">
|
5 |
+
<action method="addJs"><script>opa/optimisedproductaddition.js</script></action>
|
6 |
+
</reference>
|
7 |
+
<reference name="content">
|
8 |
+
<block type="core/template" name="opa" template="opa/opa.phtml"/>
|
9 |
+
</reference>
|
10 |
+
</adminhtml_catalog_product_new>
|
11 |
+
|
12 |
+
<adminhtml_catalog_product_edit>
|
13 |
+
<reference name="head">
|
14 |
+
<action method="addJs"><script>opa/optimisedproductaddition.js</script></action>
|
15 |
+
</reference>
|
16 |
+
<reference name="content">
|
17 |
+
<block type="core/template" name="opa" template="opa/opa.phtml"/>
|
18 |
+
</reference>
|
19 |
+
</adminhtml_catalog_product_edit>
|
20 |
+
|
21 |
+
</layout>
|
app/design/adminhtml/default/default/template/opa/opa.phtml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
|
2 |
+
<script type="text/javascript">
|
3 |
+
var $j = jQuery.noConflict();
|
4 |
+
$j(document).ready(function(){
|
5 |
+
if(document.getElementById('sku').value == ""){
|
6 |
+
doOptimiseProductAddition();
|
7 |
+
}
|
8 |
+
});
|
9 |
+
</script>
|
app/etc/modules/Creare_Opa.xml
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category Creare
|
5 |
+
* @package Creare_Opa
|
6 |
+
* @author ModuleCreator
|
7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
<config>
|
11 |
+
<modules>
|
12 |
+
<Creare_Opa>
|
13 |
+
<active>true</active>
|
14 |
+
<codePool>local</codePool>
|
15 |
+
</Creare_Opa>
|
16 |
+
</modules>
|
17 |
+
</config>
|
js/opa/optimisedproductaddition.js
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
|
3 |
+
Creare OPA
|
4 |
+
|
5 |
+
|
6 |
+
*/
|
7 |
+
|
8 |
+
function doOptimiseProductAddition(base_url){
|
9 |
+
|
10 |
+
var params = "";
|
11 |
+
|
12 |
+
try{
|
13 |
+
// Opera 8.0+, Firefox, Safari
|
14 |
+
ajaxRequest = new XMLHttpRequest();
|
15 |
+
} catch (e){
|
16 |
+
// Internet Explorer Browsers
|
17 |
+
try{
|
18 |
+
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
|
19 |
+
} catch (e) {
|
20 |
+
try{
|
21 |
+
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
|
22 |
+
} catch (e){
|
23 |
+
// Something went wrong
|
24 |
+
alert("Your browser broke!");
|
25 |
+
return false;
|
26 |
+
}
|
27 |
+
}
|
28 |
+
}
|
29 |
+
ajaxRequest.onreadystatechange = function(){
|
30 |
+
if(ajaxRequest.readyState == 4){
|
31 |
+
document.getElementById('status').selectedIndex = 1;
|
32 |
+
document.getElementById('tax_class_id').selectedIndex = 2;
|
33 |
+
document.getElementById('inventory_stock_availability').selectedIndex = 0;
|
34 |
+
document.getElementById('inventory_is_qty_decimal').selectedIndex = 1;
|
35 |
+
if(ajaxRequest.responseText != ""){
|
36 |
+
document.getElementById('sku').value = parseInt(ajaxRequest.responseText)+1;
|
37 |
+
}
|
38 |
+
} else {
|
39 |
+
document.getElementById('sku').value = '';
|
40 |
+
}
|
41 |
+
}
|
42 |
+
ajaxRequest.open("POST", base_url+'opa/ajax/', true);
|
43 |
+
ajaxRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
44 |
+
ajaxRequest.setRequestHeader("Content-length", params.length);
|
45 |
+
ajaxRequest.setRequestHeader("Connection", "close");
|
46 |
+
ajaxRequest.send(params);
|
47 |
+
|
48 |
+
}
|
package.xml
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Creare_Optimised_Product_Addition</name>
|
4 |
+
<version>0.1.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Creare's Optimised Product Addition saves you time when creating new products via the admin section of a Magento Store.</summary>
|
10 |
+
<description>Creare's Optimised Product Addition saves you time when creating new products via the admin section of a Magento Store.
|
11 |
+

|
12 |
+
It sets your product to enabled, sets your tax class to vat (or whatever is your default tax), it also sets your product to "in-stock" and automatically generates an incremental SKU.</description>
|
13 |
+
<notes>First Release</notes>
|
14 |
+
<authors><author><name>E-Commerce Web Design</name><user>EcommerceWD</user><email>dev@e-commercewebdesign.co.uk</email></author></authors>
|
15 |
+
<date>2011-12-22</date>
|
16 |
+
<time>12:55:47</time>
|
17 |
+
<contents><target name="mageetc"><dir name="modules"><file name="Creare_Opa.xml" hash="9a9e382f3ac2cf6761080fd441a7d689"/></dir></target><target name="magelocal"><dir name="Creare"><dir name="Opa"><dir><dir name="controllers"><file name="AjaxController.php" hash="f6e40b4e233c5699c80066629af91597"/></dir><dir name="etc"><file name="config.xml" hash="13a77670a475fdfc82bd4f2dd0863969"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="opa.xml" hash="19dd070a5fe4346b6ee15baa58a12438"/></dir><dir name="template"><dir name="opa"><file name="opa.phtml" hash="289c9a52310c5eac834526741cafb114"/></dir></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="opa"><file name="optimisedproductaddition.js" hash="496530db5df5afc29169232f17266f28"/></dir></dir></target></contents>
|
18 |
+
<compatible/>
|
19 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
20 |
+
</package>
|