Version Notes
Creating Configurable Product
Download this release
Release Info
Developer | Magento Core Team |
Extension | CreateConfigurableProduct |
Version | 1.6 |
Comparing to | |
See all releases |
Version 1.6
- app/code/local/Thylak/Artist/Block/Adminhtml/Artist.php +12 -0
- app/code/local/Thylak/Artist/Block/Adminhtml/Artist/Edit.php +45 -0
- app/code/local/Thylak/Artist/Block/Adminhtml/Artist/Edit/Form.php +19 -0
- app/code/local/Thylak/Artist/Block/Adminhtml/Artist/Edit/Tab/Form.php +44 -0
- app/code/local/Thylak/Artist/Block/Adminhtml/Artist/Edit/Tabs.php +29 -0
- app/code/local/Thylak/Artist/Block/Adminhtml/Artist/Grid.php +101 -0
- app/code/local/Thylak/Artist/Block/Adminhtml/Artwork/Edit.php +12 -0
- app/code/local/Thylak/Artist/Block/Adminhtml/Artwork/Grid.php +80 -0
- app/code/local/Thylak/Artist/Block/Artist.php +29 -0
- app/code/local/Thylak/Artist/Block/Artwork.php +31 -0
- app/code/local/Thylak/Artist/Block/Link.php +30 -0
- app/code/local/Thylak/Artist/Block/Login.php +50 -0
- app/code/local/Thylak/Artist/Block/Register.php +30 -0
- app/code/local/Thylak/Artist/Helper/Data.php +26 -0
- app/code/local/Thylak/Artist/Model/Artist.php +22 -0
- app/code/local/Thylak/Artist/Model/Artwork.php +177 -0
- app/code/local/Thylak/Artist/Model/Mysql4/Artist.php +22 -0
- app/code/local/Thylak/Artist/Model/Mysql4/Artist/Collection.php +22 -0
- app/code/local/Thylak/Artist/Model/Mysql4/Artwork.php +22 -0
- app/code/local/Thylak/Artist/Model/Mysql4/Artwork/Collection.php +22 -0
- app/code/local/Thylak/Artist/Model/Status.php +15 -0
- app/code/local/Thylak/Artist/controllers/Adminhtml/ArtistController.php +284 -0
- app/code/local/Thylak/Artist/controllers/IndexController.php +146 -0
- app/code/local/Thylak/Artist/etc/config.xml +128 -0
- app/code/local/Thylak/Artist/sql/artist_setup/mysql4-install-0.1.0.php +49 -0
- app/design/adminhtml/default/default/layout/artist.xml +12 -0
- app/design/adminhtml/default/default/template/artist/artwork.phtml +42 -0
- app/design/frontend/base/default/layout/artist.xml +62 -0
- app/design/frontend/base/default/template/artist/artist.phtml +39 -0
- app/design/frontend/base/default/template/artist/artistbk.phtml +65 -0
- app/design/frontend/base/default/template/artist/artwork.phtml +33 -0
- app/design/frontend/base/default/template/artist/link.phtml +9 -0
- app/design/frontend/base/default/template/artist/login.phtml +48 -0
- app/design/frontend/base/default/template/artist/register.phtml +46 -0
- app/etc/modules/Thylak_Artist.xml +14 -0
- package.xml +18 -0
app/code/local/Thylak/Artist/Block/Adminhtml/Artist.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Thylak_Artist_Block_Adminhtml_Artist extends Mage_Adminhtml_Block_Widget_Grid_Container
|
3 |
+
{
|
4 |
+
public function __construct()
|
5 |
+
{
|
6 |
+
$this->_controller = 'adminhtml_artist';
|
7 |
+
$this->_blockGroup = 'artist';
|
8 |
+
$this->_headerText = Mage::helper('artist')->__('Artist Manager');
|
9 |
+
$this->_addButtonLabel = Mage::helper('artist')->__('Add Artist');
|
10 |
+
parent::__construct();
|
11 |
+
}
|
12 |
+
}
|
app/code/local/Thylak/Artist/Block/Adminhtml/Artist/Edit.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Thylak_Artist_Block_Adminhtml_Artist_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 = 'artist';
|
11 |
+
$this->_controller = 'adminhtml_artist';
|
12 |
+
|
13 |
+
$this->_updateButton('save', 'label', Mage::helper('artist')->__('Save Artist'));
|
14 |
+
$this->_updateButton('delete', 'label', Mage::helper('artist')->__('Delete Artist'));
|
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('artist_content') == null) {
|
25 |
+
tinyMCE.execCommand('mceAddControl', false, 'artist_content');
|
26 |
+
} else {
|
27 |
+
tinyMCE.execCommand('mceRemoveControl', false, 'artist_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('artist_data') && Mage::registry('artist_data')->getId() ) {
|
40 |
+
return Mage::helper('artist')->__("Edit Artist '%s'", $this->htmlEscape(Mage::registry('artist_data')->getFirstname()));
|
41 |
+
} else {
|
42 |
+
return Mage::helper('artist')->__('Add Artist');
|
43 |
+
}
|
44 |
+
}
|
45 |
+
}
|
app/code/local/Thylak/Artist/Block/Adminhtml/Artist/Edit/Form.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Thylak_Artist_Block_Adminhtml_Artist_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/Thylak/Artist/Block/Adminhtml/Artist/Edit/Tab/Form.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Thylak_Artist_Block_Adminhtml_Artist_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('artist_form', array('legend'=>Mage::helper('artist')->__('Artist information')));
|
10 |
+
|
11 |
+
$fieldset->addField('firstname', 'text', array(
|
12 |
+
'label' => Mage::helper('artist')->__('FirstName'),
|
13 |
+
'class' => 'required-entry',
|
14 |
+
'required' => true,
|
15 |
+
'name' => 'firstname',
|
16 |
+
));
|
17 |
+
|
18 |
+
$fieldset->addField('lastname', 'text', array(
|
19 |
+
'label' => Mage::helper('artist')->__('Lastname'),
|
20 |
+
'required' => false,
|
21 |
+
'name' => 'lastname',
|
22 |
+
));
|
23 |
+
$fieldset->addField('email', 'text', array(
|
24 |
+
'label' => Mage::helper('artist')->__('Email'),
|
25 |
+
'required' => false,
|
26 |
+
'name' => 'email',
|
27 |
+
));
|
28 |
+
|
29 |
+
$fieldset->addField('password', 'text', array(
|
30 |
+
'label' => Mage::helper('artist')->__('Password'),
|
31 |
+
'required' => false,
|
32 |
+
'name' => 'password',
|
33 |
+
));
|
34 |
+
|
35 |
+
if ( Mage::getSingleton('adminhtml/session')->getArtistData() )
|
36 |
+
{
|
37 |
+
$form->setValues(Mage::getSingleton('adminhtml/session')->getArtistData());
|
38 |
+
Mage::getSingleton('adminhtml/session')->setArtistData(null);
|
39 |
+
} elseif ( Mage::registry('artist_data') ) {
|
40 |
+
$form->setValues(Mage::registry('artist_data')->getData());
|
41 |
+
}
|
42 |
+
return parent::_prepareForm();
|
43 |
+
}
|
44 |
+
}
|
app/code/local/Thylak/Artist/Block/Adminhtml/Artist/Edit/Tabs.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Thylak_Artist_Block_Adminhtml_Artist_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
|
4 |
+
{
|
5 |
+
|
6 |
+
public function __construct()
|
7 |
+
{
|
8 |
+
parent::__construct();
|
9 |
+
$this->setId('artist_tabs');
|
10 |
+
$this->setDestElementId('edit_form');
|
11 |
+
$this->setTitle(Mage::helper('artist')->__('Artist Information'));
|
12 |
+
}
|
13 |
+
|
14 |
+
protected function _beforeToHtml()
|
15 |
+
{
|
16 |
+
$this->addTab('form_section', array(
|
17 |
+
'label' => Mage::helper('artist')->__('Artist Info'),
|
18 |
+
'title' => Mage::helper('artist')->__('Artist Info'),
|
19 |
+
'content' => $this->getLayout()->createBlock('artist/adminhtml_artist_edit_tab_form')->toHtml(),
|
20 |
+
));
|
21 |
+
$this->addTab('form_section1', array(
|
22 |
+
'label' => Mage::helper('artist')->__('Artwork Info'),
|
23 |
+
'title' => Mage::helper('artist')->__('Artwork Info'),
|
24 |
+
'content' => $this->getLayout()->createBlock('artist/adminhtml_artwork_grid')->toHtml(),
|
25 |
+
));
|
26 |
+
|
27 |
+
return parent::_beforeToHtml();
|
28 |
+
}
|
29 |
+
}
|
app/code/local/Thylak/Artist/Block/Adminhtml/Artist/Grid.php
ADDED
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Thylak_Artist_Block_Adminhtml_Artist_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::__construct();
|
8 |
+
$this->setId('artistGrid');
|
9 |
+
$this->setDefaultSort('artist_id');
|
10 |
+
$this->setDefaultDir('ASC');
|
11 |
+
$this->setSaveParametersInSession(true);
|
12 |
+
}
|
13 |
+
|
14 |
+
protected function _prepareCollection()
|
15 |
+
{
|
16 |
+
$collection = Mage::getModel('artist/artist')->getCollection();
|
17 |
+
$this->setCollection($collection);
|
18 |
+
return parent::_prepareCollection();
|
19 |
+
}
|
20 |
+
|
21 |
+
protected function _prepareColumns()
|
22 |
+
{
|
23 |
+
$this->addColumn('artist_id', array(
|
24 |
+
'header' => Mage::helper('artist')->__('ID'),
|
25 |
+
'align' =>'right',
|
26 |
+
'width' => '50px',
|
27 |
+
'index' => 'artist_id',
|
28 |
+
));
|
29 |
+
|
30 |
+
$this->addColumn('firstname', array(
|
31 |
+
'header' => Mage::helper('artist')->__('FirstName'),
|
32 |
+
'align' =>'left',
|
33 |
+
'index' => 'firstname',
|
34 |
+
));
|
35 |
+
|
36 |
+
|
37 |
+
$this->addColumn('lastname', array(
|
38 |
+
'header' => Mage::helper('artist')->__('LastName'),
|
39 |
+
'width' => '150px',
|
40 |
+
'index' => 'lastname',
|
41 |
+
));
|
42 |
+
|
43 |
+
$this->addColumn('email', array(
|
44 |
+
'header' => Mage::helper('artist')->__('Email'),
|
45 |
+
'width' => '150px',
|
46 |
+
'index' => 'email',
|
47 |
+
));
|
48 |
+
|
49 |
+
$this->addColumn('password', array(
|
50 |
+
'header' => Mage::helper('artist')->__('Password'),
|
51 |
+
'width' => '150px',
|
52 |
+
'index' => 'password',
|
53 |
+
));
|
54 |
+
|
55 |
+
|
56 |
+
|
57 |
+
$this->addColumn('action',
|
58 |
+
array(
|
59 |
+
'header' => Mage::helper('artist')->__('Action'),
|
60 |
+
'width' => '100',
|
61 |
+
'type' => 'action',
|
62 |
+
'getter' => 'getId',
|
63 |
+
'actions' => array(
|
64 |
+
array(
|
65 |
+
'caption' => Mage::helper('artist')->__('Edit'),
|
66 |
+
'url' => array('base'=> '*/*/edit'),
|
67 |
+
'field' => 'id'
|
68 |
+
)
|
69 |
+
),
|
70 |
+
'filter' => false,
|
71 |
+
'sortable' => false,
|
72 |
+
'index' => 'stores',
|
73 |
+
'is_system' => true,
|
74 |
+
));
|
75 |
+
|
76 |
+
$this->addExportType('*/*/exportCsv', Mage::helper('artist')->__('CSV'));
|
77 |
+
$this->addExportType('*/*/exportXml', Mage::helper('artist')->__('XML'));
|
78 |
+
|
79 |
+
return parent::_prepareColumns();
|
80 |
+
}
|
81 |
+
|
82 |
+
protected function _prepareMassaction()
|
83 |
+
{
|
84 |
+
$this->setMassactionIdField('artist_id');
|
85 |
+
$this->getMassactionBlock()->setFormFieldName('artist');
|
86 |
+
|
87 |
+
$this->getMassactionBlock()->addItem('delete', array(
|
88 |
+
'label' => Mage::helper('artist')->__('Delete'),
|
89 |
+
'url' => $this->getUrl('*/*/massDelete'),
|
90 |
+
'confirm' => Mage::helper('artist')->__('Are you sure?')
|
91 |
+
));
|
92 |
+
|
93 |
+
return $this;
|
94 |
+
}
|
95 |
+
|
96 |
+
public function getRowUrl($row)
|
97 |
+
{
|
98 |
+
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
|
99 |
+
}
|
100 |
+
|
101 |
+
}
|
app/code/local/Thylak/Artist/Block/Adminhtml/Artwork/Edit.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Thylak_Artist_Block_Adminhtml_Artwork_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
$this->setTemplate('artist/artwork.phtml');
|
8 |
+
}
|
9 |
+
}
|
10 |
+
|
11 |
+
|
12 |
+
|
app/code/local/Thylak/Artist/Block/Adminhtml/Artwork/Grid.php
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Thylak_Artist_Block_Adminhtml_Artwork_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::__construct();
|
8 |
+
$this->setId('artworkGrid');
|
9 |
+
$this->setDefaultSort('artwork_id');
|
10 |
+
$this->setDefaultDir('ASC');
|
11 |
+
$this->setSaveParametersInSession(true);
|
12 |
+
}
|
13 |
+
|
14 |
+
protected function _prepareCollection()
|
15 |
+
{
|
16 |
+
$id = $this->getRequest()->getParam('id');
|
17 |
+
$artwork = Mage::getModel('artist/artwork')->load($id);
|
18 |
+
$custid= $artwork->filename;
|
19 |
+
//$id = Mage::getSingleton('customer/session')->getCustomerId();
|
20 |
+
$collection = Mage::getModel('artist/artwork')->getCollection();
|
21 |
+
$collection->addFieldToFilter('artist_id', $id);
|
22 |
+
$this->setCollection($collection);
|
23 |
+
return parent::_prepareCollection();
|
24 |
+
}
|
25 |
+
|
26 |
+
protected function _prepareColumns()
|
27 |
+
{
|
28 |
+
$this->addColumn('artwork_id', array(
|
29 |
+
'header' => Mage::helper('artist')->__('ID'),
|
30 |
+
'align' =>'right',
|
31 |
+
'width' => '50px',
|
32 |
+
'index' => 'artwork_id',
|
33 |
+
));
|
34 |
+
|
35 |
+
$this->addColumn('title', array(
|
36 |
+
'header' => Mage::helper('artist')->__('Title'),
|
37 |
+
'align' =>'left',
|
38 |
+
'index' => 'title',
|
39 |
+
));
|
40 |
+
|
41 |
+
|
42 |
+
$this->addColumn('action',
|
43 |
+
array(
|
44 |
+
'header' => Mage::helper('artist')->__('Action'),
|
45 |
+
'width' => '100',
|
46 |
+
'type' => 'action',
|
47 |
+
'getter' => 'getId',
|
48 |
+
'actions' => array(
|
49 |
+
array(
|
50 |
+
'caption' => Mage::helper('artist')->__('Edit'),
|
51 |
+
'url' => array('base'=> 'artist/adminhtml_artist/editartwork'),
|
52 |
+
'field' => 'id'
|
53 |
+
)
|
54 |
+
),
|
55 |
+
'filter' => false,
|
56 |
+
'sortable' => false,
|
57 |
+
'index' => 'stores',
|
58 |
+
'is_system' => true,
|
59 |
+
));
|
60 |
+
if ( Mage::getSingleton('adminhtml/session')->getArtworkData() )
|
61 |
+
{
|
62 |
+
$form->setValues(Mage::getSingleton('adminhtml/session')->getArtworkData());
|
63 |
+
Mage::getSingleton('adminhtml/session')->setArtworkData(null);
|
64 |
+
} elseif ( Mage::registry('artwork_data') ) {
|
65 |
+
$form->setValues(Mage::registry('artwork_data')->getData());
|
66 |
+
}
|
67 |
+
|
68 |
+
|
69 |
+
return parent::_prepareColumns();
|
70 |
+
}
|
71 |
+
|
72 |
+
|
73 |
+
public function getRowUrl($row)
|
74 |
+
{
|
75 |
+
return $this->getUrl('artist/adminhtml_artist/editartwork', array('id' => $row->getId()));
|
76 |
+
}
|
77 |
+
|
78 |
+
|
79 |
+
|
80 |
+
}
|
app/code/local/Thylak/Artist/Block/Artist.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Thylak
|
4 |
+
* @package Thylak_Artist
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Artist Module - Artist Block
|
10 |
+
*
|
11 |
+
* @author Buyan <buyan@talktoaprogrammer.com, bnpart47@yahoo.com>
|
12 |
+
*/
|
13 |
+
class Thylak_Artist_Block_Artist extends Mage_Core_Block_Template
|
14 |
+
{
|
15 |
+
public function _prepareLayout()
|
16 |
+
{
|
17 |
+
return parent::_prepareLayout();
|
18 |
+
}
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Artist Module - Artist Block
|
22 |
+
*
|
23 |
+
* @return Artist Form Post Action Url
|
24 |
+
*/
|
25 |
+
public function getSaveUrl()
|
26 |
+
{
|
27 |
+
return Mage::getUrl('artist/index/artistsave/');
|
28 |
+
}
|
29 |
+
}
|
app/code/local/Thylak/Artist/Block/Artwork.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Thylak
|
4 |
+
* @package Thylak_Artist
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Artist Module - Artwork Block
|
10 |
+
*
|
11 |
+
* @author Buyan <buyan@talktoaprogrammer.com, bnpart47@yahoo.com>
|
12 |
+
*/
|
13 |
+
class Thylak_Artist_Block_Artwork extends Mage_Core_Block_Template
|
14 |
+
{
|
15 |
+
public function _prepareLayout()
|
16 |
+
{
|
17 |
+
return parent::_prepareLayout();
|
18 |
+
}
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Artist Module - Artwork Block
|
22 |
+
*
|
23 |
+
* @return Artwork Form Post Action Url
|
24 |
+
*/
|
25 |
+
public function getSaveUrl()
|
26 |
+
{
|
27 |
+
return Mage::getUrl('artist/index/artworksave');
|
28 |
+
}
|
29 |
+
|
30 |
+
|
31 |
+
}
|
app/code/local/Thylak/Artist/Block/Link.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Thylak
|
4 |
+
* @package Thylak_Artist
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Artist Module - Link Block
|
10 |
+
*
|
11 |
+
* @author Buyan <buyan@talktoaprogrammer.com, bnpart47@yahoo.com>
|
12 |
+
*/
|
13 |
+
class Thylak_Artist_Block_Link extends Mage_Core_Block_Template
|
14 |
+
{
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Artist Module - Link Block
|
18 |
+
*
|
19 |
+
* @return Register Form Post Action Url
|
20 |
+
*/
|
21 |
+
public function getArtistinfoUrl()
|
22 |
+
{
|
23 |
+
return Mage::getUrl('*/*/artist/id/'.$_SESSION['id']);
|
24 |
+
}
|
25 |
+
public function getArtworkinfoUrl()
|
26 |
+
{
|
27 |
+
return Mage::getUrl('*/*/artwork/id/'.$_SESSION['id']);
|
28 |
+
}
|
29 |
+
|
30 |
+
}
|
app/code/local/Thylak/Artist/Block/Login.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Thylak
|
4 |
+
* @package Thylak_Artist
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Artist Module - Login Block
|
10 |
+
*
|
11 |
+
* @author Buyan <buyan@talktoaprogrammer.com, bnpart47@yahoo.com>
|
12 |
+
*/
|
13 |
+
class Thylak_Artist_Block_Login extends Mage_Core_Block_Template
|
14 |
+
{
|
15 |
+
public function _prepareLayout()
|
16 |
+
{
|
17 |
+
return parent::_prepareLayout();
|
18 |
+
}
|
19 |
+
/**
|
20 |
+
* Artist Module - Login Block
|
21 |
+
*
|
22 |
+
* @return Artist Details
|
23 |
+
*/
|
24 |
+
public function getArtist()
|
25 |
+
{
|
26 |
+
if (!$this->hasData('artist')) {
|
27 |
+
$this->setData('artist', Mage::registry('artist'));
|
28 |
+
}
|
29 |
+
return $this->getData('artist');
|
30 |
+
|
31 |
+
}
|
32 |
+
/**
|
33 |
+
* Artist Module - Login Block
|
34 |
+
*
|
35 |
+
* @return Login Form Post Action Url
|
36 |
+
*/
|
37 |
+
public function getPostActionUrl()
|
38 |
+
{
|
39 |
+
return Mage::getUrl('artist/index/loginPost');
|
40 |
+
}
|
41 |
+
/**
|
42 |
+
* Artist Module - Login Block
|
43 |
+
*
|
44 |
+
* @return Create Account Url - Register Page Url
|
45 |
+
*/
|
46 |
+
public function getRegisterPostActionUrl()
|
47 |
+
{
|
48 |
+
return Mage::getUrl('artist/index/create');
|
49 |
+
}
|
50 |
+
}
|
app/code/local/Thylak/Artist/Block/Register.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Thylak
|
4 |
+
* @package Thylak_Artist
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Artist Module - Register Block
|
10 |
+
*
|
11 |
+
* @author Buyan <buyan@talktoaprogrammer.com, bnpart47@yahoo.com>
|
12 |
+
*/
|
13 |
+
class Thylak_Artist_Block_Register extends Mage_Core_Block_Template
|
14 |
+
{
|
15 |
+
public function _prepareLayout()
|
16 |
+
{
|
17 |
+
return parent::_prepareLayout();
|
18 |
+
}
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Artist Module - Register Block
|
22 |
+
*
|
23 |
+
* @return Register Form Post Action Url
|
24 |
+
*/
|
25 |
+
public function getPostActionUrl()
|
26 |
+
{
|
27 |
+
return Mage::getUrl('artist/index/postCreate');
|
28 |
+
}
|
29 |
+
|
30 |
+
}
|
app/code/local/Thylak/Artist/Helper/Data.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Thylak
|
4 |
+
* @package Thylak_Artist
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Helper Class for the Artist Module
|
10 |
+
*
|
11 |
+
* @author Buyan <buyan@talktoaprogrammer.com, bnpart47@yahoo.com>
|
12 |
+
*/
|
13 |
+
class Thylak_Artist_Helper_Data extends Mage_Core_Helper_Abstract
|
14 |
+
{
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Get the Artist Url
|
18 |
+
*
|
19 |
+
* @return Artist login URL
|
20 |
+
*/
|
21 |
+
public function getArtisturl()
|
22 |
+
{
|
23 |
+
return Mage::getUrl('artist/index/');
|
24 |
+
}
|
25 |
+
|
26 |
+
}
|
app/code/local/Thylak/Artist/Model/Artist.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Thylak
|
4 |
+
* @package Thylak_Artist
|
5 |
+
*/
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Artist model
|
9 |
+
*
|
10 |
+
* @author Buyan <buyan@talktoaprogrammer.com, bnpart47@yahoo.com>
|
11 |
+
*/
|
12 |
+
class Thylak_Artist_Model_Artist extends Mage_Core_Model_Abstract
|
13 |
+
{
|
14 |
+
/**
|
15 |
+
* Constructor to initialize the Model
|
16 |
+
*/
|
17 |
+
public function _construct()
|
18 |
+
{
|
19 |
+
parent::_construct();
|
20 |
+
$this->_init('artist/artist');
|
21 |
+
}
|
22 |
+
}
|
app/code/local/Thylak/Artist/Model/Artwork.php
ADDED
@@ -0,0 +1,177 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Thylak
|
4 |
+
* @package Thylak_Artist
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Artwork model
|
10 |
+
*
|
11 |
+
* Artist Artwork
|
12 |
+
*
|
13 |
+
* @author Buyan <buyan@talktoaprogrammer.com, bnpart47@yahoo.com>
|
14 |
+
*/
|
15 |
+
class Thylak_Artist_Model_Artwork extends Mage_Core_Model_Abstract
|
16 |
+
{
|
17 |
+
|
18 |
+
public function _construct()
|
19 |
+
{
|
20 |
+
parent::_construct();
|
21 |
+
$this->_init('artist/artwork');
|
22 |
+
}
|
23 |
+
|
24 |
+
|
25 |
+
|
26 |
+
private $formdata=array();
|
27 |
+
function __isset($key)
|
28 |
+
{
|
29 |
+
|
30 |
+
return $this->formdata[$key];
|
31 |
+
}
|
32 |
+
function __set($key,$value)
|
33 |
+
{
|
34 |
+
|
35 |
+
$this->formdata[$key] = $value;
|
36 |
+
}
|
37 |
+
|
38 |
+
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Create Simple Product
|
42 |
+
*
|
43 |
+
* @param int $i, string $title
|
44 |
+
*
|
45 |
+
* @return simple product id $id
|
46 |
+
*/
|
47 |
+
public function createSimpleProduct()
|
48 |
+
{
|
49 |
+
$filename = $this->formdata['title'];
|
50 |
+
$i = $this->formdata['i'];
|
51 |
+
$sku = $filename.$i;
|
52 |
+
$name = $filename.$i;
|
53 |
+
if($i==0){
|
54 |
+
$price = 17;
|
55 |
+
$color = 3;
|
56 |
+
}
|
57 |
+
if($i==1){
|
58 |
+
$price = 30;
|
59 |
+
$color = 4;
|
60 |
+
}
|
61 |
+
|
62 |
+
$product = new Mage_Catalog_Model_Product();
|
63 |
+
$product->setSku($sku);
|
64 |
+
$product->setAttributeSetId(4);
|
65 |
+
$product->setColor($color);
|
66 |
+
$product->setTypeId('simple');
|
67 |
+
$product->setName($name);
|
68 |
+
$product->setCategoryIds(array(4)); # some cat id's, my is 7
|
69 |
+
$product->setWebsiteIDs(array(1)); # Website id, my is 1 (default frontend)
|
70 |
+
$product->setDescription('Full description here');
|
71 |
+
$product->setShortDescription('Short description here');
|
72 |
+
$product->setPrice($price); # Set some price
|
73 |
+
//Default Magento attribute
|
74 |
+
$product->setWeight(2);
|
75 |
+
$product->setVisibility(4);
|
76 |
+
$product->setStatus(1);
|
77 |
+
$product->setTaxClassId(0); # My default tax class
|
78 |
+
$product->setStockData(array(
|
79 |
+
'is_in_stock' => 1,
|
80 |
+
'qty' => 99
|
81 |
+
));
|
82 |
+
$product->setCreatedAt(strtotime('now'));
|
83 |
+
|
84 |
+
try {
|
85 |
+
|
86 |
+
|
87 |
+
$product->save();
|
88 |
+
$id = $product->getId();
|
89 |
+
return $id;
|
90 |
+
}
|
91 |
+
catch (Exception $ex) {
|
92 |
+
//Handle the error
|
93 |
+
}
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Create Configurable Product
|
98 |
+
*
|
99 |
+
* @param string $title
|
100 |
+
*
|
101 |
+
* Color Attribute id is 80
|
102 |
+
*
|
103 |
+
* @return configurable product id $id
|
104 |
+
*/
|
105 |
+
|
106 |
+
public function createConfigurableProduct()
|
107 |
+
{
|
108 |
+
$filename = $this->formdata['title'];
|
109 |
+
$pid = $this->formdata['pid'];
|
110 |
+
// $filename = $title;
|
111 |
+
//ini_set('memory_limit', '128M');
|
112 |
+
Mage::app();
|
113 |
+
$product = Mage::getModel('catalog/product');
|
114 |
+
$product->setTypeId('configurable');
|
115 |
+
$product->setTaxClassId(0);
|
116 |
+
$product->setWebsiteIds(array(1));
|
117 |
+
$product->setAttributeSetId(4);
|
118 |
+
$product->setSku($filename);
|
119 |
+
$product->setName($filename);
|
120 |
+
$product->setDescription('Shirt');
|
121 |
+
$product->setInDepth("shirt test");
|
122 |
+
$product->setPrice("150");
|
123 |
+
$product->setShortDescription('shirt');
|
124 |
+
$product->setWeight(0);
|
125 |
+
$product->setStatus(1); //enabled
|
126 |
+
$product->setVisibility(4); //catalog and search
|
127 |
+
$product->setMetaDescription("shirt");
|
128 |
+
$product->setMetaTitle("shirt");
|
129 |
+
$product->setMetaKeywords("shirt test");
|
130 |
+
$data = array($pid[0]=>
|
131 |
+
array('0'=>
|
132 |
+
array('attribute_id'=>'80','label'=>'Yellow','value_index'=>'3','is_percent'=>0,'pricing_value'=>'10'),
|
133 |
+
),
|
134 |
+
$pid[1]=>array('0'=>
|
135 |
+
array('attribute_id'=>'80','label'=>'Red','value_index'=>'4','is_percent'=>0,'pricing_value'=>'15'),
|
136 |
+
)
|
137 |
+
);
|
138 |
+
$product->setConfigurableProductsData($data);
|
139 |
+
$data = array('0'=>array('id'=>NULL,'label'=>'Color','position'=> NULL,
|
140 |
+
'values'=>array('0'=>
|
141 |
+
array('value_index'=>3,'label'=>'Yellow','is_percent'=>0,
|
142 |
+
'pricing_value'=>'10','attribute_id'=>'80'),
|
143 |
+
'1'=>
|
144 |
+
array('value_index'=>4,'label'=>'Red',
|
145 |
+
'is_percent'=>0,'pricing_value'=>'15','attribute_id'=>'80')
|
146 |
+
),
|
147 |
+
'attribute_id'=>80,'attribute_code'=>'color','frontend_label'=>'Color',
|
148 |
+
'html_id'=>'config_super_product__attribute_0')
|
149 |
+
);
|
150 |
+
$product->setConfigurableAttributesData($data);
|
151 |
+
$product->setCanSaveConfigurableAttributes(1);
|
152 |
+
|
153 |
+
try{
|
154 |
+
$product->save();
|
155 |
+
$productId = $product->getId();
|
156 |
+
$id = $product->getId();
|
157 |
+
return $id;
|
158 |
+
}
|
159 |
+
catch (Exception $e){
|
160 |
+
//print "exception:$e";
|
161 |
+
}
|
162 |
+
|
163 |
+
}
|
164 |
+
|
165 |
+
public function uploadArtwork()
|
166 |
+
{
|
167 |
+
try {
|
168 |
+
$imagename = $this->formdata['imagename'];
|
169 |
+
$artistid = $this->formdata['artistid'];
|
170 |
+
$uploader = new Varien_File_Uploader('imagename');
|
171 |
+
$path = Mage::getBaseDir('media') . DS . $artistid . DS;
|
172 |
+
$uploader->save($path, $imagename );
|
173 |
+
}catch (Exception $e) {
|
174 |
+
|
175 |
+
}
|
176 |
+
}
|
177 |
+
}
|
app/code/local/Thylak/Artist/Model/Mysql4/Artist.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Thylak
|
4 |
+
* @package Thylak_Artist
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Artist model
|
10 |
+
*
|
11 |
+
* Here we define the index field of the table
|
12 |
+
*
|
13 |
+
* @author Buyan <buyan@talktoaprogrammer.com, bnpart47@yahoo.com>
|
14 |
+
*/
|
15 |
+
class Thylak_Artist_Model_Mysql4_Artist extends Mage_Core_Model_Mysql4_Abstract
|
16 |
+
{
|
17 |
+
public function _construct()
|
18 |
+
{
|
19 |
+
// Note that the artist_id refers to the key field in your database table.
|
20 |
+
$this->_init('artist/artist', 'artist_id');
|
21 |
+
}
|
22 |
+
}
|
app/code/local/Thylak/Artist/Model/Mysql4/Artist/Collection.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Thylak
|
4 |
+
* @package Thylak_Artist
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Artist model - Collection - to get the collections
|
10 |
+
*
|
11 |
+
* Here we define the index field of the table
|
12 |
+
*
|
13 |
+
* @author Buyan <buyan@talktoaprogrammer.com, bnpart47@yahoo.com>
|
14 |
+
*/
|
15 |
+
class Thylak_Artist_Model_Mysql4_Artist_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
16 |
+
{
|
17 |
+
public function _construct()
|
18 |
+
{
|
19 |
+
parent::_construct();
|
20 |
+
$this->_init('artist/artist');
|
21 |
+
}
|
22 |
+
}
|
app/code/local/Thylak/Artist/Model/Mysql4/Artwork.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Thylak
|
4 |
+
* @package Thylak_Artist
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Artwork model
|
10 |
+
*
|
11 |
+
* Here we define the index field of the table
|
12 |
+
*
|
13 |
+
* @author Buyan <buyan@talktoaprogrammer.com, bnpart47@yahoo.com>
|
14 |
+
*/
|
15 |
+
class Thylak_Artist_Model_Mysql4_Artwork extends Mage_Core_Model_Mysql4_Abstract
|
16 |
+
{
|
17 |
+
public function _construct()
|
18 |
+
{
|
19 |
+
// Note that the artist_id refers to the key field in your database table.
|
20 |
+
$this->_init('artist/artwork', 'artwork_id');
|
21 |
+
}
|
22 |
+
}
|
app/code/local/Thylak/Artist/Model/Mysql4/Artwork/Collection.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Thylak
|
4 |
+
* @package Thylak_Artist
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Artwork model - Collection - to get the collections
|
10 |
+
*
|
11 |
+
* Here we define the index field of the table
|
12 |
+
*
|
13 |
+
* @author Buyan <buyan@talktoaprogrammer.com, bnpart47@yahoo.com>
|
14 |
+
*/
|
15 |
+
class Thylak_Artist_Model_Mysql4_Artwork_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
16 |
+
{
|
17 |
+
public function _construct()
|
18 |
+
{
|
19 |
+
parent::_construct();
|
20 |
+
$this->_init('artist/artwork');
|
21 |
+
}
|
22 |
+
}
|
app/code/local/Thylak/Artist/Model/Status.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Thylak_Artist_Model_Status extends Varien_Object
|
4 |
+
{
|
5 |
+
const STATUS_ENABLED = 1;
|
6 |
+
const STATUS_DISABLED = 2;
|
7 |
+
|
8 |
+
static public function getOptionArray()
|
9 |
+
{
|
10 |
+
return array(
|
11 |
+
self::STATUS_ENABLED => Mage::helper('artist')->__('Enabled'),
|
12 |
+
self::STATUS_DISABLED => Mage::helper('artist')->__('Disabled')
|
13 |
+
);
|
14 |
+
}
|
15 |
+
}
|
app/code/local/Thylak/Artist/controllers/Adminhtml/ArtistController.php
ADDED
@@ -0,0 +1,284 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Thylak
|
4 |
+
* @package Thylak_Artist
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
*
|
10 |
+
* Artist Controller for Admin Panel
|
11 |
+
*
|
12 |
+
* @author Buyan <buyan@talktoaprogrammer.com, bnpart47@yahoo.com>
|
13 |
+
*/
|
14 |
+
class Thylak_Artist_Adminhtml_ArtistController extends Mage_Adminhtml_Controller_action
|
15 |
+
{
|
16 |
+
/**
|
17 |
+
* Initialize the Layout
|
18 |
+
*/
|
19 |
+
protected function _initAction() {
|
20 |
+
$this->loadLayout()
|
21 |
+
->_setActiveMenu('artist/items')
|
22 |
+
->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
|
23 |
+
return $this;
|
24 |
+
}
|
25 |
+
/**
|
26 |
+
* Load Layout - Artist Detials Grid
|
27 |
+
*/
|
28 |
+
public function indexAction() {
|
29 |
+
$this->_initAction()
|
30 |
+
->renderLayout();
|
31 |
+
}
|
32 |
+
/**
|
33 |
+
* Load Layout - Artist Edit Page
|
34 |
+
*/
|
35 |
+
public function editAction() {
|
36 |
+
$id = $this->getRequest()->getParam('id');
|
37 |
+
$model = Mage::getModel('artist/artist')->load($id);
|
38 |
+
|
39 |
+
if ($model->getId() || $id == 0) {
|
40 |
+
$data = Mage::getSingleton('adminhtml/session')->getFormData(true);
|
41 |
+
if (!empty($data)) {
|
42 |
+
$model->setData($data);
|
43 |
+
}
|
44 |
+
|
45 |
+
Mage::register('artist_data', $model);
|
46 |
+
|
47 |
+
$this->loadLayout();
|
48 |
+
$this->_setActiveMenu('artist/items');
|
49 |
+
|
50 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
|
51 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
|
52 |
+
|
53 |
+
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
54 |
+
|
55 |
+
$this->_addContent($this->getLayout()->createBlock('artist/adminhtml_artist_edit'))
|
56 |
+
->_addLeft($this->getLayout()->createBlock('artist/adminhtml_artist_edit_tabs'));
|
57 |
+
|
58 |
+
$this->renderLayout();
|
59 |
+
} else {
|
60 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('artist')->__('Item does not exist'));
|
61 |
+
$this->_redirect('*/*/');
|
62 |
+
}
|
63 |
+
}
|
64 |
+
/**
|
65 |
+
* Load Layout - Artwork Edit Page
|
66 |
+
*/
|
67 |
+
public function editartworkAction() {
|
68 |
+
$id = $this->getRequest()->getParam('id');
|
69 |
+
$model = Mage::getModel('artist/artwork')->load($id);
|
70 |
+
|
71 |
+
if ($model->getId() || $id == 0) {
|
72 |
+
$data = Mage::getSingleton('adminhtml/session')->getFormData(true);
|
73 |
+
if (!empty($data)) {
|
74 |
+
$model->setData($data);
|
75 |
+
}
|
76 |
+
|
77 |
+
Mage::register('artwork_data', $model);
|
78 |
+
|
79 |
+
$this->loadLayout();
|
80 |
+
$this->_setActiveMenu('artist/items');
|
81 |
+
|
82 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
|
83 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
|
84 |
+
|
85 |
+
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
86 |
+
|
87 |
+
$this->_addContent($this->getLayout()->createBlock('artist/adminhtml_artwork_edit'));
|
88 |
+
//->_addLeft($this->getLayout()->createBlock('artist/adminhtml_artwork_edit_tabs'));
|
89 |
+
|
90 |
+
$this->renderLayout();
|
91 |
+
} else {
|
92 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('artist')->__('Item does not exist'));
|
93 |
+
$this->_redirect('*/*/');
|
94 |
+
}
|
95 |
+
}
|
96 |
+
/**
|
97 |
+
* Load Layout - Add New Artist
|
98 |
+
*/
|
99 |
+
public function newAction() {
|
100 |
+
$this->_forward('edit');
|
101 |
+
}
|
102 |
+
/**
|
103 |
+
* Save Artist Detials
|
104 |
+
*/
|
105 |
+
public function saveAction() {
|
106 |
+
if ($data = $this->getRequest()->getPost()) {
|
107 |
+
|
108 |
+
//if(isset($_FILES['filename']['name']) && $_FILES['filename']['name'] != '') {
|
109 |
+
//try {
|
110 |
+
/* Starting upload */
|
111 |
+
//$uploader = new Varien_File_Uploader('filename');
|
112 |
+
|
113 |
+
// Any extention would work
|
114 |
+
//$uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
|
115 |
+
//$uploader->setAllowRenameFiles(false);
|
116 |
+
|
117 |
+
// Set the file upload mode
|
118 |
+
// false -> get the file directly in the specified folder
|
119 |
+
// true -> get the file in the product like folders
|
120 |
+
// (file.jpg will go in something like /media/f/i/file.jpg)
|
121 |
+
//$uploader->setFilesDispersion(false);
|
122 |
+
|
123 |
+
// We set media as the upload dir
|
124 |
+
//$path = Mage::getBaseDir('media') . DS ;
|
125 |
+
//$uploader->save($path, $_FILES['filename']['name'] );
|
126 |
+
|
127 |
+
//} catch (Exception $e) {
|
128 |
+
|
129 |
+
//}
|
130 |
+
|
131 |
+
//this way the name is saved in DB
|
132 |
+
//$data['filename'] = $_FILES['filename']['name'];
|
133 |
+
//}
|
134 |
+
|
135 |
+
|
136 |
+
$model = Mage::getModel('artist/artist');
|
137 |
+
$model->setData($data)
|
138 |
+
->setId($this->getRequest()->getParam('id'));
|
139 |
+
|
140 |
+
try {
|
141 |
+
if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
|
142 |
+
$model->setCreatedTime(now())
|
143 |
+
->setUpdateTime(now());
|
144 |
+
} else {
|
145 |
+
$model->setUpdateTime(now());
|
146 |
+
}
|
147 |
+
|
148 |
+
$model->save();
|
149 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('artist')->__('Item was successfully saved'));
|
150 |
+
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
151 |
+
|
152 |
+
if ($this->getRequest()->getParam('back')) {
|
153 |
+
$this->_redirect('*/*/edit', array('id' => $model->getId()));
|
154 |
+
return;
|
155 |
+
}
|
156 |
+
$this->_redirect('*/*/');
|
157 |
+
return;
|
158 |
+
} catch (Exception $e) {
|
159 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
160 |
+
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
161 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
162 |
+
return;
|
163 |
+
}
|
164 |
+
}
|
165 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('artist')->__('Unable to find item to save'));
|
166 |
+
$this->_redirect('*/*/');
|
167 |
+
}
|
168 |
+
/**
|
169 |
+
* Delete Artist Detials
|
170 |
+
*/
|
171 |
+
public function deleteAction() {
|
172 |
+
if( $this->getRequest()->getParam('id') > 0 ) {
|
173 |
+
try {
|
174 |
+
$model = Mage::getModel('artist/artist');
|
175 |
+
|
176 |
+
$model->setId($this->getRequest()->getParam('id'))
|
177 |
+
->delete();
|
178 |
+
|
179 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));
|
180 |
+
$this->_redirect('*/*/');
|
181 |
+
} catch (Exception $e) {
|
182 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
183 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
184 |
+
}
|
185 |
+
}
|
186 |
+
$this->_redirect('*/*/');
|
187 |
+
}
|
188 |
+
/**
|
189 |
+
* Delete Selected Artist Detials - as a mass action
|
190 |
+
*/
|
191 |
+
public function massDeleteAction() {
|
192 |
+
$artistIds = $this->getRequest()->getParam('artist');
|
193 |
+
if(!is_array($artistIds)) {
|
194 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
|
195 |
+
} else {
|
196 |
+
try {
|
197 |
+
foreach ($artistIds as $artistId) {
|
198 |
+
$artist = Mage::getModel('artist/artist')->load($artistId);
|
199 |
+
$artist->delete();
|
200 |
+
}
|
201 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
202 |
+
Mage::helper('adminhtml')->__(
|
203 |
+
'Total of %d record(s) were successfully deleted', count($artistIds)
|
204 |
+
)
|
205 |
+
);
|
206 |
+
} catch (Exception $e) {
|
207 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
208 |
+
}
|
209 |
+
}
|
210 |
+
$this->_redirect('*/*/index');
|
211 |
+
}
|
212 |
+
|
213 |
+
|
214 |
+
/**
|
215 |
+
* Export Artist Detials as a csv formated
|
216 |
+
*/
|
217 |
+
public function exportCsvAction()
|
218 |
+
{
|
219 |
+
$fileName = 'artist.csv';
|
220 |
+
$content = $this->getLayout()->createBlock('artist/adminhtml_artist_grid')
|
221 |
+
->getCsv();
|
222 |
+
|
223 |
+
$this->_sendUploadResponse($fileName, $content);
|
224 |
+
}
|
225 |
+
|
226 |
+
public function exportXmlAction()
|
227 |
+
{
|
228 |
+
$fileName = 'artist.xml';
|
229 |
+
$content = $this->getLayout()->createBlock('artist/adminhtml_artist_grid')
|
230 |
+
->getXml();
|
231 |
+
|
232 |
+
$this->_sendUploadResponse($fileName, $content);
|
233 |
+
}
|
234 |
+
|
235 |
+
protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
|
236 |
+
{
|
237 |
+
$response = $this->getResponse();
|
238 |
+
$response->setHeader('HTTP/1.1 200 OK','');
|
239 |
+
$response->setHeader('Pragma', 'public', true);
|
240 |
+
$response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
|
241 |
+
$response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
|
242 |
+
$response->setHeader('Last-Modified', date('r'));
|
243 |
+
$response->setHeader('Accept-Ranges', 'bytes');
|
244 |
+
$response->setHeader('Content-Length', strlen($content));
|
245 |
+
$response->setHeader('Content-type', $contentType);
|
246 |
+
$response->setBody($content);
|
247 |
+
$response->sendResponse();
|
248 |
+
die;
|
249 |
+
}
|
250 |
+
|
251 |
+
/**
|
252 |
+
* Create Simple and Configurable Product of the Artwork
|
253 |
+
*/
|
254 |
+
public function saveartworkAction()
|
255 |
+
{
|
256 |
+
$artworkid = $this->getRequest()->getParam('id');
|
257 |
+
$thylakproduct = Mage::getModel('artist/artwork');
|
258 |
+
$status = $thylakproduct->load($artworkid)->status;
|
259 |
+
$postdata = $this->getRequest()->getPost();
|
260 |
+
$thylakproduct->setData($postdata);
|
261 |
+
$thylakproduct->setId($artworkid);
|
262 |
+
$thylakproduct->save();
|
263 |
+
if(($postdata['status']==1) && ($status!=1))
|
264 |
+
{
|
265 |
+
$imagename = $thylakproduct->load($artworkid)->imagename;
|
266 |
+
$title = $thylakproduct->load($artworkid)->title;
|
267 |
+
$thylakproduct->title = $title;
|
268 |
+
for($i=0;$i<2;$i++)
|
269 |
+
{
|
270 |
+
$thylakproduct->i = $i;
|
271 |
+
$thylaksimpleproduct = $thylakproduct->createSimpleProduct();
|
272 |
+
$pid[$i] = $thylaksimpleproduct;
|
273 |
+
}
|
274 |
+
$thylakproduct->pid = $pid;
|
275 |
+
$thylakconfigurableproduct = $thylakproduct->createConfigurableProduct();
|
276 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('artist')->__('Product was successfully created'));
|
277 |
+
}
|
278 |
+
else
|
279 |
+
{
|
280 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('artist')->__('Artwork Information successfully Updated'));
|
281 |
+
}
|
282 |
+
$this->_redirect('artist/adminhtml_artist/index');
|
283 |
+
}
|
284 |
+
}
|
app/code/local/Thylak/Artist/controllers/IndexController.php
ADDED
@@ -0,0 +1,146 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Thylak
|
4 |
+
* @package Thylak_Artist
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
*
|
10 |
+
* Artist Module
|
11 |
+
*
|
12 |
+
* Front End Controller for Artist Module
|
13 |
+
*
|
14 |
+
* @author Buyan <buyan@talktoaprogrammer.com, bnpart47@yahoo.com>
|
15 |
+
*/
|
16 |
+
class Thylak_Artist_IndexController extends Mage_Core_Controller_Front_Action
|
17 |
+
{
|
18 |
+
/**
|
19 |
+
* Load Layout - Login Page - Login.phtml
|
20 |
+
*/
|
21 |
+
public function indexAction()
|
22 |
+
{
|
23 |
+
$_SESSION['id'] = "";
|
24 |
+
$this->loadLayout();
|
25 |
+
$this->renderLayout();
|
26 |
+
}
|
27 |
+
/**
|
28 |
+
* Load Layout - Register Page - register.phtml
|
29 |
+
*/
|
30 |
+
public function createAction()
|
31 |
+
{
|
32 |
+
$_SESSION['id'] = "";
|
33 |
+
$this->loadLayout();
|
34 |
+
$this->renderLayout();
|
35 |
+
|
36 |
+
}
|
37 |
+
/**
|
38 |
+
* Load Layout - Artwork Page - artwork.phtml
|
39 |
+
*/
|
40 |
+
public function artworkAction()
|
41 |
+
{
|
42 |
+
if($_SESSION['id'] != "") {
|
43 |
+
$this->loadLayout();
|
44 |
+
$this->renderLayout();
|
45 |
+
} else {
|
46 |
+
return $this->_redirect('*/*/index', array('id' => $_SESSION['id']));
|
47 |
+
}
|
48 |
+
|
49 |
+
}
|
50 |
+
/**
|
51 |
+
* Load Layout - Artist Page - artist.phtml
|
52 |
+
*/
|
53 |
+
public function artistAction()
|
54 |
+
{
|
55 |
+
if($_SESSION['id'] != "") {
|
56 |
+
$this->loadLayout();
|
57 |
+
$this->renderLayout();
|
58 |
+
} else {
|
59 |
+
return $this->_redirect('*/*/index', array('id' => $_SESSION['id']));
|
60 |
+
}
|
61 |
+
|
62 |
+
}
|
63 |
+
/**
|
64 |
+
* Verify Login Details & login into artwork page
|
65 |
+
*
|
66 |
+
*/
|
67 |
+
public function loginPostAction()
|
68 |
+
{
|
69 |
+
|
70 |
+
$collection = Mage::getModel('artist/artist')->getCollection();
|
71 |
+
foreach ($collection as $item) {
|
72 |
+
if(($item->email == $this->getRequest()->getPost('email'))&&($item->password == $this->getRequest()->getPost('pass')))
|
73 |
+
{
|
74 |
+
|
75 |
+
$_SESSION['id'] = $item->artist_id;
|
76 |
+
Mage::getSingleton('core/session')->addSuccess('LoginSuccess');
|
77 |
+
return $this->_redirect('*/*/artist/id/'.$item->artist_id);
|
78 |
+
}
|
79 |
+
}
|
80 |
+
Mage::getSingleton('core/session')->addSuccess('LoginFailed');
|
81 |
+
return $this->_redirect('*/*/index');
|
82 |
+
}
|
83 |
+
/**
|
84 |
+
* Create a New Account
|
85 |
+
*
|
86 |
+
*/
|
87 |
+
public function postCreateAction()
|
88 |
+
{
|
89 |
+
$collection = Mage::getModel('artist/artist')->getCollection();
|
90 |
+
foreach ($collection as $item) {
|
91 |
+
if($item->email == $this->getRequest()->getPost('email'))
|
92 |
+
{
|
93 |
+
Mage::getSingleton('core/session')->addError('Artist email already available');
|
94 |
+
return $this->_redirect('*/*/index');
|
95 |
+
}
|
96 |
+
}
|
97 |
+
$artist = Mage::getModel('artist/artist');
|
98 |
+
$postdata = $this->getRequest()->getPost();
|
99 |
+
$artist->setData($postdata);
|
100 |
+
$artist->setCreatedTime(now());
|
101 |
+
$artist->setUpdateTime(now());
|
102 |
+
$artist->save();
|
103 |
+
$_SESSION['id'] = $artist->getData('artist_id') ;
|
104 |
+
Mage::getSingleton('core/session')->addSuccess('Artist information saved successfully');
|
105 |
+
return $this->_redirect('*/*/artist', array('id' => $artist->getData('artist_id')));
|
106 |
+
}
|
107 |
+
/**
|
108 |
+
* Save Artwork Details
|
109 |
+
*
|
110 |
+
*/
|
111 |
+
public function artworksaveAction()
|
112 |
+
{
|
113 |
+
$imagename = $_FILES['imagename']['name'];
|
114 |
+
$artwork = Mage::getModel('artist/artwork');
|
115 |
+
$title = $this->getRequest()->getPost('title');
|
116 |
+
$artistid = $this->getRequest()->getPost('artist_id');
|
117 |
+
$artwork->setImagename($imagename);
|
118 |
+
$artwork->setArtistId($artistid);
|
119 |
+
$artwork->setTitle($title);
|
120 |
+
$artwork->artistid = $artistid;
|
121 |
+
$artwork->imagename = $imagename;
|
122 |
+
$uploadartworkimage = $artwork->uploadArtwork();
|
123 |
+
$artwork->setCreatedTime(now());
|
124 |
+
$artwork->setUpdateTime(now());
|
125 |
+
$artwork->save();
|
126 |
+
Mage::getSingleton('core/session')->addSuccess('Artwork image uploaded successfully');
|
127 |
+
return $this->_redirect('*/*/artwork', array('id' => $artistid));
|
128 |
+
}
|
129 |
+
|
130 |
+
/**
|
131 |
+
* Save Artist Details
|
132 |
+
*
|
133 |
+
*/
|
134 |
+
public function artistsaveAction()
|
135 |
+
{
|
136 |
+
$id = $_SESSION['id'];
|
137 |
+
$artist = Mage::getModel('artist/artist');
|
138 |
+
$artist->setData($this->getRequest()->getPost());
|
139 |
+
$artist->setUpdateTime(now());
|
140 |
+
$artist->setId($id);
|
141 |
+
$artist->save();
|
142 |
+
Mage::getSingleton('core/session')->addSuccess('Artist information updated successfully');
|
143 |
+
return $this->_redirect('*/*/artist', array('id' => $id));
|
144 |
+
}
|
145 |
+
|
146 |
+
}
|
app/code/local/Thylak/Artist/etc/config.xml
ADDED
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
|
3 |
+
<!-- Config file -->
|
4 |
+
|
5 |
+
<config>
|
6 |
+
<modules>
|
7 |
+
<Thylak_Artist>
|
8 |
+
<version>0.1.0</version>
|
9 |
+
</Thylak_Artist>
|
10 |
+
</modules>
|
11 |
+
<frontend>
|
12 |
+
<routers>
|
13 |
+
<artist>
|
14 |
+
<use>standard</use>
|
15 |
+
<args>
|
16 |
+
<module>Thylak_Artist</module>
|
17 |
+
<frontName>artist</frontName>
|
18 |
+
</args>
|
19 |
+
</artist>
|
20 |
+
</routers>
|
21 |
+
<layout>
|
22 |
+
<updates>
|
23 |
+
<artist>
|
24 |
+
<file>artist.xml</file>
|
25 |
+
</artist>
|
26 |
+
</updates>
|
27 |
+
</layout>
|
28 |
+
</frontend>
|
29 |
+
<admin>
|
30 |
+
<routers>
|
31 |
+
<artist>
|
32 |
+
<use>admin</use>
|
33 |
+
<args>
|
34 |
+
<module>Thylak_Artist</module>
|
35 |
+
<frontName>artist</frontName>
|
36 |
+
</args>
|
37 |
+
</artist>
|
38 |
+
</routers>
|
39 |
+
</admin>
|
40 |
+
<adminhtml>
|
41 |
+
<menu>
|
42 |
+
<artist module="artist">
|
43 |
+
<title>Artist</title>
|
44 |
+
<sort_order>71</sort_order>
|
45 |
+
<children>
|
46 |
+
<items module="artist">
|
47 |
+
<title>Manage Artist</title>
|
48 |
+
<sort_order>0</sort_order>
|
49 |
+
<action>artist/adminhtml_artist</action>
|
50 |
+
</items>
|
51 |
+
</children>
|
52 |
+
</artist>
|
53 |
+
</menu>
|
54 |
+
<acl>
|
55 |
+
<resources>
|
56 |
+
<all>
|
57 |
+
<title>Allow Everything</title>
|
58 |
+
</all>
|
59 |
+
<admin>
|
60 |
+
<children>
|
61 |
+
<Thylak_Artist>
|
62 |
+
<title>Artist Module</title>
|
63 |
+
<sort_order>10</sort_order>
|
64 |
+
</Thylak_Artist>
|
65 |
+
</children>
|
66 |
+
</admin>
|
67 |
+
</resources>
|
68 |
+
</acl>
|
69 |
+
<layout>
|
70 |
+
<updates>
|
71 |
+
<artist>
|
72 |
+
<file>artist.xml</file>
|
73 |
+
</artist>
|
74 |
+
</updates>
|
75 |
+
</layout>
|
76 |
+
</adminhtml>
|
77 |
+
<global>
|
78 |
+
<models>
|
79 |
+
<artist>
|
80 |
+
<class>Thylak_Artist_Model</class>
|
81 |
+
<resourceModel>artist_mysql4</resourceModel>
|
82 |
+
</artist>
|
83 |
+
<artist_mysql4>
|
84 |
+
<class>Thylak_Artist_Model_Mysql4</class>
|
85 |
+
<entities>
|
86 |
+
<artist>
|
87 |
+
<table>artist</table>
|
88 |
+
</artist>
|
89 |
+
</entities>
|
90 |
+
<entities>
|
91 |
+
<artwork>
|
92 |
+
<table>artwork</table>
|
93 |
+
</artwork>
|
94 |
+
</entities>
|
95 |
+
</artist_mysql4>
|
96 |
+
</models>
|
97 |
+
<resources>
|
98 |
+
<artist_setup>
|
99 |
+
<setup>
|
100 |
+
<module>Thylak_Artist</module>
|
101 |
+
</setup>
|
102 |
+
<connection>
|
103 |
+
<use>core_setup</use>
|
104 |
+
</connection>
|
105 |
+
</artist_setup>
|
106 |
+
<artist_write>
|
107 |
+
<connection>
|
108 |
+
<use>core_write</use>
|
109 |
+
</connection>
|
110 |
+
</artist_write>
|
111 |
+
<artist_read>
|
112 |
+
<connection>
|
113 |
+
<use>core_read</use>
|
114 |
+
</connection>
|
115 |
+
</artist_read>
|
116 |
+
</resources>
|
117 |
+
<blocks>
|
118 |
+
<artist>
|
119 |
+
<class>Thylak_Artist_Block</class>
|
120 |
+
</artist>
|
121 |
+
</blocks>
|
122 |
+
<helpers>
|
123 |
+
<artist>
|
124 |
+
<class>Thylak_Artist_Helper</class>
|
125 |
+
</artist>
|
126 |
+
</helpers>
|
127 |
+
</global>
|
128 |
+
</config>
|
app/code/local/Thylak/Artist/sql/artist_setup/mysql4-install-0.1.0.php
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Thylak
|
4 |
+
* @package Thylak_Artist
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Table Creation - create table for the artist and artwork details
|
10 |
+
*
|
11 |
+
* @author Buyan <buyan@talktoaprogrammer.com, bnpart47@yahoo.com>
|
12 |
+
*/
|
13 |
+
$installer = $this;
|
14 |
+
|
15 |
+
$installer->startSetup();
|
16 |
+
|
17 |
+
$installer->run("
|
18 |
+
|
19 |
+
-- DROP TABLE IF EXISTS {$this->getTable('artist')};
|
20 |
+
CREATE TABLE {$this->getTable('artist')} (
|
21 |
+
`artist_id` int(11) unsigned NOT NULL auto_increment,
|
22 |
+
`firstname` varchar(255) NOT NULL default '',
|
23 |
+
`lastname` varchar(255) NOT NULL default '',
|
24 |
+
`email` varchar(255) NOT NULL default '',
|
25 |
+
`password` varchar(255) NOT NULL default '',
|
26 |
+
`created_time` datetime NULL,
|
27 |
+
`update_time` datetime NULL,
|
28 |
+
PRIMARY KEY (`artist_id`)
|
29 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
30 |
+
|
31 |
+
");
|
32 |
+
|
33 |
+
$installer->run("
|
34 |
+
|
35 |
+
-- DROP TABLE IF EXISTS {$this->getTable('artwork')};
|
36 |
+
CREATE TABLE {$this->getTable('artwork')} (
|
37 |
+
`artwork_id` int(11) unsigned NOT NULL auto_increment,
|
38 |
+
`artist_id` int(11) NOT NULL,
|
39 |
+
`imagename` varchar(255) NOT NULL default '',
|
40 |
+
`title` varchar(255) NOT NULL default '',
|
41 |
+
`status` tinyint(1) NOT NULL default 0,
|
42 |
+
`created_time` datetime NULL,
|
43 |
+
`update_time` datetime NULL,
|
44 |
+
PRIMARY KEY (`artwork_id`)
|
45 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
46 |
+
|
47 |
+
");
|
48 |
+
|
49 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/layout/artist.xml
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
|
3 |
+
<!-- This layout file is used to route the controller and actions -->
|
4 |
+
|
5 |
+
<layout version="0.1.0">
|
6 |
+
<artist_adminhtml_artist_index>
|
7 |
+
<reference name="content">
|
8 |
+
<block type="artist/adminhtml_artist" name="artist" />
|
9 |
+
</reference>
|
10 |
+
</artist_adminhtml_artist_index>
|
11 |
+
|
12 |
+
</layout>
|
app/design/adminhtml/default/default/template/artist/artwork.phtml
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!-- It is a view file for the admin artwork details -->
|
2 |
+
|
3 |
+
<table align="center" border="1" width="50%">
|
4 |
+
<tr><td align="center" colspan="2">
|
5 |
+
<h4><?php echo $this->__('Artwork Uploaded Image') ?></h4>
|
6 |
+
<?php
|
7 |
+
$id = $this->getRequest()->getParam('id');
|
8 |
+
if($id!="")
|
9 |
+
{
|
10 |
+
$artwork = Mage::getModel('artist/artwork')->load($id);
|
11 |
+
$title = $artwork->title;
|
12 |
+
$status = $artwork->status;
|
13 |
+
$imgname = $artwork->imagename;
|
14 |
+
$artist_id = $artwork->artist_id;
|
15 |
+
$src = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).$artist_id."/".$imgname;
|
16 |
+
}
|
17 |
+
?>
|
18 |
+
<form name="artform" id="artform" method="post" action="<?php echo $this->getUrl('*/*/saveartwork/id/'.$id); ?>" enctype="multipart/form-data">
|
19 |
+
<input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
|
20 |
+
|
21 |
+
<div class="form-edit">
|
22 |
+
</td></tr><tr><td><label for="title" class="required"><em>*</em><?php echo $this->__('Title') ?></label></td><td>
|
23 |
+
|
24 |
+
<input type="text" name="title" id="title" title="<?php echo $this->__('Title') ?>" class="input-text required-entry" value = "<?php echo $title; ?>" />
|
25 |
+
|
26 |
+
</td></tr>
|
27 |
+
<tr><td>
|
28 |
+
<label for="status" class="required"><?php echo $this->__('Approve for Catalog') ?></label></td><td>
|
29 |
+
|
30 |
+
<input type="radio" name="status" id="status" title="<?php echo $this->__('Yes') ?>" class="input-text required-entry" value = "1" <?php if($status == 1) { ?> checked="checked" <?php } ?> />Yes
|
31 |
+
<input type="radio" name="status" id="status" title="<?php echo $this->__('No') ?>" class="input-text required-entry" value = "0" <?php if($status == 0) { ?> checked="checked" <?php } else { ?> disabled="disabled" <?php } ?>/>No
|
32 |
+
|
33 |
+
</td></tr>
|
34 |
+
<tr><td><img src="<?php echo $src; ?>" height="50" width="50" /></td><td><div class="buttons-set" align="right">
|
35 |
+
<p class="required"><?php echo $this->__('* Required Fields') ?></p>
|
36 |
+
<a href="<?php echo $this->getUrl('*/*/index/'); ?>" >Back</a>
|
37 |
+
<button class="scalable save" type="submit"><span>Submit my form</span></button>
|
38 |
+
</div>
|
39 |
+
</div>
|
40 |
+
</tr>
|
41 |
+
</table>
|
42 |
+
</form>
|
app/design/frontend/base/default/layout/artist.xml
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<default>
|
4 |
+
<reference name="top.links">
|
5 |
+
<action method="addLink" translate="label title" module="artist"><label>Artist Login/Logout</label><url helper="artist/getArtisturl"/><title>Artist Login/Logout</title><prepare/><urlParams/><position>5</position></action>
|
6 |
+
</reference>
|
7 |
+
</default>
|
8 |
+
|
9 |
+
<artist_index_index>
|
10 |
+
<reference name="root">
|
11 |
+
<action method="setTemplate"><template>page/1column.phtml</template></action>
|
12 |
+
</reference>
|
13 |
+
<reference name="content">
|
14 |
+
<block type="artist/login" name="artist_login" template="artist/login.phtml" />
|
15 |
+
</reference>
|
16 |
+
</artist_index_index>
|
17 |
+
|
18 |
+
<artist_index_create>
|
19 |
+
<reference name="root">
|
20 |
+
<action method="setTemplate"><template>page/1column.phtml</template></action>
|
21 |
+
</reference>
|
22 |
+
<reference name="content">
|
23 |
+
<block type="artist/register" name="artist_register" template="artist/register.phtml">
|
24 |
+
|
25 |
+
</block>
|
26 |
+
</reference>
|
27 |
+
</artist_index_create>
|
28 |
+
|
29 |
+
<artist_index_artwork>
|
30 |
+
|
31 |
+
<reference name="root">
|
32 |
+
<action method="setTemplate"><template>page/2columns-left.phtml</template></action>
|
33 |
+
</reference>
|
34 |
+
<reference name="left">
|
35 |
+
<block type="artist/link" name="artist_link" before="_" template="artist/link.phtml" />
|
36 |
+
</reference>
|
37 |
+
<reference name="content">
|
38 |
+
<block type="artist/artwork" name="artist_artwork" template="artist/artwork.phtml" />
|
39 |
+
</reference>
|
40 |
+
</artist_index_artwork>
|
41 |
+
|
42 |
+
|
43 |
+
<artist_index_artist>
|
44 |
+
|
45 |
+
<reference name="root">
|
46 |
+
<action method="setTemplate"><template>page/2columns-left.phtml</template></action>
|
47 |
+
</reference>
|
48 |
+
<reference name="left">
|
49 |
+
<block type="artist/link" name="artist_link" before="_" template="artist/link.phtml" />
|
50 |
+
</reference>
|
51 |
+
<reference name="content">
|
52 |
+
<block type="artist/artist" name="artist_artwork" template="artist/artist.phtml" />
|
53 |
+
</reference>
|
54 |
+
</artist_index_artist>
|
55 |
+
|
56 |
+
|
57 |
+
|
58 |
+
|
59 |
+
|
60 |
+
|
61 |
+
|
62 |
+
</layout>
|
app/design/frontend/base/default/template/artist/artist.phtml
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<h4><?php echo $this->__('Artist Information') ?></h4>
|
2 |
+
<?php
|
3 |
+
$id = $this->getRequest()->getParam('id');
|
4 |
+
$artist = Mage::getModel('artist/artist')->load($id);
|
5 |
+
?>
|
6 |
+
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
|
7 |
+
<form name="artform" id="artform" method="post" action="<?php echo $this->getSaveUrl(); ?>" enctype="multipart/form-data">
|
8 |
+
<div class="fieldset">
|
9 |
+
<ul class="form-list">
|
10 |
+
<li class="fields">
|
11 |
+
<label for="firstname" class="required"><em>*</em><?php echo $this->__('First Name') ?></label>
|
12 |
+
<div class="input-box">
|
13 |
+
<input type="text" name="firstname" id="firstname" title="<?php echo $this->__('First Name') ?>" class="input-text required-entry" value = "<?php echo $artist->firstname; ?>" />
|
14 |
+
</div>
|
15 |
+
</li>
|
16 |
+
<li class="fields">
|
17 |
+
<label for="lastname" class="required"><em>*</em><?php echo $this->__('Last Name') ?></label>
|
18 |
+
<div class="input-box">
|
19 |
+
<input type="text" name="lastname" id="lastname" title="<?php echo $this->__('Last Name') ?>" class="input-text required-entry" value = "<?php echo $artist->lastname; ?>" />
|
20 |
+
</div>
|
21 |
+
</li>
|
22 |
+
<li class="fields">
|
23 |
+
<label for="email" class="required"><em>*</em><?php echo $this->__('Email') ?></label>
|
24 |
+
<div class="input-box">
|
25 |
+
<input type="text" name="email" id="email" title="<?php echo $this->__('Email') ?>" class="input-text required-entry validate-email" value = "<?php echo $artist->email; ?>" />
|
26 |
+
</div>
|
27 |
+
</li>
|
28 |
+
</ul>
|
29 |
+
<div class="buttons-set">
|
30 |
+
<p class="required"><?php echo $this->__('* Required Fields') ?></p>
|
31 |
+
<button type="submit" title="<?php echo $this->__('Submit') ?>" class="button"><span><span><?php echo $this->__('Submit') ?></span></span></button>
|
32 |
+
</div>
|
33 |
+
</div>
|
34 |
+
</form>
|
35 |
+
<script type="text/javascript">
|
36 |
+
//<![CDATA[
|
37 |
+
var dataForm = new VarienForm('artform', true);
|
38 |
+
//]]>
|
39 |
+
</script>
|
app/design/frontend/base/default/template/artist/artistbk.phtml
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<h4><?php echo $this->__('Module List') ?></h4>
|
2 |
+
<?php
|
3 |
+
|
4 |
+
/*
|
5 |
+
This shows how to load specific fields from a record in the database.
|
6 |
+
1) Note the load(15), this corresponds to saying "select * from table where table_id = 15"
|
7 |
+
2) You can then just use the get(fieldname) to pull specific data from the table.
|
8 |
+
3) If you have a field named news_id, then it becomes getNewsId, etc.
|
9 |
+
*/
|
10 |
+
/*
|
11 |
+
$news = Mage::getModel('<module>/<module>')->load(15);
|
12 |
+
echo $news->getNewsId();
|
13 |
+
echo $news->getTitle();
|
14 |
+
echo $news->getContent();
|
15 |
+
echo $news->getStatus();
|
16 |
+
*/
|
17 |
+
|
18 |
+
/*
|
19 |
+
This shows an alternate way of loading datas from a record using the database the "Magento Way" (using blocks and controller).
|
20 |
+
Uncomment blocks in /app/code/local/Namespace/Module/controllers/IndexController.php if you want to use it.
|
21 |
+
|
22 |
+
*/
|
23 |
+
/*
|
24 |
+
$object = $this->get<Module>();
|
25 |
+
echo 'id: '.$object['test_id'].'<br/>';
|
26 |
+
echo 'title: '.$object['title'].'<br/>';
|
27 |
+
echo 'content: '.$object['content'].'<br/>';
|
28 |
+
echo 'status: '.$object['status'].'<br/>';
|
29 |
+
*/
|
30 |
+
|
31 |
+
|
32 |
+
/*
|
33 |
+
This shows how to load multiple rows in a collection and save a change to them.
|
34 |
+
1) The setPageSize function will load only 5 records per page and you can set the current Page with the setCurPage function.
|
35 |
+
2) The $collection->walk('save') allows you to save everything in the collection after all changes have been made.
|
36 |
+
*/
|
37 |
+
/*
|
38 |
+
$i = 0;
|
39 |
+
|
40 |
+
$collection = Mage::getModel('<module>/<module>')->getCollection();
|
41 |
+
$collection->setPageSize(5);
|
42 |
+
$collection->setCurPage(2);
|
43 |
+
$size = $collection->getSize();
|
44 |
+
$cnt = count($collection);
|
45 |
+
foreach ($collection as $item) {
|
46 |
+
$i = $i+1;
|
47 |
+
$item->setTitle($i);
|
48 |
+
echo $item->getTitle();
|
49 |
+
}
|
50 |
+
|
51 |
+
$collection->walk('save');
|
52 |
+
*/
|
53 |
+
|
54 |
+
/*
|
55 |
+
This shows how to load a single record and save a change.
|
56 |
+
1) Note the setTitle, this corresponds to the table field name, title, and then you pass it the text to change.
|
57 |
+
2) Call the save() function only on a single record.
|
58 |
+
*/
|
59 |
+
/*
|
60 |
+
$object = Mage::getModel('<module>/<module>')->load(1);
|
61 |
+
$object->setTitle('This is a changed title');
|
62 |
+
$object->save();
|
63 |
+
*/
|
64 |
+
|
65 |
+
?>
|
app/design/frontend/base/default/template/artist/artwork.phtml
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php $id = $this->getRequest()->getParam('id'); ?>
|
2 |
+
<h4><?php echo $this->__('Artwork Image Upload') ?></h4>
|
3 |
+
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
|
4 |
+
<form name="artform" id="artform" method="post" action="<?php echo $this->getSaveUrl(); ?>" enctype="multipart/form-data">
|
5 |
+
<div class="fieldset">
|
6 |
+
<input type="hidden" name="artist_id" id="artist_id" value = "<?php echo $id; ?>" />
|
7 |
+
<ul class="form-list">
|
8 |
+
<li class="fields">
|
9 |
+
<label for="title" class="required"><em>*</em><?php echo $this->__('Title') ?></label>
|
10 |
+
<div class="input-box">
|
11 |
+
<input type="text" name="title" id="title" title="<?php echo $this->__('Title') ?>" class="input-text required-entry" value = "" />
|
12 |
+
|
13 |
+
</div>
|
14 |
+
</li>
|
15 |
+
<li class="fields">
|
16 |
+
<label for="imagename" class="required"><em>*</em> <?php echo $this->__('File') ?></label>
|
17 |
+
<div class="input-box">
|
18 |
+
<input type="file" name="imagename" id="imagename" title="<?php echo $this->__('File') ?>" class="required-entry" />
|
19 |
+
</div>
|
20 |
+
</li>
|
21 |
+
|
22 |
+
</ul>
|
23 |
+
<div class="buttons-set">
|
24 |
+
<p class="required"><?php echo $this->__('* Required Fields') ?></p>
|
25 |
+
<button type="submit" title="<?php echo $this->__('Submit') ?>" class="button"><span><span><?php echo $this->__('Submit') ?></span></span></button>
|
26 |
+
</div>
|
27 |
+
</div>
|
28 |
+
</form>
|
29 |
+
<script type="text/javascript">
|
30 |
+
//<![CDATA[
|
31 |
+
var dataForm = new VarienForm('artform', true);
|
32 |
+
//]]>
|
33 |
+
</script>
|
app/design/frontend/base/default/template/artist/link.phtml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="block">
|
2 |
+
<div class="block-title">
|
3 |
+
<strong><span><?php echo $this->__('My Account') ?></span></strong>
|
4 |
+
</div>
|
5 |
+
<div class="block-content">
|
6 |
+
<a href="<?php echo $this->getArtistinfoUrl(); ?>">Artist Info</a><br \>
|
7 |
+
<a href="<?php echo $this->getArtworkinfoUrl(); ?>">Artwork Info</a>
|
8 |
+
</div>
|
9 |
+
</div>
|
app/design/frontend/base/default/template/artist/login.phtml
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="account-login">
|
2 |
+
<div class="page-title">
|
3 |
+
<h3><?php echo $this->__('Log in or Create an Account') ?></h3>
|
4 |
+
</div>
|
5 |
+
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
|
6 |
+
<div class="col2-set">
|
7 |
+
<form action="<?php echo $this->getRegisterPostActionUrl() ?>" method="post" id=register-form">
|
8 |
+
<div class="col-1 new-users">
|
9 |
+
<div class="content">
|
10 |
+
<h4><?php echo $this->__('New Customers') ?></h4>
|
11 |
+
<p><?php echo $this->__('By creating an account with our store, you will be able to move through the checkout process faster, store multiple shipping addresses, view and track your orders in your account and more.') ?></p>
|
12 |
+
</div>
|
13 |
+
<div class="button-set">
|
14 |
+
<button type="submit" class="button right" onclick="window.location='<?php echo $this->getCreateAccountUrl() ?>';" type="button"><span><?php echo $this->__('Create an Account') ?></span></button>
|
15 |
+
</div>
|
16 |
+
</div>
|
17 |
+
</form>
|
18 |
+
<form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="login-form">
|
19 |
+
<div class="col-2 registered-users">
|
20 |
+
<div class="content">
|
21 |
+
<h4><?php echo $this->__('Registered Customers') ?></h4>
|
22 |
+
<p><?php echo $this->__('If you have an account with us, please log in.') ?></p>
|
23 |
+
<ul class="form-list">
|
24 |
+
<li>
|
25 |
+
<label for="email"><?php echo $this->__('Email Address') ?> <span class="required">*</span></label><br />
|
26 |
+
<input name="email" value="" title="<?php echo $this->__('Email Address') ?>" id="email" type="text" class="input-text required-entry" style="width:250px;" />
|
27 |
+
</li>
|
28 |
+
<li>
|
29 |
+
<label for="pass"><?php echo $this->__('Password') ?> <span class="required">*</span></label><br />
|
30 |
+
<input name="pass" type="password" class="input-text required-entry validate-password" id="pass" style="width:250px;" />
|
31 |
+
</li>
|
32 |
+
</ul>
|
33 |
+
<p class="required"><?php echo $this->__('* Required Fields') ?></p>
|
34 |
+
</div>
|
35 |
+
<div class="col-2 registered-users">
|
36 |
+
<div class="button-set">
|
37 |
+
<!--<a href="<?php echo $this->getForgotPasswordUrl() ?>" class="left"><?php echo $this->__('Forgot Your Password?') ?></a>-->
|
38 |
+
<button class="button right" type="submit" name="send" id="send2"><span><?php echo $this->__('Login') ?></span></button>
|
39 |
+
</div>
|
40 |
+
</div>
|
41 |
+
</div>
|
42 |
+
</form>
|
43 |
+
</div>
|
44 |
+
<script type="text/javascript">
|
45 |
+
var dataForm = new VarienForm('login-form', true);
|
46 |
+
var dataForm = new VarienForm('register-form', true);
|
47 |
+
</script>
|
48 |
+
</div>
|
app/design/frontend/base/default/template/artist/register.phtml
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="account-create">
|
2 |
+
<div class="page-title">
|
3 |
+
<h3><?php echo $this->__('Artist Register') ?></h3>
|
4 |
+
</div>
|
5 |
+
<div class="login-box">
|
6 |
+
<form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="login-form">
|
7 |
+
<div class="fieldset">
|
8 |
+
<div class="content">
|
9 |
+
<ul class="form-list">
|
10 |
+
<li>
|
11 |
+
<label for="firstname"><?php echo $this->__('First Name') ?> <span class="required">*</span></label><br />
|
12 |
+
<input name="firstname" value="" title="<?php echo $this->__('First Name') ?>" id="firstname" type="text" class="input-text required-entry" style="width:250px;" />
|
13 |
+
</li>
|
14 |
+
|
15 |
+
<li>
|
16 |
+
<label for="lastname"><?php echo $this->__('Last Name') ?> <span class="required">*</span></label><br />
|
17 |
+
<input name="lastname" value="" title="<?php echo $this->__('Last Name') ?>" id="lastname" type="text" class="input-text required-entry" style="width:250px;" />
|
18 |
+
</li>
|
19 |
+
|
20 |
+
|
21 |
+
<li>
|
22 |
+
<label for="email"><?php echo $this->__('Email') ?> <span class="required">*</span></label><br />
|
23 |
+
<input name="email" value="" title="<?php echo $this->__('Email') ?>" id="email" type="text" class="input-text required-entry validate-email" style="width:250px;" />
|
24 |
+
</li>
|
25 |
+
|
26 |
+
<li>
|
27 |
+
<label for="password"><?php echo $this->__('Password') ?> <span class="required">*</span></label><br />
|
28 |
+
<input name="password" value="" title="<?php echo $this->__('Password') ?>" id="password" type="password" class="input-text required-entry" style="width:250px;" />
|
29 |
+
</li>
|
30 |
+
|
31 |
+
<p class="required"><?php echo $this->__('* Required Fields') ?></p>
|
32 |
+
</div>
|
33 |
+
<div class="button-set">
|
34 |
+
|
35 |
+
<button class="button" type="submit" name="send" id="send2"><span><?php echo $this->__('Register') ?></span></button>
|
36 |
+
</div>
|
37 |
+
</div>
|
38 |
+
</form>
|
39 |
+
</div>
|
40 |
+
|
41 |
+
|
42 |
+
<script type="text/javascript">
|
43 |
+
var dataForm = new VarienForm('login-form', true);
|
44 |
+
|
45 |
+
</script>
|
46 |
+
</div>
|
app/etc/modules/Thylak_Artist.xml
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
|
3 |
+
<!-- Create a Artist module with the Namespace Thylak
|
4 |
+
Here active = true to enable the module and codepool = local
|
5 |
+
for notify that it was custom module created in local.-->
|
6 |
+
|
7 |
+
<config>
|
8 |
+
<modules>
|
9 |
+
<Thylak_Artist>
|
10 |
+
<active>true</active>
|
11 |
+
<codePool>local</codePool>
|
12 |
+
</Thylak_Artist>
|
13 |
+
</modules>
|
14 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>CreateConfigurableProduct</name>
|
4 |
+
<version>1.6</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Creating Configurable Product</summary>
|
10 |
+
<description>Creating Configurable Product with the Color Attribute - id 80.</description>
|
11 |
+
<notes>Creating Configurable Product</notes>
|
12 |
+
<authors><author><name>Rajesh</name><user>auto-converted</user><email>rajeshn@thylaksoft.com</email></author></authors>
|
13 |
+
<date>2010-06-03</date>
|
14 |
+
<time>07:11:38</time>
|
15 |
+
<contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="artist.xml" hash="772a732a2403a641132944cddcc1b499"/></dir><dir name="template"><dir name="artist"><file name="artwork.phtml" hash="2953a7b9e60af7ed653de85eaeeff01a"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="artist.xml" hash="f29216c2517fb32301b268526ace78f5"/></dir><dir name="template"><dir name="artist"><file name="artist.phtml" hash="531ec36fb40300b4d098d255d7778205"/><file name="artistbk.phtml" hash="2915883a63952ae13711051b66d5d14d"/><file name="artwork.phtml" hash="72ea65349851f2af2f1b354bdd3fa20d"/><file name="link.phtml" hash="de0640dc8582165cc57789335c64d907"/><file name="login.phtml" hash="68b8b3f82fa8c972bf33aa0005220e8d"/><file name="register.phtml" hash="63241b5be8234f7ea4ac4e31c0286ef1"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Thylak_Artist.xml" hash="cdf46de2c13b7723a0b658040ff3ba36"/></dir></target><target name="magelocal"><dir name="Thylak"><dir name="Artist"><dir name="Block"><file name="Artist.php" hash="78696c23cbb1fc81766783ed4961b4d2"/><file name="Artwork.php" hash="468bedb477c5be838dbbfba08e2ef415"/><file name="Link.php" hash="51ccdf44f6b0ebef53bc66f4bb3f7c70"/><file name="Login.php" hash="9b119fa68ab9df18aabacea23eae5e57"/><file name="Register.php" hash="4aa86bf1d51b3024c5950ceaad5af2f4"/><dir name="Adminhtml"><file name="Artist.php" hash="a2cb0b5663bb683e3853b9ab53ec8ab4"/><dir name="Artist"><file name="Edit.php" hash="f6433beec9175b575b8bb3f56ce97b07"/><file name="Grid.php" hash="ecc9e1601c36c6c19514fd47506712fa"/><dir name="Edit"><file name="Form.php" hash="14b519fad37fea763c769b4fda0b7671"/><file name="Tabs.php" hash="0cb7e4787b77938a04fa6657ee56077a"/><dir name="Tab"><file name="Form.php" hash="a84e930fa6f66154c74b869ee4d25280"/></dir></dir></dir><dir name="Artwork"><file name="Edit.php" hash="a570c13adcb4527560ad8243c9abe888"/><file name="Grid.php" hash="6b42d51376930acfa5e1227be2dc42a8"/></dir></dir></dir><dir name="controllers"><file name="IndexController.php" hash="1b203d4e76c8c80becb781f1f87affef"/><dir name="Adminhtml"><file name="ArtistController.php" hash="1957b7cfba2bb3540b35d84402c82b04"/></dir></dir><dir name="etc"><file name="config.xml" hash="26328e697b8d107d59f67204372be2e7"/></dir><dir name="Helper"><file name="Data.php" hash="3b933ae167eada90c24472137854843b"/></dir><dir name="Model"><file name="Artist.php" hash="2b87d0d2858c53f86b8d80b4a82989c6"/><file name="Artwork.php" hash="47655a9de369c9336ff7dd40eb517bf6"/><file name="Status.php" hash="251b5e876dcb33dadf9d56932319419c"/><dir name="Mysql4"><file name="Artist.php" hash="6eafaf3d241f0e9302cd2c4923752eb2"/><file name="Artwork.php" hash="89ee0c6a78f56013ea14a92a6dd56d00"/><dir name="Artist"><file name="Collection.php" hash="3c25ee5c6152b3fcc9a57953f3fb19f3"/></dir><dir name="Artwork"><file name="Collection.php" hash="a1496cfd605bd24beff2b092e0c95e1c"/></dir></dir></dir><dir name="sql"><dir name="artist_setup"><file name="mysql4-install-0.1.0.php" hash="e72523276a5b8945b76491692b3481bc"/></dir></dir></dir></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies/>
|
18 |
+
</package>
|