Version Notes
First release.
Download this release
Release Info
Developer | Vivek |
Extension | Galaxy_Unsold |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/local/Galaxy/Unsoldproduct/Block/Adminhtml/Unsoldproduct.php +5 -0
- app/code/local/Galaxy/Unsoldproduct/Block/Unsoldproduct.php +17 -0
- app/code/local/Galaxy/Unsoldproduct/Helper/Data.php +6 -0
- app/code/local/Galaxy/Unsoldproduct/Model/Mysql4/Unsoldproduct.php +10 -0
- app/code/local/Galaxy/Unsoldproduct/Model/Mysql4/Unsoldproduct/Collection.php +10 -0
- app/code/local/Galaxy/Unsoldproduct/Model/Status.php +15 -0
- app/code/local/Galaxy/Unsoldproduct/Model/Unsoldproduct.php +31 -0
- app/code/local/Galaxy/Unsoldproduct/controllers/Adminhtml/IndexController.php +28 -0
- app/code/local/Galaxy/Unsoldproduct/controllers/IndexController.php +47 -0
- app/code/local/Galaxy/Unsoldproduct/etc/config.xml +115 -0
- app/code/local/Galaxy/Unsoldproduct/sql/unsoldproduct_setup/blockmysql4-install-0.1.0.php +23 -0
- app/design/adminhtml/default/default/layout/unsoldproduct.xml +15 -0
- package.xml +18 -0
app/code/local/Galaxy/Unsoldproduct/Block/Adminhtml/Unsoldproduct.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Galaxy_Unsoldproduct_Block_Adminhtml_Unsoldproduct extends Mage_Adminhtml_Block_Template
|
3 |
+
{
|
4 |
+
|
5 |
+
}
|
app/code/local/Galaxy/Unsoldproduct/Block/Unsoldproduct.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Galaxy_Unsoldproduct_Block_Unsoldproduct extends Mage_Core_Block_Template
|
3 |
+
{
|
4 |
+
public function _prepareLayout()
|
5 |
+
{
|
6 |
+
return parent::_prepareLayout();
|
7 |
+
}
|
8 |
+
|
9 |
+
public function getUnsoldproduct()
|
10 |
+
{
|
11 |
+
if (!$this->hasData('unsoldproduct')) {
|
12 |
+
$this->setData('unsoldproduct', Mage::registry('unsoldproduct'));
|
13 |
+
}
|
14 |
+
return $this->getData('unsoldproduct');
|
15 |
+
|
16 |
+
}
|
17 |
+
}
|
app/code/local/Galaxy/Unsoldproduct/Helper/Data.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Galaxy_Unsoldproduct_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
}
|
app/code/local/Galaxy/Unsoldproduct/Model/Mysql4/Unsoldproduct.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Galaxy_Unsoldproduct_Model_Mysql4_Unsoldproduct extends Mage_Core_Model_Mysql4_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
// Note that the unsoldproduct_id refers to the key field in your database table.
|
8 |
+
$this->_init('unsoldproduct/unsoldproduct', 'unsoldproduct_id');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Galaxy/Unsoldproduct/Model/Mysql4/Unsoldproduct/Collection.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Galaxy_Unsoldproduct_Model_Mysql4_Unsoldproduct_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('unsoldproduct/unsoldproduct');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Galaxy/Unsoldproduct/Model/Status.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Galaxy_Unsoldproduct_Model_Status extends Varien_Object
|
4 |
+
{
|
5 |
+
const STATUS_ENABLED = 1;
|
6 |
+
const STATUS_DISABLED = 2;
|
7 |
+
|
8 |
+
static public function getOptionArray()
|
9 |
+
{
|
10 |
+
return array(
|
11 |
+
self::STATUS_ENABLED => Mage::helper('unsoldproduct')->__('Enabled'),
|
12 |
+
self::STATUS_DISABLED => Mage::helper('unsoldproduct')->__('Disabled')
|
13 |
+
);
|
14 |
+
}
|
15 |
+
}
|
app/code/local/Galaxy/Unsoldproduct/Model/Unsoldproduct.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Galaxy_Unsoldproduct_Model_Unsoldproduct extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('unsoldproduct/unsoldproduct');
|
9 |
+
}
|
10 |
+
// get unsold products lists
|
11 |
+
public function getUnsoldproductslists($datefrom,$dateto)
|
12 |
+
{
|
13 |
+
$date=explode("/",$datefrom);
|
14 |
+
|
15 |
+
$newdatefrom=$date[2]."-".$date[0]."-".$date[1];
|
16 |
+
|
17 |
+
$date1=explode("/",$dateto);
|
18 |
+
|
19 |
+
$newdateto=$date1[2]."-".$date1[0]."-".$date1[1];
|
20 |
+
|
21 |
+
$resource = Mage::getSingleton('core/resource');
|
22 |
+
$catalogtableName = $resource->getTableName('catalog/product');
|
23 |
+
|
24 |
+
$tableNameSales = $resource->getTableName('sales_flat_order_item');
|
25 |
+
|
26 |
+
$query="SELECT e.entity_id as id FROM $catalogtableName e WHERE e.entity_id NOT IN (SELECT s1.product_id FROM $tableNameSales s1 where s1.created_at BETWEEN '".$newdatefrom." 00:00:00' AND '".$newdateto." 23:59:59') GROUP BY e.entity_id";
|
27 |
+
$data = Mage::getSingleton('core/resource')->getConnection('core_read')->fetchAll($query);
|
28 |
+
//echo $query;
|
29 |
+
return $data;
|
30 |
+
}
|
31 |
+
}
|
app/code/local/Galaxy/Unsoldproduct/controllers/Adminhtml/IndexController.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Galaxy_Unsoldproduct_Adminhtml_IndexController extends Mage_Adminhtml_Controller_Action
|
4 |
+
{
|
5 |
+
public function indexAction()
|
6 |
+
{
|
7 |
+
$this->loadLayout()->renderLayout();
|
8 |
+
}
|
9 |
+
public function postAction()
|
10 |
+
{
|
11 |
+
$flag=true;
|
12 |
+
$from = $this->getRequest()->getParam('report_from');
|
13 |
+
$to = $this->getRequest()->getParam('report_to');
|
14 |
+
if($from=="")
|
15 |
+
{
|
16 |
+
$flag=false;
|
17 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('unsoldproduct')->__('Please select date From'));
|
18 |
+
}
|
19 |
+
if($to=="")
|
20 |
+
{
|
21 |
+
$flag=false;
|
22 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('unsoldproduct')->__('Please select date To'));
|
23 |
+
}
|
24 |
+
|
25 |
+
$this->loadLayout();
|
26 |
+
$this->renderLayout();
|
27 |
+
}
|
28 |
+
}
|
app/code/local/Galaxy/Unsoldproduct/controllers/IndexController.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Galaxy_Unsoldproduct_IndexController extends Mage_Core_Controller_Front_Action
|
3 |
+
{
|
4 |
+
public function indexAction()
|
5 |
+
{
|
6 |
+
|
7 |
+
/*
|
8 |
+
* Load an object by id
|
9 |
+
* Request looking like:
|
10 |
+
* http://site.com/unsoldproduct?id=15
|
11 |
+
* or
|
12 |
+
* http://site.com/unsoldproduct/id/15
|
13 |
+
*/
|
14 |
+
/*
|
15 |
+
$unsoldproduct_id = $this->getRequest()->getParam('id');
|
16 |
+
|
17 |
+
if($unsoldproduct_id != null && $unsoldproduct_id != '') {
|
18 |
+
$unsoldproduct = Mage::getModel('unsoldproduct/unsoldproduct')->load($unsoldproduct_id)->getData();
|
19 |
+
} else {
|
20 |
+
$unsoldproduct = null;
|
21 |
+
}
|
22 |
+
*/
|
23 |
+
|
24 |
+
/*
|
25 |
+
* If no param we load a the last created item
|
26 |
+
*/
|
27 |
+
/*
|
28 |
+
if($unsoldproduct == null) {
|
29 |
+
$resource = Mage::getSingleton('core/resource');
|
30 |
+
$read= $resource->getConnection('core_read');
|
31 |
+
$unsoldproductTable = $resource->getTableName('unsoldproduct');
|
32 |
+
|
33 |
+
$select = $read->select()
|
34 |
+
->from($unsoldproductTable,array('unsoldproduct_id','title','content','status'))
|
35 |
+
->where('status',1)
|
36 |
+
->order('created_time DESC') ;
|
37 |
+
|
38 |
+
$unsoldproduct = $read->fetchRow($select);
|
39 |
+
}
|
40 |
+
Mage::register('unsoldproduct', $unsoldproduct);
|
41 |
+
*/
|
42 |
+
|
43 |
+
|
44 |
+
$this->loadLayout();
|
45 |
+
$this->renderLayout();
|
46 |
+
}
|
47 |
+
}
|
app/code/local/Galaxy/Unsoldproduct/etc/config.xml
ADDED
@@ -0,0 +1,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Galaxy_Unsoldproduct>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</Galaxy_Unsoldproduct>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<routers>
|
10 |
+
<unsoldproduct>
|
11 |
+
<use>standard</use>
|
12 |
+
<args>
|
13 |
+
<module>Galaxy_Unsoldproduct</module>
|
14 |
+
<frontName>unsoldproduct</frontName>
|
15 |
+
</args>
|
16 |
+
</unsoldproduct>
|
17 |
+
</routers>
|
18 |
+
<layout>
|
19 |
+
<updates>
|
20 |
+
<unsoldproduct>
|
21 |
+
<file>unsoldproduct.xml</file>
|
22 |
+
</unsoldproduct>
|
23 |
+
</updates>
|
24 |
+
</layout>
|
25 |
+
</frontend>
|
26 |
+
<global>
|
27 |
+
<models>
|
28 |
+
<unsoldproduct>
|
29 |
+
<class>Galaxy_Unsoldproduct_Model</class>
|
30 |
+
<resourceModel>unsoldproduct_mysql4</resourceModel>
|
31 |
+
</unsoldproduct>
|
32 |
+
<unsoldproduct_mysql4>
|
33 |
+
<class>Galaxy_Unsoldproduct_Model_Mysql4</class>
|
34 |
+
<entities>
|
35 |
+
<unsoldproduct>
|
36 |
+
<table>unsoldproduct</table>
|
37 |
+
</unsoldproduct>
|
38 |
+
</entities>
|
39 |
+
</unsoldproduct_mysql4>
|
40 |
+
</models>
|
41 |
+
<resources>
|
42 |
+
<unsoldproduct_setup>
|
43 |
+
<setup>
|
44 |
+
<module>Galaxy_Unsoldproduct</module>
|
45 |
+
</setup>
|
46 |
+
<connection>
|
47 |
+
<use>core_setup</use>
|
48 |
+
</connection>
|
49 |
+
</unsoldproduct_setup>
|
50 |
+
<unsoldproduct_write>
|
51 |
+
<connection>
|
52 |
+
<use>core_write</use>
|
53 |
+
</connection>
|
54 |
+
</unsoldproduct_write>
|
55 |
+
<unsoldproduct_read>
|
56 |
+
<connection>
|
57 |
+
<use>core_read</use>
|
58 |
+
</connection>
|
59 |
+
</unsoldproduct_read>
|
60 |
+
</resources>
|
61 |
+
<blocks>
|
62 |
+
<unsoldproduct>
|
63 |
+
<class>Galaxy_Unsoldproduct_Block</class>
|
64 |
+
</unsoldproduct>
|
65 |
+
</blocks>
|
66 |
+
<helpers>
|
67 |
+
<unsoldproduct>
|
68 |
+
<class>Galaxy_Unsoldproduct_Helper</class>
|
69 |
+
</unsoldproduct>
|
70 |
+
</helpers>
|
71 |
+
</global>
|
72 |
+
<admin>
|
73 |
+
<routers>
|
74 |
+
<unsoldproduct>
|
75 |
+
<use>admin</use>
|
76 |
+
<args>
|
77 |
+
<module>Galaxy_Unsoldproduct</module>
|
78 |
+
<frontName>unsoldproduct</frontName>
|
79 |
+
</args>
|
80 |
+
</unsoldproduct>
|
81 |
+
</routers>
|
82 |
+
</admin>
|
83 |
+
<adminhtml>
|
84 |
+
<menu>
|
85 |
+
<unsoldproduct module="unsoldproduct">
|
86 |
+
<title>Unsoldproduct</title>
|
87 |
+
<sort_order>99</sort_order>
|
88 |
+
<children>
|
89 |
+
<items module="unsoldproduct">
|
90 |
+
<title>Manage Items</title>
|
91 |
+
<sort_order>0</sort_order>
|
92 |
+
<action>unsoldproduct/adminhtml_index</action>
|
93 |
+
</items>
|
94 |
+
</children>
|
95 |
+
</unsoldproduct>
|
96 |
+
</menu>
|
97 |
+
<acl>
|
98 |
+
<resources>
|
99 |
+
<all>
|
100 |
+
<title>Allow everything</title>
|
101 |
+
</all>
|
102 |
+
<admin translate="title" module="unsoldproduct">
|
103 |
+
<title>Magento Admin Galaxy Unsoldproduct</title>
|
104 |
+
</admin>
|
105 |
+
</resources>
|
106 |
+
</acl>
|
107 |
+
<layout>
|
108 |
+
<updates>
|
109 |
+
<unsoldproduct>
|
110 |
+
<file>unsoldproduct.xml</file>
|
111 |
+
</unsoldproduct>
|
112 |
+
</updates>
|
113 |
+
</layout>
|
114 |
+
</adminhtml>
|
115 |
+
</config>
|
app/code/local/Galaxy/Unsoldproduct/sql/unsoldproduct_setup/blockmysql4-install-0.1.0.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
$installer->run("
|
8 |
+
|
9 |
+
-- DROP TABLE IF EXISTS {$this->getTable('unsoldproduct')};
|
10 |
+
CREATE TABLE {$this->getTable('unsoldproduct')} (
|
11 |
+
`unsoldproduct_id` int(11) unsigned NOT NULL auto_increment,
|
12 |
+
`title` varchar(255) NOT NULL default '',
|
13 |
+
`filename` varchar(255) NOT NULL default '',
|
14 |
+
`content` text NOT NULL default '',
|
15 |
+
`status` smallint(6) NOT NULL default '0',
|
16 |
+
`created_time` datetime NULL,
|
17 |
+
`update_time` datetime NULL,
|
18 |
+
PRIMARY KEY (`unsoldproduct_id`)
|
19 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
20 |
+
|
21 |
+
");
|
22 |
+
|
23 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/layout/unsoldproduct.xml
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout>
|
3 |
+
<unsoldproduct_adminhtml_index_index>
|
4 |
+
<update handle="unsoldproduct_index_index"/>
|
5 |
+
<reference name="content">
|
6 |
+
<block type="unsoldproduct/adminhtml_unsoldproduct" name="myadmin" template="unsoldproduct/unsoldproduct.phtml"/>
|
7 |
+
</reference>
|
8 |
+
</unsoldproduct_adminhtml_index_index>
|
9 |
+
<unsoldproduct_adminhtml_index_post>
|
10 |
+
|
11 |
+
<reference name="content">
|
12 |
+
<block type="unsoldproduct/adminhtml_unsoldproduct" name="myadmin" template="unsoldproduct/unsoldproduct.phtml"/>
|
13 |
+
</reference>
|
14 |
+
</unsoldproduct_adminhtml_index_post>
|
15 |
+
</layout>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Galaxy_Unsold</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Provide unsold product information of your store between selected dates.</summary>
|
10 |
+
<description>This extension provides unsold products of your store between two given dates with views of that products between given dates and still its remain as unsold on your store.</description>
|
11 |
+
<notes>First release. </notes>
|
12 |
+
<authors><author><name>Vivek</name><user>galaxyweblinks</user><email>vivek.jha@galaxysofttech.co.in</email></author></authors>
|
13 |
+
<date>2014-04-26</date>
|
14 |
+
<time>05:51:49</time>
|
15 |
+
<contents><target name="magelocal"><dir name="Galaxy"><dir name="Unsoldproduct"><dir name="Block"><dir name="Adminhtml"><file name="Unsoldproduct.php" hash="2887dc6077abc0c26ed107d5ffc33a91"/></dir><file name="Unsoldproduct.php" hash="960589023be9b09d9b31e45873583f0d"/></dir><dir name="Helper"><file name="Data.php" hash="13436758ffacb3d31d914dc561d44061"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Unsoldproduct"><file name="Collection.php" hash="87d87448519f1e28c500c1f053f8a36e"/></dir><file name="Unsoldproduct.php" hash="eb75ab1b143606c0d82fa51b7b8e5684"/></dir><file name="Status.php" hash="4a728b1fa487be343d54185ada49c12f"/><file name="Unsoldproduct.php" hash="b3a5eeecc1a3041b831a62576d206127"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="IndexController.php" hash="3b8f77804a90c0c94dd24fbfdec5b881"/></dir><file name="IndexController.php" hash="3ca4fa6d25810381186b527d21625d35"/></dir><dir name="etc"><file name="config.xml" hash="a4b0daf24e5bf441a2dd086b69f3f134"/></dir><dir name="sql"><dir name="unsoldproduct_setup"><file name="blockmysql4-install-0.1.0.php" hash="04b12fe4ec2741bb8d080d8ad0e0773a"/></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="unsoldproduct"><file name="unsoldproduct.phtml" hash=""/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="moduels"><file name="Galaxy_Unsoldproduct.xml" hash=""/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="unsoldproduct.xml" hash="16ced89eb5d9d6b8e75a89c05361d96d"/></dir></dir></dir></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.0.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|