Version Notes
This is stable version of this extension and has been tested on various version of community editions. In this particular version we are supporting it to run on PHP V 7.0.99
Download this release
Release Info
Developer | SEO North Melbourne |
Extension | Product-Margin |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/community/Studio45/Productmargin/Block/Adminhtml/Productmargin.php +12 -0
- app/code/community/Studio45/Productmargin/Block/Adminhtml/Productmargin/Edit.php +56 -0
- app/code/community/Studio45/Productmargin/Block/Adminhtml/Productmargin/Edit/Form.php +18 -0
- app/code/community/Studio45/Productmargin/Block/Adminhtml/Productmargin/Edit/Tab/Form.php +54 -0
- app/code/community/Studio45/Productmargin/Block/Adminhtml/Productmargin/Edit/Tabs.php +22 -0
- app/code/community/Studio45/Productmargin/Block/Adminhtml/Productmargin/Grid.php +166 -0
- app/code/community/Studio45/Productmargin/Helper/Data.php +48 -0
- app/code/community/Studio45/Productmargin/Model/Forms.php +11 -0
- app/code/community/Studio45/Productmargin/Model/Mysql4/Forms.php +8 -0
- app/code/community/Studio45/Productmargin/Model/Mysql4/Forms/Collection.php +9 -0
- app/code/community/Studio45/Productmargin/Model/Observer.php +36 -0
- app/code/community/Studio45/Productmargin/controllers/Adminhtml/ProductmarginController.php +259 -0
- app/code/community/Studio45/Productmargin/etc/config.xml +166 -0
- app/code/community/Studio45/Productmargin/sql/productmargin_setup/mysql4-install-0.1.0.php +27 -0
- app/design/adminhtml/default/default/layout/productmargin.xml +15 -0
- app/etc/modules/Studio45_Productmargin.xml +10 -0
- package.xml +18 -0
app/code/community/Studio45/Productmargin/Block/Adminhtml/Productmargin.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Studio45_Productmargin_Block_Adminhtml_Productmargin extends Mage_Adminhtml_Block_Widget_Grid_Container
|
3 |
+
{
|
4 |
+
public function __construct()
|
5 |
+
{
|
6 |
+
$this->_controller = 'adminhtml_productmargin';
|
7 |
+
$this->_blockGroup = 'productmargin';
|
8 |
+
$this->_headerText = Mage::helper('productmargin')->__('Manage Product Margin');
|
9 |
+
$this->_addButtonLabel = Mage::helper('productmargin')->__('Add Product Margin');
|
10 |
+
parent::__construct();
|
11 |
+
}
|
12 |
+
}
|
app/code/community/Studio45/Productmargin/Block/Adminhtml/Productmargin/Edit.php
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Studio45_Productmargin_Block_Adminhtml_Productmargin_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
3 |
+
{
|
4 |
+
public function __construct()
|
5 |
+
{
|
6 |
+
parent::__construct();
|
7 |
+
|
8 |
+
$this->_objectId = 'id';
|
9 |
+
$this->_blockGroup = 'productmargin';
|
10 |
+
$this->_controller = 'adminhtml_productmargin';
|
11 |
+
|
12 |
+
$this->_updateButton('save', 'label', Mage::helper('productmargin')->__('Save'));
|
13 |
+
$this->_updateButton('delete', 'label', Mage::helper('productmargin')->__('Delete'));
|
14 |
+
|
15 |
+
$this->_addButton('saveandcontinue', array(
|
16 |
+
'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
|
17 |
+
'onclick' => 'saveAndContinueEdit()',
|
18 |
+
'class' => 'save',
|
19 |
+
), -100);
|
20 |
+
|
21 |
+
$this->_formScripts[] = "
|
22 |
+
function toggleEditor() {
|
23 |
+
if (tinyMCE.getInstanceById('productmargin_content') == null) {
|
24 |
+
tinyMCE.execCommand('mceAddControl', false, 'productmargin_content');
|
25 |
+
} else {
|
26 |
+
tinyMCE.execCommand('mceRemoveControl', false, 'productmargin_content');
|
27 |
+
}
|
28 |
+
}
|
29 |
+
|
30 |
+
function saveAndContinueEdit(){
|
31 |
+
editForm.submit($('edit_form').action+'back/edit/');
|
32 |
+
}
|
33 |
+
";
|
34 |
+
}
|
35 |
+
protected function _prepareLayout()
|
36 |
+
{
|
37 |
+
parent::_prepareLayout();
|
38 |
+
if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
|
39 |
+
$this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
|
40 |
+
}
|
41 |
+
}
|
42 |
+
public function getHeaderText()
|
43 |
+
{
|
44 |
+
if( Mage::registry('productmargin_data') && Mage::registry('productmargin_data')->getFormsIndex() )
|
45 |
+
{
|
46 |
+
$currentFormId = Mage::registry('productmargin_data')->getFormsIndex();
|
47 |
+
Mage::getSingleton('core/session')->setCurrentFormId($currentFormId);
|
48 |
+
return Mage::helper('productmargin')->__("Edit '%s'", $this->htmlEscape(Mage::registry('productmargin_data')->getProductName()));
|
49 |
+
}
|
50 |
+
else
|
51 |
+
{
|
52 |
+
Mage::getSingleton('core/session')->setCurrentFormId(0);
|
53 |
+
return Mage::helper('productmargin')->__('Add Product Margin');
|
54 |
+
}
|
55 |
+
}
|
56 |
+
}
|
app/code/community/Studio45/Productmargin/Block/Adminhtml/Productmargin/Edit/Form.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Studio45_Productmargin_Block_Adminhtml_Productmargin_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
3 |
+
{
|
4 |
+
protected function _prepareForm()
|
5 |
+
{
|
6 |
+
$form = new Varien_Data_Form(array(
|
7 |
+
'id' => 'edit_form',
|
8 |
+
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
|
9 |
+
'method' => 'post',
|
10 |
+
'enctype' => 'multipart/form-data'
|
11 |
+
)
|
12 |
+
);
|
13 |
+
|
14 |
+
$form->setUseContainer(true);
|
15 |
+
$this->setForm($form);
|
16 |
+
return parent::_prepareForm();
|
17 |
+
}
|
18 |
+
}
|
app/code/community/Studio45/Productmargin/Block/Adminhtml/Productmargin/Edit/Tab/Form.php
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Studio45_Productmargin_Block_Adminhtml_Productmargin_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
|
3 |
+
{
|
4 |
+
protected function _prepareForm()
|
5 |
+
{
|
6 |
+
$model = Mage::registry('productmargin_data');
|
7 |
+
|
8 |
+
if($model->getStores())
|
9 |
+
{
|
10 |
+
$model->setStores(explode(',',$model->getStores()));
|
11 |
+
}
|
12 |
+
$form = new Varien_Data_Form();
|
13 |
+
$this->setForm($form);
|
14 |
+
$fieldset = $form->addFieldset('productmargin_form', array('legend'=>Mage::helper('productmargin')->__('Product Information')));
|
15 |
+
|
16 |
+
$_productCollection = Mage::getModel('catalog/product')
|
17 |
+
->getCollection()
|
18 |
+
->addAttributeToSort('created_at', 'DESC')
|
19 |
+
->addAttributeToSelect('*')
|
20 |
+
->load();
|
21 |
+
$array[] = array('label' => 'Select Product', 'value' => '');
|
22 |
+
foreach ($_productCollection as $_product)
|
23 |
+
{
|
24 |
+
$getSku = $_product->getSku();
|
25 |
+
$getName = $_product->getName();
|
26 |
+
|
27 |
+
$array[] = array('label' => $getName.' (sku-'.$getSku.')', 'value' => $getSku.'||'.$getName);
|
28 |
+
}
|
29 |
+
|
30 |
+
$fieldset->addField('title', 'select', array(
|
31 |
+
'label' => Mage::helper('productmargin')->__('Select Product'),
|
32 |
+
'name' => 'title',
|
33 |
+
'class' => 'required-entry',
|
34 |
+
'required' => true,
|
35 |
+
'values' => $array,
|
36 |
+
));
|
37 |
+
|
38 |
+
$fieldset->addField('ebay_price','text',array(
|
39 |
+
'label' => Mage::helper('productmargin')->__('Ebay Product Price'),
|
40 |
+
'name' => 'ebay_price',
|
41 |
+
'class' => 'required-entry validate-number',
|
42 |
+
'required' => true,
|
43 |
+
));
|
44 |
+
|
45 |
+
if (Mage::getSingleton('adminhtml/session')->getFormData())
|
46 |
+
{
|
47 |
+
$form->setValues(Mage::getSingleton('adminhtml/session')->getFormData());
|
48 |
+
Mage::getSingleton('adminhtml/session')->setFormData(null);
|
49 |
+
} elseif ( Mage::registry('productmargin_data') ) {
|
50 |
+
$form->setValues(Mage::registry('productmargin_data')->getData());
|
51 |
+
}
|
52 |
+
return parent::_prepareForm();
|
53 |
+
}
|
54 |
+
}
|
app/code/community/Studio45/Productmargin/Block/Adminhtml/Productmargin/Edit/Tabs.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Studio45_Productmargin_Block_Adminhtml_Productmargin_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
|
3 |
+
{
|
4 |
+
public function __construct()
|
5 |
+
{
|
6 |
+
parent::__construct();
|
7 |
+
$this->setId('productmargin_tabs');
|
8 |
+
$this->setName('productmargin_tabs');
|
9 |
+
$this->setDestElementId('edit_form');
|
10 |
+
$this->setTitle(Mage::helper('productmargin')->__('Product Information'));
|
11 |
+
}
|
12 |
+
protected function _beforeToHtml()
|
13 |
+
{
|
14 |
+
$this->addTab('general_section', array(
|
15 |
+
'label' => Mage::helper('productmargin')->__('Product Information'),
|
16 |
+
'title' => Mage::helper('productmargin')->__('Product Information'),
|
17 |
+
'content' => $this->getLayout()->createBlock('productmargin/adminhtml_productmargin_edit_tab_form')->toHtml(),
|
18 |
+
));
|
19 |
+
|
20 |
+
return parent::_beforeToHtml();
|
21 |
+
}
|
22 |
+
}
|
app/code/community/Studio45/Productmargin/Block/Adminhtml/Productmargin/Grid.php
ADDED
@@ -0,0 +1,166 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Studio45_Productmargin_Block_Adminhtml_Productmargin_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
3 |
+
{
|
4 |
+
public function __construct()
|
5 |
+
{
|
6 |
+
parent::__construct();
|
7 |
+
$this->setId('productmarginGrid');
|
8 |
+
$this->setDefaultSort('forms_index');
|
9 |
+
$this->setDefaultDir('ASC');
|
10 |
+
$this->setSaveParametersInSession(true);
|
11 |
+
}
|
12 |
+
protected function _prepareCollection()
|
13 |
+
{
|
14 |
+
$collection = Mage::getModel('productmargin/forms')->getResourceCollection();
|
15 |
+
|
16 |
+
foreach ($collection as $view) {
|
17 |
+
if ( $view->getStores() && $view->getStores() != 0 ) {
|
18 |
+
$view->setStores(explode(',',$view->getStores()));
|
19 |
+
} else {
|
20 |
+
$view->setStores(array('0'));
|
21 |
+
}
|
22 |
+
}
|
23 |
+
$this->setCollection($collection);
|
24 |
+
$this->_prepareTotals('product_price,ebay_price');
|
25 |
+
|
26 |
+
return parent::_prepareCollection();
|
27 |
+
}
|
28 |
+
|
29 |
+
protected function _prepareTotals($columns = null){
|
30 |
+
$columns=explode(',',$columns);
|
31 |
+
if(!$columns){
|
32 |
+
return;
|
33 |
+
}
|
34 |
+
|
35 |
+
$this->_countTotals = true;
|
36 |
+
$totals = new Varien_Object();
|
37 |
+
$fields = array();
|
38 |
+
foreach($columns as $column)
|
39 |
+
{
|
40 |
+
$fields[$column] = 0;
|
41 |
+
}
|
42 |
+
foreach ($this->getCollection() as $item)
|
43 |
+
{
|
44 |
+
foreach($fields as $field=>$value)
|
45 |
+
{
|
46 |
+
$fields[$field]+=$item->getData($field);
|
47 |
+
|
48 |
+
}
|
49 |
+
}
|
50 |
+
|
51 |
+
$totals->setData($fields);
|
52 |
+
$this->setTotals($totals);
|
53 |
+
return;
|
54 |
+
}
|
55 |
+
protected function _prepareColumns()
|
56 |
+
{
|
57 |
+
$this->addColumn('forms_index', array(
|
58 |
+
'header' => Mage::helper('productmargin')->__('ID'),
|
59 |
+
'align' =>'left',
|
60 |
+
'width' => '50px',
|
61 |
+
'index' => 'forms_index',
|
62 |
+
'totals_label' => $this->__('Total'),
|
63 |
+
));
|
64 |
+
$this->addColumn('product_name', array(
|
65 |
+
'header' => Mage::helper('productmargin')->__('Product Name'),
|
66 |
+
'align' =>'left',
|
67 |
+
'width' => '250px',
|
68 |
+
'index' => 'product_name',
|
69 |
+
));
|
70 |
+
$this->addColumn('product_sku', array(
|
71 |
+
'header' => Mage::helper('productmargin')->__('Product SKU'),
|
72 |
+
'align' =>'left',
|
73 |
+
'width' => '50px',
|
74 |
+
'index' => 'product_sku',
|
75 |
+
));
|
76 |
+
|
77 |
+
$this->addColumn('product_price', array(
|
78 |
+
'header' => Mage::helper('productmargin')->__('Product Price'),
|
79 |
+
'align' =>'left',
|
80 |
+
'width' => '50px',
|
81 |
+
'index' => 'product_price',
|
82 |
+
));
|
83 |
+
$this->addColumn('ebay_price', array(
|
84 |
+
'header' => Mage::helper('productmargin')->__('Ebay Product Price'),
|
85 |
+
'align' =>'left',
|
86 |
+
'width' => '50px',
|
87 |
+
'index' => 'ebay_price',
|
88 |
+
));
|
89 |
+
|
90 |
+
$this->addColumn('margin_price', array(
|
91 |
+
'header' => Mage::helper('productmargin')->__('Product Margin'),
|
92 |
+
'align' =>'left',
|
93 |
+
'width' => '50px',
|
94 |
+
'index' => 'margin_price',
|
95 |
+
));
|
96 |
+
|
97 |
+
$this->addColumn('created_time', array(
|
98 |
+
'header' => Mage::helper('productmargin')->__('Created Time'),
|
99 |
+
'align' => 'left',
|
100 |
+
'width' => '150px',
|
101 |
+
'index' => 'created_time',
|
102 |
+
));
|
103 |
+
|
104 |
+
if ( !Mage::app()->isSingleStoreMode() )
|
105 |
+
{
|
106 |
+
$this->addColumn('stores', array(
|
107 |
+
'header' => Mage::helper('productmargin')->__('Store View'),
|
108 |
+
'width' => '150px',
|
109 |
+
'index' => 'stores',
|
110 |
+
'type' => 'store',
|
111 |
+
'store_all' => true,
|
112 |
+
'store_view' => true,
|
113 |
+
'sortable' => true,
|
114 |
+
'filter_condition_callback' => array($this, '_filterStoreCondition'),
|
115 |
+
));
|
116 |
+
}
|
117 |
+
$this->addColumn('action',
|
118 |
+
array(
|
119 |
+
'header' => Mage::helper('productmargin')->__('Action'),
|
120 |
+
'width' => '50px',
|
121 |
+
'type' => 'action',
|
122 |
+
'getter' => 'getId',
|
123 |
+
'actions' => array(
|
124 |
+
array(
|
125 |
+
'caption' => Mage::helper('productmargin')->__('Edit'),
|
126 |
+
'url' => array('base'=> '*/*/edit'),
|
127 |
+
'field' => 'id'
|
128 |
+
),
|
129 |
+
),
|
130 |
+
'filter' => false,
|
131 |
+
'sortable' => false,
|
132 |
+
'index' => 'stores',
|
133 |
+
'is_system' => true,
|
134 |
+
'totals_label' => ''
|
135 |
+
));
|
136 |
+
|
137 |
+
|
138 |
+
return parent::_prepareColumns();
|
139 |
+
}
|
140 |
+
protected function _filterStoreCondition($collection, $column)
|
141 |
+
{
|
142 |
+
if ( !$value = $column->getFilter()->getValue() ) {
|
143 |
+
return;
|
144 |
+
}
|
145 |
+
$this->getCollection()->addStoreFilter($value);
|
146 |
+
}
|
147 |
+
protected function _prepareMassaction()
|
148 |
+
{
|
149 |
+
$this->setMassactionIdField('forms_index');
|
150 |
+
$this->getMassactionBlock()->setFormFieldName('productmargin');
|
151 |
+
|
152 |
+
$this->getMassactionBlock()->addItem('delete', array(
|
153 |
+
'label' => Mage::helper('productmargin')->__('Delete'),
|
154 |
+
'url' => $this->getUrl('*/*/massDelete'),
|
155 |
+
'confirm' => Mage::helper('productmargin')->__('Are you sure?'),
|
156 |
+
'totals_label' => ''
|
157 |
+
));
|
158 |
+
|
159 |
+
|
160 |
+
return $this;
|
161 |
+
}
|
162 |
+
public function getRowUrl($row)
|
163 |
+
{
|
164 |
+
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
|
165 |
+
}
|
166 |
+
}
|
app/code/community/Studio45/Productmargin/Helper/Data.php
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Studio45_Productmargin_Helper_Data extends Mage_Core_Helper_Abstract
|
3 |
+
{
|
4 |
+
protected $_formData;
|
5 |
+
|
6 |
+
public function setFormData($data)
|
7 |
+
{
|
8 |
+
$this->_formData = $data;
|
9 |
+
}
|
10 |
+
public function getFormData()
|
11 |
+
{
|
12 |
+
return $this->_formData;
|
13 |
+
}
|
14 |
+
public function getRedirectUrl()
|
15 |
+
{
|
16 |
+
return Mage::getStoreConfig('productmargin_section/form_submission/redirect_url');
|
17 |
+
}
|
18 |
+
|
19 |
+
public function getFormsModel()
|
20 |
+
{
|
21 |
+
return Mage::getModel('productmargin/forms');
|
22 |
+
}
|
23 |
+
|
24 |
+
public function isEnabled()
|
25 |
+
{
|
26 |
+
return Mage::getStoreConfig('productmargin_section/general/active');
|
27 |
+
}
|
28 |
+
|
29 |
+
public function showLinkinTopmenu()
|
30 |
+
{
|
31 |
+
return Mage::getStoreConfig('productmargin_section/general/in_topmenu');
|
32 |
+
}
|
33 |
+
|
34 |
+
public function getFormCollection()
|
35 |
+
{
|
36 |
+
$formCollection = array();
|
37 |
+
$formCollection = Mage::getModel('productmargin/forms')->getCollection();
|
38 |
+
return $formCollection;
|
39 |
+
}
|
40 |
+
|
41 |
+
public function getCurrentFormId()
|
42 |
+
{
|
43 |
+
$sessionFormId = intval(Mage::getSingleton('core/session')->getCurrentFormId());
|
44 |
+
if(is_int($currentFormId = $sessionFormId))
|
45 |
+
return $currentFormId;
|
46 |
+
}
|
47 |
+
|
48 |
+
}
|
app/code/community/Studio45/Productmargin/Model/Forms.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Studio45_Productmargin_Model_Forms extends Mage_Core_Model_Abstract
|
3 |
+
{
|
4 |
+
protected $_currentFormId=0;
|
5 |
+
|
6 |
+
public function _construct()
|
7 |
+
{
|
8 |
+
parent::_construct();
|
9 |
+
$this->_init('productmargin/forms');
|
10 |
+
}
|
11 |
+
}
|
app/code/community/Studio45/Productmargin/Model/Mysql4/Forms.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Studio45_Productmargin_Model_Mysql4_Forms extends Mage_Core_Model_Mysql4_Abstract
|
3 |
+
{
|
4 |
+
public function _construct()
|
5 |
+
{
|
6 |
+
$this->_init('productmargin/forms', 'forms_index');
|
7 |
+
}
|
8 |
+
}
|
app/code/community/Studio45/Productmargin/Model/Mysql4/Forms/Collection.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Studio45_Productmargin_Model_Mysql4_Forms_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
3 |
+
{
|
4 |
+
public function _construct()
|
5 |
+
{
|
6 |
+
parent::_construct();
|
7 |
+
$this->_init('productmargin/forms');
|
8 |
+
}
|
9 |
+
}
|
app/code/community/Studio45/Productmargin/Model/Observer.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Studio45_Productmargin_Model_Observer
|
3 |
+
{
|
4 |
+
public function addToTopmenu(Varien_Event_Observer $observer)
|
5 |
+
{
|
6 |
+
if(Mage::helper('productmargin')->showLinkinTopmenu())
|
7 |
+
{
|
8 |
+
$menu = $observer->getMenu();
|
9 |
+
$tree = $menu->getTree();
|
10 |
+
|
11 |
+
$node = new Varien_Data_Tree_Node(array(
|
12 |
+
'name' => 'Productmargin',
|
13 |
+
'id' => 'productmargin',
|
14 |
+
'url' => Mage::getUrl('productmargin'),
|
15 |
+
), 'id', $tree, $menu);
|
16 |
+
|
17 |
+
$menu->addChild($node);
|
18 |
+
|
19 |
+
// Children menu items
|
20 |
+
$collection = Mage::getModel('productmargin/forms')->getCollection();
|
21 |
+
$collection->addFieldToFilter('status',array('eq'=>1));
|
22 |
+
$collection->addFieldToFilter('in_menu',array('eq'=>1));
|
23 |
+
foreach ($collection as $category)
|
24 |
+
{
|
25 |
+
$tree = $node->getTree();
|
26 |
+
$data = array(
|
27 |
+
'name' => $category->getTitle(),
|
28 |
+
'id' => 'category-node-'.$category->getFormsIndex(),
|
29 |
+
'url' => Mage::getUrl('productmargin/index/view').'id/'.$category->getFormsIndex(),
|
30 |
+
);
|
31 |
+
$subNode = new Varien_Data_Tree_Node($data, 'id', $tree, $node);
|
32 |
+
$node->addChild($subNode);
|
33 |
+
}
|
34 |
+
}
|
35 |
+
}
|
36 |
+
}
|
app/code/community/Studio45/Productmargin/controllers/Adminhtml/ProductmarginController.php
ADDED
@@ -0,0 +1,259 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Studio45_Productmargin_Adminhtml_ProductmarginController extends Mage_Adminhtml_Controller_Action
|
3 |
+
{
|
4 |
+
public function fieldsgridAction()
|
5 |
+
{
|
6 |
+
echo $this->getLayout()->createBlock('productmargin/adminhtml_productmargin_edit_tab_fieldsgrid')->toHtml();
|
7 |
+
}
|
8 |
+
public function recordsgridAction()
|
9 |
+
{
|
10 |
+
$this->loadLayout();
|
11 |
+
$this->_addContent($this->getLayout()->createBlock('productmargin/adminhtml_productmargin_edit_tab_recordsgrid'));
|
12 |
+
$this->renderLayout();
|
13 |
+
}
|
14 |
+
public function optionsAction()
|
15 |
+
{
|
16 |
+
$this->loadLayout();
|
17 |
+
$this->renderLayout();
|
18 |
+
}
|
19 |
+
public function getBaseTmpMediaUrl()
|
20 |
+
{
|
21 |
+
return Mage::getBaseUrl('media') . 'productmargin';
|
22 |
+
}
|
23 |
+
public function getBaseTmpMediaPath()
|
24 |
+
{
|
25 |
+
return Mage::getBaseDir('media') . DS . 'productmargin';
|
26 |
+
}
|
27 |
+
protected function _initAction()
|
28 |
+
{
|
29 |
+
$this->loadLayout()
|
30 |
+
->_setActiveMenu('productmargin/items')
|
31 |
+
->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Form Manager'));
|
32 |
+
|
33 |
+
return $this;
|
34 |
+
}
|
35 |
+
public function indexAction()
|
36 |
+
{
|
37 |
+
$this->_initAction()
|
38 |
+
->renderLayout();
|
39 |
+
}
|
40 |
+
|
41 |
+
public function editAction()
|
42 |
+
{
|
43 |
+
$this->_title($this->__("Form"));
|
44 |
+
$this->_title($this->__("Form Listing"));
|
45 |
+
$this->_title($this->__("Edit Form"));
|
46 |
+
|
47 |
+
$id = $this->getRequest()->getParam("id");
|
48 |
+
$model = Mage::getModel("productmargin/forms")->load($id);
|
49 |
+
|
50 |
+
if ($model->getFormsIndex() || $id==0)
|
51 |
+
{
|
52 |
+
$data = Mage::getSingleton('adminhtml/session')->getFormData(true);
|
53 |
+
if (!empty($data))
|
54 |
+
{
|
55 |
+
$model->setData($data);
|
56 |
+
}
|
57 |
+
Mage::register("productmargin_data", $model);
|
58 |
+
$this->loadLayout();
|
59 |
+
$this->_setActiveMenu("productmargin/items");
|
60 |
+
$this->_addBreadcrumb(Mage::helper("adminhtml")->__("Form Manager"), Mage::helper("adminhtml")->__("Form Manager"));
|
61 |
+
$this->_addBreadcrumb(Mage::helper("adminhtml")->__("Form Description"), Mage::helper("adminhtml")->__("Form Description"));
|
62 |
+
$this->getLayout()->getBlock("head")->setCanLoadExtJs(true);
|
63 |
+
$this->_addContent($this->getLayout()->createBlock("productmargin/adminhtml_productmargin_edit"))->_addLeft($this->getLayout()->createBlock("productmargin/adminhtml_productmargin_edit_tabs"));
|
64 |
+
$this->renderLayout();
|
65 |
+
}
|
66 |
+
else {
|
67 |
+
Mage::getSingleton("adminhtml/session")->addError(Mage::helper("productmargin")->__("Form does not exist."));
|
68 |
+
$this->_redirect("*/*/");
|
69 |
+
}
|
70 |
+
}
|
71 |
+
public function newAction()
|
72 |
+
{
|
73 |
+
$this->_title($this->__("Form"));
|
74 |
+
$this->_title($this->__("New Form"));
|
75 |
+
|
76 |
+
$id = $this->getRequest()->getParam("id");
|
77 |
+
$model = Mage::getModel("productmargin/forms")->load($id);
|
78 |
+
|
79 |
+
$data = Mage::getSingleton("adminhtml/session")->getFormData(true);
|
80 |
+
if (!empty($data)) {
|
81 |
+
$model->setData($data);
|
82 |
+
}
|
83 |
+
Mage::register("productmargin_data", $model);
|
84 |
+
|
85 |
+
$this->loadLayout();
|
86 |
+
$this->_setActiveMenu("productmargin/items");
|
87 |
+
|
88 |
+
$this->getLayout()->getBlock("head")->setCanLoadExtJs(true);
|
89 |
+
|
90 |
+
$this->_addBreadcrumb(Mage::helper("adminhtml")->__("Form Manager"), Mage::helper("adminhtml")->__("Form Manager"));
|
91 |
+
$this->_addBreadcrumb(Mage::helper("adminhtml")->__("Form Description"), Mage::helper("adminhtml")->__("Form Description"));
|
92 |
+
|
93 |
+
$this->_addContent($this->getLayout()->createBlock("productmargin/adminhtml_productmargin_edit"))->_addLeft($this->getLayout()->createBlock("productmargin/adminhtml_productmargin_edit_tabs"));
|
94 |
+
|
95 |
+
$this->renderLayout();
|
96 |
+
}
|
97 |
+
public function saveAction()
|
98 |
+
{
|
99 |
+
if ($data = $this->getRequest()->getPost())
|
100 |
+
{
|
101 |
+
$model = Mage::getModel("productmargin/forms")->load($this->getRequest()->getParam("id"));
|
102 |
+
$currentFormId = $this->getRequest()->getParam("id");
|
103 |
+
$_helper = Mage::helper("productmargin");
|
104 |
+
|
105 |
+
try
|
106 |
+
{
|
107 |
+
|
108 |
+
if(isset($data['stores']) && !empty($data['stores']))
|
109 |
+
{
|
110 |
+
if(in_array('0',$data['stores'])){
|
111 |
+
$data['stores'] = array(0);
|
112 |
+
}
|
113 |
+
$data['stores'] = implode(',',$data['stores']);
|
114 |
+
}
|
115 |
+
if ($model->getCreatedTime() == NULL)
|
116 |
+
{
|
117 |
+
$data['created_time'] = now();
|
118 |
+
}
|
119 |
+
$data['update_time'] = now();
|
120 |
+
|
121 |
+
$skuPrd = explode("||", $_REQUEST['title']);
|
122 |
+
$prdSku = $skuPrd[0];
|
123 |
+
$prdName = $skuPrd[1];
|
124 |
+
|
125 |
+
$data['product_name'] = $prdName;
|
126 |
+
$data['product_sku'] = $prdSku;
|
127 |
+
|
128 |
+
$_Prdproduct = Mage::getModel('catalog/product')->loadByAttribute('sku',$prdSku);
|
129 |
+
$prdPrice = $_Prdproduct->getPrice();
|
130 |
+
|
131 |
+
$ebayPrice = $_REQUEST['ebay_price'];
|
132 |
+
|
133 |
+
if ($prdPrice > $ebayPrice)
|
134 |
+
{
|
135 |
+
$marginPrice = $prdPrice - $ebayPrice;
|
136 |
+
$mrPrice = "- ".$marginPrice;
|
137 |
+
}else if($prdPrice < $ebayPrice)
|
138 |
+
{
|
139 |
+
$marginPrice = $ebayPrice - $prdPrice;
|
140 |
+
$mrPrice = "+ ".$marginPrice;
|
141 |
+
}else if($prdPrice == $ebayPrice )
|
142 |
+
{
|
143 |
+
$mrPrice = "0";
|
144 |
+
}else
|
145 |
+
{
|
146 |
+
$mrPrice = $ebayPrice - $prdPrice;
|
147 |
+
}
|
148 |
+
|
149 |
+
$data['margin_price'] = $mrPrice;
|
150 |
+
$data['product_price'] = $prdPrice;
|
151 |
+
|
152 |
+
$model->setData($data)
|
153 |
+
->setFormsIndex($this->getRequest()->getParam("id"))
|
154 |
+
->save();
|
155 |
+
|
156 |
+
if(!$currentFormId)
|
157 |
+
$currentFormId = $model->getFormsIndex();
|
158 |
+
|
159 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('productmargin')->__(' Product margin was successfully saved'));
|
160 |
+
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
161 |
+
|
162 |
+
if ($this->getRequest()->getParam('back')) {
|
163 |
+
$this->_redirect('*/*/edit', array('id' => $model->getFormsIndex()));
|
164 |
+
return;
|
165 |
+
}
|
166 |
+
$this->_redirect('*/*/');
|
167 |
+
return;
|
168 |
+
}
|
169 |
+
catch (Exception $e)
|
170 |
+
{
|
171 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
172 |
+
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
173 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
174 |
+
return;
|
175 |
+
}
|
176 |
+
}
|
177 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('productmargin')->__('Unable to find product margin information to save'));
|
178 |
+
$this->_redirect('*/*/');
|
179 |
+
}
|
180 |
+
|
181 |
+
|
182 |
+
public function deleteAction()
|
183 |
+
{
|
184 |
+
if( $this->getRequest()->getParam('id') > 0 )
|
185 |
+
{
|
186 |
+
try
|
187 |
+
{
|
188 |
+
$model = Mage::getModel('productmargin/forms');
|
189 |
+
|
190 |
+
$model->setFormsIndex($this->getRequest()->getParam('id'))
|
191 |
+
->delete();
|
192 |
+
|
193 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Successfully deleted'));
|
194 |
+
$this->_redirect('*/*/');
|
195 |
+
}
|
196 |
+
catch (Exception $e)
|
197 |
+
{
|
198 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
199 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
200 |
+
}
|
201 |
+
}
|
202 |
+
$this->_redirect('*/*/');
|
203 |
+
}
|
204 |
+
public function massDeleteAction()
|
205 |
+
{
|
206 |
+
$productmarginIds = $this->getRequest()->getParam('productmargin');
|
207 |
+
if(!is_array($productmarginIds))
|
208 |
+
{
|
209 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select Form(s)'));
|
210 |
+
}
|
211 |
+
else
|
212 |
+
{
|
213 |
+
try
|
214 |
+
{
|
215 |
+
foreach ($productmarginIds as $productmarginId)
|
216 |
+
{
|
217 |
+
$productmargin = Mage::getModel('productmargin/forms')->load($productmarginId);
|
218 |
+
$productmargin->delete();
|
219 |
+
}
|
220 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
221 |
+
Mage::helper('adminhtml')->__('Total of %d record(s) were successfully deleted', count($productmarginIds)));
|
222 |
+
}
|
223 |
+
catch (Exception $e)
|
224 |
+
{
|
225 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
226 |
+
}
|
227 |
+
}
|
228 |
+
$this->_redirect('*/*/index');
|
229 |
+
}
|
230 |
+
public function massStatusAction()
|
231 |
+
{
|
232 |
+
$productmarginIds = $this->getRequest()->getParam('productmargin');
|
233 |
+
if(!is_array($productmarginIds))
|
234 |
+
{
|
235 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('Please select Form(s)'));
|
236 |
+
}
|
237 |
+
else
|
238 |
+
{
|
239 |
+
try
|
240 |
+
{
|
241 |
+
foreach ($productmarginIds as $productmarginId)
|
242 |
+
{
|
243 |
+
$productmargin = Mage::getSingleton('productmargin/forms')
|
244 |
+
->load($productmarginId)
|
245 |
+
->setStatus($this->getRequest()->getParam('status'))
|
246 |
+
->setIsMassupdate(true)
|
247 |
+
->save();
|
248 |
+
}
|
249 |
+
$this->_getSession()->addSuccess(
|
250 |
+
$this->__('Total of %d record(s) were successfully updated', count($productmarginIds)));
|
251 |
+
}
|
252 |
+
catch (Exception $e)
|
253 |
+
{
|
254 |
+
$this->_getSession()->addError($e->getMessage());
|
255 |
+
}
|
256 |
+
}
|
257 |
+
$this->_redirect('*/*/index');
|
258 |
+
}
|
259 |
+
}
|
app/code/community/Studio45/Productmargin/etc/config.xml
ADDED
@@ -0,0 +1,166 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Studio45_Productmargin>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</Studio45_Productmargin>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<routers>
|
10 |
+
<productmargin>
|
11 |
+
<use>standard</use>
|
12 |
+
<args>
|
13 |
+
<module>Studio45_Productmargin</module>
|
14 |
+
<frontName>productmargin</frontName>
|
15 |
+
</args>
|
16 |
+
</productmargin>
|
17 |
+
</routers>
|
18 |
+
<events>
|
19 |
+
<page_block_html_topmenu_gethtml_before>
|
20 |
+
<observers>
|
21 |
+
<productmargin>
|
22 |
+
<class>productmargin/observer</class>
|
23 |
+
<method>addToTopmenu</method>
|
24 |
+
</productmargin>
|
25 |
+
</observers>
|
26 |
+
</page_block_html_topmenu_gethtml_before>
|
27 |
+
</events>
|
28 |
+
</frontend>
|
29 |
+
<admin>
|
30 |
+
<routers>
|
31 |
+
<productmargin>
|
32 |
+
<use>admin</use>
|
33 |
+
<args>
|
34 |
+
<module>Studio45_Productmargin</module>
|
35 |
+
<frontName>productmargin</frontName>
|
36 |
+
</args>
|
37 |
+
</productmargin>
|
38 |
+
</routers>
|
39 |
+
</admin>
|
40 |
+
<adminhtml>
|
41 |
+
<menu>
|
42 |
+
<productmargin module="productmargin">
|
43 |
+
<depends>
|
44 |
+
<config>productmargin_section/general/active</config>
|
45 |
+
</depends>
|
46 |
+
<title>Product Margin</title>
|
47 |
+
<sort_order>71</sort_order>
|
48 |
+
<children>
|
49 |
+
<items module="productmargin">
|
50 |
+
<title>Manage Product Margin</title>
|
51 |
+
<sort_order>0</sort_order>
|
52 |
+
<action>productmargin/adminhtml_productmargin</action>
|
53 |
+
</items>
|
54 |
+
<items2 module="productmargin">
|
55 |
+
<title>Add Product Margin</title>
|
56 |
+
<sort_order>1</sort_order>
|
57 |
+
<action>productmargin/adminhtml_productmargin/new</action>
|
58 |
+
</items2>
|
59 |
+
</children>
|
60 |
+
</productmargin>
|
61 |
+
</menu>
|
62 |
+
<acl>
|
63 |
+
<resources>
|
64 |
+
<all>
|
65 |
+
<title>Allow Everything</title>
|
66 |
+
</all>
|
67 |
+
<admin>
|
68 |
+
<children>
|
69 |
+
<productmargin module="productmargin">
|
70 |
+
<title>Studio45</title>
|
71 |
+
<sort_order>71</sort_order>
|
72 |
+
<children>
|
73 |
+
<items module="productmargin">
|
74 |
+
<title>Manage Forms</title>
|
75 |
+
<sort_order>0</sort_order>
|
76 |
+
<action>productmargin/adminhtml_productmargin</action>
|
77 |
+
</items>
|
78 |
+
<items2 module="productmargin">
|
79 |
+
<title>Add Form</title>
|
80 |
+
<sort_order>1</sort_order>
|
81 |
+
<action>productmargin/adminhtml_productmargin/new</action>
|
82 |
+
</items2>
|
83 |
+
<items3 module="productmargin">
|
84 |
+
<title>productmargin Settings</title>
|
85 |
+
<sort_order>2</sort_order>
|
86 |
+
<action>adminhtml/system_config/edit/section/productmargin_section</action>
|
87 |
+
</items3>
|
88 |
+
</children>
|
89 |
+
</productmargin>
|
90 |
+
<system>
|
91 |
+
<children>
|
92 |
+
<config>
|
93 |
+
<children>
|
94 |
+
<productmargin_section translate="title" module="productmargin">
|
95 |
+
<title>Studio45 Productmargin Section</title>
|
96 |
+
</productmargin_section>
|
97 |
+
</children>
|
98 |
+
</config>
|
99 |
+
</children>
|
100 |
+
</system>
|
101 |
+
</children>
|
102 |
+
</admin>
|
103 |
+
</resources>
|
104 |
+
</acl>
|
105 |
+
<layout>
|
106 |
+
<updates>
|
107 |
+
<productmargin>
|
108 |
+
<file>productmargin.xml</file>
|
109 |
+
</productmargin>
|
110 |
+
</updates>
|
111 |
+
</layout>
|
112 |
+
</adminhtml>
|
113 |
+
<global>
|
114 |
+
<models>
|
115 |
+
<productmargin>
|
116 |
+
<class>Studio45_Productmargin_Model</class>
|
117 |
+
<resourceModel>productmargin_mysql4</resourceModel>
|
118 |
+
</productmargin>
|
119 |
+
<productmargin_mysql4>
|
120 |
+
<class>Studio45_Productmargin_Model_Mysql4</class>
|
121 |
+
<entities>
|
122 |
+
<forms>
|
123 |
+
<table>productmargin_forms</table>
|
124 |
+
</forms>
|
125 |
+
</entities>
|
126 |
+
</productmargin_mysql4>
|
127 |
+
</models>
|
128 |
+
<resources>
|
129 |
+
<productmargin_setup>
|
130 |
+
<setup>
|
131 |
+
<module>Studio45_Productmargin</module>
|
132 |
+
</setup>
|
133 |
+
<connection>
|
134 |
+
<use>core_setup</use>
|
135 |
+
</connection>
|
136 |
+
</productmargin_setup>
|
137 |
+
<productmargin_write>
|
138 |
+
<connection>
|
139 |
+
<use>core_write</use>
|
140 |
+
</connection>
|
141 |
+
</productmargin_write>
|
142 |
+
<productmargin_read>
|
143 |
+
<connection>
|
144 |
+
<use>core_read</use>
|
145 |
+
</connection>
|
146 |
+
</productmargin_read>
|
147 |
+
</resources>
|
148 |
+
<blocks>
|
149 |
+
<productmargin>
|
150 |
+
<class>Studio45_Productmargin_Block</class>
|
151 |
+
</productmargin>
|
152 |
+
</blocks>
|
153 |
+
<helpers>
|
154 |
+
<productmargin>
|
155 |
+
<class>Studio45_Productmargin_Helper</class>
|
156 |
+
</productmargin>
|
157 |
+
</helpers>
|
158 |
+
</global>
|
159 |
+
<default>
|
160 |
+
<productmargin_section>
|
161 |
+
<general>
|
162 |
+
<active>1</active>
|
163 |
+
</general>
|
164 |
+
</productmargin_section>
|
165 |
+
</default>
|
166 |
+
</config>
|
app/code/community/Studio45/Productmargin/sql/productmargin_setup/mysql4-install-0.1.0.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
$installer->run("
|
8 |
+
|
9 |
+
-- DROP TABLE IF EXISTS {$this->getTable('productmargin_forms')};
|
10 |
+
CREATE TABLE {$this->getTable('productmargin_forms')} (
|
11 |
+
`forms_index` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
|
12 |
+
`title` VARCHAR(255) NOT NULL,
|
13 |
+
`no_of_fields` INT(50) NULL DEFAULT '0',
|
14 |
+
`product_name` text NOT NULL ,
|
15 |
+
`product_sku` VARCHAR(255) NULL,
|
16 |
+
`margin_price` VARCHAR(255) NULL,
|
17 |
+
`product_price` VARCHAR(255) NULL,
|
18 |
+
`ebay_price` VARCHAR(255) NULL DEFAULT '#fbfaf6',
|
19 |
+
`created_time` DATETIME NULL DEFAULT NULL,
|
20 |
+
`update_time` DATETIME NULL DEFAULT NULL,
|
21 |
+
`status` VARCHAR(255) NOT NULL,
|
22 |
+
PRIMARY KEY (`forms_index`)
|
23 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
24 |
+
|
25 |
+
");
|
26 |
+
|
27 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/layout/productmargin.xml
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.3.1">
|
3 |
+
|
4 |
+
<productmargin_adminhtml_productmargin_index>
|
5 |
+
<update handle="editor_index_index"/>
|
6 |
+
<reference name="content">
|
7 |
+
<block type="productmargin/adminhtml_productmargin" name="productmargin" />
|
8 |
+
</reference>
|
9 |
+
</productmargin_adminhtml_productmargin_index>
|
10 |
+
<productmargin_adminhtml_productmargin_options>
|
11 |
+
<block type="core/text_list" name="root" output="toHtml">
|
12 |
+
<block type="productmargin/adminhtml_productmargin_edit_tab_options" name="admin.product.options"/>
|
13 |
+
</block>
|
14 |
+
</productmargin_adminhtml_productmargin_options>
|
15 |
+
</layout>
|
app/etc/modules/Studio45_Productmargin.xml
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Studio45_Productmargin>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
<version>0.1.0</version>
|
8 |
+
</Studio45_Productmargin>
|
9 |
+
</modules>
|
10 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Product-Margin</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>OSL v3.0</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>A perfect comparison rate calculator that helps compares pricing of different products in an organised and meaningful way. </summary>
|
10 |
+
<description>Product margin is an easy to use comparison rate calculator, using which admin can compare pricing of different products in an easy way. Having access to reliable information saves great deal of time, and allows you to track the pricing of products efficiently and easily. </description>
|
11 |
+
<notes>This is stable version of this extension and has been tested on various version of community editions. In this particular version we are supporting it to run on PHP V 7.0.99</notes>
|
12 |
+
<authors><author><name>SEO North Melbourne</name><user>seonorthmelbourne</user><email>info@seonorthmelbourne.com.au</email></author></authors>
|
13 |
+
<date>2017-01-20</date>
|
14 |
+
<time>12:35:30</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Studio45"><dir name="Productmargin"><dir name="Block"><dir name="Adminhtml"><dir name="Productmargin"><dir name="Edit"><file name="Form.php" hash="7d6618337127ba3104a4b79a77183aac"/><dir name="Tab"><file name="Form.php" hash="34ed8a595bc60d7f0951bfa5007f2ad9"/><file name="Form.php" hash="34ed8a595bc60d7f0951bfa5007f2ad9"/><file name="Form.php" hash="34ed8a595bc60d7f0951bfa5007f2ad9"/><file name="Form.php" hash="34ed8a595bc60d7f0951bfa5007f2ad9"/><file name="Form.php" hash="34ed8a595bc60d7f0951bfa5007f2ad9"/><file name="Form.php" hash="34ed8a595bc60d7f0951bfa5007f2ad9"/><file name="Form.php" hash="34ed8a595bc60d7f0951bfa5007f2ad9"/><file name="Form.php" hash="34ed8a595bc60d7f0951bfa5007f2ad9"/></dir><file name="Tabs.php" hash="8b6e4cd5f1d733134c42a0800082f1fe"/><file name="Form.php" hash="7d6618337127ba3104a4b79a77183aac"/><file name="Tabs.php" hash="8b6e4cd5f1d733134c42a0800082f1fe"/><file name="Form.php" hash="7d6618337127ba3104a4b79a77183aac"/><file name="Tabs.php" hash="8b6e4cd5f1d733134c42a0800082f1fe"/><file name="Form.php" hash="7d6618337127ba3104a4b79a77183aac"/><file name="Tabs.php" hash="8b6e4cd5f1d733134c42a0800082f1fe"/><file name="Form.php" hash="7d6618337127ba3104a4b79a77183aac"/><file name="Tabs.php" hash="8b6e4cd5f1d733134c42a0800082f1fe"/><file name="Form.php" hash="7d6618337127ba3104a4b79a77183aac"/><file name="Tabs.php" hash="8b6e4cd5f1d733134c42a0800082f1fe"/><file name="Form.php" hash="7d6618337127ba3104a4b79a77183aac"/><file name="Tabs.php" hash="8b6e4cd5f1d733134c42a0800082f1fe"/></dir><file name="Edit.php" hash="94a3cf1d5c3a6633c1144c1c00675aea"/><file name="Grid.php" hash="18b326cba344f65b0763513b7b9523fa"/><file name="Edit.php" hash="94a3cf1d5c3a6633c1144c1c00675aea"/><file name="Grid.php" hash="18b326cba344f65b0763513b7b9523fa"/><file name="Edit.php" hash="94a3cf1d5c3a6633c1144c1c00675aea"/><file name="Grid.php" hash="18b326cba344f65b0763513b7b9523fa"/><file name="Edit.php" hash="94a3cf1d5c3a6633c1144c1c00675aea"/><file name="Grid.php" hash="18b326cba344f65b0763513b7b9523fa"/><file name="Edit.php" hash="94a3cf1d5c3a6633c1144c1c00675aea"/><file name="Grid.php" hash="18b326cba344f65b0763513b7b9523fa"/><file name="Edit.php" hash="94a3cf1d5c3a6633c1144c1c00675aea"/><file name="Grid.php" hash="18b326cba344f65b0763513b7b9523fa"/></dir><file name="Productmargin.php" hash="633b58b9a4d84d5cfd4f7dee44ef5c4e"/><file name="Productmargin.php" hash="633b58b9a4d84d5cfd4f7dee44ef5c4e"/><file name="Productmargin.php" hash="633b58b9a4d84d5cfd4f7dee44ef5c4e"/><file name="Productmargin.php" hash="633b58b9a4d84d5cfd4f7dee44ef5c4e"/><file name="Productmargin.php" hash="633b58b9a4d84d5cfd4f7dee44ef5c4e"/></dir></dir><dir name="Helper"><file name="Data.php" hash="8ab1517a5316ccc065dcb88ed0b8b483"/><file name="Data.php" hash="8ab1517a5316ccc065dcb88ed0b8b483"/><file name="Data.php" hash="8ab1517a5316ccc065dcb88ed0b8b483"/><file name="Data.php" hash="8ab1517a5316ccc065dcb88ed0b8b483"/></dir><dir name="Model"><file name="Forms.php" hash="1d23fe363085065ec8a909ac2f06e420"/><dir name="Mysql4"><dir name="Forms"><file name="Collection.php" hash="0d1723bc28a5817340a5d604c4d0de93"/><file name="Collection.php" hash="0d1723bc28a5817340a5d604c4d0de93"/><file name="Collection.php" hash="0d1723bc28a5817340a5d604c4d0de93"/><file name="Collection.php" hash="0d1723bc28a5817340a5d604c4d0de93"/><file name="Collection.php" hash="0d1723bc28a5817340a5d604c4d0de93"/><file name="Collection.php" hash="0d1723bc28a5817340a5d604c4d0de93"/></dir><file name="Forms.php" hash="9cfe169894a28adf16503c4e980b2d65"/><file name="Forms.php" hash="9cfe169894a28adf16503c4e980b2d65"/><file name="Forms.php" hash="9cfe169894a28adf16503c4e980b2d65"/><file name="Forms.php" hash="9cfe169894a28adf16503c4e980b2d65"/><file name="Forms.php" hash="9cfe169894a28adf16503c4e980b2d65"/></dir><file name="Observer.php" hash="ad21b9697d3fd3f5075d3e1a1c05107c"/><file name="Forms.php" hash="1d23fe363085065ec8a909ac2f06e420"/><file name="Observer.php" hash="ad21b9697d3fd3f5075d3e1a1c05107c"/><file name="Forms.php" hash="1d23fe363085065ec8a909ac2f06e420"/><file name="Observer.php" hash="ad21b9697d3fd3f5075d3e1a1c05107c"/><file name="Forms.php" hash="1d23fe363085065ec8a909ac2f06e420"/><file name="Observer.php" hash="ad21b9697d3fd3f5075d3e1a1c05107c"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="ProductmarginController.php" hash="820db4568a39895a78194aa5394e9a14"/><file name="ProductmarginController.php" hash="820db4568a39895a78194aa5394e9a14"/><file name="ProductmarginController.php" hash="820db4568a39895a78194aa5394e9a14"/><file name="ProductmarginController.php" hash="820db4568a39895a78194aa5394e9a14"/><file name="ProductmarginController.php" hash="820db4568a39895a78194aa5394e9a14"/></dir></dir><dir name="etc"><file name="config.xml" hash="9ec1d317bc7df949ae1935dbe23e26f3"/><file name="config.xml" hash="9ec1d317bc7df949ae1935dbe23e26f3"/><file name="config.xml" hash="9ec1d317bc7df949ae1935dbe23e26f3"/><file name="config.xml" hash="9ec1d317bc7df949ae1935dbe23e26f3"/></dir><dir name="sql"><dir name="productmargin_setup"><file name="mysql4-install-0.1.0.php" hash="a4843674b49bfeb80440504474f43e5c"/><file name="mysql4-install-0.1.0.php" hash="a4843674b49bfeb80440504474f43e5c"/><file name="mysql4-install-0.1.0.php" hash="a4843674b49bfeb80440504474f43e5c"/><file name="mysql4-install-0.1.0.php" hash="a4843674b49bfeb80440504474f43e5c"/><file name="mysql4-install-0.1.0.php" hash="a4843674b49bfeb80440504474f43e5c"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="productmargin.xml" hash="7907b74319908e004dd60b683754985f"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Studio45_Productmargin.xml" hash="6160fa696704016c589275cec6554808"/></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.2.0</min><max>7.0.99</max></php></required></dependencies>
|
18 |
+
</package>
|