Version Notes
This is a latest release.
Download this release
Release Info
Developer | Medma Infomatix |
Extension | Medma_Thirdparty_Import |
Version | 1.0.1 |
Comparing to | |
See all releases |
Code changes from version 1.0.0 to 1.0.1
- app/code/local/Coolwear/Categorytrans/Block/Adminhtml/Categorytrans/Edit.php +0 -81
- app/code/local/Coolwear/Categorytrans/Block/Adminhtml/Categorytrans/Edit.php~ +0 -53
- app/code/local/Coolwear/Categorytrans/Block/Adminhtml/Categorytrans/Edit/Form.php~ +0 -88
- app/code/local/Coolwear/Categorytrans/Block/Adminhtml/Categorytrans/Edit/Tab/Form.php~ +0 -119
- app/code/local/Coolwear/Categorytrans/Block/Adminhtml/Categorytrans/Grid.php~ +0 -55
- app/code/local/Coolwear/Categorytrans/Block/Categorytrans.php +0 -12
- app/code/local/Coolwear/Categorytrans/Helper/Data.php +0 -6
- app/code/local/Coolwear/Categorytrans/Helper/Data.php~ +0 -6
- app/code/local/Coolwear/Categorytrans/Model/Mysql4/Categorytrans/Collection.php~ +0 -10
- app/code/local/Coolwear/Categorytrans/Model/Mysql4/Stockcontrol.php~ +0 -10
- app/code/local/Coolwear/Categorytrans/controllers/Adminhtml/CategorytransController.php~ +0 -107
- app/code/local/Coolwear/Categorytrans/controllers/Adminhtml/StockcontrolController.php~ +0 -129
- app/code/local/Coolwear/Categorytrans/controllers/Adminhtml/StockcontrolController_bkp21may2012.php +0 -120
- app/code/local/Coolwear/Categorytrans/etc/config.xml~ +0 -76
- app/code/local/Coolwear/Categorytrans/sql/categorytrans_setup/mysql4-install-0.1.0.php~ +0 -21
- app/code/local/Coolwear/Importproduct/Model/Observer.php~ +0 -360
- app/code/local/Coolwear/Importproduct/Model/Observer_bkp3sep2012.php +0 -138
- app/code/local/Coolwear/Importproduct/Model/Observer_bkp5sep2012.php +0 -257
- app/code/local/Coolwear/Importproduct/etc/config.xml +0 -33
- app/code/local/Coolwear/Importproduct/etc/config.xml~ +0 -33
- app/code/local/Coolwear/Productimport/Block/Adminhtml/Productimport.php +0 -12
- app/code/local/Coolwear/Productimport/Block/Adminhtml/Productimport.php~ +0 -12
- app/code/local/Coolwear/Productimport/Block/Adminhtml/_Productimport/Edit.php +0 -45
- app/code/local/Coolwear/Productimport/Block/Adminhtml/_Productimport/Edit/Form.php +0 -19
- app/code/local/Coolwear/Productimport/Block/Adminhtml/_Productimport/Edit/Tab/Form.php +0 -75
- app/code/local/Coolwear/Productimport/Block/Adminhtml/_Productimport/Edit/Tabs.php +0 -37
- app/code/local/Coolwear/Productimport/Block/Adminhtml/_Productimport/Grid.php +0 -137
- app/code/local/Coolwear/Productimport/Block/Productimport.php +0 -16
- app/code/local/Coolwear/Productimport/Block/Productimport.php~ +0 -17
- app/code/local/Coolwear/Productimport/Helper/Data.php +0 -6
- app/code/local/Coolwear/Productimport/Helper/Data.php~ +0 -6
- app/code/local/Coolwear/Productimport/controllers/Adminhtml/ProductimportController.php~ +0 -374
- app/code/local/Coolwear/Productimport/controllers/Adminhtml/ProductimportController_25Sep2012.php +0 -358
- app/code/local/Coolwear/Productimport/etc/config.xml~ +0 -106
- app/code/local/{Coolwear → Medma}/Categorytrans/Block/Adminhtml/Categorytrans.php +1 -1
- app/code/local/Medma/Categorytrans/Block/Adminhtml/Categorytrans/Edit.php +36 -0
- app/code/local/{Coolwear → Medma}/Categorytrans/Block/Adminhtml/Categorytrans/Edit/Form.php +16 -6
- app/code/local/{Coolwear → Medma}/Categorytrans/Block/Adminhtml/Categorytrans/Edit/Tab/Form.php +0 -0
- app/code/local/{Coolwear → Medma}/Categorytrans/Block/Adminhtml/Categorytrans/Edit/Tabs.php +1 -1
- app/code/local/{Coolwear → Medma}/Categorytrans/Block/Adminhtml/Categorytrans/Grid.php +7 -11
- app/code/local/{Coolwear/Categorytrans/Block/Stockcontrol.php~ → Medma/Categorytrans/Block/Categorytrans.php} +1 -1
- app/code/local/Medma/Categorytrans/Helper/Data.php +6 -0
- app/code/local/{Coolwear → Medma}/Categorytrans/Model/Categorytrans.php +1 -1
- app/code/local/{Coolwear → Medma}/Categorytrans/Model/Mysql4/Categorytrans.php +1 -1
- app/code/local/{Coolwear → Medma}/Categorytrans/Model/Mysql4/Categorytrans/Collection.php +1 -1
- app/code/local/{Coolwear → Medma}/Categorytrans/controllers/Adminhtml/CategorytransController.php +11 -6
- app/code/local/{Coolwear → Medma}/Categorytrans/etc/config.xml +28 -20
- app/code/local/{Coolwear → Medma}/Categorytrans/sql/categorytrans_setup/mysql4-install-0.1.0.php +3 -2
- app/code/local/{Coolwear → Medma}/Importproduct/Model/Observer.php +1 -1
- app/code/local/Medma/Importproduct/etc/config.xml +33 -0
- app/code/local/Medma/Productimport/Helper/Data.php +6 -0
- app/code/local/{Coolwear → Medma}/Productimport/controllers/Adminhtml/ProductimportController.php +1 -1
- app/code/local/{Coolwear → Medma}/Productimport/etc/config.xml +10 -15
- app/design/adminhtml/default/default/layout/productimport.xml +1 -1
- app/design/adminhtml/default/default/template/{coolwear → productImport}/import.phtml +0 -0
- app/etc/modules/{Coolwear_Categorytrans.xml → Medma_Categorytrans.xml} +2 -2
- app/etc/modules/{Coolwear_Importproduct.xml → Medma_Importproduct.xml} +2 -2
- app/etc/modules/{Coolwear_Productimport.xml → Medma_Productimport.xml} +2 -2
- package.xml +7 -7
app/code/local/Coolwear/Categorytrans/Block/Adminhtml/Categorytrans/Edit.php
DELETED
@@ -1,81 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Coolwear_Categorytrans_Block_Adminhtml_Categorytrans_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
3 |
-
{
|
4 |
-
public function __construct()
|
5 |
-
{
|
6 |
-
parent::__construct();
|
7 |
-
$this->_objectId = 'id';
|
8 |
-
$this->_blockGroup = 'categorytrans';
|
9 |
-
$this->_controller = 'adminhtml_categorytrans';
|
10 |
-
$this->_formScripts[] = "
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
function getPresentQty(base_url,product_id,next_quantity_id,secret_key){
|
17 |
-
|
18 |
-
|
19 |
-
// alert(base_url+product_id+next_quantity_id+secret_key);
|
20 |
-
new Ajax.Request(base_url+'stockcontrol/adminhtml_stockcontrol/getPresentQty/product_id/'+product_id+'/key/'+secret_key,
|
21 |
-
|
22 |
-
|
23 |
-
{
|
24 |
-
|
25 |
-
|
26 |
-
method:'Post',
|
27 |
-
|
28 |
-
|
29 |
-
onSuccess: function(transport){
|
30 |
-
|
31 |
-
|
32 |
-
var response = transport.responseText || 'no response text';
|
33 |
-
//alert('success'+response);
|
34 |
-
|
35 |
-
document.getElementById(next_quantity_id).value=response;
|
36 |
-
|
37 |
-
},
|
38 |
-
|
39 |
-
|
40 |
-
onFailure: function(){
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
alert('Failure in Ajax');
|
47 |
-
|
48 |
-
|
49 |
-
}
|
50 |
-
|
51 |
-
|
52 |
-
});
|
53 |
-
|
54 |
-
|
55 |
-
}
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
";
|
61 |
-
|
62 |
-
}
|
63 |
-
|
64 |
-
|
65 |
-
public function getHeaderText()
|
66 |
-
|
67 |
-
{
|
68 |
-
|
69 |
-
if( Mage::registry('categorytrans_data') && Mage::registry('categorytrans_data')->getId() ) {
|
70 |
-
|
71 |
-
return Mage::helper('categorytrans')->__("Edit Category '%s'", $this->htmlEscape(Mage::registry('categorytrans_data')->getName()));
|
72 |
-
|
73 |
-
|
74 |
-
} else {
|
75 |
-
|
76 |
-
return Mage::helper('categorytrans')->__('Add Category');
|
77 |
-
|
78 |
-
}
|
79 |
-
|
80 |
-
}
|
81 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Coolwear/Categorytrans/Block/Adminhtml/Categorytrans/Edit.php~
DELETED
@@ -1,53 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Futurtek_Stockcontrol_Block_Adminhtml_Stockcontrol_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
3 |
-
{
|
4 |
-
public function __construct()
|
5 |
-
{
|
6 |
-
parent::__construct();
|
7 |
-
$this->_objectId = 'id';
|
8 |
-
$this->_blockGroup = 'stockcontrol';
|
9 |
-
$this->_controller = 'adminhtml_stockcontrol';
|
10 |
-
$this->_formScripts[] = "
|
11 |
-
|
12 |
-
function getPresentQty(base_url,product_id,next_quantity_id,secret_key){
|
13 |
-
// alert(base_url+product_id+next_quantity_id+secret_key);
|
14 |
-
new Ajax.Request(base_url+'stockcontrol/adminhtml_stockcontrol/getPresentQty/product_id/'+product_id+'/key/'+secret_key,
|
15 |
-
{
|
16 |
-
method:'Post',
|
17 |
-
onSuccess: function(transport){
|
18 |
-
var response = transport.responseText || 'no response text';
|
19 |
-
alert('success'+response);
|
20 |
-
|
21 |
-
document.getElementById(next_quantity_id).value=response;
|
22 |
-
|
23 |
-
},
|
24 |
-
onFailure: function(){
|
25 |
-
|
26 |
-
alert('Failure in Ajax');
|
27 |
-
}
|
28 |
-
});
|
29 |
-
}
|
30 |
-
|
31 |
-
|
32 |
-
";
|
33 |
-
|
34 |
-
}
|
35 |
-
|
36 |
-
|
37 |
-
public function getHeaderText()
|
38 |
-
|
39 |
-
{
|
40 |
-
|
41 |
-
if( Mage::registry('stockcontrol_data') && Mage::registry('stockcontrol_data')->getId() ) {
|
42 |
-
|
43 |
-
return Mage::helper('stockcontrol')->__("Edit Stock '%s'", $this->htmlEscape(Mage::registry('stockcontrol_data')->getName()));
|
44 |
-
|
45 |
-
|
46 |
-
} else {
|
47 |
-
|
48 |
-
return Mage::helper('stockcontrol')->__('Add Stock');
|
49 |
-
|
50 |
-
}
|
51 |
-
|
52 |
-
}
|
53 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Coolwear/Categorytrans/Block/Adminhtml/Categorytrans/Edit/Form.php~
DELETED
@@ -1,88 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Coolwear_Categorytrans_Block_Adminhtml_Categorytrans_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
4 |
-
{
|
5 |
-
protected function _prepareForm()
|
6 |
-
{
|
7 |
-
$form = new Varien_Data_Form(array(
|
8 |
-
'id' => 'edit_form',
|
9 |
-
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
|
10 |
-
'method' => 'post'));
|
11 |
-
|
12 |
-
$form->setUseContainer(true);
|
13 |
-
$this->setForm($form);
|
14 |
-
$hlp = Mage::helper('categorytrans');
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
$collection = Mage::getResourceModel('categorytrans/categorytrans');
|
19 |
-
|
20 |
-
$category_model=Mage::getModel('catalog/category')->getCollection()->addAttributeToSelect('*')->load();
|
21 |
-
|
22 |
-
//print_r($products_model);exit;
|
23 |
-
//$products_values= array();
|
24 |
-
|
25 |
-
$category_values[] = array(
|
26 |
-
|
27 |
-
'label' => 'Select Category',
|
28 |
-
'value' => ''
|
29 |
-
);
|
30 |
-
|
31 |
-
foreach($category_model as $key => $values)
|
32 |
-
{
|
33 |
-
$category_values[] = array(
|
34 |
-
'label' => $values['name'],
|
35 |
-
'value' => $values['entity_id']
|
36 |
-
);
|
37 |
-
}
|
38 |
-
|
39 |
-
|
40 |
-
// Most Important Line for printing the above query //
|
41 |
-
|
42 |
-
//$collection->printlogquery(true);
|
43 |
-
//exit(0);
|
44 |
-
|
45 |
-
$fldInfo = $form->addFieldset('stockcontrol_info', array('legend'=> $hlp->__('Stockcontrol')));
|
46 |
-
|
47 |
-
$fldInfo->addField('category_id', 'select', array(
|
48 |
-
|
49 |
-
'label' => $hlp->__('Category Name'),
|
50 |
-
|
51 |
-
'class' => 'required-entry',
|
52 |
-
|
53 |
-
'name' => 'category_id',
|
54 |
-
|
55 |
-
'values' =>$category_values,
|
56 |
-
|
57 |
-
));
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
$fldInfo->addField('english', 'text', array(
|
62 |
-
'label' => $hlp->__('English translate'),
|
63 |
-
'class' => 'required-entry',
|
64 |
-
'name' => 'english',
|
65 |
-
|
66 |
-
));
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
?>
|
73 |
-
|
74 |
-
<?php
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
if ( Mage::registry('stockcontrol_data') ) {
|
81 |
-
$form->setValues(Mage::registry('stockcontrol_data')->getData());
|
82 |
-
}
|
83 |
-
|
84 |
-
|
85 |
-
return parent::_prepareForm();
|
86 |
-
|
87 |
-
}
|
88 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Coolwear/Categorytrans/Block/Adminhtml/Categorytrans/Edit/Tab/Form.php~
DELETED
@@ -1,119 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Medma_Groups_Block_Adminhtml_Groups_Edit_Tab_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 |
-
|
11 |
-
$form->setUseContainer(true);
|
12 |
-
$this->setForm($form);
|
13 |
-
$hlp = Mage::helper('brands');
|
14 |
-
|
15 |
-
/*******************Code to display values from multiple tables*********************/
|
16 |
-
|
17 |
-
$id = Mage::registry('brands_data')->getId();
|
18 |
-
|
19 |
-
$brand_model = Mage::registry('brands_data')->getData();
|
20 |
-
|
21 |
-
$power_model = Mage::getModel('brands/power')->getCollection()->addFieldToFilter('brand_id',array('eq'=>$id))->getData();
|
22 |
-
|
23 |
-
// $diameter_model = Mage::getModel('brands/power')->getCollection()->addFieldToFilter('brand_id',array('eq'=>$id))->getData();
|
24 |
-
//
|
25 |
-
// $power_model = Mage::getModel('brands/power')->getCollection()->addFieldToFilter('brand_id',array('eq'=>$id))->getData();
|
26 |
-
//
|
27 |
-
// $power_model = Mage::getModel('brands/power')->getCollection()->addFieldToFilter('brand_id',array('eq'=>$id))->getData();
|
28 |
-
//
|
29 |
-
// $power_model = Mage::getModel('brands/power')->getCollection()->addFieldToFilter('brand_id',array('eq'=>$id))->getData();
|
30 |
-
|
31 |
-
/*******************Code to display values from multiple tables*********************/
|
32 |
-
|
33 |
-
|
34 |
-
$fldInfo = $form->addFieldset('brands_info', array('legend'=> $hlp->__('Brands Details')));
|
35 |
-
|
36 |
-
// $fldInfo->addField('store_id', 'select', array(
|
37 |
-
// 'label' => $hlp->__('Store View'),
|
38 |
-
// 'class' => 'required-entry',
|
39 |
-
// 'required' => true,
|
40 |
-
// 'name' => 'store_id',
|
41 |
-
// // 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm()
|
42 |
-
// ));
|
43 |
-
//
|
44 |
-
// $fldInfo->addField('follow_up', 'select', array(
|
45 |
-
// 'label' => $hlp->__('Follow Up'),
|
46 |
-
// 'name' => 'follow_up',
|
47 |
-
// 'options' => array(
|
48 |
-
// 'first' => $hlp->__('First'),
|
49 |
-
// 'second' => $hlp->__('Second'),
|
50 |
-
// 'third' => $hlp->__('Third'),
|
51 |
-
// ),
|
52 |
-
// ));
|
53 |
-
|
54 |
-
// $fldInfo->addField('sheduled_at', 'date', array(
|
55 |
-
// 'label' => $hlp->__('Alert Will Be Sent On'),
|
56 |
-
// 'image' => $this->getSkinUrl('images/grid-cal.gif'),
|
57 |
-
// 'format' => Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT),
|
58 |
-
// 'name' => 'sheduled_at',
|
59 |
-
// ));
|
60 |
-
//
|
61 |
-
// $fldInfo->addField('customer_email', 'text', array(
|
62 |
-
// 'label' => $hlp->__('Customer E-mail'),
|
63 |
-
// 'class' => 'required-entry validate-email',
|
64 |
-
// 'required' => true,
|
65 |
-
// 'name' => 'customer_email',
|
66 |
-
// ));
|
67 |
-
// $fldInfo->addField('brand_id', 'text', array(
|
68 |
-
// 'label' => $hlp->__('Brand ID'),
|
69 |
-
// 'class' => 'required-entry',
|
70 |
-
// 'required' => true,
|
71 |
-
// 'name' => 'brand_id',
|
72 |
-
// ));
|
73 |
-
$fldInfo->addField('brand_name', 'text', array(
|
74 |
-
'label' => $hlp->__('Brand Name'),
|
75 |
-
'class' => 'required-entry',
|
76 |
-
'required' => true,
|
77 |
-
'name' => 'brand_name',
|
78 |
-
));
|
79 |
-
|
80 |
-
$fldInfo->addField('power_value', 'text', array(
|
81 |
-
'label' => $hlp->__('Power Value'),
|
82 |
-
'class' => 'required-entry',
|
83 |
-
'required' => true,
|
84 |
-
'name' => 'power_value',
|
85 |
-
));
|
86 |
-
// $fldInfo->addField('power_value', 'select', array(
|
87 |
-
// 'label' => $hlp->__('Power Value'),
|
88 |
-
// 'options' => array(
|
89 |
-
// 'first' => $hlp->__('First'),
|
90 |
-
// 'second' => $hlp->__('Second'),
|
91 |
-
// 'third' => $hlp->__('Third')),
|
92 |
-
// 'name' => 'power_value',
|
93 |
-
// ));
|
94 |
-
//
|
95 |
-
// $fldInfo->addField('products', 'textarea', array(
|
96 |
-
// 'label' => $hlp->__('Produsts'),
|
97 |
-
// 'class' => 'required-entry',
|
98 |
-
// 'required' => true,
|
99 |
-
// 'name' => 'products',
|
100 |
-
// 'style' => 'width:35em;height:15em;',
|
101 |
-
// ));
|
102 |
-
// $fldInfo->addField('is_preprocessed', 'hidden', array(
|
103 |
-
// 'name' => 'is_preprocessed',
|
104 |
-
// 'value' => 1,
|
105 |
-
// ));
|
106 |
-
|
107 |
-
if ( Mage::registry('brands_data') ) {
|
108 |
-
//$form->setValues(Mage::registry('brands_data')->getData());
|
109 |
-
$form->setValues(array_merge($power_model[0],$brand_model));
|
110 |
-
|
111 |
-
|
112 |
-
}
|
113 |
-
|
114 |
-
return parent::_prepareForm();
|
115 |
-
}
|
116 |
-
}
|
117 |
-
|
118 |
-
?>
|
119 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Coolwear/Categorytrans/Block/Adminhtml/Categorytrans/Grid.php~
DELETED
@@ -1,55 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @author Adjustware
|
4 |
-
*/
|
5 |
-
class Coolwear_Categorytrans_Block_Adminhtml_Categorytrans_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
6 |
-
{
|
7 |
-
public function __construct()
|
8 |
-
{
|
9 |
-
parent::__construct();
|
10 |
-
$this->setId('categorytrans');
|
11 |
-
$this->setDefaultSort('id');
|
12 |
-
//$this->_removeButton('add_new');
|
13 |
-
|
14 |
-
}
|
15 |
-
|
16 |
-
protected function _prepareCollection()
|
17 |
-
{
|
18 |
-
$collection = Mage::getModel('categorytrans/categorytrans')->getCollection();
|
19 |
-
$_translateCondition="main_table.category_id=pc.entity_id AND pc.attribute_id='35'";
|
20 |
-
$collection->getSelect()->join(
|
21 |
-
array('pc'=>'catalog_category_entity_varchar'),
|
22 |
-
$_translateCondition,
|
23 |
-
array('name'=>'pc.value'));
|
24 |
-
//$collection->printLogQuery(true);
|
25 |
-
//exit;
|
26 |
-
|
27 |
-
$this->setCollection($collection);
|
28 |
-
return parent::_prepareCollection();
|
29 |
-
}
|
30 |
-
|
31 |
-
|
32 |
-
protected function _prepareColumns()
|
33 |
-
{
|
34 |
-
$this->addColumn('category_id', array(
|
35 |
-
'header'=> Mage::helper('categorytrans')->__('Category Name'),
|
36 |
-
'width' => '80px',
|
37 |
-
'type' => 'text',
|
38 |
-
'index' => 'name'
|
39 |
-
));
|
40 |
-
$this->addColumn('sku', array(
|
41 |
-
'header'=> Mage::helper('categorytrans')->__('English Translate'),
|
42 |
-
'width' => '80px',
|
43 |
-
'type' => 'text',
|
44 |
-
'index' => 'english'
|
45 |
-
));
|
46 |
-
return $this;
|
47 |
-
}
|
48 |
-
|
49 |
-
public function getRowUrl($row)
|
50 |
-
{
|
51 |
-
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
|
52 |
-
}
|
53 |
-
|
54 |
-
|
55 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Coolwear/Categorytrans/Block/Categorytrans.php
DELETED
@@ -1,12 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Coolwear_Categorytrans_Block_categorytrans extends Mage_Core_Block_Template
|
3 |
-
{
|
4 |
-
protected function _toHtml()
|
5 |
-
{
|
6 |
-
// return 'Weldone';
|
7 |
-
}
|
8 |
-
public function pqr(){
|
9 |
-
return 'neelima';
|
10 |
-
}
|
11 |
-
}
|
12 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Coolwear/Categorytrans/Helper/Data.php
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Coolwear_Categorytrans_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
-
{
|
5 |
-
|
6 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Coolwear/Categorytrans/Helper/Data.php~
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Medma_Printcodes_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
-
{
|
5 |
-
|
6 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Coolwear/Categorytrans/Model/Mysql4/Categorytrans/Collection.php~
DELETED
@@ -1,10 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Medma_Printcodes_Model_Mysql4_Printcodes_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
4 |
-
{
|
5 |
-
public function _construct()
|
6 |
-
{
|
7 |
-
parent::_construct();
|
8 |
-
$this->_init('printcodes/printcodes');
|
9 |
-
}
|
10 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Coolwear/Categorytrans/Model/Mysql4/Stockcontrol.php~
DELETED
@@ -1,10 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Medma_Printcodes_Model_Mysql4_Printcodes extends Mage_Core_Model_Mysql4_Abstract
|
4 |
-
{
|
5 |
-
public function _construct()
|
6 |
-
{
|
7 |
-
// Note that the florist_id refers to the key field in your database table.
|
8 |
-
$this->_init('printcodes/printcodes', 'print_code_id');
|
9 |
-
}
|
10 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Coolwear/Categorytrans/controllers/Adminhtml/CategorytransController.php~
DELETED
@@ -1,107 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Coolwear_Categorytrans_Adminhtml_CategorytransController extends Mage_Adminhtml_Controller_action
|
4 |
-
{
|
5 |
-
public function indexAction() {
|
6 |
-
|
7 |
-
|
8 |
-
$this->loadLayout();
|
9 |
-
$this->_setActiveMenu('catalog/categorytrans');
|
10 |
-
//$this->_addBreadcrumb($this->__('Manage Grouped Product Discount Rule'), $this->__('Discount'));
|
11 |
-
$this->_addContent($this->getLayout()->createBlock('categorytrans/adminhtml_categorytrans'));
|
12 |
-
$this->renderLayout();
|
13 |
-
|
14 |
-
}
|
15 |
-
|
16 |
-
public function editAction() {
|
17 |
-
$id = $this->getRequest()->getParam('id');
|
18 |
-
|
19 |
-
$model = Mage::getModel('categorytrans/categorytrans')->load($id);
|
20 |
-
|
21 |
-
if ($model->getId() || $id == 0) {
|
22 |
-
$data = Mage::getSingleton('adminhtml/session')->getFormData(true);
|
23 |
-
if (!empty($data)) {
|
24 |
-
$model->setData($data);
|
25 |
-
}
|
26 |
-
|
27 |
-
Mage::register('categorytrans_data', $model);
|
28 |
-
$this->loadLayout();
|
29 |
-
$this->_setActiveMenu('catalog/categorytrans');
|
30 |
-
|
31 |
-
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
32 |
-
|
33 |
-
$this->_addContent($this->getLayout()->createBlock('categorytrans/adminhtml_categorytrans_edit'));
|
34 |
-
|
35 |
-
$this->renderLayout();
|
36 |
-
} else {
|
37 |
-
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('categorytrans')->__('Item does not exist'));
|
38 |
-
$this->_redirect('*/*/');
|
39 |
-
}
|
40 |
-
}
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
public function newAction() {
|
46 |
-
$this->editAction();
|
47 |
-
}
|
48 |
-
|
49 |
-
public function saveAction() {
|
50 |
-
$id= $this->getRequest()->getParam('id');
|
51 |
-
|
52 |
-
$model= Mage::getModel('categorytrans/categorytrans');
|
53 |
-
|
54 |
-
if ($data = $this->getRequest()->getPost()) {
|
55 |
-
|
56 |
-
try {
|
57 |
-
|
58 |
-
$model->setData($data)->setId($id);
|
59 |
-
$model->save();
|
60 |
-
|
61 |
-
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('categorytrans')->__('Quantity Update Operation Perform successfully'));
|
62 |
-
|
63 |
-
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
64 |
-
|
65 |
-
$this->_redirect('*/*/');
|
66 |
-
return;
|
67 |
-
} catch (Exception $e) {
|
68 |
-
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
69 |
-
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
70 |
-
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
71 |
-
return;
|
72 |
-
}
|
73 |
-
}
|
74 |
-
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('categorytrans')->__('Unable to find item to save'));
|
75 |
-
$this->_redirect('*/*/');
|
76 |
-
}
|
77 |
-
public function deleteAction() {
|
78 |
-
if( $this->getRequest()->getParam('id') > 0 ) {
|
79 |
-
try {
|
80 |
-
$model = Mage::getModel('categorytrans/categorytrans');
|
81 |
-
|
82 |
-
$model->setId($this->getRequest()->getParam('id'))
|
83 |
-
->delete();
|
84 |
-
|
85 |
-
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));
|
86 |
-
$this->_redirect('*/*/');
|
87 |
-
} catch (Exception $e) {
|
88 |
-
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
89 |
-
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
90 |
-
}
|
91 |
-
}
|
92 |
-
$this->_redirect('*/*/');
|
93 |
-
}
|
94 |
-
public function getPresentQtyAction(){
|
95 |
-
$product_id = $this->getRequest()->getParam('product_id');
|
96 |
-
|
97 |
-
$model = Mage::getModel('catalog/product');
|
98 |
-
$_product = $model->load($product_id);
|
99 |
-
$stocklevel = (int)Mage::getModel('cataloginventory/stock_item')
|
100 |
-
->loadByProduct($_product)->getQty();
|
101 |
-
|
102 |
-
|
103 |
-
echo $stocklevel;
|
104 |
-
}
|
105 |
-
|
106 |
-
|
107 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Coolwear/Categorytrans/controllers/Adminhtml/StockcontrolController.php~
DELETED
@@ -1,129 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Futurtek_Stockcontrol_Adminhtml_StockcontrolController extends Mage_Adminhtml_Controller_action
|
4 |
-
{
|
5 |
-
public function indexAction() {
|
6 |
-
|
7 |
-
|
8 |
-
$this->loadLayout();
|
9 |
-
$this->_setActiveMenu('catalog/stockcontrol');
|
10 |
-
//$this->_addBreadcrumb($this->__('Manage Grouped Product Discount Rule'), $this->__('Discount'));
|
11 |
-
$this->_addContent($this->getLayout()->createBlock('stockcontrol/adminhtml_stockcontrol'));
|
12 |
-
$this->renderLayout();
|
13 |
-
|
14 |
-
}
|
15 |
-
|
16 |
-
public function editAction() {
|
17 |
-
$id = $this->getRequest()->getParam('id');
|
18 |
-
|
19 |
-
$model = Mage::getModel('stockcontrol/stockcontrol')->load($id);
|
20 |
-
|
21 |
-
if ($model->getId() || $id == 0) {
|
22 |
-
$data = Mage::getSingleton('adminhtml/session')->getFormData(true);
|
23 |
-
if (!empty($data)) {
|
24 |
-
$model->setData($data);
|
25 |
-
}
|
26 |
-
|
27 |
-
Mage::register('stockcontrol_data', $model);
|
28 |
-
$this->loadLayout();
|
29 |
-
$this->_setActiveMenu('catalog/stockcontrol');
|
30 |
-
|
31 |
-
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
32 |
-
|
33 |
-
$this->_addContent($this->getLayout()->createBlock('stockcontrol/adminhtml_stockcontrol_edit'));
|
34 |
-
|
35 |
-
$this->renderLayout();
|
36 |
-
} else {
|
37 |
-
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('stockcontrol')->__('Item does not exist'));
|
38 |
-
$this->_redirect('*/*/');
|
39 |
-
}
|
40 |
-
}
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
public function newAction() {
|
46 |
-
$this->editAction();
|
47 |
-
}
|
48 |
-
|
49 |
-
public function saveAction() {
|
50 |
-
$id= $this->getRequest()->getParam('id');
|
51 |
-
|
52 |
-
$model= Mage::getModel('stockcontrol/stockcontrol');
|
53 |
-
|
54 |
-
if ($data = $this->getRequest()->getPost()) {
|
55 |
-
if($data['operation']=='Stock In'){
|
56 |
-
$total_qty=$data['present_qty']+$data['added_qty'];
|
57 |
-
}elseif($data['operation']=='Stock Out'){
|
58 |
-
if($data['present_qty']<='0'){
|
59 |
-
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('stockcontrol')->__('Quantity is less to perform Stock Out operation'));
|
60 |
-
$this->_redirect('*/*/');
|
61 |
-
}else{
|
62 |
-
$total_qty=$data['present_qty']-$data['added_qty'];
|
63 |
-
}
|
64 |
-
}
|
65 |
-
$model_product= Mage::getModel('catalog/product');
|
66 |
-
$_product = $model_product->load($data['product_id']);
|
67 |
-
$stockData = $_product->getStockData();
|
68 |
-
$stockData['qty'] = $total_qty;
|
69 |
-
$_product->setStockData($stockData);
|
70 |
-
$_product->save();
|
71 |
-
$user = Mage::getSingleton('admin/session')->getData();
|
72 |
-
$userId = $user['user']['user_id'];
|
73 |
-
$data['total_qty']=$total_qty;
|
74 |
-
$data['added_by']=$userId ;
|
75 |
-
// $stocklevel = (int)Mage::getModel('cataloginventory/stock_item')
|
76 |
-
// ->loadByProduct($_product)->getQty();
|
77 |
-
// echo $stocklevel;exit;
|
78 |
-
try {
|
79 |
-
|
80 |
-
$model->setData($data)->setId($id);
|
81 |
-
$model->save();
|
82 |
-
|
83 |
-
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('stockcontrol')->__('Quantity Update Operation Perform successfully'));
|
84 |
-
|
85 |
-
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
86 |
-
|
87 |
-
$this->_redirect('*/*/');
|
88 |
-
return;
|
89 |
-
} catch (Exception $e) {
|
90 |
-
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
91 |
-
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
92 |
-
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
93 |
-
return;
|
94 |
-
}
|
95 |
-
}
|
96 |
-
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('stockcontrol')->__('Unable to find item to save'));
|
97 |
-
$this->_redirect('*/*/');
|
98 |
-
}
|
99 |
-
public function deleteAction() {
|
100 |
-
if( $this->getRequest()->getParam('id') > 0 ) {
|
101 |
-
try {
|
102 |
-
$model = Mage::getModel('stockcontrol/stockcontrol');
|
103 |
-
|
104 |
-
$model->setId($this->getRequest()->getParam('id'))
|
105 |
-
->delete();
|
106 |
-
|
107 |
-
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));
|
108 |
-
$this->_redirect('*/*/');
|
109 |
-
} catch (Exception $e) {
|
110 |
-
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
111 |
-
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
112 |
-
}
|
113 |
-
}
|
114 |
-
$this->_redirect('*/*/');
|
115 |
-
}
|
116 |
-
public function getPresentQtyAction(){
|
117 |
-
$product_id = $this->getRequest()->getParam('product_id');
|
118 |
-
|
119 |
-
$model = Mage::getModel('catalog/product');
|
120 |
-
$_product = $model->load($product_id);
|
121 |
-
$stocklevel = (int)Mage::getModel('cataloginventory/stock_item')
|
122 |
-
->loadByProduct($_product)->getQty();
|
123 |
-
|
124 |
-
|
125 |
-
echo $stocklevel;
|
126 |
-
}
|
127 |
-
|
128 |
-
|
129 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Coolwear/Categorytrans/controllers/Adminhtml/StockcontrolController_bkp21may2012.php
DELETED
@@ -1,120 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Futurtek_Stockcontrol_Adminhtml_StockcontrolController extends Mage_Adminhtml_Controller_action
|
4 |
-
{
|
5 |
-
public function indexAction() {
|
6 |
-
|
7 |
-
|
8 |
-
$this->loadLayout();
|
9 |
-
$this->_setActiveMenu('catalog/stockcontrol');
|
10 |
-
//$this->_addBreadcrumb($this->__('Manage Grouped Product Discount Rule'), $this->__('Discount'));
|
11 |
-
$this->_addContent($this->getLayout()->createBlock('stockcontrol/adminhtml_stockcontrol'));
|
12 |
-
$this->renderLayout();
|
13 |
-
|
14 |
-
}
|
15 |
-
|
16 |
-
public function editAction() {
|
17 |
-
$id = $this->getRequest()->getParam('id');
|
18 |
-
|
19 |
-
$model = Mage::getModel('stockcontrol/stockcontrol')->load($id);
|
20 |
-
|
21 |
-
if ($model->getId() || $id == 0) {
|
22 |
-
$data = Mage::getSingleton('adminhtml/session')->getFormData(true);
|
23 |
-
if (!empty($data)) {
|
24 |
-
$model->setData($data);
|
25 |
-
}
|
26 |
-
|
27 |
-
Mage::register('stockcontrol_data', $model);
|
28 |
-
$this->loadLayout();
|
29 |
-
$this->_setActiveMenu('catalog/stockcontrol');
|
30 |
-
|
31 |
-
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
32 |
-
|
33 |
-
$this->_addContent($this->getLayout()->createBlock('stockcontrol/adminhtml_stockcontrol_edit'));
|
34 |
-
|
35 |
-
$this->renderLayout();
|
36 |
-
} else {
|
37 |
-
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('stockcontrol')->__('Item does not exist'));
|
38 |
-
$this->_redirect('*/*/');
|
39 |
-
}
|
40 |
-
}
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
public function newAction() {
|
46 |
-
$this->editAction();
|
47 |
-
}
|
48 |
-
|
49 |
-
public function saveAction() {
|
50 |
-
$id= $this->getRequest()->getParam('id');
|
51 |
-
|
52 |
-
$model= Mage::getModel('stockcontrol/stockcontrol');
|
53 |
-
|
54 |
-
if ($data = $this->getRequest()->getPost()) {
|
55 |
-
$total_qty=$data['present_qty']+$data['added_qty'];
|
56 |
-
$model_product= Mage::getModel('catalog/product');
|
57 |
-
$_product = $model_product->load($data['product_id']);
|
58 |
-
$stockData = $_product->getStockData();
|
59 |
-
$stockData['qty'] = $total_qty;
|
60 |
-
$_product->setStockData($stockData);
|
61 |
-
$_product->save();
|
62 |
-
$user = Mage::getSingleton('admin/session')->getData();
|
63 |
-
$userId = $user['user']['user_id'];
|
64 |
-
$data['total_qty']=$total_qty;
|
65 |
-
$data['added_by']=$userId ;
|
66 |
-
// $stocklevel = (int)Mage::getModel('cataloginventory/stock_item')
|
67 |
-
// ->loadByProduct($_product)->getQty();
|
68 |
-
// echo $stocklevel;exit;
|
69 |
-
try {
|
70 |
-
|
71 |
-
$model->setData($data)->setId($id);
|
72 |
-
$model->save();
|
73 |
-
|
74 |
-
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('stockcontrol')->__('Item added successfully'));
|
75 |
-
|
76 |
-
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
77 |
-
|
78 |
-
$this->_redirect('*/*/');
|
79 |
-
return;
|
80 |
-
} catch (Exception $e) {
|
81 |
-
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
82 |
-
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
83 |
-
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
84 |
-
return;
|
85 |
-
}
|
86 |
-
}
|
87 |
-
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('stockcontrol')->__('Unable to find item to save'));
|
88 |
-
$this->_redirect('*/*/');
|
89 |
-
}
|
90 |
-
public function deleteAction() {
|
91 |
-
if( $this->getRequest()->getParam('id') > 0 ) {
|
92 |
-
try {
|
93 |
-
$model = Mage::getModel('stockcontrol/stockcontrol');
|
94 |
-
|
95 |
-
$model->setId($this->getRequest()->getParam('id'))
|
96 |
-
->delete();
|
97 |
-
|
98 |
-
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));
|
99 |
-
$this->_redirect('*/*/');
|
100 |
-
} catch (Exception $e) {
|
101 |
-
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
102 |
-
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
103 |
-
}
|
104 |
-
}
|
105 |
-
$this->_redirect('*/*/');
|
106 |
-
}
|
107 |
-
public function getPresentQtyAction(){
|
108 |
-
$product_id = $this->getRequest()->getParam('product_id');
|
109 |
-
|
110 |
-
$model = Mage::getModel('catalog/product');
|
111 |
-
$_product = $model->load($product_id);
|
112 |
-
$stocklevel = (int)Mage::getModel('cataloginventory/stock_item')
|
113 |
-
->loadByProduct($_product)->getQty();
|
114 |
-
|
115 |
-
|
116 |
-
echo $stocklevel;
|
117 |
-
}
|
118 |
-
|
119 |
-
|
120 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Coolwear/Categorytrans/etc/config.xml~
DELETED
@@ -1,76 +0,0 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<config>
|
3 |
-
<modules>
|
4 |
-
<Futurtek_Stockcontrol>
|
5 |
-
<version>0.1.0</version>
|
6 |
-
</Futurtek_Stockcontrol>
|
7 |
-
</modules>
|
8 |
-
<admin>
|
9 |
-
<routers>
|
10 |
-
<stockcontrol>
|
11 |
-
<use>admin</use>
|
12 |
-
<args>
|
13 |
-
<module>Futurtek_Stockcontrol</module>
|
14 |
-
<frontName>stockcontrol</frontName>
|
15 |
-
</args>
|
16 |
-
</stockcontrol>
|
17 |
-
</routers>
|
18 |
-
</admin>
|
19 |
-
|
20 |
-
<adminhtml>
|
21 |
-
<menu>
|
22 |
-
<catalog>
|
23 |
-
<children>
|
24 |
-
<stockcontrol translate="title" module="stockcontrol">
|
25 |
-
<title>Stock Control</title>
|
26 |
-
<sort_order>5</sort_order>
|
27 |
-
<action>stockcontrol/adminhtml_stockcontrol</action>
|
28 |
-
</stockcontrol>
|
29 |
-
</children>
|
30 |
-
</catalog>
|
31 |
-
</menu>
|
32 |
-
|
33 |
-
<acl>
|
34 |
-
<resources>
|
35 |
-
<admin>
|
36 |
-
<children>
|
37 |
-
<catalog>
|
38 |
-
<children>
|
39 |
-
<stockcontrol translate="title">
|
40 |
-
<title>Stock Control</title>
|
41 |
-
<sort_order>1600</sort_order>
|
42 |
-
</stockcontrol>
|
43 |
-
</children>
|
44 |
-
</catalog>
|
45 |
-
</children>
|
46 |
-
</admin>
|
47 |
-
</resources>
|
48 |
-
</acl>
|
49 |
-
</adminhtml>
|
50 |
-
|
51 |
-
<global>
|
52 |
-
<resources>
|
53 |
-
<stockcontrol_write>
|
54 |
-
<connection>
|
55 |
-
<use>core_write</use>
|
56 |
-
</connection>
|
57 |
-
</stockcontrol_write>
|
58 |
-
<stockcontrol_read>
|
59 |
-
<connection>
|
60 |
-
<use>core_read</use>
|
61 |
-
</connection>
|
62 |
-
</stockcontrol_read>
|
63 |
-
</resources>
|
64 |
-
<blocks>
|
65 |
-
<stockcontrol>
|
66 |
-
<class>Futurtek_Stockcontrol_Block</class>
|
67 |
-
</stockcontrol>
|
68 |
-
</blocks>
|
69 |
-
<helpers>
|
70 |
-
<stockcontrol>
|
71 |
-
<class>Futurtek_Stockcontrol_Helper</class>
|
72 |
-
</stockcontrol>
|
73 |
-
</helpers>
|
74 |
-
</global>
|
75 |
-
|
76 |
-
</config>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Coolwear/Categorytrans/sql/categorytrans_setup/mysql4-install-0.1.0.php~
DELETED
@@ -1,21 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
$installer = $this;
|
4 |
-
|
5 |
-
$installer->startSetup();
|
6 |
-
|
7 |
-
$installer->run("
|
8 |
-
|
9 |
-
|
10 |
-
CREATE TABLE stockcontrol(
|
11 |
-
`stock_id` int(11) unsigned NOT NULL auto_increment,
|
12 |
-
`product_id` int(11) unsigned NOT NULL,
|
13 |
-
`present_qty` varchar(255) NOT NULL default '',
|
14 |
-
`added_qty` varchar(255) NOT NULL default '',
|
15 |
-
`qty_added_date` varchar(255) NOT NULL default '',
|
16 |
-
PRIMARY KEY (`stock_id`)
|
17 |
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
18 |
-
|
19 |
-
");
|
20 |
-
|
21 |
-
$installer->endSetup();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Coolwear/Importproduct/Model/Observer.php~
DELETED
@@ -1,360 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Coolwear_Importproduct_Model_Observer
|
4 |
-
{
|
5 |
-
|
6 |
-
|
7 |
-
/**
|
8 |
-
* Flag to stop observer executing more than once
|
9 |
-
*
|
10 |
-
* @var static bool
|
11 |
-
*/
|
12 |
-
|
13 |
-
/**
|
14 |
-
* This method will run when the product is saved from the Magento Admin
|
15 |
-
* Use this function to update the product model, process the
|
16 |
-
* data or anything you like
|
17 |
-
*
|
18 |
-
* @param Varien_Event_Observer $observer
|
19 |
-
*/
|
20 |
-
|
21 |
-
|
22 |
-
public function importProductCoolwear(){
|
23 |
-
$flag=true;
|
24 |
-
$i=0;
|
25 |
-
$product_array=array();
|
26 |
-
$category_array=array();
|
27 |
-
$configurable_attribute = "variation"; $attr_id = 132;
|
28 |
-
$importDir = Mage::getBaseDir('media') . DS . 'import/';
|
29 |
-
$contents = file_get_contents ("http://devilwear.co.uk/store/feeds/es_edirectory.txt");
|
30 |
-
//$contents = file_get_contents ("my.txt");
|
31 |
-
$lines = explode("##,", $contents);
|
32 |
-
foreach($lines as $line) {
|
33 |
-
|
34 |
-
|
35 |
-
$result =str_getcsv($line, ",", "\"");
|
36 |
-
|
37 |
-
//if(($result['33']=='Jeans & Trousers')&&($result['32']=='Mens')){
|
38 |
-
$sub_category_model = Mage::getModel('categorytrans/categorytrans')->getCollection()->addFieldToFilter('english', array('eq' => $result['33']));
|
39 |
-
foreach ($sub_category_model as $sub_category_dtl)
|
40 |
-
$sub_category_id=$sub_category_dtl['category_id'];
|
41 |
-
|
42 |
-
array_push($category_array, $sub_category_id);
|
43 |
-
//$category_array.push($sub_category_id);
|
44 |
-
//print_r($result);
|
45 |
-
try{
|
46 |
-
$translate_model = Mage::getModel('categorytrans/categorytrans')->getCollection()->addFieldToFilter('english ', array('eq' => $result['32']));
|
47 |
-
foreach ($translate_model as $translate_dtl){
|
48 |
-
$translate_dtl['category_id'];
|
49 |
-
array_push($category_array,$translate_dtl['category_id']);
|
50 |
-
|
51 |
-
if($translate_dtl['category_id']){
|
52 |
-
$cProduct = Mage::getModel('catalog/product');
|
53 |
-
$exchange_rate=9.5;
|
54 |
-
$name=basename($result['12']);
|
55 |
-
|
56 |
-
$name = explode(".", $name);
|
57 |
-
$finalprice=$result['20']*$exchange_rate;
|
58 |
-
if($result['3']){
|
59 |
-
$conf_attribute =$result['3'];
|
60 |
-
$conf_attribute = explode("-",$conf_attribute);
|
61 |
-
//echo 'conf'.$conf_attribute['0'];
|
62 |
-
foreach ($conf_attribute as $value) {
|
63 |
-
$variation_id = $this->attributeValueExists('variation',$value);
|
64 |
-
if($variation_id)
|
65 |
-
{
|
66 |
-
|
67 |
-
}else{
|
68 |
-
$variation_id = $this->addAttributeValue('variation',$value);
|
69 |
-
}
|
70 |
-
|
71 |
-
|
72 |
-
$image_name=basename($result['12']);
|
73 |
-
$mediaArray = array(
|
74 |
-
'thumbnail' =>$result['12'],
|
75 |
-
'small_image' =>$result['12'],
|
76 |
-
'image' =>$result['12'],
|
77 |
-
);
|
78 |
-
/*create Simple Product*/
|
79 |
-
$sProduct = Mage::getModel('catalog/product');
|
80 |
-
|
81 |
-
$productId = $sProduct->getIdBySku($result['0'].'/'.$value);
|
82 |
-
|
83 |
-
if($productId){
|
84 |
-
$_product = $sProduct->load($productId );
|
85 |
-
$stockData = $_product->getStockData();
|
86 |
-
$stockData['qty'] = $result['25'];
|
87 |
-
$stockData['is_in_stock'] = 1;
|
88 |
-
$_product->setStockData($stockData);
|
89 |
-
$_product->save();
|
90 |
-
}else{
|
91 |
-
|
92 |
-
$sProduct ->setTypeId(Mage_Catalog_Model_Product_Type::TYPE_SIMPLE) ->setWebsiteIds(array(1)) ->setStatus(Mage_Catalog_Model_Product_Status::STATUS_ENABLED) ->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE)
|
93 |
-
->setTaxClassId(0)
|
94 |
-
->setAttributeSetId(4)
|
95 |
-
|
96 |
-
// Populated further up the script
|
97 |
-
->setSku($result['0'].'/'.$value)
|
98 |
-
// $main_product_data is an array created as part of a wider foreach loop, which this code is inside of
|
99 |
-
->setName($result['1'])
|
100 |
-
->setShortDescription($result['1'])
|
101 |
-
->setDescription($result['2'])
|
102 |
-
->setCost(sprintf("%0.0f", $result['20']))
|
103 |
-
->setPrice(sprintf("%0.0f", $finalprice))
|
104 |
-
->setCategoryIds($category_array) ->setData($configurable_attribute,$variation_id) ; // Set the stock data. Let Magento handle this as opposed to manually creating a cataloginventory/stock_item model..
|
105 |
-
|
106 |
-
$sProduct->setStockData(array( 'is_in_stock' => 1, 'qty' => $result['25'] )); $sProduct->save();
|
107 |
-
|
108 |
-
// Store some data for later once we've created the configurable product, so we can // associate this simple product to it later..
|
109 |
-
/*creating configure product*/
|
110 |
-
$cProduct = Mage::getModel('catalog/product');
|
111 |
-
|
112 |
-
$configureProductId =$cProduct->getIdBySku($result['0']);
|
113 |
-
if($configureProductId){
|
114 |
-
$this->addToConfigurable($configureProductId,$sProduct->getId());
|
115 |
-
}
|
116 |
-
else{
|
117 |
-
$cProduct->setTypeId(Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) ->setTaxClassId(1)
|
118 |
-
->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH) ->setStatus(Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
|
119 |
-
->setTaxClassId(0)
|
120 |
-
->setWebsiteIds(array(1))
|
121 |
-
->setAttributeSetId(4) // You can determine this another way if you need to.
|
122 |
-
->setCategoryIds($category_array)
|
123 |
-
->setSku($result['0'])
|
124 |
-
->setName($result['1'])
|
125 |
-
->setShortDescription($result['1'])
|
126 |
-
->setDescription($result['2'])
|
127 |
-
->setCost(sprintf("%0.0f", $result['20']))
|
128 |
-
->setPrice(sprintf("%0.0f", $finalprice))
|
129 |
-
//->setUrlKey($name['0'])
|
130 |
-
->setData($configurable_attribute,$variation_id)
|
131 |
-
->setCreatedAt(strtotime('now'));
|
132 |
-
$img =$result['12'];
|
133 |
-
/*creating image from url save it to given path*/
|
134 |
-
$fullpath = $importDir.$image_name;
|
135 |
-
|
136 |
-
$ch = curl_init ($img);
|
137 |
-
|
138 |
-
curl_setopt($ch, CURLOPT_HEADER, 0);
|
139 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
140 |
-
curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);
|
141 |
-
$rawdata=curl_exec($ch);
|
142 |
-
curl_close ($ch);
|
143 |
-
if(file_exists($fullpath)){
|
144 |
-
unlink($fullpath);
|
145 |
-
}
|
146 |
-
|
147 |
-
$fp = fopen($fullpath,'x');
|
148 |
-
fwrite($fp, $rawdata);
|
149 |
-
fclose($fp);
|
150 |
-
foreach($mediaArray as $imageType => $fileName) {
|
151 |
-
|
152 |
-
if ( file_exists($fullpath) ) {
|
153 |
-
$cProduct->addImageToMediaGallery($fullpath, $imageType, false);
|
154 |
-
|
155 |
-
}
|
156 |
-
}
|
157 |
-
//
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
$cProduct->setStockData(array( 'use_config_manage_stock' => 1, 'is_in_stock' => 1, 'is_salable' => 1 ,'qty' =>$result['25']));
|
162 |
-
$cProduct->setCanSaveConfigurableAttributes(true);
|
163 |
-
$cProduct->setCanSaveCustomOptions(true);
|
164 |
-
$cProductTypeInstance = $cProduct->getTypeInstance();
|
165 |
-
$cProductTypeInstance->setUsedProductAttributeIds(array($_attributeIds[$configurable_attribute]));
|
166 |
-
// Now we need to get the information back in Magento's own format, and add bits of data to what it gives us..
|
167 |
-
$data = array('0'=>array('id'=>NULL,'label'=>'Variation','position'=> NULL,
|
168 |
-
'values'=>array('0'=>
|
169 |
-
array('value_index'=>$conf_attribute['0'],'label'=>$conf_attribute['0'],'is_percent'=>0,
|
170 |
-
'pricing_value'=>'0',
|
171 |
-
'attribute_id'=> $attr_id),
|
172 |
-
),
|
173 |
-
'attribute_id'=> $attr_id,'attribute_code'=>'variation','frontend_label'=>'Variation',
|
174 |
-
'html_id'=>'config_super_product__attribute_0')
|
175 |
-
);
|
176 |
-
$cProduct->setConfigurableAttributesData($data);
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
// $cProduct->setConfigurableProductsData($data);
|
182 |
-
$cProduct->save();
|
183 |
-
$this->addToConfigurable($cProduct->getId(),$sProduct->getId());
|
184 |
-
}
|
185 |
-
|
186 |
-
|
187 |
-
}
|
188 |
-
|
189 |
-
}
|
190 |
-
}else{
|
191 |
-
$cProduct = Mage::getModel('catalog/product');
|
192 |
-
$simpleproductId = $cProduct->getIdBySku($result['0']);
|
193 |
-
if($simpleproductId){
|
194 |
-
$_product = $cProduct->load($simpleproductId );
|
195 |
-
$stockData = $_product->getStockData();
|
196 |
-
$stockData['qty'] = $result['25'];
|
197 |
-
$stockData['is_in_stock'] = 1;
|
198 |
-
$_product->setStockData($stockData);
|
199 |
-
$_product->save();
|
200 |
-
|
201 |
-
|
202 |
-
}else{
|
203 |
-
$image_name=basename($result['12']);
|
204 |
-
$mediaArray = array(
|
205 |
-
'thumbnail' =>$result['12'],
|
206 |
-
'small_image' =>$result['12'],
|
207 |
-
'image' =>$result['12'],
|
208 |
-
);
|
209 |
-
// Remove unset images, add image to gallery if exists
|
210 |
-
|
211 |
-
|
212 |
-
$cProduct->setTypeId('simple')
|
213 |
-
->setTaxClassId(0)
|
214 |
-
->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH) ->setStatus(Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
|
215 |
-
->setWebsiteIds(array(1))
|
216 |
-
->setAttributeSetId(4) // You can determine this another way if you need to.
|
217 |
-
->setCategoryIds($category_array)
|
218 |
-
->setSku($result['0'])
|
219 |
-
->setName($name['0'])
|
220 |
-
->setShortDescription($result['1'])
|
221 |
-
->setDescription($result['2'])
|
222 |
-
->setCost(sprintf("%0.0f", $result['20']))
|
223 |
-
->setPrice(sprintf("%0.0f", $finalprice))
|
224 |
-
//->setUrlKey($name['0'])
|
225 |
-
->setStockData(array(
|
226 |
-
'is_in_stock' => 1,
|
227 |
-
'qty' =>$result['25']
|
228 |
-
))
|
229 |
-
->setCreatedAt(strtotime('now'));
|
230 |
-
$img =$result['12'];
|
231 |
-
|
232 |
-
$fullpath = $importDir.$image_name;
|
233 |
-
/*creating image from url save it to given path*/
|
234 |
-
$ch = curl_init ($img);
|
235 |
-
|
236 |
-
curl_setopt($ch, CURLOPT_HEADER, 0);
|
237 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
238 |
-
curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);
|
239 |
-
$rawdata=curl_exec($ch);
|
240 |
-
curl_close ($ch);
|
241 |
-
if(file_exists($fullpath)){
|
242 |
-
unlink($fullpath);
|
243 |
-
}
|
244 |
-
|
245 |
-
$fp = fopen($fullpath,'x');
|
246 |
-
fwrite($fp, $rawdata);
|
247 |
-
fclose($fp);
|
248 |
-
foreach($mediaArray as $imageType => $fileName) {
|
249 |
-
|
250 |
-
if ( file_exists($fullpath) ) {
|
251 |
-
$cProduct->addImageToMediaGallery($fullpath, $imageType, false);
|
252 |
-
|
253 |
-
}
|
254 |
-
}
|
255 |
-
|
256 |
-
$cProduct->save();
|
257 |
-
}
|
258 |
-
}
|
259 |
-
|
260 |
-
}
|
261 |
-
}
|
262 |
-
}catch(Exception $e){
|
263 |
-
Mage::log('Product Import Error: '.$e->getMessage().' '.$e->getTraceAsString() , null, 'productImport.log');
|
264 |
-
}
|
265 |
-
|
266 |
-
//}//my if block
|
267 |
-
|
268 |
-
}
|
269 |
-
|
270 |
-
|
271 |
-
}
|
272 |
-
|
273 |
-
/****************Checks Attribute Present or Not*************************/
|
274 |
-
public function attributeValueExists($arg_attribute, $arg_value)
|
275 |
-
{
|
276 |
-
$attribute_model = Mage::getModel('eav/entity_attribute');
|
277 |
-
$attribute_options_model= Mage::getModel('eav/entity_attribute_source_table') ;
|
278 |
-
|
279 |
-
$attribute_code = $attribute_model->getIdByCode('catalog_product', $arg_attribute);
|
280 |
-
$attribute = $attribute_model->load($attribute_code);
|
281 |
-
|
282 |
-
$attribute_table = $attribute_options_model->setAttribute($attribute);
|
283 |
-
$options = $attribute_options_model->getAllOptions(false);
|
284 |
-
|
285 |
-
foreach($options as $option)
|
286 |
-
{
|
287 |
-
if ($option['label'] == $arg_value)
|
288 |
-
{
|
289 |
-
return $option['value'];
|
290 |
-
}
|
291 |
-
}
|
292 |
-
|
293 |
-
return false;
|
294 |
-
}
|
295 |
-
|
296 |
-
/****************Add Attribute If not Present*************************/
|
297 |
-
public function addAttributeValue($arg_attribute, $arg_value)
|
298 |
-
{
|
299 |
-
$attribute_model = Mage::getModel('eav/entity_attribute');
|
300 |
-
$attribute_options_model= Mage::getModel('eav/entity_attribute_source_table') ;
|
301 |
-
|
302 |
-
$attribute_code = $attribute_model->getIdByCode('catalog_product', $arg_attribute);
|
303 |
-
$attribute = $attribute_model->load($attribute_code);
|
304 |
-
|
305 |
-
$attribute_table = $attribute_options_model->setAttribute($attribute);
|
306 |
-
$options = $attribute_options_model->getAllOptions(false);
|
307 |
-
|
308 |
-
if(!$this->attributeValueExists($arg_attribute, $arg_value))
|
309 |
-
{
|
310 |
-
$value['option'] = array($arg_value,$arg_value);
|
311 |
-
$result = array('value' => $value);
|
312 |
-
$attribute->setData('option',$result);
|
313 |
-
$attribute->save();
|
314 |
-
}
|
315 |
-
|
316 |
-
foreach($options as $option)
|
317 |
-
{
|
318 |
-
if ($option['label'] == $arg_value)
|
319 |
-
{
|
320 |
-
return $option['value'];
|
321 |
-
}
|
322 |
-
}
|
323 |
-
return true;
|
324 |
-
}
|
325 |
-
|
326 |
-
/****************Fetch Attribute Value*************************/
|
327 |
-
public function getAttributeValue($arg_attribute, $arg_option_id)
|
328 |
-
{
|
329 |
-
$attribute_model = Mage::getModel('eav/entity_attribute');
|
330 |
-
$attribute_table = Mage::getModel('eav/entity_attribute_source_table');
|
331 |
-
|
332 |
-
$attribute_code = $attribute_model->getIdByCode('catalog_product', $arg_attribute);
|
333 |
-
$attribute = $attribute_model->load($attribute_code);
|
334 |
-
|
335 |
-
$attribute_table->setAttribute($attribute);
|
336 |
-
|
337 |
-
$option = $attribute_table->getOptionText($arg_option_id);
|
338 |
-
|
339 |
-
return $option;
|
340 |
-
}
|
341 |
-
|
342 |
-
/**************Mapping Simple Product to Configure Product*********************/
|
343 |
-
public function addToConfigurable($config_product_id, $simple_product_id)
|
344 |
-
{
|
345 |
-
$config_product = Mage::getModel('catalog/product') -> load($config_product_id);
|
346 |
-
$new_ids = array();
|
347 |
-
$current_ids = $config_product -> getTypeInstance() -> getUsedProductIds();
|
348 |
-
$current_ids[] = $simple_product_id;
|
349 |
-
$current_ids = array_unique($current_ids);
|
350 |
-
|
351 |
-
foreach($current_ids as $temp_id)
|
352 |
-
{
|
353 |
-
parse_str("position=", $new_ids[$temp_id]);
|
354 |
-
}
|
355 |
-
|
356 |
-
$config_product -> setConfigurableProductsData($new_ids) -> save();
|
357 |
-
}
|
358 |
-
|
359 |
-
|
360 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Coolwear/Importproduct/Model/Observer_bkp3sep2012.php
DELETED
@@ -1,138 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Coolwear_Importproduct_Model_Observer
|
4 |
-
{
|
5 |
-
|
6 |
-
|
7 |
-
/**
|
8 |
-
* Flag to stop observer executing more than once
|
9 |
-
*
|
10 |
-
* @var static bool
|
11 |
-
*/
|
12 |
-
|
13 |
-
/**
|
14 |
-
* This method will run when the product is saved from the Magento Admin
|
15 |
-
* Use this function to update the product model, process the
|
16 |
-
* data or anything you like
|
17 |
-
*
|
18 |
-
* @param Varien_Event_Observer $observer
|
19 |
-
*/
|
20 |
-
|
21 |
-
|
22 |
-
public function importProductCoolwear(){
|
23 |
-
$flag=true;
|
24 |
-
$i=0;
|
25 |
-
$product_array=array();
|
26 |
-
$contents = file_get_contents ("http://devilwear.co.uk/store/feeds/es_edirectory.txt");
|
27 |
-
$lines = explode("##,", $contents);
|
28 |
-
//$lines1 = array_shift($lines);
|
29 |
-
//print_r($lines1);exit;
|
30 |
-
foreach($lines as $line) {
|
31 |
-
|
32 |
-
|
33 |
-
$result =str_getcsv($line, ",", "\"");
|
34 |
-
|
35 |
-
//print_r($result);
|
36 |
-
$translate_model = Mage::getModel('categorytrans/categorytrans')->getCollection()->addFieldToFilter('english ', array('eq' => $result['32']));
|
37 |
-
foreach ($translate_model as $translate_dtl){
|
38 |
-
$translate_dtl['category_id'];
|
39 |
-
if($translate_dtl['category_id']){
|
40 |
-
|
41 |
-
$cProduct = Mage::getModel('catalog/product');
|
42 |
-
$exchange_rate=$cProduct->getExchangeRate();
|
43 |
-
$name=basename($result['12']);
|
44 |
-
$name = explode(".", $name);
|
45 |
-
if($result['3']){
|
46 |
-
|
47 |
-
// $cProduct ->setTypeId(Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) ->setTaxClassId(1)
|
48 |
-
// ->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH) ->setStatus(Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
|
49 |
-
// ->setWebsiteIds(array(1))
|
50 |
-
// ->setCategoryIds($translate_dtl['category_id'])
|
51 |
-
// ->setAttributeSetId(1) // You can determine this another way if you need to.
|
52 |
-
// ->setSku($result['0'])
|
53 |
-
// ->setName($name['0'])
|
54 |
-
// ->setShortDescription($result['1'])
|
55 |
-
// ->setDescription($result['2'])
|
56 |
-
// ->setPrice(sprintf("%0.2f", $result['20']))
|
57 |
-
// ->setUrlKey($name['0']) ;
|
58 |
-
// $cProduct->setCanSaveConfigurableAttributes(true);
|
59 |
-
// $cProduct->setCanSaveCustomOptions(true);
|
60 |
-
// $cProductTypeInstance = $cProduct->getTypeInstance();
|
61 |
-
// $cProductTypeInstance->setUsedProductAttributeIds(array($_attributeIds[$configurable_attribute]));
|
62 |
-
// $attributes_array = $cProductTypeInstance->getConfigurableAttributesAsArray(); foreach($attributes_array as $key => $attribute_array) { $attributes_array[$key]['use_default'] = 1;
|
63 |
-
// $attributes_array[$key]['position'] = 0;
|
64 |
-
// if (isset($attribute_array['frontend_label'])) {
|
65 |
-
// $attributes_array[$key]['label'] = $attribute_array['frontend_label']; } else { $attributes_array[$key]['label'] = $attribute_array['attribute_code']; }
|
66 |
-
// }
|
67 |
-
// //Add it back to the configurable product..
|
68 |
-
// $cProduct->setConfigurableAttributesData($attributes_array);
|
69 |
-
// //Remember that $simpleProducts array we created earlier? Now we need that data
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
}else{
|
74 |
-
$mediaArray = array(
|
75 |
-
'thumbnail' =>$result['12'],
|
76 |
-
'small_image' =>$result['12'],
|
77 |
-
'image' =>$result['12'],
|
78 |
-
);
|
79 |
-
// Remove unset images, add image to gallery if exists
|
80 |
-
$importDir = Mage::getBaseDir('media') . DS . 'import/';
|
81 |
-
$finalprice=$result['20']*$exchange_rate;
|
82 |
-
$cProduct->setTypeId('simple')
|
83 |
-
->setTaxClassId(1)
|
84 |
-
->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH) ->setStatus(Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
|
85 |
-
->setWebsiteIds(array(1))
|
86 |
-
->setCategoryIds($translate_dtl['category_id'])
|
87 |
-
->setAttributeSetId(4) // You can determine this another way if you need to.
|
88 |
-
->setSku($result['0'])
|
89 |
-
->setName($name['0'])
|
90 |
-
->setShortDescription($result['1'])
|
91 |
-
->setDescription($result['2'])
|
92 |
-
->setCost(sprintf("%0.2f", $result['20']))
|
93 |
-
->setPrice(sprintf("%0.2f", $finalprice))
|
94 |
-
->setUrlKey($name['0'])
|
95 |
-
->setStockData(array(
|
96 |
-
'is_in_stock' => 1,
|
97 |
-
'qty' =>$result['25']
|
98 |
-
))
|
99 |
-
->setCreatedAt(strtotime('now'));
|
100 |
-
$img =$result['12'];
|
101 |
-
|
102 |
-
$fullpath = $importDir.$name;
|
103 |
-
|
104 |
-
$ch = curl_init ($img);
|
105 |
-
|
106 |
-
curl_setopt($ch, CURLOPT_HEADER, 0);
|
107 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
108 |
-
curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);
|
109 |
-
$rawdata=curl_exec($ch);
|
110 |
-
curl_close ($ch);
|
111 |
-
if(file_exists($fullpath)){
|
112 |
-
unlink($fullpath);
|
113 |
-
}
|
114 |
-
|
115 |
-
$fp = fopen($fullpath,'x');
|
116 |
-
fwrite($fp, $rawdata);
|
117 |
-
fclose($fp);
|
118 |
-
foreach($mediaArray as $imageType => $fileName) {
|
119 |
-
|
120 |
-
if ( file_exists($fullpath) ) {
|
121 |
-
$cProduct->addImageToMediaGallery($fullpath, $imageType, false);
|
122 |
-
|
123 |
-
}
|
124 |
-
}
|
125 |
-
|
126 |
-
|
127 |
-
}
|
128 |
-
$cProduct->save();
|
129 |
-
}
|
130 |
-
}
|
131 |
-
|
132 |
-
|
133 |
-
}
|
134 |
-
//exit;
|
135 |
-
|
136 |
-
}
|
137 |
-
|
138 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Coolwear/Importproduct/Model/Observer_bkp5sep2012.php
DELETED
@@ -1,257 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Coolwear_Importproduct_Model_Observer
|
4 |
-
{
|
5 |
-
|
6 |
-
|
7 |
-
/**
|
8 |
-
* Flag to stop observer executing more than once
|
9 |
-
*
|
10 |
-
* @var static bool
|
11 |
-
*/
|
12 |
-
|
13 |
-
/**
|
14 |
-
* This method will run when the product is saved from the Magento Admin
|
15 |
-
* Use this function to update the product model, process the
|
16 |
-
* data or anything you like
|
17 |
-
*
|
18 |
-
* @param Varien_Event_Observer $observer
|
19 |
-
*/
|
20 |
-
|
21 |
-
|
22 |
-
public function importProductCoolwear(){
|
23 |
-
$flag=true;
|
24 |
-
$i=0;
|
25 |
-
$product_array=array();
|
26 |
-
$configurable_attribute = "variation"; $attr_id = 132;
|
27 |
-
$importDir = Mage::getBaseDir('media') . DS . 'import/';
|
28 |
-
$contents = file_get_contents ("http://devilwear.co.uk/store/feeds/es_edirectory.txt");
|
29 |
-
$lines = explode("##,", $contents);
|
30 |
-
|
31 |
-
//$lines1 = array_shift($lines);
|
32 |
-
//print_r($lines1);exit;
|
33 |
-
foreach($lines as $line) {
|
34 |
-
|
35 |
-
|
36 |
-
$result =str_getcsv($line, ",", "\"");
|
37 |
-
|
38 |
-
//print_r($result);
|
39 |
-
$translate_model = Mage::getModel('categorytrans/categorytrans')->getCollection()->addFieldToFilter('english ', array('eq' => $result['32']));
|
40 |
-
foreach ($translate_model as $translate_dtl){
|
41 |
-
$translate_dtl['category_id'];
|
42 |
-
if($translate_dtl['category_id']){
|
43 |
-
|
44 |
-
$cProduct = Mage::getModel('catalog/product');
|
45 |
-
$exchange_rate=9.5;
|
46 |
-
$name=basename($result['12']);
|
47 |
-
|
48 |
-
$name = explode(".", $name);
|
49 |
-
$finalprice=$result['20']*$exchange_rate;
|
50 |
-
if($result['3']){
|
51 |
-
|
52 |
-
$variation_id = $this->attributeValueExists('variation',$result['3']);
|
53 |
-
if(!$variation_id)
|
54 |
-
{
|
55 |
-
$variation_id = $this->addAttributeValue('variation',$result['3']);
|
56 |
-
}
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
$image_name=basename($result['12']);
|
61 |
-
$mediaArray = array(
|
62 |
-
'thumbnail' =>$result['12'],
|
63 |
-
'small_image' =>$result['12'],
|
64 |
-
'image' =>$result['12'],
|
65 |
-
);
|
66 |
-
$cProduct->setTypeId(Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) ->setTaxClassId(1)
|
67 |
-
->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH) ->setStatus(Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
|
68 |
-
->setWebsiteIds(array(1))
|
69 |
-
->setCategoryIds($translate_dtl['category_id'])
|
70 |
-
->setAttributeSetId(4) // You can determine this another way if you need to.
|
71 |
-
->setSku($result['0'])
|
72 |
-
->setName($name['0'])
|
73 |
-
->setShortDescription($result['1'])
|
74 |
-
->setDescription($result['2'])
|
75 |
-
->setCost(sprintf("%0.2f", $result['20']))
|
76 |
-
->setPrice(sprintf("%0.2f", $finalprice))
|
77 |
-
->setUrlKey($name['0'])
|
78 |
-
->setData($configurable_attribute,$variation_id)
|
79 |
-
->setCreatedAt(strtotime('now'));
|
80 |
-
$img =$result['12'];
|
81 |
-
|
82 |
-
$fullpath = $importDir.$image_name;
|
83 |
-
|
84 |
-
$ch = curl_init ($img);
|
85 |
-
|
86 |
-
curl_setopt($ch, CURLOPT_HEADER, 0);
|
87 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
88 |
-
curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);
|
89 |
-
$rawdata=curl_exec($ch);
|
90 |
-
curl_close ($ch);
|
91 |
-
if(file_exists($fullpath)){
|
92 |
-
unlink($fullpath);
|
93 |
-
}
|
94 |
-
|
95 |
-
$fp = fopen($fullpath,'x');
|
96 |
-
fwrite($fp, $rawdata);
|
97 |
-
fclose($fp);
|
98 |
-
foreach($mediaArray as $imageType => $fileName) {
|
99 |
-
|
100 |
-
if ( file_exists($fullpath) ) {
|
101 |
-
$cProduct->addImageToMediaGallery($fullpath, $imageType, false);
|
102 |
-
|
103 |
-
}
|
104 |
-
}
|
105 |
-
// $product_data = array('0'=>
|
106 |
-
// array('attribute_id'=>$attr_id,'label'=>$result['3'],'value_index'=>$result['3'],'is_percent'=>0,'pricing_value'=>'')
|
107 |
-
// );
|
108 |
-
|
109 |
-
//$cProduct->setConfigurableProductsData($product_data);
|
110 |
-
$data = array('0'=>array('id'=>NULL,'label'=>'Variation','position'=> NULL,
|
111 |
-
'values'=>array('0'=>
|
112 |
-
array('value_index'=>$result['3'],'label'=>$result['3'],'is_percent'=>0,
|
113 |
-
'pricing_value'=>'0','attribute_id'=> $attr_id),
|
114 |
-
),
|
115 |
-
'attribute_id'=> $attr_id,'attribute_code'=>'variation','frontend_label'=>'Variation',
|
116 |
-
'html_id'=>'config_super_product__attribute_0')
|
117 |
-
);
|
118 |
-
$cProduct->setConfigurableAttributesData($data);
|
119 |
-
$cProduct->setCanSaveConfigurableAttributes(1);
|
120 |
-
$cProduct->setStockData(array( 'use_config_manage_stock' => 1, 'is_in_stock' => 1, 'is_salable' => 1 ,'qty' =>$result['25']));
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
}/*else{
|
126 |
-
$image_name=basename($result['12']);
|
127 |
-
$mediaArray = array(
|
128 |
-
'thumbnail' =>$result['12'],
|
129 |
-
'small_image' =>$result['12'],
|
130 |
-
'image' =>$result['12'],
|
131 |
-
);
|
132 |
-
// Remove unset images, add image to gallery if exists
|
133 |
-
|
134 |
-
|
135 |
-
$cProduct->setTypeId('simple')
|
136 |
-
->setTaxClassId(0)
|
137 |
-
->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH) ->setStatus(Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
|
138 |
-
->setWebsiteIds(array(1))
|
139 |
-
->setCategoryIds($translate_dtl['category_id'])
|
140 |
-
->setAttributeSetId(4) // You can determine this another way if you need to.
|
141 |
-
->setSku($result['0'])
|
142 |
-
->setName($name['0'])
|
143 |
-
->setShortDescription($result['1'])
|
144 |
-
->setDescription($result['2'])
|
145 |
-
->setCost(sprintf("%0.2f", $result['20']))
|
146 |
-
->setPrice(sprintf("%0.2f", $finalprice))
|
147 |
-
->setUrlKey($name['0'])
|
148 |
-
->setStockData(array(
|
149 |
-
'is_in_stock' => 1,
|
150 |
-
'qty' =>$result['25']
|
151 |
-
))
|
152 |
-
->setCreatedAt(strtotime('now'));
|
153 |
-
$img =$result['12'];
|
154 |
-
|
155 |
-
$fullpath = $importDir.$image_name;
|
156 |
-
|
157 |
-
$ch = curl_init ($img);
|
158 |
-
|
159 |
-
curl_setopt($ch, CURLOPT_HEADER, 0);
|
160 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
161 |
-
curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);
|
162 |
-
$rawdata=curl_exec($ch);
|
163 |
-
curl_close ($ch);
|
164 |
-
if(file_exists($fullpath)){
|
165 |
-
unlink($fullpath);
|
166 |
-
}
|
167 |
-
|
168 |
-
$fp = fopen($fullpath,'x');
|
169 |
-
fwrite($fp, $rawdata);
|
170 |
-
fclose($fp);
|
171 |
-
foreach($mediaArray as $imageType => $fileName) {
|
172 |
-
|
173 |
-
if ( file_exists($fullpath) ) {
|
174 |
-
$cProduct->addImageToMediaGallery($fullpath, $imageType, false);
|
175 |
-
|
176 |
-
}
|
177 |
-
}
|
178 |
-
|
179 |
-
|
180 |
-
}*/
|
181 |
-
$cProduct->save();
|
182 |
-
}
|
183 |
-
}
|
184 |
-
|
185 |
-
|
186 |
-
}
|
187 |
-
|
188 |
-
|
189 |
-
}
|
190 |
-
|
191 |
-
public function attributeValueExists($arg_attribute, $arg_value)
|
192 |
-
{
|
193 |
-
$attribute_model = Mage::getModel('eav/entity_attribute');
|
194 |
-
$attribute_options_model= Mage::getModel('eav/entity_attribute_source_table') ;
|
195 |
-
|
196 |
-
$attribute_code = $attribute_model->getIdByCode('catalog_product', $arg_attribute);
|
197 |
-
$attribute = $attribute_model->load($attribute_code);
|
198 |
-
|
199 |
-
$attribute_table = $attribute_options_model->setAttribute($attribute);
|
200 |
-
$options = $attribute_options_model->getAllOptions(false);
|
201 |
-
|
202 |
-
foreach($options as $option)
|
203 |
-
{
|
204 |
-
if ($option['label'] == $arg_value)
|
205 |
-
{
|
206 |
-
return $option['value'];
|
207 |
-
}
|
208 |
-
}
|
209 |
-
|
210 |
-
return false;
|
211 |
-
}
|
212 |
-
|
213 |
-
public function addAttributeValue($arg_attribute, $arg_value)
|
214 |
-
{
|
215 |
-
$attribute_model = Mage::getModel('eav/entity_attribute');
|
216 |
-
$attribute_options_model= Mage::getModel('eav/entity_attribute_source_table') ;
|
217 |
-
|
218 |
-
$attribute_code = $attribute_model->getIdByCode('catalog_product', $arg_attribute);
|
219 |
-
$attribute = $attribute_model->load($attribute_code);
|
220 |
-
|
221 |
-
$attribute_table = $attribute_options_model->setAttribute($attribute);
|
222 |
-
$options = $attribute_options_model->getAllOptions(false);
|
223 |
-
|
224 |
-
if(!$this->attributeValueExists($arg_attribute, $arg_value))
|
225 |
-
{
|
226 |
-
$value['option'] = array($arg_value,$arg_value);
|
227 |
-
$result = array('value' => $value);
|
228 |
-
$attribute->setData('option',$result);
|
229 |
-
$attribute->save();
|
230 |
-
}
|
231 |
-
|
232 |
-
foreach($options as $option)
|
233 |
-
{
|
234 |
-
if ($option['label'] == $arg_value)
|
235 |
-
{
|
236 |
-
return $option['value'];
|
237 |
-
}
|
238 |
-
}
|
239 |
-
return true;
|
240 |
-
}
|
241 |
-
public function getAttributeValue($arg_attribute, $arg_option_id)
|
242 |
-
{
|
243 |
-
$attribute_model = Mage::getModel('eav/entity_attribute');
|
244 |
-
$attribute_table = Mage::getModel('eav/entity_attribute_source_table');
|
245 |
-
|
246 |
-
$attribute_code = $attribute_model->getIdByCode('catalog_product', $arg_attribute);
|
247 |
-
$attribute = $attribute_model->load($attribute_code);
|
248 |
-
|
249 |
-
$attribute_table->setAttribute($attribute);
|
250 |
-
|
251 |
-
$option = $attribute_table->getOptionText($arg_option_id);
|
252 |
-
|
253 |
-
return $option;
|
254 |
-
}
|
255 |
-
|
256 |
-
|
257 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Coolwear/Importproduct/etc/config.xml
DELETED
@@ -1,33 +0,0 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<config>
|
3 |
-
<modules>
|
4 |
-
<Coolwear_Importproduct>
|
5 |
-
<version>0.1.0</version>
|
6 |
-
</Coolwear_Importproduct>
|
7 |
-
</modules>
|
8 |
-
<global>
|
9 |
-
<models>
|
10 |
-
<importproduct>
|
11 |
-
<class>Coolwear_Importproduct_Model</class>
|
12 |
-
</importproduct>
|
13 |
-
</models>
|
14 |
-
<!--<events>
|
15 |
-
<checkout_cart_product_add_after>
|
16 |
-
<observers>
|
17 |
-
<coolwear_importproduct>
|
18 |
-
<class>Coolwear_Importproduct_Model_Observer</class>
|
19 |
-
<method>importProductCoolwear</method>
|
20 |
-
</coolwear_importproduct>
|
21 |
-
</observers>
|
22 |
-
</checkout_cart_product_add_after>
|
23 |
-
</events>-->
|
24 |
-
</global>
|
25 |
-
<crontab>
|
26 |
-
<jobs>
|
27 |
-
<coolwear_importproduct>
|
28 |
-
<schedule><cron_expr>0 20 * * *</cron_expr></schedule>
|
29 |
-
<run><model>importproduct/observer::importProductCoolwear</model></run>
|
30 |
-
</coolwear_importproduct>
|
31 |
-
</jobs>
|
32 |
-
</crontab>
|
33 |
-
</config>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Coolwear/Importproduct/etc/config.xml~
DELETED
@@ -1,33 +0,0 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<config>
|
3 |
-
<modules>
|
4 |
-
<Coolwear_Importproduct>
|
5 |
-
<version>0.1.0</version>
|
6 |
-
</Coolwear_Importproduct>
|
7 |
-
</modules>
|
8 |
-
<global>
|
9 |
-
<models>
|
10 |
-
<importproduct>
|
11 |
-
<class>Coolwear_Importproduct_Model</class>
|
12 |
-
</importproduct>
|
13 |
-
</models>
|
14 |
-
<events>
|
15 |
-
<checkout_cart_product_add_after>
|
16 |
-
<observers>
|
17 |
-
<coolwear_importproduct>
|
18 |
-
<class>Coolwear_Importproduct_Model_Observer</class>
|
19 |
-
<method>importProductCoolwear</method>
|
20 |
-
</coolwear_importproduct>
|
21 |
-
</observers>
|
22 |
-
</checkout_cart_product_add_after>
|
23 |
-
</events>
|
24 |
-
</global>
|
25 |
-
<!-- <crontab>
|
26 |
-
<jobs>
|
27 |
-
<coolwear_importproduct>
|
28 |
-
<schedule><cron_expr>0 20 * * *</cron_expr></schedule>
|
29 |
-
<run><model>importproduct/observer::importProductCoolwear</model></run>
|
30 |
-
</coolwear_importproduct>
|
31 |
-
</jobs>
|
32 |
-
</crontab>-->
|
33 |
-
</config>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Coolwear/Productimport/Block/Adminhtml/Productimport.php
DELETED
@@ -1,12 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Coolwear_Productimport_Block_Adminhtml_Web extends Mage_Adminhtml_Block_Widget_Grid_Container
|
3 |
-
{
|
4 |
-
public function __construct()
|
5 |
-
{
|
6 |
-
$this->_controller = 'adminhtml_productimport';
|
7 |
-
$this->_blockGroup = 'productimport';
|
8 |
-
$this->_headerText = Mage::helper('productimport')->__('Import Products');
|
9 |
-
$this->_addButtonLabel = Mage::helper('productimport')->__('Check Import');
|
10 |
-
parent::__construct();
|
11 |
-
}
|
12 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Coolwear/Productimport/Block/Adminhtml/Productimport.php~
DELETED
@@ -1,12 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Company_Web_Block_Adminhtml_Web extends Mage_Adminhtml_Block_Widget_Grid_Container
|
3 |
-
{
|
4 |
-
public function __construct()
|
5 |
-
{
|
6 |
-
$this->_controller = 'adminhtml_web';
|
7 |
-
$this->_blockGroup = 'web';
|
8 |
-
$this->_headerText = Mage::helper('web')->__('Manage Our Products');
|
9 |
-
$this->_addButtonLabel = Mage::helper('web')->__('Add Item here');
|
10 |
-
parent::__construct();
|
11 |
-
}
|
12 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Coolwear/Productimport/Block/Adminhtml/_Productimport/Edit.php
DELETED
@@ -1,45 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Company_Web_Block_Adminhtml_Web_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
4 |
-
{
|
5 |
-
public function __construct()
|
6 |
-
{
|
7 |
-
parent::__construct();
|
8 |
-
|
9 |
-
$this->_objectId = 'id';
|
10 |
-
$this->_blockGroup = 'web';
|
11 |
-
$this->_controller = 'adminhtml_web';
|
12 |
-
|
13 |
-
$this->_updateButton('save', 'label', Mage::helper('web')->__('Save Item'));
|
14 |
-
$this->_updateButton('delete', 'label', Mage::helper('web')->__('Delete Item'));
|
15 |
-
|
16 |
-
$this->_addButton('saveandcontinue', array(
|
17 |
-
'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
|
18 |
-
'onclick' => 'saveAndContinueEdit()',
|
19 |
-
'class' => 'save',
|
20 |
-
), -100);
|
21 |
-
|
22 |
-
$this->_formScripts[] = "
|
23 |
-
function toggleEditor() {
|
24 |
-
if (tinyMCE.getInstanceById('web_content') == null) {
|
25 |
-
tinyMCE.execCommand('mceAddControl', false, 'web_content');
|
26 |
-
} else {
|
27 |
-
tinyMCE.execCommand('mceRemoveControl', false, 'web_content');
|
28 |
-
}
|
29 |
-
}
|
30 |
-
|
31 |
-
function saveAndContinueEdit(){
|
32 |
-
editForm.submit($('edit_form').action+'back/edit/');
|
33 |
-
}
|
34 |
-
";
|
35 |
-
}
|
36 |
-
|
37 |
-
public function getHeaderText()
|
38 |
-
{
|
39 |
-
if( Mage::registry('web_data') && Mage::registry('web_data')->getId() ) {
|
40 |
-
return Mage::helper('web')->__("Edit Item '%s'", $this->htmlEscape(Mage::registry('web_data')->getTitle()));
|
41 |
-
} else {
|
42 |
-
return Mage::helper('web')->__('Add Item');
|
43 |
-
}
|
44 |
-
}
|
45 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Coolwear/Productimport/Block/Adminhtml/_Productimport/Edit/Form.php
DELETED
@@ -1,19 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Company_Web_Block_Adminhtml_Web_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
4 |
-
{
|
5 |
-
protected function _prepareForm()
|
6 |
-
{
|
7 |
-
$form = new Varien_Data_Form(array(
|
8 |
-
'id' => 'edit_form',
|
9 |
-
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
|
10 |
-
'method' => 'post',
|
11 |
-
'enctype' => 'multipart/form-data'
|
12 |
-
)
|
13 |
-
);
|
14 |
-
|
15 |
-
$form->setUseContainer(true);
|
16 |
-
$this->setForm($form);
|
17 |
-
return parent::_prepareForm();
|
18 |
-
}
|
19 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Coolwear/Productimport/Block/Adminhtml/_Productimport/Edit/Tab/Form.php
DELETED
@@ -1,75 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Company_Web_Block_Adminhtml_Web_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
|
4 |
-
{
|
5 |
-
protected function _prepareForm()
|
6 |
-
{
|
7 |
-
$form = new Varien_Data_Form();
|
8 |
-
$this->setForm($form);
|
9 |
-
$fieldset = $form->addFieldset('web_form', array('legend'=>Mage::helper('web')->__('Item information')));
|
10 |
-
|
11 |
-
$fieldset->addField('title', 'text', array(
|
12 |
-
'label' => Mage::helper('web')->__('Title'),
|
13 |
-
'class' => 'required-entry',
|
14 |
-
'required' => true,
|
15 |
-
'name' => 'title',
|
16 |
-
));
|
17 |
-
|
18 |
-
$fieldset->addField('filename', 'file', array(
|
19 |
-
'label' => Mage::helper('web')->__('File'),
|
20 |
-
'required' => false,
|
21 |
-
'name' => 'filename',
|
22 |
-
));
|
23 |
-
|
24 |
-
$fieldset->addField('status', 'select', array(
|
25 |
-
'label' => Mage::helper('web')->__('Status'),
|
26 |
-
'name' => 'status',
|
27 |
-
'values' => array(
|
28 |
-
array(
|
29 |
-
'value' => 1,
|
30 |
-
'label' => Mage::helper('web')->__('Enabled'),
|
31 |
-
),
|
32 |
-
|
33 |
-
array(
|
34 |
-
'value' => 2,
|
35 |
-
'label' => Mage::helper('web')->__('Disabled'),
|
36 |
-
),
|
37 |
-
),
|
38 |
-
));
|
39 |
-
|
40 |
-
|
41 |
-
$fieldset->addField('yesno', 'select', array(
|
42 |
-
'label' => $this->__('Yes or No?'),
|
43 |
-
'values' => Mage::getModel('adminhtml/system_config_source_yesnocustom')
|
44 |
-
->toOptionArray(),
|
45 |
-
));
|
46 |
-
$fieldset->addField('custom_value', text, array(
|
47 |
-
'label' => $this->__('Other'),
|
48 |
-
));
|
49 |
-
|
50 |
-
// Append dependency javascript
|
51 |
-
$this->setChild('form_after', $this->getLayout()
|
52 |
-
->createBlock('adminhtml/widget_form_element_dependence')
|
53 |
-
->addFieldMap('yesno', 'yesno')
|
54 |
-
->addFieldMap('custom_value', 'custom_value')
|
55 |
-
->addFieldDependence('custom_value', 'yesno', 1) // 2 = 'Specified'
|
56 |
-
);
|
57 |
-
$fieldset->addField('content', 'editor', array(
|
58 |
-
'name' => 'content',
|
59 |
-
'label' => Mage::helper('web')->__('Content'),
|
60 |
-
'title' => Mage::helper('web')->__('Content'),
|
61 |
-
'style' => 'width:300px; height:300px;',
|
62 |
-
'wysiwyg' => false,
|
63 |
-
'required' => true,
|
64 |
-
));
|
65 |
-
|
66 |
-
if ( Mage::getSingleton('adminhtml/session')->getWebData() )
|
67 |
-
{
|
68 |
-
$form->setValues(Mage::getSingleton('adminhtml/session')->getWebData());
|
69 |
-
Mage::getSingleton('adminhtml/session')->setWebData(null);
|
70 |
-
} elseif ( Mage::registry('web_data') ) {
|
71 |
-
$form->setValues(Mage::registry('web_data')->getData());
|
72 |
-
}
|
73 |
-
return parent::_prepareForm();
|
74 |
-
}
|
75 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Coolwear/Productimport/Block/Adminhtml/_Productimport/Edit/Tabs.php
DELETED
@@ -1,37 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Company_Web_Block_Adminhtml_Web_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
|
4 |
-
{
|
5 |
-
|
6 |
-
public function __construct()
|
7 |
-
{
|
8 |
-
parent::__construct();
|
9 |
-
$this->setId('web_tabs');
|
10 |
-
$this->setDestElementId('edit_form');
|
11 |
-
$this->setTitle(Mage::helper('web')->__('Item Information'));
|
12 |
-
}
|
13 |
-
|
14 |
-
protected function _beforeToHtml()
|
15 |
-
{
|
16 |
-
$this->addTab('form_section', array(
|
17 |
-
'label' => Mage::helper('web')->__('Item Information'),
|
18 |
-
'title' => Mage::helper('web')->__('Item Information'),
|
19 |
-
'content' => $this->getLayout()->createBlock('web/adminhtml_web_edit_tab_form')->toHtml(),
|
20 |
-
));
|
21 |
-
|
22 |
-
$this->addTab('form_section1', array(
|
23 |
-
'label' => Mage::helper('web')->__('Product Information'),
|
24 |
-
'title' => Mage::helper('web')->__('Product Information'),
|
25 |
-
'content' => $this->getLayout()->createBlock('web/adminhtml_web_edit_tab_form1')->toHtml(),
|
26 |
-
));
|
27 |
-
$this->addTab('user_section', array(
|
28 |
-
'label' => Mage::helper('web')->__('User Information'),
|
29 |
-
'title' => Mage::helper('web')->__('User Information'),
|
30 |
-
'content' => $this->getLayout()->createBlock('web/adminhtml_web_edit_tab_form2')->toHtml(),
|
31 |
-
|
32 |
-
));
|
33 |
-
|
34 |
-
|
35 |
-
return parent::_beforeToHtml();
|
36 |
-
}
|
37 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Coolwear/Productimport/Block/Adminhtml/_Productimport/Grid.php
DELETED
@@ -1,137 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Company_Web_Block_Adminhtml_Web_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
4 |
-
{
|
5 |
-
public function __construct()
|
6 |
-
{
|
7 |
-
parent::__construct();
|
8 |
-
$this->setId('webGrid');
|
9 |
-
$this->setDefaultSort('web_id');
|
10 |
-
$this->setDefaultDir('ASC');
|
11 |
-
$this->setSaveParametersInSession(true);
|
12 |
-
}
|
13 |
-
|
14 |
-
protected function _prepareCollection()
|
15 |
-
{
|
16 |
-
$collection = Mage::getModel('web/web')->getCollection();
|
17 |
-
//$collection->printlogquery(true); exit;
|
18 |
-
$collection->getSelect()->join('user','user.web_id = main_table.web_id');
|
19 |
-
$this->setCollection($collection);
|
20 |
-
return parent::_prepareCollection();
|
21 |
-
}
|
22 |
-
|
23 |
-
protected function _prepareColumns()
|
24 |
-
{
|
25 |
-
|
26 |
-
|
27 |
-
$this->addColumn('title', array(
|
28 |
-
'header' => Mage::helper('web')->__('Title'),
|
29 |
-
'align' =>'left',
|
30 |
-
'index' => 'title',
|
31 |
-
));
|
32 |
-
$this->addColumn('size', array(
|
33 |
-
'header' => Mage::helper('web')->__('Size'),
|
34 |
-
'align' =>'left',
|
35 |
-
'index' => 'size',
|
36 |
-
));
|
37 |
-
$this->addColumn('product_name', array(
|
38 |
-
'header' => Mage::helper('web')->__('Product Name'),
|
39 |
-
'align' =>'left',
|
40 |
-
'index' => 'product_name',
|
41 |
-
));
|
42 |
-
$this->addColumn('image', array(
|
43 |
-
'header' => Mage::helper('web')->__('File Name'),
|
44 |
-
'type' => 'image',
|
45 |
-
'width' => '50px',
|
46 |
-
'index' => 'filename',
|
47 |
-
'align' =>'left',
|
48 |
-
|
49 |
-
));
|
50 |
-
|
51 |
-
|
52 |
-
$this->addColumn('username', array(
|
53 |
-
'header' => Mage::helper('web')->__('Username'),
|
54 |
-
'width' => '150px',
|
55 |
-
'index' => 'username',
|
56 |
-
));
|
57 |
-
|
58 |
-
$this->addColumn('email', array(
|
59 |
-
'header' => Mage::helper('web')->__('Email'),
|
60 |
-
'width' => '150px',
|
61 |
-
'index' => 'email',
|
62 |
-
));
|
63 |
-
|
64 |
-
|
65 |
-
$this->addColumn('status', array(
|
66 |
-
'header' => Mage::helper('web')->__('Status'),
|
67 |
-
'align' => 'left',
|
68 |
-
'width' => '80px',
|
69 |
-
'index' => 'status',
|
70 |
-
'type' => 'options',
|
71 |
-
'options' => array(
|
72 |
-
1 => 'Enabled',
|
73 |
-
2 => 'Disabled',
|
74 |
-
),
|
75 |
-
));
|
76 |
-
|
77 |
-
$this->addColumn('action',
|
78 |
-
array(
|
79 |
-
'header' => Mage::helper('web')->__('Action'),
|
80 |
-
'width' => '100',
|
81 |
-
'type' => 'action',
|
82 |
-
'getter' => 'getId',
|
83 |
-
'actions' => array(
|
84 |
-
array(
|
85 |
-
'caption' => Mage::helper('web')->__('Edit'),
|
86 |
-
'url' => array('base'=> '*/*/edit'),
|
87 |
-
'field' => 'id'
|
88 |
-
)
|
89 |
-
),
|
90 |
-
'filter' => false,
|
91 |
-
'sortable' => false,
|
92 |
-
'index' => 'stores',
|
93 |
-
'is_system' => true,
|
94 |
-
));
|
95 |
-
|
96 |
-
$this->addExportType('*/*/exportCsv', Mage::helper('web')->__('CSV'));
|
97 |
-
$this->addExportType('*/*/exportXml', Mage::helper('web')->__('XML'));
|
98 |
-
|
99 |
-
return parent::_prepareColumns();
|
100 |
-
}
|
101 |
-
|
102 |
-
protected function _prepareMassaction()
|
103 |
-
{
|
104 |
-
$this->setMassactionIdField('web_id');
|
105 |
-
$this->getMassactionBlock()->setFormFieldName('web');
|
106 |
-
|
107 |
-
$this->getMassactionBlock()->addItem('delete', array(
|
108 |
-
'label' => Mage::helper('web')->__('Delete'),
|
109 |
-
'url' => $this->getUrl('*/*/massDelete'),
|
110 |
-
'confirm' => Mage::helper('web')->__('Are you sure?')
|
111 |
-
));
|
112 |
-
|
113 |
-
$statuses = Mage::getSingleton('web/status')->getOptionArray();
|
114 |
-
|
115 |
-
array_unshift($statuses, array('label'=>'', 'value'=>''));
|
116 |
-
$this->getMassactionBlock()->addItem('status', array(
|
117 |
-
'label'=> Mage::helper('web')->__('Change status'),
|
118 |
-
'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
|
119 |
-
'additional' => array(
|
120 |
-
'visibility' => array(
|
121 |
-
'name' => 'status',
|
122 |
-
'type' => 'select',
|
123 |
-
'class' => 'required-entry',
|
124 |
-
'label' => Mage::helper('web')->__('Status'),
|
125 |
-
'values' => $statuses
|
126 |
-
)
|
127 |
-
)
|
128 |
-
));
|
129 |
-
return $this;
|
130 |
-
}
|
131 |
-
|
132 |
-
public function getRowUrl($row)
|
133 |
-
{
|
134 |
-
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
|
135 |
-
}
|
136 |
-
|
137 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Coolwear/Productimport/Block/Productimport.php
DELETED
@@ -1,16 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Coolwear_Productimport_Block_Web extends Mage_Core_Block_Template
|
3 |
-
{
|
4 |
-
public function _prepareLayout()
|
5 |
-
{
|
6 |
-
return parent::_prepareLayout();
|
7 |
-
}
|
8 |
-
|
9 |
-
public function getProductimport()
|
10 |
-
{
|
11 |
-
if (!$this->hasData('productimport')) {
|
12 |
-
$this->setData('productimport', Mage::registry('productimport'));
|
13 |
-
}
|
14 |
-
return $this->getData('productimport');
|
15 |
-
}
|
16 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Coolwear/Productimport/Block/Productimport.php~
DELETED
@@ -1,17 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Coolwear_Productimport_Block_Web extends Mage_Core_Block_Template
|
3 |
-
{
|
4 |
-
public function _prepareLayout()
|
5 |
-
{
|
6 |
-
return parent::_prepareLayout();
|
7 |
-
}
|
8 |
-
|
9 |
-
public function getProductimport()
|
10 |
-
{
|
11 |
-
if (!$this->hasData('productimport')) {
|
12 |
-
$this->setData('productimport', Mage::registry('productimport'));
|
13 |
-
}
|
14 |
-
return $this->getData('productimport');
|
15 |
-
|
16 |
-
}
|
17 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Coolwear/Productimport/Helper/Data.php
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Coolwear_Productimport_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
-
{
|
5 |
-
|
6 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Coolwear/Productimport/Helper/Data.php~
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Medma_Printcodes_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
-
{
|
5 |
-
|
6 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Coolwear/Productimport/controllers/Adminhtml/ProductimportController.php~
DELETED
@@ -1,374 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Coolwear_Productimport_Adminhtml_ProductimportController extends Mage_Adminhtml_Controller_action
|
4 |
-
{
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
public function indexAction() {
|
9 |
-
$this->loadLayout()->renderLayout();
|
10 |
-
}
|
11 |
-
public function productimportAction() {
|
12 |
-
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Flag to stop observer executing more than once
|
16 |
-
*
|
17 |
-
* @var static bool
|
18 |
-
*/
|
19 |
-
|
20 |
-
/**
|
21 |
-
* This method will run when the product is saved from the Magento Admin
|
22 |
-
* Use this function to update the product model, process the
|
23 |
-
* data or anything you like
|
24 |
-
*
|
25 |
-
* @param Varien_Event_Observer $observer
|
26 |
-
*/
|
27 |
-
|
28 |
-
|
29 |
-
$flag=true;
|
30 |
-
$i=0;
|
31 |
-
$product_array=array();
|
32 |
-
$category_array=array();
|
33 |
-
$configurable_attribute = "variation"; $attr_id = 132;
|
34 |
-
$importDir = Mage::getBaseDir('media') . DS . 'import/';
|
35 |
-
$contents = file_get_contents ("http://devilwear.co.uk/store/feeds/es_edirectory.txt");
|
36 |
-
//$contents = file_get_contents ("my.txt");
|
37 |
-
$lines = explode("##,", $contents);
|
38 |
-
|
39 |
-
foreach($lines as $line) {
|
40 |
-
|
41 |
-
|
42 |
-
$result =str_getcsv($line, ",", "\"");
|
43 |
-
|
44 |
-
//if(($result['33']=='Jeans & Trousers')&&($result['32']=='Mens')){
|
45 |
-
$sub_category_model = Mage::getModel('categorytrans/categorytrans')->getCollection()->addFieldToFilter('english', array('eq' => $result['33']));
|
46 |
-
foreach ($sub_category_model as $sub_category_dtl)
|
47 |
-
$sub_category_id=$sub_category_dtl['category_id'];
|
48 |
-
|
49 |
-
array_push($category_array, $sub_category_id);
|
50 |
-
//$category_array.push($sub_category_id);
|
51 |
-
//print_r($result);
|
52 |
-
try{
|
53 |
-
$translate_model = Mage::getModel('categorytrans/categorytrans')->getCollection()->addFieldToFilter('english ', array('eq' => $result['32']));
|
54 |
-
foreach ($translate_model as $translate_dtl){
|
55 |
-
$translate_dtl['category_id'];
|
56 |
-
array_push($category_array,$translate_dtl['category_id']);
|
57 |
-
|
58 |
-
if($translate_dtl['category_id']){
|
59 |
-
$cProduct = Mage::getModel('catalog/product');
|
60 |
-
$exchange_rate=9.5;
|
61 |
-
$name=basename($result['12']);
|
62 |
-
|
63 |
-
$name = explode(".", $name);
|
64 |
-
$finalprice=$result['20']*$exchange_rate;
|
65 |
-
if($result['3']){
|
66 |
-
$conf_attribute =$result['3'];
|
67 |
-
$conf_attribute = explode("-",$conf_attribute);
|
68 |
-
foreach ($conf_attribute as $value) {
|
69 |
-
$variation_id = $this->attributeValueExists('variation',$value);
|
70 |
-
if($variation_id)
|
71 |
-
{
|
72 |
-
//echo 'exits'.$variation_id;exit;
|
73 |
-
|
74 |
-
}else{
|
75 |
-
$this->addAttributeValue('variation',$value);
|
76 |
-
$variation_id =$this->attributeValueExists('variation',$value);
|
77 |
-
//echo 'notexits'.$variation_id;exit;
|
78 |
-
}
|
79 |
-
|
80 |
-
|
81 |
-
$image_name=basename($result['12']);
|
82 |
-
$mediaArray = array(
|
83 |
-
'thumbnail' =>$result['12'],
|
84 |
-
'small_image' =>$result['12'],
|
85 |
-
'image' =>$result['12'],
|
86 |
-
);
|
87 |
-
/*create Simple Product*/
|
88 |
-
$sProduct = Mage::getModel('catalog/product');
|
89 |
-
|
90 |
-
$productId = $sProduct->getIdBySku($result['0'].'/'.$value);
|
91 |
-
|
92 |
-
if($productId){
|
93 |
-
$_product = $sProduct->load($productId );
|
94 |
-
$stockData = $_product->getStockData();
|
95 |
-
$stockData['qty'] = $result['25'];
|
96 |
-
$stockData['is_in_stock'] = 1;
|
97 |
-
$_product->setStockData($stockData);
|
98 |
-
$_product->save();
|
99 |
-
}else{
|
100 |
-
|
101 |
-
$sProduct ->setTypeId(Mage_Catalog_Model_Product_Type::TYPE_SIMPLE) ->setWebsiteIds(array(1)) ->setStatus(Mage_Catalog_Model_Product_Status::STATUS_ENABLED) ->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE)
|
102 |
-
->setTaxClassId(0)
|
103 |
-
->setAttributeSetId(4)
|
104 |
-
|
105 |
-
// Populated further up the script
|
106 |
-
->setSku($result['0'].'/'.$value)
|
107 |
-
// $main_product_data is an array created as part of a wider foreach loop, which this code is inside of
|
108 |
-
->setName($result['1'])
|
109 |
-
->setShortDescription($result['1'])
|
110 |
-
->setDescription($result['2'])
|
111 |
-
->setCost(sprintf("%0.0f", $result['20']))
|
112 |
-
->setPrice(sprintf("%0.0f", $finalprice))
|
113 |
-
->setCategoryIds($category_array) ->setData($configurable_attribute,$variation_id) ; // Set the stock data. Let Magento handle this as opposed to manually creating a cataloginventory/stock_item model..
|
114 |
-
|
115 |
-
$sProduct->setStockData(array( 'is_in_stock' => 1, 'qty' => $result['25'] )); $sProduct->save();
|
116 |
-
|
117 |
-
// Store some data for later once we've created the configurable product, so we can // associate this simple product to it later..
|
118 |
-
/*creating configure product*/
|
119 |
-
$cProduct = Mage::getModel('catalog/product');
|
120 |
-
|
121 |
-
$configureProductId =$cProduct->getIdBySku($result['0']);
|
122 |
-
if($configureProductId){
|
123 |
-
$this->addToConfigurable($configureProductId,$sProduct->getId());
|
124 |
-
}
|
125 |
-
else{
|
126 |
-
$cProduct->setTypeId(Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) ->setTaxClassId(1)
|
127 |
-
->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH) ->setStatus(Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
|
128 |
-
->setTaxClassId(0)
|
129 |
-
->setWebsiteIds(array(1))
|
130 |
-
->setAttributeSetId(4) // You can determine this another way if you need to.
|
131 |
-
->setCategoryIds($category_array)
|
132 |
-
->setSku($result['0'])
|
133 |
-
->setName($result['1'])
|
134 |
-
->setShortDescription($result['1'])
|
135 |
-
->setDescription($result['2'])
|
136 |
-
->setCost(sprintf("%0.0f", $result['20']))
|
137 |
-
->setPrice(sprintf("%0.0f", $finalprice))
|
138 |
-
//->setUrlKey($name['0'])
|
139 |
-
->setData($configurable_attribute,$variation_id)
|
140 |
-
->setCreatedAt(strtotime('now'));
|
141 |
-
$img =$result['12'];
|
142 |
-
/*creating image from url save it to given path*/
|
143 |
-
$fullpath = $importDir.$image_name;
|
144 |
-
|
145 |
-
$ch = curl_init ($img);
|
146 |
-
|
147 |
-
curl_setopt($ch, CURLOPT_HEADER, 0);
|
148 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
149 |
-
curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);
|
150 |
-
$rawdata=curl_exec($ch);
|
151 |
-
curl_close ($ch);
|
152 |
-
if(file_exists($fullpath)){
|
153 |
-
unlink($fullpath);
|
154 |
-
}
|
155 |
-
|
156 |
-
$fp = fopen($fullpath,'x');
|
157 |
-
fwrite($fp, $rawdata);
|
158 |
-
fclose($fp);
|
159 |
-
foreach($mediaArray as $imageType => $fileName) {
|
160 |
-
|
161 |
-
if ( file_exists($fullpath) ) {
|
162 |
-
$cProduct->addImageToMediaGallery($fullpath, $imageType, false);
|
163 |
-
|
164 |
-
}
|
165 |
-
}
|
166 |
-
//
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
$cProduct->setStockData(array( 'use_config_manage_stock' => 1, 'is_in_stock' => 1, 'is_salable' => 1 ,'qty' =>$result['25']));
|
171 |
-
$cProduct->setCanSaveConfigurableAttributes(true);
|
172 |
-
$cProduct->setCanSaveCustomOptions(true);
|
173 |
-
$cProductTypeInstance = $cProduct->getTypeInstance();
|
174 |
-
$cProductTypeInstance->setUsedProductAttributeIds(array($_attributeIds[$configurable_attribute]));
|
175 |
-
// Now we need to get the information back in Magento's own format, and add bits of data to what it gives us..
|
176 |
-
$data = array('0'=>array('id'=>NULL,'label'=>'Variation','position'=> NULL,
|
177 |
-
'values'=>array('0'=>
|
178 |
-
array('value_index'=>$conf_attribute['0'],'label'=>$conf_attribute['0'],'is_percent'=>0,
|
179 |
-
'pricing_value'=>'0',
|
180 |
-
'attribute_id'=> $attr_id),
|
181 |
-
),
|
182 |
-
'attribute_id'=> $attr_id,'attribute_code'=>'variation','frontend_label'=>'Variation',
|
183 |
-
'html_id'=>'config_super_product__attribute_0')
|
184 |
-
);
|
185 |
-
$cProduct->setConfigurableAttributesData($data);
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
// $cProduct->setConfigurableProductsData($data);
|
191 |
-
$cProduct->save();
|
192 |
-
$this->addToConfigurable($cProduct->getId(),$sProduct->getId());
|
193 |
-
}
|
194 |
-
|
195 |
-
|
196 |
-
}
|
197 |
-
|
198 |
-
}
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
}else{
|
203 |
-
//echo $result['25'];
|
204 |
-
|
205 |
-
$cProduct = Mage::getModel('catalog/product');
|
206 |
-
$simpleproductId = $cProduct->getIdBySku($result['0']);
|
207 |
-
if($simpleproductId){
|
208 |
-
$_product = $cProduct->load($simpleproductId );
|
209 |
-
$stockData = $_product->getStockData();
|
210 |
-
$stockData['qty'] = $result['25'];
|
211 |
-
$stockData['is_in_stock'] = 1;
|
212 |
-
$_product->setStockData($stockData);
|
213 |
-
$_product->save();
|
214 |
-
|
215 |
-
|
216 |
-
}else{
|
217 |
-
|
218 |
-
$image_name=basename($result['12']);
|
219 |
-
$mediaArray = array(
|
220 |
-
'thumbnail' =>$result['12'],
|
221 |
-
'small_image' =>$result['12'],
|
222 |
-
'image' =>$result['12'],
|
223 |
-
);
|
224 |
-
// Remove unset images, add image to gallery if exists
|
225 |
-
|
226 |
-
|
227 |
-
$cProduct->setTypeId('simple')
|
228 |
-
->setTaxClassId(0)
|
229 |
-
->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH) ->setStatus(Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
|
230 |
-
->setWebsiteIds(array(1))
|
231 |
-
->setAttributeSetId(4) // You can determine this another way if you need to.
|
232 |
-
->setCategoryIds($category_array)
|
233 |
-
->setSku($result['0'])
|
234 |
-
->setName($name['0'])
|
235 |
-
->setShortDescription($result['1'])
|
236 |
-
->setDescription($result['2'])
|
237 |
-
->setCost(sprintf("%0.0f", $result['20']))
|
238 |
-
->setPrice(sprintf("%0.0f", $finalprice))
|
239 |
-
//->setUrlKey($name['0'])
|
240 |
-
->setStockData(array(
|
241 |
-
'is_in_stock' => 1,
|
242 |
-
'qty' =>$result['25']
|
243 |
-
))
|
244 |
-
->setCreatedAt(strtotime('now'));
|
245 |
-
$img =$result['12'];
|
246 |
-
|
247 |
-
$fullpath = $importDir.$image_name;
|
248 |
-
/*creating image from url save it to given path*/
|
249 |
-
$ch = curl_init ($img);
|
250 |
-
|
251 |
-
curl_setopt($ch, CURLOPT_HEADER, 0);
|
252 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
253 |
-
curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);
|
254 |
-
$rawdata=curl_exec($ch);
|
255 |
-
curl_close ($ch);
|
256 |
-
if(file_exists($fullpath)){
|
257 |
-
unlink($fullpath);
|
258 |
-
}
|
259 |
-
|
260 |
-
$fp = fopen($fullpath,'x');
|
261 |
-
fwrite($fp, $rawdata);
|
262 |
-
fclose($fp);
|
263 |
-
foreach($mediaArray as $imageType => $fileName) {
|
264 |
-
|
265 |
-
if ( file_exists($fullpath) ) {
|
266 |
-
$cProduct->addImageToMediaGallery($fullpath, $imageType, false);
|
267 |
-
|
268 |
-
}
|
269 |
-
}
|
270 |
-
$cProduct->save();
|
271 |
-
}
|
272 |
-
|
273 |
-
}
|
274 |
-
|
275 |
-
}
|
276 |
-
}
|
277 |
-
}catch(Exception $e){
|
278 |
-
Mage::log('Product Import Error: '.$e->getMessage().' '.$e->getTraceAsString() , null, 'productImport.log');
|
279 |
-
}
|
280 |
-
|
281 |
-
//}//my if block
|
282 |
-
|
283 |
-
}
|
284 |
-
$this->loadLayout()->renderLayout();
|
285 |
-
}
|
286 |
-
/****************Checks Attribute Present or Not*************************/
|
287 |
-
public function attributeValueExists($arg_attribute, $arg_value)
|
288 |
-
{
|
289 |
-
$attribute_model = Mage::getModel('eav/entity_attribute');
|
290 |
-
$attribute_options_model= Mage::getModel('eav/entity_attribute_source_table') ;
|
291 |
-
|
292 |
-
$attribute_code = $attribute_model->getIdByCode('catalog_product', $arg_attribute);
|
293 |
-
$attribute = $attribute_model->load($attribute_code);
|
294 |
-
|
295 |
-
$attribute_table = $attribute_options_model->setAttribute($attribute);
|
296 |
-
$options = $attribute_options_model->getAllOptions(false);
|
297 |
-
|
298 |
-
foreach($options as $option)
|
299 |
-
{
|
300 |
-
if ($option['label'] == $arg_value)
|
301 |
-
{
|
302 |
-
return $option['value'];
|
303 |
-
}
|
304 |
-
}
|
305 |
-
|
306 |
-
return false;
|
307 |
-
}
|
308 |
-
|
309 |
-
/****************Add Attribute If not Present*************************/
|
310 |
-
public function addAttributeValue($arg_attribute, $arg_value)
|
311 |
-
{
|
312 |
-
$attribute_model = Mage::getModel('eav/entity_attribute');
|
313 |
-
$attribute_options_model= Mage::getModel('eav/entity_attribute_source_table') ;
|
314 |
-
|
315 |
-
$attribute_code = $attribute_model->getIdByCode('catalog_product', $arg_attribute);
|
316 |
-
$attribute = $attribute_model->load($attribute_code);
|
317 |
-
|
318 |
-
$attribute_table = $attribute_options_model->setAttribute($attribute);
|
319 |
-
$options = $attribute_options_model->getAllOptions(false);
|
320 |
-
|
321 |
-
if(!$this->attributeValueExists($arg_attribute, $arg_value))
|
322 |
-
{
|
323 |
-
$value['option'] = array($arg_value,$arg_value);
|
324 |
-
$result = array('value' => $value);
|
325 |
-
$attribute->setData('option',$result);
|
326 |
-
$attribute->save();
|
327 |
-
|
328 |
-
}
|
329 |
-
|
330 |
-
foreach($options as $option)
|
331 |
-
{
|
332 |
-
if ($option['label'] == $arg_value)
|
333 |
-
{
|
334 |
-
return $option['value'];
|
335 |
-
}
|
336 |
-
}
|
337 |
-
return true;
|
338 |
-
}
|
339 |
-
|
340 |
-
/****************Fetch Attribute Value*************************/
|
341 |
-
public function getAttributeValue($arg_attribute, $arg_option_id)
|
342 |
-
{
|
343 |
-
$attribute_model = Mage::getModel('eav/entity_attribute');
|
344 |
-
$attribute_table = Mage::getModel('eav/entity_attribute_source_table');
|
345 |
-
|
346 |
-
$attribute_code = $attribute_model->getIdByCode('catalog_product', $arg_attribute);
|
347 |
-
$attribute = $attribute_model->load($attribute_code);
|
348 |
-
|
349 |
-
$attribute_table->setAttribute($attribute);
|
350 |
-
|
351 |
-
$option = $attribute_table->getOptionText($arg_option_id);
|
352 |
-
|
353 |
-
return $option;
|
354 |
-
}
|
355 |
-
|
356 |
-
/**************Mapping Simple Product to Configure Product*********************/
|
357 |
-
public function addToConfigurable($config_product_id, $simple_product_id)
|
358 |
-
{
|
359 |
-
$config_product = Mage::getModel('catalog/product') -> load($config_product_id);
|
360 |
-
$new_ids = array();
|
361 |
-
$current_ids = $config_product -> getTypeInstance() -> getUsedProductIds();
|
362 |
-
$current_ids[] = $simple_product_id;
|
363 |
-
$current_ids = array_unique($current_ids);
|
364 |
-
|
365 |
-
foreach($current_ids as $temp_id)
|
366 |
-
{
|
367 |
-
parse_str("position=", $new_ids[$temp_id]);
|
368 |
-
}
|
369 |
-
|
370 |
-
$config_product -> setConfigurableProductsData($new_ids) -> save();
|
371 |
-
}
|
372 |
-
|
373 |
-
|
374 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Coolwear/Productimport/controllers/Adminhtml/ProductimportController_25Sep2012.php
DELETED
@@ -1,358 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Coolwear_Productimport_Adminhtml_ProductimportController extends Mage_Adminhtml_Controller_action
|
4 |
-
{
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
public function indexAction() {
|
9 |
-
$this->loadLayout()->renderLayout();
|
10 |
-
}
|
11 |
-
public function productimportAction() {
|
12 |
-
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Flag to stop observer executing more than once
|
16 |
-
*
|
17 |
-
* @var static bool
|
18 |
-
*/
|
19 |
-
|
20 |
-
/**
|
21 |
-
* This method will run when the product is saved from the Magento Admin
|
22 |
-
* Use this function to update the product model, process the
|
23 |
-
* data or anything you like
|
24 |
-
*
|
25 |
-
* @param Varien_Event_Observer $observer
|
26 |
-
*/
|
27 |
-
|
28 |
-
|
29 |
-
$flag=true;
|
30 |
-
$i=0;
|
31 |
-
$product_array=array();
|
32 |
-
$category_array=array();
|
33 |
-
$configurable_attribute = "variation"; $attr_id = 132;
|
34 |
-
$importDir = Mage::getBaseDir('media') . DS . 'import/';
|
35 |
-
$contents = file_get_contents ("http://devilwear.co.uk/store/feeds/es_edirectory.txt");
|
36 |
-
//$contents = file_get_contents ("my.txt");
|
37 |
-
$lines = explode("##,", $contents);
|
38 |
-
|
39 |
-
foreach($lines as $line) {
|
40 |
-
|
41 |
-
|
42 |
-
$result =str_getcsv($line, ",", "\"");
|
43 |
-
|
44 |
-
//if(($result['33']=='Jeans & Trousers')&&($result['32']=='Mens')){
|
45 |
-
$sub_category_model = Mage::getModel('categorytrans/categorytrans')->getCollection()->addFieldToFilter('english', array('eq' => $result['33']));
|
46 |
-
foreach ($sub_category_model as $sub_category_dtl)
|
47 |
-
$sub_category_id=$sub_category_dtl['category_id'];
|
48 |
-
|
49 |
-
array_push($category_array, $sub_category_id);
|
50 |
-
//$category_array.push($sub_category_id);
|
51 |
-
//print_r($result);
|
52 |
-
try{
|
53 |
-
$translate_model = Mage::getModel('categorytrans/categorytrans')->getCollection()->addFieldToFilter('english ', array('eq' => $result['32']));
|
54 |
-
foreach ($translate_model as $translate_dtl){
|
55 |
-
$translate_dtl['category_id'];
|
56 |
-
array_push($category_array,$translate_dtl['category_id']);
|
57 |
-
|
58 |
-
if($translate_dtl['category_id']){
|
59 |
-
$cProduct = Mage::getModel('catalog/product');
|
60 |
-
$exchange_rate=9.5;
|
61 |
-
$name=basename($result['12']);
|
62 |
-
|
63 |
-
$name = explode(".", $name);
|
64 |
-
$finalprice=$result['20']*$exchange_rate;
|
65 |
-
if($result['3']){
|
66 |
-
$conf_attribute =$result['3'];
|
67 |
-
$conf_attribute = explode("-",$conf_attribute);
|
68 |
-
//echo 'conf'.$conf_attribute['0'];
|
69 |
-
$variation_id = $this->attributeValueExists('variation',$conf_attribute['0']);
|
70 |
-
if($variation_id)
|
71 |
-
{
|
72 |
-
|
73 |
-
}else{
|
74 |
-
$variation_id = $this->addAttributeValue('variation',$conf_attribute['0']);
|
75 |
-
}
|
76 |
-
|
77 |
-
|
78 |
-
$image_name=basename($result['12']);
|
79 |
-
$mediaArray = array(
|
80 |
-
'thumbnail' =>$result['12'],
|
81 |
-
'small_image' =>$result['12'],
|
82 |
-
'image' =>$result['12'],
|
83 |
-
);
|
84 |
-
/*create Simple Product*/
|
85 |
-
$sProduct = Mage::getModel('catalog/product');
|
86 |
-
|
87 |
-
$productId = $sProduct->getIdBySku('S'.$result['0']);
|
88 |
-
|
89 |
-
if($productId){
|
90 |
-
$_product = $sProduct->load($productId );
|
91 |
-
$stockData = $_product->getStockData();
|
92 |
-
$stockData['qty'] = $result['25'];
|
93 |
-
$stockData['is_in_stock'] = 1;
|
94 |
-
$_product->setStockData($stockData);
|
95 |
-
$_product->save();
|
96 |
-
}else{
|
97 |
-
|
98 |
-
$sProduct ->setTypeId(Mage_Catalog_Model_Product_Type::TYPE_SIMPLE) ->setWebsiteIds(array(1)) ->setStatus(Mage_Catalog_Model_Product_Status::STATUS_ENABLED) ->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE)
|
99 |
-
->setTaxClassId(0)
|
100 |
-
->setAttributeSetId(4)
|
101 |
-
|
102 |
-
// Populated further up the script
|
103 |
-
->setSku('S'.$result['0'])
|
104 |
-
// $main_product_data is an array created as part of a wider foreach loop, which this code is inside of
|
105 |
-
->setName($result['1'])
|
106 |
-
->setShortDescription($result['1'])
|
107 |
-
->setDescription($result['2'])
|
108 |
-
->setCost(sprintf("%0.0f", $result['20']))
|
109 |
-
->setPrice(sprintf("%0.0f", $finalprice))
|
110 |
-
->setCategoryIds($category_array) ->setData($configurable_attribute,$variation_id) ; // Set the stock data. Let Magento handle this as opposed to manually creating a cataloginventory/stock_item model..
|
111 |
-
|
112 |
-
$sProduct->setStockData(array( 'is_in_stock' => 1, 'qty' => $result['25'] )); $sProduct->save();
|
113 |
-
// Store some data for later once we've created the configurable product, so we can // associate this simple product to it later..
|
114 |
-
/*creating configure product*/
|
115 |
-
|
116 |
-
$cProduct->setTypeId(Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) ->setTaxClassId(1)
|
117 |
-
->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH) ->setStatus(Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
|
118 |
-
->setTaxClassId(0)
|
119 |
-
->setWebsiteIds(array(1))
|
120 |
-
->setAttributeSetId(4) // You can determine this another way if you need to.
|
121 |
-
->setCategoryIds($category_array)
|
122 |
-
->setSku($result['0'])
|
123 |
-
->setName($result['1'])
|
124 |
-
->setShortDescription($result['1'])
|
125 |
-
->setDescription($result['2'])
|
126 |
-
->setCost(sprintf("%0.0f", $result['20']))
|
127 |
-
->setPrice(sprintf("%0.0f", $finalprice))
|
128 |
-
//->setUrlKey($name['0'])
|
129 |
-
->setData($configurable_attribute,$variation_id)
|
130 |
-
->setCreatedAt(strtotime('now'));
|
131 |
-
$img =$result['12'];
|
132 |
-
/*creating image from url save it to given path*/
|
133 |
-
$fullpath = $importDir.$image_name;
|
134 |
-
|
135 |
-
$ch = curl_init ($img);
|
136 |
-
|
137 |
-
curl_setopt($ch, CURLOPT_HEADER, 0);
|
138 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
139 |
-
curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);
|
140 |
-
$rawdata=curl_exec($ch);
|
141 |
-
curl_close ($ch);
|
142 |
-
if(file_exists($fullpath)){
|
143 |
-
unlink($fullpath);
|
144 |
-
}
|
145 |
-
|
146 |
-
$fp = fopen($fullpath,'x');
|
147 |
-
fwrite($fp, $rawdata);
|
148 |
-
fclose($fp);
|
149 |
-
foreach($mediaArray as $imageType => $fileName) {
|
150 |
-
|
151 |
-
if ( file_exists($fullpath) ) {
|
152 |
-
$cProduct->addImageToMediaGallery($fullpath, $imageType, false);
|
153 |
-
|
154 |
-
}
|
155 |
-
}
|
156 |
-
//
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
$cProduct->setStockData(array( 'use_config_manage_stock' => 1, 'is_in_stock' => 1, 'is_salable' => 1 ,'qty' =>$result['25']));
|
161 |
-
$cProduct->setCanSaveConfigurableAttributes(true);
|
162 |
-
$cProduct->setCanSaveCustomOptions(true);
|
163 |
-
$cProductTypeInstance = $cProduct->getTypeInstance();
|
164 |
-
$cProductTypeInstance->setUsedProductAttributeIds(array($_attributeIds[$configurable_attribute]));
|
165 |
-
// Now we need to get the information back in Magento's own format, and add bits of data to what it gives us..
|
166 |
-
$data = array('0'=>array('id'=>NULL,'label'=>'Variation','position'=> NULL,
|
167 |
-
'values'=>array('0'=>
|
168 |
-
array('value_index'=>$conf_attribute['0'],'label'=>$conf_attribute['0'],'is_percent'=>0,
|
169 |
-
'pricing_value'=>'0',
|
170 |
-
'attribute_id'=> $attr_id),
|
171 |
-
),
|
172 |
-
'attribute_id'=> $attr_id,'attribute_code'=>'variation','frontend_label'=>'Variation',
|
173 |
-
'html_id'=>'config_super_product__attribute_0')
|
174 |
-
);
|
175 |
-
$cProduct->setConfigurableAttributesData($data);
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
// $cProduct->setConfigurableProductsData($data);
|
181 |
-
$cProduct->save();
|
182 |
-
|
183 |
-
$this->addToConfigurable($cProduct->getId(),$sProduct->getId());
|
184 |
-
|
185 |
-
}
|
186 |
-
|
187 |
-
}else{
|
188 |
-
//echo $result['25'];
|
189 |
-
|
190 |
-
$cProduct = Mage::getModel('catalog/product');
|
191 |
-
$simpleproductId = $cProduct->getIdBySku($result['0']);
|
192 |
-
if($simpleproductId){
|
193 |
-
$_product = $cProduct->load($simpleproductId );
|
194 |
-
$stockData = $_product->getStockData();
|
195 |
-
$stockData['qty'] = $result['25'];
|
196 |
-
$stockData['is_in_stock'] = 1;
|
197 |
-
$_product->setStockData($stockData);
|
198 |
-
$_product->save();
|
199 |
-
|
200 |
-
|
201 |
-
}else{
|
202 |
-
|
203 |
-
$image_name=basename($result['12']);
|
204 |
-
$mediaArray = array(
|
205 |
-
'thumbnail' =>$result['12'],
|
206 |
-
'small_image' =>$result['12'],
|
207 |
-
'image' =>$result['12'],
|
208 |
-
);
|
209 |
-
// Remove unset images, add image to gallery if exists
|
210 |
-
|
211 |
-
|
212 |
-
$cProduct->setTypeId('simple')
|
213 |
-
->setTaxClassId(0)
|
214 |
-
->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH) ->setStatus(Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
|
215 |
-
->setWebsiteIds(array(1))
|
216 |
-
->setAttributeSetId(4) // You can determine this another way if you need to.
|
217 |
-
->setCategoryIds($category_array)
|
218 |
-
->setSku($result['0'])
|
219 |
-
->setName($name['0'])
|
220 |
-
->setShortDescription($result['1'])
|
221 |
-
->setDescription($result['2'])
|
222 |
-
->setCost(sprintf("%0.0f", $result['20']))
|
223 |
-
->setPrice(sprintf("%0.0f", $finalprice))
|
224 |
-
//->setUrlKey($name['0'])
|
225 |
-
->setStockData(array(
|
226 |
-
'is_in_stock' => 1,
|
227 |
-
'qty' =>$result['25']
|
228 |
-
))
|
229 |
-
->setCreatedAt(strtotime('now'));
|
230 |
-
$img =$result['12'];
|
231 |
-
|
232 |
-
$fullpath = $importDir.$image_name;
|
233 |
-
/*creating image from url save it to given path*/
|
234 |
-
$ch = curl_init ($img);
|
235 |
-
|
236 |
-
curl_setopt($ch, CURLOPT_HEADER, 0);
|
237 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
238 |
-
curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);
|
239 |
-
$rawdata=curl_exec($ch);
|
240 |
-
curl_close ($ch);
|
241 |
-
if(file_exists($fullpath)){
|
242 |
-
unlink($fullpath);
|
243 |
-
}
|
244 |
-
|
245 |
-
$fp = fopen($fullpath,'x');
|
246 |
-
fwrite($fp, $rawdata);
|
247 |
-
fclose($fp);
|
248 |
-
foreach($mediaArray as $imageType => $fileName) {
|
249 |
-
|
250 |
-
if ( file_exists($fullpath) ) {
|
251 |
-
$cProduct->addImageToMediaGallery($fullpath, $imageType, false);
|
252 |
-
|
253 |
-
}
|
254 |
-
}
|
255 |
-
$cProduct->save();
|
256 |
-
}
|
257 |
-
|
258 |
-
}
|
259 |
-
|
260 |
-
}
|
261 |
-
}
|
262 |
-
}catch(Exception $e){
|
263 |
-
Mage::log('Product Import Error: '.$e->getMessage().' '.$e->getTraceAsString() , null, 'productImport.log');
|
264 |
-
}
|
265 |
-
|
266 |
-
//}//my if block
|
267 |
-
|
268 |
-
}
|
269 |
-
$this->loadLayout()->renderLayout();
|
270 |
-
}
|
271 |
-
/****************Checks Attribute Present or Not*************************/
|
272 |
-
public function attributeValueExists($arg_attribute, $arg_value)
|
273 |
-
{
|
274 |
-
$attribute_model = Mage::getModel('eav/entity_attribute');
|
275 |
-
$attribute_options_model= Mage::getModel('eav/entity_attribute_source_table') ;
|
276 |
-
|
277 |
-
$attribute_code = $attribute_model->getIdByCode('catalog_product', $arg_attribute);
|
278 |
-
$attribute = $attribute_model->load($attribute_code);
|
279 |
-
|
280 |
-
$attribute_table = $attribute_options_model->setAttribute($attribute);
|
281 |
-
$options = $attribute_options_model->getAllOptions(false);
|
282 |
-
|
283 |
-
foreach($options as $option)
|
284 |
-
{
|
285 |
-
if ($option['label'] == $arg_value)
|
286 |
-
{
|
287 |
-
return $option['value'];
|
288 |
-
}
|
289 |
-
}
|
290 |
-
|
291 |
-
return false;
|
292 |
-
}
|
293 |
-
|
294 |
-
/****************Add Attribute If not Present*************************/
|
295 |
-
public function addAttributeValue($arg_attribute, $arg_value)
|
296 |
-
{
|
297 |
-
$attribute_model = Mage::getModel('eav/entity_attribute');
|
298 |
-
$attribute_options_model= Mage::getModel('eav/entity_attribute_source_table') ;
|
299 |
-
|
300 |
-
$attribute_code = $attribute_model->getIdByCode('catalog_product', $arg_attribute);
|
301 |
-
$attribute = $attribute_model->load($attribute_code);
|
302 |
-
|
303 |
-
$attribute_table = $attribute_options_model->setAttribute($attribute);
|
304 |
-
$options = $attribute_options_model->getAllOptions(false);
|
305 |
-
|
306 |
-
if(!$this->attributeValueExists($arg_attribute, $arg_value))
|
307 |
-
{
|
308 |
-
$value['option'] = array($arg_value,$arg_value);
|
309 |
-
$result = array('value' => $value);
|
310 |
-
$attribute->setData('option',$result);
|
311 |
-
$attribute->save();
|
312 |
-
}
|
313 |
-
|
314 |
-
foreach($options as $option)
|
315 |
-
{
|
316 |
-
if ($option['label'] == $arg_value)
|
317 |
-
{
|
318 |
-
return $option['value'];
|
319 |
-
}
|
320 |
-
}
|
321 |
-
return true;
|
322 |
-
}
|
323 |
-
|
324 |
-
/****************Fetch Attribute Value*************************/
|
325 |
-
public function getAttributeValue($arg_attribute, $arg_option_id)
|
326 |
-
{
|
327 |
-
$attribute_model = Mage::getModel('eav/entity_attribute');
|
328 |
-
$attribute_table = Mage::getModel('eav/entity_attribute_source_table');
|
329 |
-
|
330 |
-
$attribute_code = $attribute_model->getIdByCode('catalog_product', $arg_attribute);
|
331 |
-
$attribute = $attribute_model->load($attribute_code);
|
332 |
-
|
333 |
-
$attribute_table->setAttribute($attribute);
|
334 |
-
|
335 |
-
$option = $attribute_table->getOptionText($arg_option_id);
|
336 |
-
|
337 |
-
return $option;
|
338 |
-
}
|
339 |
-
|
340 |
-
/**************Mapping Simple Product to Configure Product*********************/
|
341 |
-
public function addToConfigurable($config_product_id, $simple_product_id)
|
342 |
-
{
|
343 |
-
$config_product = Mage::getModel('catalog/product') -> load($config_product_id);
|
344 |
-
$new_ids = array();
|
345 |
-
$current_ids = $config_product -> getTypeInstance() -> getUsedProductIds();
|
346 |
-
$current_ids[] = $simple_product_id;
|
347 |
-
$current_ids = array_unique($current_ids);
|
348 |
-
|
349 |
-
foreach($current_ids as $temp_id)
|
350 |
-
{
|
351 |
-
parse_str("position=", $new_ids[$temp_id]);
|
352 |
-
}
|
353 |
-
|
354 |
-
$config_product -> setConfigurableProductsData($new_ids) -> save();
|
355 |
-
}
|
356 |
-
|
357 |
-
|
358 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Coolwear/Productimport/etc/config.xml~
DELETED
@@ -1,106 +0,0 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<config>
|
3 |
-
<modules>
|
4 |
-
<Coolwear_Productimport>
|
5 |
-
<version>0.1.1</version>
|
6 |
-
</Coolwear_Productimport>
|
7 |
-
</modules>
|
8 |
-
<frontend>
|
9 |
-
<routers>
|
10 |
-
<productimport>
|
11 |
-
<use>standard</use>
|
12 |
-
<args>
|
13 |
-
<module>Coolwear_Productimport</module>
|
14 |
-
<frontName>productimport</frontName>
|
15 |
-
</args>
|
16 |
-
</productimport>
|
17 |
-
</routers>
|
18 |
-
<layout>
|
19 |
-
<updates>
|
20 |
-
<productimport>
|
21 |
-
<file>productimport.xml</file>
|
22 |
-
</productimport>
|
23 |
-
</updates>
|
24 |
-
</layout>
|
25 |
-
</frontend>
|
26 |
-
<admin>
|
27 |
-
<routers>
|
28 |
-
<productimport>
|
29 |
-
<use>admin</use>
|
30 |
-
<args>
|
31 |
-
<module>Coolwear_Productimport</module>
|
32 |
-
<frontName>productimport</frontName>
|
33 |
-
</args>
|
34 |
-
</productimport>
|
35 |
-
</routers>
|
36 |
-
</admin>
|
37 |
-
<adminhtml>
|
38 |
-
<menu>
|
39 |
-
<productimport module="productimport">
|
40 |
-
<title>Product Import</title>
|
41 |
-
<sort_order>71</sort_order>
|
42 |
-
<children>
|
43 |
-
<items module="productimport">
|
44 |
-
<title>Check Import</title>
|
45 |
-
<sort_order>0</sort_order>
|
46 |
-
<action>productimport/adminhtml_productimport/productimport</action>
|
47 |
-
</items>
|
48 |
-
</children>
|
49 |
-
</productimport>
|
50 |
-
</menu>
|
51 |
-
<acl>
|
52 |
-
<resources>
|
53 |
-
<all>
|
54 |
-
<title>Allow Everything</title>
|
55 |
-
</all>
|
56 |
-
<admin>
|
57 |
-
<children>
|
58 |
-
<Product_Import>
|
59 |
-
<title>Check Import</title>
|
60 |
-
<sort_order>10</sort_order>
|
61 |
-
</Product_Import>
|
62 |
-
</children>
|
63 |
-
</admin>
|
64 |
-
</resources>
|
65 |
-
</acl>
|
66 |
-
<layout>
|
67 |
-
<updates>
|
68 |
-
<productimport>
|
69 |
-
<file>productimport.xml</file>
|
70 |
-
</productimport>
|
71 |
-
</updates>
|
72 |
-
</layout>
|
73 |
-
</adminhtml>
|
74 |
-
<global>
|
75 |
-
<resources>
|
76 |
-
<productimport_setup>
|
77 |
-
<setup>
|
78 |
-
<module>Coolwear_Productimport</module>
|
79 |
-
</setup>
|
80 |
-
<connection>
|
81 |
-
<use>core_setup</use>
|
82 |
-
</connection>
|
83 |
-
</productimport_setup>
|
84 |
-
<productimport_write>
|
85 |
-
<connection>
|
86 |
-
<use>core_write</use>
|
87 |
-
</connection>
|
88 |
-
</productimport_write>
|
89 |
-
<productimport_read>
|
90 |
-
<connection>
|
91 |
-
<use>core_read</use>
|
92 |
-
</connection>
|
93 |
-
</productimport_read>
|
94 |
-
</resources>
|
95 |
-
<blocks>
|
96 |
-
<productimport>
|
97 |
-
<class>Coolwear_Productimport_Block</class>
|
98 |
-
</productimport>
|
99 |
-
</blocks>
|
100 |
-
<helpers>
|
101 |
-
<productimport>
|
102 |
-
<class>Coolwear_Productimport_Helper</class>
|
103 |
-
</productimport>
|
104 |
-
</helpers>
|
105 |
-
</global>
|
106 |
-
</config>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/{Coolwear → Medma}/Categorytrans/Block/Adminhtml/Categorytrans.php
RENAMED
@@ -1,5 +1,5 @@
|
|
1 |
<?php
|
2 |
-
class
|
3 |
{
|
4 |
public function __construct()
|
5 |
{
|
1 |
<?php
|
2 |
+
class Medma_Categorytrans_Block_Adminhtml_Categorytrans extends Mage_Adminhtml_Block_Widget_Grid_Container
|
3 |
{
|
4 |
public function __construct()
|
5 |
{
|
app/code/local/Medma/Categorytrans/Block/Adminhtml/Categorytrans/Edit.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Medma_Categorytrans_Block_Adminhtml_Categorytrans_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
3 |
+
{
|
4 |
+
public function __construct()
|
5 |
+
{
|
6 |
+
parent::__construct();
|
7 |
+
$this->_objectId = 'id';
|
8 |
+
$this->_blockGroup = 'categorytrans';
|
9 |
+
$this->_controller = 'adminhtml_categorytrans';
|
10 |
+
$this->_formScripts[] = "
|
11 |
+
function setCategoryName(cat_name){
|
12 |
+
//alert(cat_name);
|
13 |
+
document.getElementById('category_name').value=cat_name;
|
14 |
+
}
|
15 |
+
";
|
16 |
+
|
17 |
+
}
|
18 |
+
|
19 |
+
|
20 |
+
public function getHeaderText()
|
21 |
+
|
22 |
+
{
|
23 |
+
|
24 |
+
if( Mage::registry('categorytrans_data') && Mage::registry('categorytrans_data')->getId() ) {
|
25 |
+
|
26 |
+
return Mage::helper('categorytrans')->__("Edit Category '%s'", $this->htmlEscape(Mage::registry('categorytrans_data')->getName()));
|
27 |
+
|
28 |
+
|
29 |
+
} else {
|
30 |
+
|
31 |
+
return Mage::helper('categorytrans')->__('Add Category');
|
32 |
+
|
33 |
+
}
|
34 |
+
|
35 |
+
}
|
36 |
+
}
|
app/code/local/{Coolwear → Medma}/Categorytrans/Block/Adminhtml/Categorytrans/Edit/Form.php
RENAMED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class
|
4 |
{
|
5 |
protected function _prepareForm()
|
6 |
{
|
@@ -13,7 +13,7 @@ class Coolwear_Categorytrans_Block_Adminhtml_Categorytrans_Edit_Form extends Mag
|
|
13 |
$this->setForm($form);
|
14 |
$hlp = Mage::helper('categorytrans');
|
15 |
|
16 |
-
|
17 |
|
18 |
$collection = Mage::getResourceModel('categorytrans/categorytrans');
|
19 |
|
@@ -35,8 +35,8 @@ class Coolwear_Categorytrans_Block_Adminhtml_Categorytrans_Edit_Form extends Mag
|
|
35 |
'value' => $values['entity_id']
|
36 |
);
|
37 |
}
|
38 |
-
unset($category_values[1]);
|
39 |
-
unset($category_values[2]);
|
40 |
|
41 |
|
42 |
// Most Important Line for printing the above query //
|
@@ -54,11 +54,21 @@ class Coolwear_Categorytrans_Block_Adminhtml_Categorytrans_Edit_Form extends Mag
|
|
54 |
|
55 |
'name' => 'category_id',
|
56 |
|
57 |
-
|
|
|
58 |
|
59 |
));
|
60 |
|
61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
|
63 |
$fldInfo->addField('english', 'text', array(
|
64 |
'label' => $hlp->__('English translate'),
|
1 |
<?php
|
2 |
|
3 |
+
class Medma_Categorytrans_Block_Adminhtml_Categorytrans_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
4 |
{
|
5 |
protected function _prepareForm()
|
6 |
{
|
13 |
$this->setForm($form);
|
14 |
$hlp = Mage::helper('categorytrans');
|
15 |
|
16 |
+
$setCategoryName_key = Mage::getSingleton('adminhtml/url')->getSecretKey("adminhtml_categorytrans","setCategoryNameAction");
|
17 |
|
18 |
$collection = Mage::getResourceModel('categorytrans/categorytrans');
|
19 |
|
35 |
'value' => $values['entity_id']
|
36 |
);
|
37 |
}
|
38 |
+
unset($category_values[1]);
|
39 |
+
unset($category_values[2]);
|
40 |
|
41 |
|
42 |
// Most Important Line for printing the above query //
|
54 |
|
55 |
'name' => 'category_id',
|
56 |
|
57 |
+
'values' =>$category_values,
|
58 |
+
'onchange' => "setCategoryName(this.options[this.selectedIndex].text);"
|
59 |
|
60 |
));
|
61 |
|
62 |
+
$fldInfo->addField('category_name', 'hidden', array(
|
63 |
+
|
64 |
+
'label' => $hlp->__('Category Name'),
|
65 |
+
|
66 |
+
'name' => 'category_name',
|
67 |
+
|
68 |
+
|
69 |
+
|
70 |
+
|
71 |
+
));
|
72 |
|
73 |
$fldInfo->addField('english', 'text', array(
|
74 |
'label' => $hlp->__('English translate'),
|
app/code/local/{Coolwear → Medma}/Categorytrans/Block/Adminhtml/Categorytrans/Edit/Tab/Form.php
RENAMED
File without changes
|
app/code/local/{Coolwear → Medma}/Categorytrans/Block/Adminhtml/Categorytrans/Edit/Tabs.php
RENAMED
@@ -21,4 +21,4 @@ class Medma_Groups_Block_Adminhtml_Groups_Edit_Tabs extends Mage_Adminhtml_Block
|
|
21 |
|
22 |
return parent::_beforeToHtml();
|
23 |
}
|
24 |
-
}
|
21 |
|
22 |
return parent::_beforeToHtml();
|
23 |
}
|
24 |
+
}
|
app/code/local/{Coolwear → Medma}/Categorytrans/Block/Adminhtml/Categorytrans/Grid.php
RENAMED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* @author Adjustware
|
4 |
*/
|
5 |
-
class
|
6 |
{
|
7 |
public function __construct()
|
8 |
{
|
@@ -15,14 +15,9 @@ class Coolwear_Categorytrans_Block_Adminhtml_Categorytrans_Grid extends Mage_Adm
|
|
15 |
|
16 |
protected function _prepareCollection()
|
17 |
{
|
|
|
18 |
$collection = Mage::getModel('categorytrans/categorytrans')->getCollection();
|
19 |
-
|
20 |
-
$collection->getSelect()->join(
|
21 |
-
array('pc'=>'catalog_category_entity_varchar'),
|
22 |
-
$_translateCondition,
|
23 |
-
array('name'=>'pc.value'));
|
24 |
-
//$collection->printLogQuery(true);
|
25 |
-
//exit;
|
26 |
|
27 |
$this->setCollection($collection);
|
28 |
return parent::_prepareCollection();
|
@@ -31,11 +26,12 @@ class Coolwear_Categorytrans_Block_Adminhtml_Categorytrans_Grid extends Mage_Adm
|
|
31 |
|
32 |
protected function _prepareColumns()
|
33 |
{
|
34 |
-
|
35 |
-
|
|
|
36 |
'width' => '80px',
|
37 |
'type' => 'text',
|
38 |
-
'index' => '
|
39 |
));
|
40 |
$this->addColumn('sku', array(
|
41 |
'header'=> Mage::helper('categorytrans')->__('English Translate'),
|
2 |
/**
|
3 |
* @author Adjustware
|
4 |
*/
|
5 |
+
class Medma_Categorytrans_Block_Adminhtml_Categorytrans_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
6 |
{
|
7 |
public function __construct()
|
8 |
{
|
15 |
|
16 |
protected function _prepareCollection()
|
17 |
{
|
18 |
+
|
19 |
$collection = Mage::getModel('categorytrans/categorytrans')->getCollection();
|
20 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
$this->setCollection($collection);
|
23 |
return parent::_prepareCollection();
|
26 |
|
27 |
protected function _prepareColumns()
|
28 |
{
|
29 |
+
|
30 |
+
$this->addColumn('category_name', array(
|
31 |
+
'header'=> Mage::helper('categorytrans')->__('Magento Category Name'),
|
32 |
'width' => '80px',
|
33 |
'type' => 'text',
|
34 |
+
'index' => 'category_name'
|
35 |
));
|
36 |
$this->addColumn('sku', array(
|
37 |
'header'=> Mage::helper('categorytrans')->__('English Translate'),
|
app/code/local/{Coolwear/Categorytrans/Block/Stockcontrol.php~ → Medma/Categorytrans/Block/Categorytrans.php}
RENAMED
@@ -1,5 +1,5 @@
|
|
1 |
<?php
|
2 |
-
class
|
3 |
{
|
4 |
protected function _toHtml()
|
5 |
{
|
1 |
<?php
|
2 |
+
class Medma_Categorytrans_Block_categorytrans extends Mage_Core_Block_Template
|
3 |
{
|
4 |
protected function _toHtml()
|
5 |
{
|
app/code/local/Medma/Categorytrans/Helper/Data.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Medma_Categorytrans_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
}
|
app/code/local/{Coolwear → Medma}/Categorytrans/Model/Categorytrans.php
RENAMED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class
|
4 |
{
|
5 |
public function _construct()
|
6 |
{
|
1 |
<?php
|
2 |
|
3 |
+
class Medma_Categorytrans_Model_Categorytrans extends Mage_Core_Model_Abstract
|
4 |
{
|
5 |
public function _construct()
|
6 |
{
|
app/code/local/{Coolwear → Medma}/Categorytrans/Model/Mysql4/Categorytrans.php
RENAMED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class
|
4 |
{
|
5 |
public function _construct()
|
6 |
{
|
1 |
<?php
|
2 |
|
3 |
+
class Medma_Categorytrans_Model_Mysql4_Categorytrans extends Mage_Core_Model_Mysql4_Abstract
|
4 |
{
|
5 |
public function _construct()
|
6 |
{
|
app/code/local/{Coolwear → Medma}/Categorytrans/Model/Mysql4/Categorytrans/Collection.php
RENAMED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class
|
4 |
{
|
5 |
public function _construct()
|
6 |
{
|
1 |
<?php
|
2 |
|
3 |
+
class Medma_Categorytrans_Model_Mysql4_Categorytrans_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
4 |
{
|
5 |
public function _construct()
|
6 |
{
|
app/code/local/{Coolwear → Medma}/Categorytrans/controllers/Adminhtml/CategorytransController.php
RENAMED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class
|
4 |
{
|
5 |
public function indexAction() {
|
6 |
|
@@ -47,15 +47,20 @@ class Coolwear_Categorytrans_Adminhtml_CategorytransController extends Mage_Admi
|
|
47 |
}
|
48 |
|
49 |
public function saveAction() {
|
50 |
-
|
51 |
-
|
52 |
$model= Mage::getModel('categorytrans/categorytrans');
|
53 |
-
|
54 |
if ($data = $this->getRequest()->getPost()) {
|
55 |
-
|
56 |
try {
|
57 |
|
58 |
-
|
|
|
|
|
|
|
|
|
|
|
59 |
$model->save();
|
60 |
|
61 |
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('categorytrans')->__('Category is successfully translated'));
|
1 |
<?php
|
2 |
|
3 |
+
class Medma_Categorytrans_Adminhtml_CategorytransController extends Mage_Adminhtml_Controller_action
|
4 |
{
|
5 |
public function indexAction() {
|
6 |
|
47 |
}
|
48 |
|
49 |
public function saveAction() {
|
50 |
+
//$id= $this->getRequest()->getParam('id');
|
51 |
+
|
52 |
$model= Mage::getModel('categorytrans/categorytrans');
|
53 |
+
//print_r($model);
|
54 |
if ($data = $this->getRequest()->getPost()) {
|
55 |
+
//print_r($data);exit;
|
56 |
try {
|
57 |
|
58 |
+
$model->setCategoryId($data['category_id']);
|
59 |
+
$model->setCategoryName($data['category_name']);
|
60 |
+
$model->setEnglish($data['english']);
|
61 |
+
|
62 |
+
|
63 |
+
//$model->setData($data);
|
64 |
$model->save();
|
65 |
|
66 |
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('categorytrans')->__('Category is successfully translated'));
|
app/code/local/{Coolwear → Medma}/Categorytrans/etc/config.xml
RENAMED
@@ -1,16 +1,16 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<config>
|
3 |
<modules>
|
4 |
-
<
|
5 |
-
<version>0.1.
|
6 |
-
</
|
7 |
</modules>
|
8 |
<admin>
|
9 |
<routers>
|
10 |
<categorytrans>
|
11 |
<use>admin</use>
|
12 |
<args>
|
13 |
-
<module>
|
14 |
<frontName>categorytrans</frontName>
|
15 |
</args>
|
16 |
</categorytrans>
|
@@ -51,12 +51,12 @@
|
|
51 |
<global>
|
52 |
<models>
|
53 |
<categorytrans>
|
54 |
-
<class>
|
55 |
<resourceModel>categorytrans_mysql4</resourceModel>
|
56 |
</categorytrans>
|
57 |
|
58 |
<categorytrans_mysql4>
|
59 |
-
<class>
|
60 |
<entities>
|
61 |
<categorytrans>
|
62 |
<table>categorytranslate</table>
|
@@ -65,26 +65,34 @@
|
|
65 |
</categorytrans_mysql4>
|
66 |
|
67 |
</models>
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
<blocks>
|
81 |
<categorytrans>
|
82 |
-
<class>
|
83 |
</categorytrans>
|
84 |
</blocks>
|
85 |
<helpers>
|
86 |
<categorytrans>
|
87 |
-
<class>
|
88 |
</categorytrans>
|
89 |
</helpers>
|
90 |
</global>
|
1 |
<?xml version="1.0"?>
|
2 |
<config>
|
3 |
<modules>
|
4 |
+
<Medma_Categorytrans>
|
5 |
+
<version>0.1.2</version>
|
6 |
+
</Medma_Categorytrans>
|
7 |
</modules>
|
8 |
<admin>
|
9 |
<routers>
|
10 |
<categorytrans>
|
11 |
<use>admin</use>
|
12 |
<args>
|
13 |
+
<module>Medma_Categorytrans</module>
|
14 |
<frontName>categorytrans</frontName>
|
15 |
</args>
|
16 |
</categorytrans>
|
51 |
<global>
|
52 |
<models>
|
53 |
<categorytrans>
|
54 |
+
<class>Medma_Categorytrans_Model</class>
|
55 |
<resourceModel>categorytrans_mysql4</resourceModel>
|
56 |
</categorytrans>
|
57 |
|
58 |
<categorytrans_mysql4>
|
59 |
+
<class>Medma_Categorytrans_Model_Mysql4</class>
|
60 |
<entities>
|
61 |
<categorytrans>
|
62 |
<table>categorytranslate</table>
|
65 |
</categorytrans_mysql4>
|
66 |
|
67 |
</models>
|
68 |
+
<resources>
|
69 |
+
<categorytrans_setup>
|
70 |
+
<setup>
|
71 |
+
<module>Medma_Categorytrans</module>
|
72 |
+
</setup>
|
73 |
+
<connection>
|
74 |
+
<use>core_setup</use>
|
75 |
+
</connection>
|
76 |
+
</categorytrans_setup>
|
77 |
+
<categorytrans_write>
|
78 |
+
<connection>
|
79 |
+
<use>core_write</use>
|
80 |
+
</connection>
|
81 |
+
</categorytrans_write>
|
82 |
+
<categorytrans_read>
|
83 |
+
<connection>
|
84 |
+
<use>core_read</use>
|
85 |
+
</connection>
|
86 |
+
</categorytrans_read>
|
87 |
+
</resources>
|
88 |
<blocks>
|
89 |
<categorytrans>
|
90 |
+
<class>Medma_Categorytrans_Block</class>
|
91 |
</categorytrans>
|
92 |
</blocks>
|
93 |
<helpers>
|
94 |
<categorytrans>
|
95 |
+
<class>Medma_Categorytrans_Helper</class>
|
96 |
</categorytrans>
|
97 |
</helpers>
|
98 |
</global>
|
app/code/local/{Coolwear → Medma}/Categorytrans/sql/categorytrans_setup/mysql4-install-0.1.0.php
RENAMED
@@ -7,10 +7,11 @@ $installer->startSetup();
|
|
7 |
$installer->run("
|
8 |
|
9 |
|
10 |
-
CREATE TABLE IF NOT EXISTS
|
11 |
`trans_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
12 |
`category_id` int(11) unsigned NOT NULL,
|
13 |
-
|
|
|
14 |
PRIMARY KEY (`trans_id`)
|
15 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
16 |
|
7 |
$installer->run("
|
8 |
|
9 |
|
10 |
+
CREATE TABLE IF NOT EXISTS {$this->getTable('categorytranslate')} (
|
11 |
`trans_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
12 |
`category_id` int(11) unsigned NOT NULL,
|
13 |
+
`english` varchar(255) NOT NULL DEFAULT '',
|
14 |
+
`category_name` varchar(255) NOT NULL DEFAULT '',
|
15 |
PRIMARY KEY (`trans_id`)
|
16 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
17 |
|
app/code/local/{Coolwear → Medma}/Importproduct/Model/Observer.php
RENAMED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class
|
4 |
{
|
5 |
|
6 |
|
1 |
<?php
|
2 |
|
3 |
+
class Medma_Importproduct_Model_Observer
|
4 |
{
|
5 |
|
6 |
|
app/code/local/Medma/Importproduct/etc/config.xml
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Medma_Importproduct>
|
5 |
+
<version>0.1.2</version>
|
6 |
+
</Medma_Importproduct>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<models>
|
10 |
+
<importproduct>
|
11 |
+
<class>Medma_Importproduct_Model</class>
|
12 |
+
</importproduct>
|
13 |
+
</models>
|
14 |
+
<!--<events>
|
15 |
+
<checkout_cart_product_add_after>
|
16 |
+
<observers>
|
17 |
+
<medma_importproduct>
|
18 |
+
<class>Medma_Importproduct_Model_Observer</class>
|
19 |
+
<method>importProductMedma</method>
|
20 |
+
</medma_importproduct>
|
21 |
+
</observers>
|
22 |
+
</checkout_cart_product_add_after>
|
23 |
+
</events>-->
|
24 |
+
</global>
|
25 |
+
<crontab>
|
26 |
+
<jobs>
|
27 |
+
<medma_importproduct>
|
28 |
+
<schedule><cron_expr>0 20 * * *</cron_expr></schedule>
|
29 |
+
<run><model>importproduct/observer::importProductMedma</model></run>
|
30 |
+
</medma_importproduct>
|
31 |
+
</jobs>
|
32 |
+
</crontab>
|
33 |
+
</config>
|
app/code/local/Medma/Productimport/Helper/Data.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Medma_Productimport_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
}
|
app/code/local/{Coolwear → Medma}/Productimport/controllers/Adminhtml/ProductimportController.php
RENAMED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class
|
4 |
{
|
5 |
|
6 |
|
1 |
<?php
|
2 |
|
3 |
+
class Medma_Productimport_Adminhtml_ProductimportController extends Mage_Adminhtml_Controller_action
|
4 |
{
|
5 |
|
6 |
|
app/code/local/{Coolwear → Medma}/Productimport/etc/config.xml
RENAMED
@@ -1,16 +1,16 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<config>
|
3 |
<modules>
|
4 |
-
<
|
5 |
-
<version>0.1.
|
6 |
-
</
|
7 |
</modules>
|
8 |
<frontend>
|
9 |
<routers>
|
10 |
<productimport>
|
11 |
<use>standard</use>
|
12 |
<args>
|
13 |
-
<module>
|
14 |
<frontName>productimport</frontName>
|
15 |
</args>
|
16 |
</productimport>
|
@@ -28,7 +28,7 @@
|
|
28 |
<productimport>
|
29 |
<use>admin</use>
|
30 |
<args>
|
31 |
-
<module>
|
32 |
<frontName>productimport</frontName>
|
33 |
</args>
|
34 |
</productimport>
|
@@ -75,7 +75,7 @@
|
|
75 |
<resources>
|
76 |
<productimport_setup>
|
77 |
<setup>
|
78 |
-
<module>
|
79 |
</setup>
|
80 |
<connection>
|
81 |
<use>core_setup</use>
|
@@ -91,16 +91,11 @@
|
|
91 |
<use>core_read</use>
|
92 |
</connection>
|
93 |
</productimport_read>
|
94 |
-
</resources>
|
95 |
-
|
96 |
<productimport>
|
97 |
-
|
98 |
-
</productimport>
|
99 |
-
</blocks>
|
100 |
-
<helpers>
|
101 |
-
<productimport>
|
102 |
-
<class>Coolwear_Productimport_Helper</class>
|
103 |
</productimport>
|
104 |
-
</helpers>
|
105 |
</global>
|
106 |
</config>
|
1 |
<?xml version="1.0"?>
|
2 |
<config>
|
3 |
<modules>
|
4 |
+
<Medma_Productimport>
|
5 |
+
<version>0.1.2</version>
|
6 |
+
</Medma_Productimport>
|
7 |
</modules>
|
8 |
<frontend>
|
9 |
<routers>
|
10 |
<productimport>
|
11 |
<use>standard</use>
|
12 |
<args>
|
13 |
+
<module>Medma_Productimport</module>
|
14 |
<frontName>productimport</frontName>
|
15 |
</args>
|
16 |
</productimport>
|
28 |
<productimport>
|
29 |
<use>admin</use>
|
30 |
<args>
|
31 |
+
<module>Medma_Productimport</module>
|
32 |
<frontName>productimport</frontName>
|
33 |
</args>
|
34 |
</productimport>
|
75 |
<resources>
|
76 |
<productimport_setup>
|
77 |
<setup>
|
78 |
+
<module>Medma_Productimport</module>
|
79 |
</setup>
|
80 |
<connection>
|
81 |
<use>core_setup</use>
|
91 |
<use>core_read</use>
|
92 |
</connection>
|
93 |
</productimport_read>
|
94 |
+
</resources>
|
95 |
+
<helpers>
|
96 |
<productimport>
|
97 |
+
<class>Medma_Productimport_Helper</class>
|
|
|
|
|
|
|
|
|
|
|
98 |
</productimport>
|
99 |
+
</helpers>
|
100 |
</global>
|
101 |
</config>
|
app/design/adminhtml/default/default/layout/productimport.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<layout version="0.1.0">
|
3 |
<productimport_adminhtml_productimport_productimport>
|
4 |
<reference name="content">
|
5 |
-
<block type="page/html" name="content_import" template="
|
6 |
</reference>
|
7 |
</productimport_adminhtml_productimport_productimport>
|
8 |
</layout>
|
2 |
<layout version="0.1.0">
|
3 |
<productimport_adminhtml_productimport_productimport>
|
4 |
<reference name="content">
|
5 |
+
<block type="page/html" name="content_import" template="productImport/import.phtml" />
|
6 |
</reference>
|
7 |
</productimport_adminhtml_productimport_productimport>
|
8 |
</layout>
|
app/design/adminhtml/default/default/template/{coolwear → productImport}/import.phtml
RENAMED
File without changes
|
app/etc/modules/{Coolwear_Categorytrans.xml → Medma_Categorytrans.xml}
RENAMED
@@ -1,9 +1,9 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<config>
|
3 |
<modules>
|
4 |
-
<
|
5 |
<active>true</active>
|
6 |
<codePool>local</codePool>
|
7 |
-
</
|
8 |
</modules>
|
9 |
</config>
|
1 |
<?xml version="1.0"?>
|
2 |
<config>
|
3 |
<modules>
|
4 |
+
<Medma_Categorytrans>
|
5 |
<active>true</active>
|
6 |
<codePool>local</codePool>
|
7 |
+
</Medma_Categorytrans>
|
8 |
</modules>
|
9 |
</config>
|
app/etc/modules/{Coolwear_Importproduct.xml → Medma_Importproduct.xml}
RENAMED
@@ -1,9 +1,9 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<config>
|
3 |
<modules>
|
4 |
-
<
|
5 |
<active>true</active>
|
6 |
<codePool>local</codePool>
|
7 |
-
</
|
8 |
</modules>
|
9 |
</config>
|
1 |
<?xml version="1.0"?>
|
2 |
<config>
|
3 |
<modules>
|
4 |
+
<Medma_Importproduct>
|
5 |
<active>true</active>
|
6 |
<codePool>local</codePool>
|
7 |
+
</Medma_Importproduct>
|
8 |
</modules>
|
9 |
</config>
|
app/etc/modules/{Coolwear_Productimport.xml → Medma_Productimport.xml}
RENAMED
@@ -1,9 +1,9 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<config>
|
3 |
<modules>
|
4 |
-
<
|
5 |
<active>true</active>
|
6 |
<codePool>local</codePool>
|
7 |
-
</
|
8 |
</modules>
|
9 |
</config>
|
1 |
<?xml version="1.0"?>
|
2 |
<config>
|
3 |
<modules>
|
4 |
+
<Medma_Productimport>
|
5 |
<active>true</active>
|
6 |
<codePool>local</codePool>
|
7 |
+
</Medma_Productimport>
|
8 |
</modules>
|
9 |
</config>
|
package.xml
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Medma_Thirdparty_Import</name>
|
4 |
-
<version>1.0.
|
5 |
<stability>stable</stability>
|
6 |
<license>OSL v3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
-
<summary>This extension imports the products from 3rd Party
|
10 |
-
<description>This extension imports the products from 3rd Party
|
11 |
-
<notes>This is
|
12 |
<authors><author><name>Medma Infomatix</name><user>Medma_Infomatix</user><email>gaurav@medma.in</email></author></authors>
|
13 |
-
<date>2012-
|
14 |
-
<time>
|
15 |
-
<contents><target name="magelocal"><dir name="
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Medma_Thirdparty_Import</name>
|
4 |
+
<version>1.0.1</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>OSL v3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
+
<summary>This extension imports the products from 3rd Party websites.</summary>
|
10 |
+
<description>This extension imports the products from 3rd Party websites. The extension is very useful as it imports all kinds of products. This extension also provides category translation section.</description>
|
11 |
+
<notes>This is a latest release.</notes>
|
12 |
<authors><author><name>Medma Infomatix</name><user>Medma_Infomatix</user><email>gaurav@medma.in</email></author></authors>
|
13 |
+
<date>2012-12-27</date>
|
14 |
+
<time>08:03:27</time>
|
15 |
+
<contents><target name="magelocal"><dir name="Medma"><dir name="Categorytrans"><dir name="Block"><dir name="Adminhtml"><dir name="Categorytrans"><dir name="Edit"><file name="Form.php" hash="bdcfd9b80876268b766f41388329ad78"/><dir name="Tab"><file name="Form.php" hash="dfd11760871042496386ae18c5ae9bff"/></dir><file name="Tabs.php" hash="da936d3c6d6dd467ccd1200ab5764d3b"/></dir><file name="Edit.php" hash="dccb4622663d510030581e493c00d1af"/><file name="Grid.php" hash="e69f0b4e305dbebd98c83da6f6901a48"/></dir><file name="Categorytrans.php" hash="0250392f9b78cf86d450947aa94ff6c2"/></dir><file name="Categorytrans.php" hash="b767fcb97b032486961ca00bb1441f64"/></dir><dir name="Helper"><file name="Data.php" hash="da26a932e30928df5237b4f67d6785f3"/></dir><dir name="Model"><file name="Categorytrans.php" hash="862286a1517208a2c0e7b5a7007ced72"/><dir name="Mysql4"><dir name="Categorytrans"><file name="Collection.php" hash="0ab3e3a9d8607a86e65361892181eed3"/></dir><file name="Categorytrans.php" hash="8d87758fc0030774c1b8a6dbb289fa7f"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="CategorytransController.php" hash="77e6bf2ad05a346ee2008e2cb31ddbec"/></dir></dir><dir name="etc"><file name="config.xml" hash="3243206ab6d62d6979cfb82994b0ad53"/></dir><dir name="sql"><dir name="categorytrans_setup"><file name="mysql4-install-0.1.0.php" hash="91e5b8035df2ca00565fb73497ad2a22"/></dir></dir></dir><dir name="Importproduct"><dir name="Model"><file name="Observer.php" hash="43adf1a9d1d91d541b86f8c8149ff7d8"/></dir><dir name="etc"><file name="config.xml" hash="8e916eaa96814234904aae9bb531c79e"/></dir></dir><dir name="Productimport"><dir name="Helper"><file name="Data.php" hash="3c830ae3a2dd6b619501b66eed744cb1"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="ProductimportController.php" hash="823773010252da7b2f6a8ca5dc9106d0"/></dir></dir><dir name="etc"><file name="config.xml" hash="c639cdb1852134f7da03984d81e75f21"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Medma_Categorytrans.xml" hash="e790371ea43b03a9c2789de3bec6f414"/><file name="Medma_Importproduct.xml" hash="dd15b3231fa59557857cde7df05c151b"/><file name="Medma_Productimport.xml" hash="8b7dfaf182a15242041ede908a0c0de5"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="productimport.xml" hash="5ff801607ff53f908c0f832971f4a7ec"/></dir><dir name="template"><dir name="productImport"><file name="import.phtml" hash="ba3d1815728623877506936035e2e73a"/></dir></dir></dir></dir></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|