Version Notes
Installation steps
Download this release
Release Info
| Developer | Niveus Solutions |
| Extension | Niveus_ProductVideo |
| Version | 1.1.0 |
| Comparing to | |
| See all releases | |
Code changes from version 1.0.0 to 1.1.0
- app/code/community/Niveus/ProductVideo/etc/config.xml +1 -1
- app/code/community/Niveus/Productlabels/Block/Adminhtml/Css/Edit.php +0 -57
- app/code/community/Niveus/Productlabels/Block/Adminhtml/Css/Edit/Form.php +0 -18
- app/code/community/Niveus/Productlabels/Block/Adminhtml/Css/Edit/Tab/Css.php +0 -51
- app/code/community/Niveus/Productlabels/Block/Adminhtml/Css/Edit/Tabs.php +0 -24
- app/code/community/Niveus/Productlabels/Block/Adminhtml/Element/Fieldset.php +0 -83
- app/code/community/Niveus/Productlabels/Block/Adminhtml/Element/Fieldsetcss.php +0 -57
- app/code/community/Niveus/Productlabels/Block/Adminhtml/Element/Form.php +0 -18
- app/code/community/Niveus/Productlabels/Block/Adminhtml/Element/Formcss.php +0 -18
- app/code/community/Niveus/Productlabels/Block/Adminhtml/Productlabels.php +0 -38
- app/code/community/Niveus/Productlabels/Block/Adminhtml/Productlabels/Edit.php +0 -59
- app/code/community/Niveus/Productlabels/Block/Adminhtml/Productlabels/Edit/Form.php +0 -20
- app/code/community/Niveus/Productlabels/Block/Adminhtml/Productlabels/Edit/Tab/Form.php +0 -164
- app/code/community/Niveus/Productlabels/Block/Adminhtml/Productlabels/Edit/Tabs.php +0 -24
- app/code/community/Niveus/Productlabels/Block/Adminhtml/Productlabels/Grid.php +0 -116
- app/code/community/Niveus/Productlabels/Block/Css.php +0 -36
- app/code/community/Niveus/Productlabels/Block/Productlabels.php +0 -28
- app/code/community/Niveus/Productlabels/Helper/Data.php +0 -98
- app/code/community/Niveus/Productlabels/Model/Attribute.php +0 -44
- app/code/community/Niveus/Productlabels/Model/Config/Listlabel.php +0 -28
- app/code/community/Niveus/Productlabels/Model/Css.php +0 -53
- app/code/community/Niveus/Productlabels/Model/Filter.php +0 -112
- app/code/community/Niveus/Productlabels/Model/Mysql4/Attribute.php +0 -10
- app/code/community/Niveus/Productlabels/Model/Mysql4/Attribute/Collection.php +0 -10
- app/code/community/Niveus/Productlabels/Model/Mysql4/Css.php +0 -10
- app/code/community/Niveus/Productlabels/Model/Mysql4/Css/Collection.php +0 -23
- app/code/community/Niveus/Productlabels/Model/Mysql4/Productlabels.php +0 -10
- app/code/community/Niveus/Productlabels/Model/Mysql4/Productlabels/Collection.php +0 -104
- app/code/community/Niveus/Productlabels/Model/Mysql4/Type/Int.php +0 -10
- app/code/community/Niveus/Productlabels/Model/Mysql4/Type/Int/Collection.php +0 -10
- app/code/community/Niveus/Productlabels/Model/Mysql4/Type/Text.php +0 -10
- app/code/community/Niveus/Productlabels/Model/Mysql4/Type/Text/Collection.php +0 -10
- app/code/community/Niveus/Productlabels/Model/Mysql4/Type/Varchar.php +0 -10
- app/code/community/Niveus/Productlabels/Model/Mysql4/Type/Varchar/Collection.php +0 -10
- app/code/community/Niveus/Productlabels/Model/Productlabels.php +0 -59
- app/code/community/Niveus/Productlabels/Model/Productrule.php +0 -314
- app/code/community/Niveus/Productlabels/Model/Rule.php +0 -14
- app/code/community/Niveus/Productlabels/Model/Rule/Combine.php +0 -58
- app/code/community/Niveus/Productlabels/Model/Rule/Condition/Product.php +0 -325
- app/code/community/Niveus/Productlabels/Model/Status.php +0 -15
- app/code/community/Niveus/Productlabels/Model/Type/Int.php +0 -10
- app/code/community/Niveus/Productlabels/Model/Type/Text.php +0 -10
- app/code/community/Niveus/Productlabels/Model/Type/Varchar.php +0 -10
- app/code/community/Niveus/Productlabels/controllers/Adminhtml/CssController.php +0 -76
- app/code/community/Niveus/Productlabels/controllers/Adminhtml/ProductlabelsController.php +0 -490
- app/code/community/Niveus/Productlabels/controllers/IndexController.php +0 -47
- app/code/community/Niveus/Productlabels/etc/config.xml +0 -183
- app/code/community/Niveus/Productlabels/sql/productlabels_setup/mysql4-install-0.1.0.php +0 -123
- app/code/community/Niveus/Requestproduct/Block/Adminhtml/Requestnewproduct.php +0 -16
- app/code/community/Niveus/Requestproduct/Block/Adminhtml/Requestnewproduct/Grid.php +0 -85
- app/code/community/Niveus/Requestproduct/Block/Requestnewproduct.php +0 -8
- app/code/community/Niveus/Requestproduct/Helper/Data.php +0 -7
- app/code/community/Niveus/Requestproduct/Model/Mysql4/Requestnewproduct.php +0 -11
- app/code/community/Niveus/Requestproduct/Model/Mysql4/Requestnewproduct/Collection.php +0 -11
- app/code/community/Niveus/Requestproduct/Model/Requestnewproduct.php +0 -11
- app/code/community/Niveus/Requestproduct/controllers/Adminhtml/RequestnewproductController.php +0 -44
- app/code/community/Niveus/Requestproduct/controllers/IndexController.php +0 -47
- app/code/community/Niveus/Requestproduct/etc/adminhtml.xml +0 -40
- app/code/community/Niveus/Requestproduct/etc/config.xml +0 -99
- app/code/community/Niveus/Requestproduct/sql/niveus_requestproduct_setup/mysql4-install-1.0.0.php +0 -37
- package.xml +4 -4
app/code/community/Niveus/ProductVideo/etc/config.xml
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
<config>
|
| 4 |
<modules>
|
| 5 |
<Niveus_ProductVideo>
|
| 6 |
-
<version>
|
| 7 |
</Niveus_ProductVideo>
|
| 8 |
</modules>
|
| 9 |
|
| 3 |
<config>
|
| 4 |
<modules>
|
| 5 |
<Niveus_ProductVideo>
|
| 6 |
+
<version>1.1.0</version>
|
| 7 |
</Niveus_ProductVideo>
|
| 8 |
</modules>
|
| 9 |
|
app/code/community/Niveus/Productlabels/Block/Adminhtml/Css/Edit.php
DELETED
|
@@ -1,57 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
class Niveus_Productlabels_Block_Adminhtml_Css_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
| 4 |
-
{
|
| 5 |
-
public function __construct()
|
| 6 |
-
{
|
| 7 |
-
parent::__construct();
|
| 8 |
-
$this->setTemplate('niveus_productlabels/form/container.phtml');
|
| 9 |
-
$this->_objectId = Mage::registry('productlabels_css_data')->getId();
|
| 10 |
-
$this->_blockGroup = 'productlabels';
|
| 11 |
-
$this->_controller = 'adminhtml_css';
|
| 12 |
-
$this->_removeButton('back');
|
| 13 |
-
$this->_removeButton('reset');
|
| 14 |
-
$this->_removeButton('delete');
|
| 15 |
-
$this->_addButton('cancel', array(
|
| 16 |
-
'label' => Mage::helper('adminhtml')->__('Cancel'),
|
| 17 |
-
'onclick' => 'setLocation(\'' . $this->getCancelUrl() . '\')',
|
| 18 |
-
'class' => 'back',
|
| 19 |
-
), -1);
|
| 20 |
-
$this->_updateButton('save', 'label', Mage::helper('productlabels')->__('Save Css'));
|
| 21 |
-
|
| 22 |
-
$this->_addButton('saveandcontinue', array(
|
| 23 |
-
'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
|
| 24 |
-
'onclick' => 'saveAndContinueEdit()',
|
| 25 |
-
'class' => 'save',
|
| 26 |
-
), -100);
|
| 27 |
-
|
| 28 |
-
$this->_formScripts[] = "
|
| 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('productlabels_css_data') && Mage::registry('productlabels_css_data')->getId() ) {
|
| 40 |
-
return Mage::helper('productlabels')->__("Edit Css");
|
| 41 |
-
} else {
|
| 42 |
-
return Mage::helper('productlabels')->__('Add Item');
|
| 43 |
-
}
|
| 44 |
-
}
|
| 45 |
-
|
| 46 |
-
/**
|
| 47 |
-
* Get URL for cancel button
|
| 48 |
-
*
|
| 49 |
-
* @return string
|
| 50 |
-
*/
|
| 51 |
-
public function getCancelUrl()
|
| 52 |
-
{
|
| 53 |
-
return $this->getUrl('*/adminhtml_productlabels',array('store' => $this->getRequest()->getParam('store',0)));
|
| 54 |
-
}
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Productlabels/Block/Adminhtml/Css/Edit/Form.php
DELETED
|
@@ -1,18 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
class Niveus_Productlabels_Block_Adminhtml_Css_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
| 3 |
-
{
|
| 4 |
-
protected function _prepareForm()
|
| 5 |
-
{
|
| 6 |
-
$form = new Varien_Data_Form(array(
|
| 7 |
-
'id' => 'edit_form',
|
| 8 |
-
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
|
| 9 |
-
'method' => 'post',
|
| 10 |
-
'enctype' => 'multipart/form-data'
|
| 11 |
-
)
|
| 12 |
-
);
|
| 13 |
-
|
| 14 |
-
$form->setUseContainer(true);
|
| 15 |
-
$this->setForm($form);
|
| 16 |
-
return parent::_prepareForm();
|
| 17 |
-
}
|
| 18 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Productlabels/Block/Adminhtml/Css/Edit/Tab/Css.php
DELETED
|
@@ -1,51 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
class Niveus_Productlabels_Block_Adminhtml_Css_Edit_Tab_Css extends Niveus_Productlabels_Block_Adminhtml_Element_Formcss
|
| 4 |
-
{
|
| 5 |
-
|
| 6 |
-
protected function _prepareForm()
|
| 7 |
-
{
|
| 8 |
-
$form = new Varien_Data_Form();
|
| 9 |
-
$this->setForm($form);
|
| 10 |
-
$form->setDataObject(Mage::registry('productlabels_css_data'));
|
| 11 |
-
$fieldset = $form->addFieldset('productlabels_css', array('legend'=>Mage::helper('productlabels')->__('Css information')));
|
| 12 |
-
//$fieldsetRenderer = Mage::getBlockSingleton('adminhtml/system_config_form_fieldset');
|
| 13 |
-
$element = $fieldset->addField('content', 'editor', array(
|
| 14 |
-
'name' => 'content',
|
| 15 |
-
'label' => Mage::helper('productlabels')->__('Content'),
|
| 16 |
-
'title' => Mage::helper('productlabels')->__('Content'),
|
| 17 |
-
'style' => 'width:500px; height:200px;',
|
| 18 |
-
))->setEntityAttribute(Mage::registry('productlabels_css_data'));
|
| 19 |
-
|
| 20 |
-
$curStore = $this->getRequest()->getParam('store',0);
|
| 21 |
-
|
| 22 |
-
$fieldset->addField('cur_store', 'hidden', array(
|
| 23 |
-
'name' => 'cur_store',
|
| 24 |
-
));
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
if($id = Mage::registry('productlabels_css_data')->getId() && Mage::registry('productlabels_css_data')->getStore() == $curStore)
|
| 30 |
-
{
|
| 31 |
-
$fieldset->addField('id', 'hidden', array(
|
| 32 |
-
'name' => 'id',
|
| 33 |
-
'value' => Mage::registry('productlabels_css_data')->getId()
|
| 34 |
-
));
|
| 35 |
-
}
|
| 36 |
-
|
| 37 |
-
if ( Mage::getSingleton('adminhtml/session')->getProductlabelsCssData() )
|
| 38 |
-
{
|
| 39 |
-
$form->setValues(Mage::getSingleton('adminhtml/session')->getProductlabelsCssData());
|
| 40 |
-
Mage::getSingleton('adminhtml/session')->setProductlabelsCssData(null);
|
| 41 |
-
} elseif ( Mage::registry('productlabels_css_data') ) {
|
| 42 |
-
$form->setValues(Mage::registry('productlabels_css_data')->getData());
|
| 43 |
-
}
|
| 44 |
-
return parent::_prepareForm();
|
| 45 |
-
}
|
| 46 |
-
|
| 47 |
-
public function getStoreCode()
|
| 48 |
-
{
|
| 49 |
-
return $this->getRequest()->getParam('store', '');
|
| 50 |
-
}
|
| 51 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Productlabels/Block/Adminhtml/Css/Edit/Tabs.php
DELETED
|
@@ -1,24 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
class Niveus_Productlabels_Block_Adminhtml_Css_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
|
| 4 |
-
{
|
| 5 |
-
|
| 6 |
-
public function __construct()
|
| 7 |
-
{
|
| 8 |
-
parent::__construct();
|
| 9 |
-
$this->setId('css_tabs');
|
| 10 |
-
$this->setDestElementId('edit_form');
|
| 11 |
-
$this->setTitle(Mage::helper('productlabels')->__('Css Information'));
|
| 12 |
-
}
|
| 13 |
-
|
| 14 |
-
protected function _beforeToHtml()
|
| 15 |
-
{
|
| 16 |
-
$this->addTab('form_section', array(
|
| 17 |
-
'label' => Mage::helper('productlabels')->__('Css Information'),
|
| 18 |
-
'title' => Mage::helper('productlabels')->__('Css Information'),
|
| 19 |
-
'content' => $this->getLayout()->createBlock('productlabels/adminhtml_css_edit_tab_css')->toHtml(),
|
| 20 |
-
));
|
| 21 |
-
|
| 22 |
-
return parent::_beforeToHtml();
|
| 23 |
-
}
|
| 24 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Productlabels/Block/Adminhtml/Element/Fieldset.php
DELETED
|
@@ -1,83 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
class Niveus_Productlabels_Block_Adminhtml_Element_Fieldset extends Mage_Adminhtml_Block_Catalog_Form_Renderer_Fieldset_Element
|
| 3 |
-
{
|
| 4 |
-
/*public function getScopeLabel()
|
| 5 |
-
{
|
| 6 |
-
$html = '';
|
| 7 |
-
$attribute_code = $this->getElement()->getName();
|
| 8 |
-
$attribute = Mage::getModel('productlabels/attribute')->getCollection()
|
| 9 |
-
->addFieldToFilter('name_attribute',$attribute_code)->setPageSize(1)
|
| 10 |
-
->getFirstItem();
|
| 11 |
-
$this->setData('attribute',$attribute);
|
| 12 |
-
if (!$attribute || Mage::app()->isSingleStoreMode()) {
|
| 13 |
-
return $html;
|
| 14 |
-
}
|
| 15 |
-
if ($attribute->isScopeGlobal()) {
|
| 16 |
-
$html.= '[GLOBAL]';
|
| 17 |
-
}
|
| 18 |
-
elseif ($attribute->isScopeWebsite()) {
|
| 19 |
-
$html.= '[WEBSITE]';
|
| 20 |
-
}
|
| 21 |
-
elseif ($attribute->isScopeStore()) {
|
| 22 |
-
$html.= '[STORE VIEW]';
|
| 23 |
-
}
|
| 24 |
-
|
| 25 |
-
return $html;
|
| 26 |
-
}*/
|
| 27 |
-
|
| 28 |
-
/*public function getAttribute()
|
| 29 |
-
{
|
| 30 |
-
return $this->getData('attribute');
|
| 31 |
-
}*/
|
| 32 |
-
|
| 33 |
-
public function getAttributeCode()
|
| 34 |
-
{
|
| 35 |
-
return $this->getAttribute()->getNameAttribute();
|
| 36 |
-
}
|
| 37 |
-
|
| 38 |
-
/*public function getDataObject()
|
| 39 |
-
{
|
| 40 |
-
return Mage::registry('productlabels_data');
|
| 41 |
-
}*/
|
| 42 |
-
|
| 43 |
-
public function usedDefault()
|
| 44 |
-
{
|
| 45 |
-
$store = $this->getRequest()->getParam('store');
|
| 46 |
-
if(!$store)
|
| 47 |
-
return false;
|
| 48 |
-
$attribute = $this->getAttribute();
|
| 49 |
-
if(!$attribute->getType())
|
| 50 |
-
return false;
|
| 51 |
-
$storeIn = Mage::registry('productlabels_data')->getData($attribute->getNameAttribute().'_in_store');
|
| 52 |
-
//if($attribute->getId() == 6){echo $storeIn;exit;}
|
| 53 |
-
if($storeIn == $this->_getDefaultStoreId() || !$storeIn)
|
| 54 |
-
return true;
|
| 55 |
-
return false;
|
| 56 |
-
|
| 57 |
-
//return in_array($attribute->getId(), Mage::registry('attribute_default'));
|
| 58 |
-
//return !$storeIn || ($storeIn != $this->_getDefaultStoreId());
|
| 59 |
-
/*$collection = Mage::getModel('productlabels/type_'.$attribute->getType())->getCollection()
|
| 60 |
-
->addFieldToFilter('label_id',$this->getRequest()->getParam('id'))
|
| 61 |
-
->addFieldToFilter('attribute_id',$attribute->getId())
|
| 62 |
-
->addFieldToFilter('store_id',$this->getRequest()->getParam('store'));
|
| 63 |
-
/* if($collection->count() == 0)
|
| 64 |
-
$this->getElement()->setDisabled(true);*/
|
| 65 |
-
//return $collection->count() == 0;
|
| 66 |
-
}
|
| 67 |
-
|
| 68 |
-
/**
|
| 69 |
-
* Default sore ID getter
|
| 70 |
-
*
|
| 71 |
-
* @return integer
|
| 72 |
-
*/
|
| 73 |
-
protected function _getDefaultStoreId()
|
| 74 |
-
{
|
| 75 |
-
return Mage_Catalog_Model_Abstract::DEFAULT_STORE_ID;
|
| 76 |
-
}
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
}
|
| 82 |
-
|
| 83 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Productlabels/Block/Adminhtml/Element/Fieldsetcss.php
DELETED
|
@@ -1,57 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
class Niveus_Productlabels_Block_Adminhtml_Element_Fieldsetcss extends Mage_Adminhtml_Block_Catalog_Form_Renderer_Fieldset_Element
|
| 3 |
-
{
|
| 4 |
-
/*public function getScopeLabel()
|
| 5 |
-
{
|
| 6 |
-
$html = '';
|
| 7 |
-
$attribute_code = $this->getElement()->getName();
|
| 8 |
-
$attribute = Mage::getModel('productlabels/attribute')->getCollection()
|
| 9 |
-
->addFieldToFilter('name_attribute',$attribute_code)->setPageSize(1)
|
| 10 |
-
->getFirstItem();
|
| 11 |
-
$this->setData('attribute',$attribute);
|
| 12 |
-
if (!$attribute || Mage::app()->isSingleStoreMode()) {
|
| 13 |
-
return $html;
|
| 14 |
-
}
|
| 15 |
-
if ($attribute->isScopeGlobal()) {
|
| 16 |
-
$html.= '[GLOBAL]';
|
| 17 |
-
}
|
| 18 |
-
elseif ($attribute->isScopeWebsite()) {
|
| 19 |
-
$html.= '[WEBSITE]';
|
| 20 |
-
}
|
| 21 |
-
elseif ($attribute->isScopeStore()) {
|
| 22 |
-
$html.= '[STORE VIEW]';
|
| 23 |
-
}
|
| 24 |
-
|
| 25 |
-
return $html;
|
| 26 |
-
}*/
|
| 27 |
-
|
| 28 |
-
/*public function getAttribute()
|
| 29 |
-
{
|
| 30 |
-
return $this->getData('attribute');
|
| 31 |
-
}*/
|
| 32 |
-
|
| 33 |
-
public function getAttributeCode()
|
| 34 |
-
{
|
| 35 |
-
return $this->getAttribute()->getNameAttribute();
|
| 36 |
-
}
|
| 37 |
-
|
| 38 |
-
/*public function getDataObject()
|
| 39 |
-
{
|
| 40 |
-
return Mage::registry('productlabels_data');
|
| 41 |
-
}*/
|
| 42 |
-
|
| 43 |
-
public function usedDefault()
|
| 44 |
-
{
|
| 45 |
-
$store = $this->getRequest()->getParam('store');
|
| 46 |
-
if(!$store)
|
| 47 |
-
return false;
|
| 48 |
-
|
| 49 |
-
return Mage::registry('productlabels_css_data')->getStore() == 0;
|
| 50 |
-
}
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
}
|
| 56 |
-
|
| 57 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Productlabels/Block/Adminhtml/Element/Form.php
DELETED
|
@@ -1,18 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
class Niveus_Productlabels_Block_Adminhtml_Element_Form extends Mage_Adminhtml_Block_Widget_Form
|
| 3 |
-
{
|
| 4 |
-
protected function _prepareLayout()
|
| 5 |
-
{
|
| 6 |
-
Varien_Data_Form::setElementRenderer(
|
| 7 |
-
$this->getLayout()->createBlock('adminhtml/widget_form_renderer_element')
|
| 8 |
-
);
|
| 9 |
-
Varien_Data_Form::setFieldsetRenderer(
|
| 10 |
-
$this->getLayout()->createBlock('adminhtml/widget_form_renderer_fieldset')
|
| 11 |
-
);
|
| 12 |
-
Varien_Data_Form::setFieldsetElementRenderer(
|
| 13 |
-
$this->getLayout()->createBlock('productlabels/adminhtml_element_fieldset')
|
| 14 |
-
);
|
| 15 |
-
}
|
| 16 |
-
}
|
| 17 |
-
|
| 18 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Productlabels/Block/Adminhtml/Element/Formcss.php
DELETED
|
@@ -1,18 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
class Niveus_Productlabels_Block_Adminhtml_Element_Formcss extends Mage_Adminhtml_Block_Widget_Form
|
| 3 |
-
{
|
| 4 |
-
protected function _prepareLayout()
|
| 5 |
-
{
|
| 6 |
-
Varien_Data_Form::setElementRenderer(
|
| 7 |
-
$this->getLayout()->createBlock('adminhtml/widget_form_renderer_element')
|
| 8 |
-
);
|
| 9 |
-
Varien_Data_Form::setFieldsetRenderer(
|
| 10 |
-
$this->getLayout()->createBlock('adminhtml/widget_form_renderer_fieldset')
|
| 11 |
-
);
|
| 12 |
-
Varien_Data_Form::setFieldsetElementRenderer(
|
| 13 |
-
$this->getLayout()->createBlock('productlabels/adminhtml_element_fieldsetcss')
|
| 14 |
-
);
|
| 15 |
-
}
|
| 16 |
-
}
|
| 17 |
-
|
| 18 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Productlabels/Block/Adminhtml/Productlabels.php
DELETED
|
@@ -1,38 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
class Niveus_Productlabels_Block_Adminhtml_Productlabels extends Mage_Adminhtml_Block_Widget_Grid_Container
|
| 3 |
-
{
|
| 4 |
-
public function __construct()
|
| 5 |
-
{
|
| 6 |
-
$this->_controller = 'adminhtml_productlabels';
|
| 7 |
-
$this->_blockGroup = 'productlabels';
|
| 8 |
-
$this->_headerText = Mage::helper('productlabels')->__('Product labels Manager');
|
| 9 |
-
$this->_addButtonLabel = Mage::helper('productlabels')->__('Add New Label');
|
| 10 |
-
parent::__construct();
|
| 11 |
-
$this->setTemplate('niveus_productlabels/grid/container.phtml');
|
| 12 |
-
$this->_addButton('css', array(
|
| 13 |
-
'label' => $this->__('CSS Editor'),
|
| 14 |
-
'onclick' => 'setLocation(\'' . $this->getCssUrl() .'\')',
|
| 15 |
-
'class' => 'css',
|
| 16 |
-
));
|
| 17 |
-
}
|
| 18 |
-
|
| 19 |
-
public function _prepareLayout()
|
| 20 |
-
{
|
| 21 |
-
/**
|
| 22 |
-
* Display store switcher if system has more one store
|
| 23 |
-
*/
|
| 24 |
-
if (!Mage::app()->isSingleStoreMode()) {
|
| 25 |
-
$this->setChild('store_switcher',
|
| 26 |
-
$this->getLayout()->createBlock('adminhtml/store_switcher')
|
| 27 |
-
->setUseConfirm(false)
|
| 28 |
-
->setSwitchUrl($this->getUrl('*/*/*', array('store'=>null)))
|
| 29 |
-
);
|
| 30 |
-
}
|
| 31 |
-
parent::_prepareLayout();
|
| 32 |
-
}
|
| 33 |
-
|
| 34 |
-
public function getCssUrl()
|
| 35 |
-
{
|
| 36 |
-
return $this->getUrl('*/adminhtml_css/edit');
|
| 37 |
-
}
|
| 38 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Productlabels/Block/Adminhtml/Productlabels/Edit.php
DELETED
|
@@ -1,59 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
class Niveus_Productlabels_Block_Adminhtml_Productlabels_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
| 4 |
-
{
|
| 5 |
-
public function __construct()
|
| 6 |
-
{
|
| 7 |
-
parent::__construct();
|
| 8 |
-
$this->setTemplate('niveus_productlabels/form/container.phtml');
|
| 9 |
-
|
| 10 |
-
$this->_objectId = 'id';
|
| 11 |
-
$this->_blockGroup = 'productlabels';
|
| 12 |
-
$this->_controller = 'adminhtml_productlabels';
|
| 13 |
-
|
| 14 |
-
$this->_updateButton('save', 'label', Mage::helper('productlabels')->__('Save Label'));
|
| 15 |
-
$this->_updateButton('delete', 'label', Mage::helper('productlabels')->__('Delete Label'));
|
| 16 |
-
|
| 17 |
-
$this->_addButton('saveandcontinue', array(
|
| 18 |
-
'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
|
| 19 |
-
'onclick' => 'saveAndContinueEdit()',
|
| 20 |
-
'class' => 'save',
|
| 21 |
-
), -100);
|
| 22 |
-
|
| 23 |
-
$this->_formScripts[] = "
|
| 24 |
-
function toggleEditor() {
|
| 25 |
-
if (tinyMCE.getInstanceById('productlabels_content') == null) {
|
| 26 |
-
tinyMCE.execCommand('mceAddControl', false, 'productlabels_content');
|
| 27 |
-
} else {
|
| 28 |
-
tinyMCE.execCommand('mceRemoveControl', false, 'productlabels_content');
|
| 29 |
-
}
|
| 30 |
-
}
|
| 31 |
-
|
| 32 |
-
function saveAndContinueEdit(){
|
| 33 |
-
editForm.submit($('edit_form').action+'back/edit/');
|
| 34 |
-
}
|
| 35 |
-
|
| 36 |
-
function deletePicture(id)
|
| 37 |
-
{
|
| 38 |
-
$(id + '-pic').setStyle({'display':'none'});
|
| 39 |
-
$('no' + id).value = 1;
|
| 40 |
-
}
|
| 41 |
-
";
|
| 42 |
-
}
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
public function getBackUrl()
|
| 47 |
-
{
|
| 48 |
-
return $this->getUrl('*/*/',array('store' => $this->getRequest()->getParam('store',0)));
|
| 49 |
-
}
|
| 50 |
-
|
| 51 |
-
public function getHeaderText()
|
| 52 |
-
{
|
| 53 |
-
if( Mage::registry('productlabels_data') && Mage::registry('productlabels_data')->getId() ) {
|
| 54 |
-
return Mage::helper('productlabels')->__("Edit Label '%s'", $this->htmlEscape(Mage::registry('productlabels_data')->getName()));
|
| 55 |
-
} else {
|
| 56 |
-
return Mage::helper('productlabels')->__('Add Label');
|
| 57 |
-
}
|
| 58 |
-
}
|
| 59 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Productlabels/Block/Adminhtml/Productlabels/Edit/Form.php
DELETED
|
@@ -1,20 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
class Niveus_Productlabels_Block_Adminhtml_Productlabels_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 |
-
|
| 20 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Productlabels/Block/Adminhtml/Productlabels/Edit/Tab/Form.php
DELETED
|
@@ -1,164 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
class Niveus_Productlabels_Block_Adminhtml_Productlabels_Edit_Tab_Form extends Niveus_Productlabels_Block_Adminhtml_Element_Form
|
| 4 |
-
{
|
| 5 |
-
|
| 6 |
-
/**
|
| 7 |
-
* Class constructor
|
| 8 |
-
*
|
| 9 |
-
*/
|
| 10 |
-
protected function _construct()
|
| 11 |
-
{
|
| 12 |
-
parent::_construct();
|
| 13 |
-
$this->setTemplate('niveus_productlabels/edit/form.phtml');
|
| 14 |
-
}
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
protected function _prepareForm()
|
| 19 |
-
{
|
| 20 |
-
$form = new Varien_Data_Form();
|
| 21 |
-
$this->setForm($form);
|
| 22 |
-
$form->setDataObject(Mage::registry('productlabels_data'));
|
| 23 |
-
$fieldset = $form->addFieldset('productlabels_form', array('legend'=>Mage::helper('productlabels')->__('General information')));
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
$fieldset->addField('store', 'hidden', array(
|
| 28 |
-
'name' => 'store',
|
| 29 |
-
));
|
| 30 |
-
|
| 31 |
-
$fieldset->addField('id', 'hidden', array(
|
| 32 |
-
'name' => 'id',
|
| 33 |
-
));
|
| 34 |
-
|
| 35 |
-
$this->_setFieldset($fieldset);
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
$this->initFormCondition($form);
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
if ( Mage::getSingleton('adminhtml/session')->getProductlabelsData() )
|
| 42 |
-
{
|
| 43 |
-
$form->setValues(Mage::getSingleton('adminhtml/session')->getProductlabelsData());
|
| 44 |
-
Mage::getSingleton('adminhtml/session')->setProductlabelsData(null);
|
| 45 |
-
} elseif ( Mage::registry('productlabels_data') ) {
|
| 46 |
-
$form->setValues(Mage::registry('productlabels_data')->getData());
|
| 47 |
-
}
|
| 48 |
-
return parent::_prepareForm();
|
| 49 |
-
}
|
| 50 |
-
|
| 51 |
-
public function _setFieldset($fieldset)
|
| 52 |
-
{
|
| 53 |
-
$attributes = Mage::getModel('productlabels/attribute')->getCollection();
|
| 54 |
-
|
| 55 |
-
foreach($attributes as $a)
|
| 56 |
-
{
|
| 57 |
-
$atrName = $a->getNameAttribute();
|
| 58 |
-
$data = array(
|
| 59 |
-
'label' => Mage::helper('productlabels')->__($a->getTitle()),
|
| 60 |
-
'title' => Mage::helper('productlabels')->__($a->getTitle()),
|
| 61 |
-
'name' => $atrName,
|
| 62 |
-
'required' => $a->getRequire()
|
| 63 |
-
);
|
| 64 |
-
if($a->getClass())
|
| 65 |
-
$data['class'] = $a->getClass();
|
| 66 |
-
if($atrName == 'texthtml')
|
| 67 |
-
{
|
| 68 |
-
$data['style'] = 'width:300px; height:200px;';
|
| 69 |
-
$data['wysiwyg'] = false;
|
| 70 |
-
}
|
| 71 |
-
elseif($atrName == 'enable')
|
| 72 |
-
{
|
| 73 |
-
$data['checked'] = (Mage::registry('productlabels_data')->getEnable()=="1") ? true : false;
|
| 74 |
-
$data['onclick'] = 'this.value = this.checked ? 1 : 2;';
|
| 75 |
-
}
|
| 76 |
-
$element = $fieldset->addField($atrName, $a->getTypeBackend(), $data)
|
| 77 |
-
->setEntityAttribute($a);
|
| 78 |
-
if($atrName == 'texthtml')
|
| 79 |
-
$this->addInsertVariableButton($fieldset);
|
| 80 |
-
if($a->getTypeBackend() == 'file')
|
| 81 |
-
{
|
| 82 |
-
$pathImage = Mage::registry('productlabels_data')->getData($atrName);
|
| 83 |
-
if($pathImage && $pathImage != 'nopic')
|
| 84 |
-
{
|
| 85 |
-
|
| 86 |
-
$imageHtml = "<div>
|
| 87 |
-
<img id='$atrName-pic' src='".Mage::helper('productlabels')->resizeImage($pathImage,50,50,"niveus_productlabels/".$atrName,'admin')."'/>
|
| 88 |
-
<input type='hidden' name='no$atrName' value='0' id='no$atrName'/>
|
| 89 |
-
<input type='hidden' name='cur$atrName' value='$pathImage' id='cur$atrName'/>
|
| 90 |
-
<button type='button' onclick='deletePicture(\"$atrName\");return false;'><span><span>Delete Image</span></span></button>
|
| 91 |
-
</div>";
|
| 92 |
-
$element->setAfterElementHtml($imageHtml);
|
| 93 |
-
}
|
| 94 |
-
}
|
| 95 |
-
|
| 96 |
-
}
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
}
|
| 101 |
-
|
| 102 |
-
public function addInsertVariableButton($fieldset)
|
| 103 |
-
{
|
| 104 |
-
/* Add Insert Varialbe Button */
|
| 105 |
-
$fieldset->addField('orig_template_variables', 'hidden', array(
|
| 106 |
-
'name' => 'orig_template_variables',
|
| 107 |
-
));
|
| 108 |
-
|
| 109 |
-
$fieldset->addField('variables', 'hidden', array(
|
| 110 |
-
'name' => 'variables'
|
| 111 |
-
));
|
| 112 |
-
|
| 113 |
-
$fieldset->addField('template_variables', 'hidden', array(
|
| 114 |
-
'name' => 'template_variables',
|
| 115 |
-
));
|
| 116 |
-
|
| 117 |
-
$insertVariableButton = $this->getLayout()
|
| 118 |
-
->createBlock('adminhtml/widget_button', '', array(
|
| 119 |
-
'type' => 'button',
|
| 120 |
-
'label' => Mage::helper('adminhtml')->__('Insert Variable...'),
|
| 121 |
-
'onclick' => 'templateControl.openVariableChooser();return false;'
|
| 122 |
-
));
|
| 123 |
-
|
| 124 |
-
$fieldset->addField('insert_variable', 'note', array(
|
| 125 |
-
'text' => $insertVariableButton->toHtml()
|
| 126 |
-
));
|
| 127 |
-
}
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
public function initFormCondition($form)
|
| 132 |
-
{
|
| 133 |
-
$model = Mage::getModel('productlabels/rule');
|
| 134 |
-
|
| 135 |
-
$actionsArr = unserialize(Mage::registry('productlabels_data')->getActions());
|
| 136 |
-
|
| 137 |
-
if (!empty($actionsArr) && is_array($actionsArr)) {
|
| 138 |
-
$model->getActions()->loadArray($actionsArr);
|
| 139 |
-
}
|
| 140 |
-
|
| 141 |
-
$model->getActions()->setJsFormObject('rule_actions_fieldset');
|
| 142 |
-
|
| 143 |
-
$renderer = Mage::getBlockSingleton('adminhtml/widget_form_renderer_fieldset')
|
| 144 |
-
->setTemplate('promo/fieldset.phtml')
|
| 145 |
-
->setNewChildUrl(str_replace('productlabels_admin',Mage::getConfig()->getNode('admin/routers/adminhtml/args/frontName'),$this->getUrl('*/promo_quote/newActionHtml/form/rule_actions_fieldset')));
|
| 146 |
-
|
| 147 |
-
$fieldset = $form->addFieldset('rule_actions_fieldset', array(
|
| 148 |
-
'legend'=>Mage::helper('productlabels')->__('Conditions')
|
| 149 |
-
))->setRenderer($renderer);
|
| 150 |
-
|
| 151 |
-
$element = $fieldset->addField('actions', 'text', array(
|
| 152 |
-
'name' => 'actions',
|
| 153 |
-
'label' => Mage::helper('salesrule')->__('Apply To'),
|
| 154 |
-
'title' => Mage::helper('salesrule')->__('Apply To'),
|
| 155 |
-
'required' => true,
|
| 156 |
-
))->setRule($model)->setRenderer(Mage::getBlockSingleton('rule/actions'));
|
| 157 |
-
|
| 158 |
-
$element->setAfterElementHtml('<span class="value scope-label">'.Mage::helper('productlabels')->__('[GLOBAL]').'</span>');
|
| 159 |
-
Mage::dispatchEvent('adminhtml_block_salesrule_actions_prepareform', array('form' => $form));
|
| 160 |
-
|
| 161 |
-
$form->setValues($model->getData());
|
| 162 |
-
|
| 163 |
-
}
|
| 164 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Productlabels/Block/Adminhtml/Productlabels/Edit/Tabs.php
DELETED
|
@@ -1,24 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
class Niveus_Productlabels_Block_Adminhtml_Productlabels_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
|
| 4 |
-
{
|
| 5 |
-
|
| 6 |
-
public function __construct()
|
| 7 |
-
{
|
| 8 |
-
parent::__construct();
|
| 9 |
-
$this->setId('productlabels_tabs');
|
| 10 |
-
$this->setDestElementId('edit_form');
|
| 11 |
-
$this->setTitle(Mage::helper('productlabels')->__('Item Information'));
|
| 12 |
-
}
|
| 13 |
-
|
| 14 |
-
protected function _beforeToHtml()
|
| 15 |
-
{
|
| 16 |
-
$this->addTab('form_section', array(
|
| 17 |
-
'label' => Mage::helper('productlabels')->__('Item Information'),
|
| 18 |
-
'title' => Mage::helper('productlabels')->__('Item Information'),
|
| 19 |
-
'content' => $this->getLayout()->createBlock('productlabels/adminhtml_productlabels_edit_tab_form')->toHtml(),
|
| 20 |
-
));
|
| 21 |
-
|
| 22 |
-
return parent::_beforeToHtml();
|
| 23 |
-
}
|
| 24 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Productlabels/Block/Adminhtml/Productlabels/Grid.php
DELETED
|
@@ -1,116 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
class Niveus_Productlabels_Block_Adminhtml_Productlabels_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
| 4 |
-
{
|
| 5 |
-
public function __construct()
|
| 6 |
-
{
|
| 7 |
-
parent::__construct();
|
| 8 |
-
$this->setId('productlabelsGrid');
|
| 9 |
-
$this->setDefaultSort('id');
|
| 10 |
-
$this->setDefaultDir('ASC');
|
| 11 |
-
$this->setSaveParametersInSession(true);
|
| 12 |
-
}
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
protected function _prepareCollection()
|
| 16 |
-
{
|
| 17 |
-
$collection = Mage::getModel('productlabels/productlabels')->getCollection();
|
| 18 |
-
$collection->addAttributeToSelect(array('enable'));
|
| 19 |
-
|
| 20 |
-
$this->setCollection($collection);
|
| 21 |
-
return parent::_prepareCollection();
|
| 22 |
-
}
|
| 23 |
-
|
| 24 |
-
protected function _prepareColumns()
|
| 25 |
-
{
|
| 26 |
-
$this->addColumn('id', array(
|
| 27 |
-
'header' => Mage::helper('productlabels')->__('ID'),
|
| 28 |
-
'align' =>'right',
|
| 29 |
-
'width' => '50px',
|
| 30 |
-
'index' => 'id',
|
| 31 |
-
));
|
| 32 |
-
|
| 33 |
-
$this->addColumn('name', array(
|
| 34 |
-
'header' => Mage::helper('productlabels')->__('Title'),
|
| 35 |
-
'align' =>'left',
|
| 36 |
-
'index' => 'name',
|
| 37 |
-
));
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
$this->addColumn('enable', array(
|
| 42 |
-
'header' => Mage::helper('productlabels')->__('Status'),
|
| 43 |
-
'align' => 'left',
|
| 44 |
-
'width' => '80px',
|
| 45 |
-
'index' => 'enable',
|
| 46 |
-
'type' => 'options',
|
| 47 |
-
//'filter_index' => 'enabletbl.value',
|
| 48 |
-
'options' => array(
|
| 49 |
-
1 => 'Enabled',
|
| 50 |
-
2 => 'Disabled',
|
| 51 |
-
),
|
| 52 |
-
));
|
| 53 |
-
|
| 54 |
-
$this->addColumn('action',
|
| 55 |
-
array(
|
| 56 |
-
'header' => Mage::helper('productlabels')->__('Action'),
|
| 57 |
-
'width' => '100',
|
| 58 |
-
'type' => 'action',
|
| 59 |
-
'getter' => 'getId',
|
| 60 |
-
'actions' => array(
|
| 61 |
-
array(
|
| 62 |
-
'caption' => Mage::helper('productlabels')->__('Edit'),
|
| 63 |
-
'url' => array('base'=> '*/*/edit'),
|
| 64 |
-
'field' => 'id'
|
| 65 |
-
)
|
| 66 |
-
),
|
| 67 |
-
'filter' => false,
|
| 68 |
-
'sortable' => false,
|
| 69 |
-
'index' => 'stores',
|
| 70 |
-
'is_system' => true,
|
| 71 |
-
));
|
| 72 |
-
|
| 73 |
-
$this->addExportType('*/*/exportCsv', Mage::helper('productlabels')->__('CSV'));
|
| 74 |
-
$this->addExportType('*/*/exportXml', Mage::helper('productlabels')->__('XML'));
|
| 75 |
-
|
| 76 |
-
return parent::_prepareColumns();
|
| 77 |
-
}
|
| 78 |
-
|
| 79 |
-
protected function _prepareMassaction()
|
| 80 |
-
{
|
| 81 |
-
$this->setMassactionIdField('productlabels_id');
|
| 82 |
-
$this->getMassactionBlock()->setFormFieldName('productlabels');
|
| 83 |
-
|
| 84 |
-
$this->getMassactionBlock()->addItem('delete', array(
|
| 85 |
-
'label' => Mage::helper('productlabels')->__('Delete'),
|
| 86 |
-
'url' => $this->getUrl('*/*/massDelete'),
|
| 87 |
-
'confirm' => Mage::helper('productlabels')->__('Are you sure?')
|
| 88 |
-
));
|
| 89 |
-
|
| 90 |
-
$statuses = Mage::getSingleton('productlabels/status')->getOptionArray();
|
| 91 |
-
|
| 92 |
-
array_unshift($statuses, array('label'=>'', 'value'=>''));
|
| 93 |
-
$this->getMassactionBlock()->addItem('status', array(
|
| 94 |
-
'label'=> Mage::helper('productlabels')->__('Change status'),
|
| 95 |
-
'url' => $this->getUrl('*/*/massStatus', array('_current'=>true,'store' => $this->getRequest()->getParam('store',0))),
|
| 96 |
-
'additional' => array(
|
| 97 |
-
'visibility' => array(
|
| 98 |
-
'name' => 'status',
|
| 99 |
-
'type' => 'select',
|
| 100 |
-
'class' => 'required-entry',
|
| 101 |
-
'label' => Mage::helper('productlabels')->__('Status'),
|
| 102 |
-
'values' => $statuses
|
| 103 |
-
)
|
| 104 |
-
)
|
| 105 |
-
));
|
| 106 |
-
return $this;
|
| 107 |
-
}
|
| 108 |
-
|
| 109 |
-
public function getRowUrl($row)
|
| 110 |
-
{
|
| 111 |
-
return $this->getUrl('*/*/edit', array('id' => $row->getId(),
|
| 112 |
-
'store' => $this->getRequest()->getParam('store',0))
|
| 113 |
-
);
|
| 114 |
-
}
|
| 115 |
-
|
| 116 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Productlabels/Block/Css.php
DELETED
|
@@ -1,36 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
class Niveus_Productlabels_Block_Css extends Mage_Core_Block_Template
|
| 3 |
-
{
|
| 4 |
-
public function _toHtml() {
|
| 5 |
-
$css = $this->getCss();
|
| 6 |
-
if($css)
|
| 7 |
-
echo "<style type='text/css'>$css</style>";
|
| 8 |
-
parent::_toHtml();
|
| 9 |
-
}
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
public function getCss()
|
| 13 |
-
{
|
| 14 |
-
$store = Mage::app()->getStore()->getId();
|
| 15 |
-
$css = Mage::getModel('productlabels/css')->getCollection()
|
| 16 |
-
->setStoreId(array($this->_getDefaultStoreId(),$store));
|
| 17 |
-
foreach($css as $c)
|
| 18 |
-
{
|
| 19 |
-
$content = $c->getContent();
|
| 20 |
-
if($c->getStore() == $store)
|
| 21 |
-
break;
|
| 22 |
-
}
|
| 23 |
-
return $content;
|
| 24 |
-
}
|
| 25 |
-
|
| 26 |
-
/**
|
| 27 |
-
* Default sore ID getter
|
| 28 |
-
*
|
| 29 |
-
* @return integer
|
| 30 |
-
*/
|
| 31 |
-
protected function _getDefaultStoreId()
|
| 32 |
-
{
|
| 33 |
-
return Mage_Catalog_Model_Abstract::DEFAULT_STORE_ID;
|
| 34 |
-
}
|
| 35 |
-
|
| 36 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Productlabels/Block/Productlabels.php
DELETED
|
@@ -1,28 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
class Niveus_Productlabels_Block_Productlabels extends Mage_Core_Block_Template
|
| 3 |
-
{
|
| 4 |
-
public function _prepareLayout()
|
| 5 |
-
{
|
| 6 |
-
return parent::_prepareLayout();
|
| 7 |
-
}
|
| 8 |
-
|
| 9 |
-
public function getProductlabels()
|
| 10 |
-
{
|
| 11 |
-
if (!$this->hasData('productlabels')) {
|
| 12 |
-
$this->setData('productlabels', Mage::registry('productlabels'));
|
| 13 |
-
}
|
| 14 |
-
return $this->getData('productlabels');
|
| 15 |
-
|
| 16 |
-
}
|
| 17 |
-
|
| 18 |
-
public function addObject($_object)
|
| 19 |
-
{
|
| 20 |
-
$this->setData('object',$_object);
|
| 21 |
-
return $this;
|
| 22 |
-
}
|
| 23 |
-
|
| 24 |
-
public function getObject()
|
| 25 |
-
{
|
| 26 |
-
return $this->getData('object');
|
| 27 |
-
}
|
| 28 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Productlabels/Helper/Data.php
DELETED
|
@@ -1,98 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
class Niveus_Productlabels_Helper_Data extends Mage_Core_Helper_Abstract
|
| 3 |
-
{
|
| 4 |
-
protected $labels;
|
| 5 |
-
public function resizeImage($imageName, $width=NULL, $height=NULL, $imagePath=NULL,$type)
|
| 6 |
-
{
|
| 7 |
-
$imagePath = str_replace("/", DS, $imagePath);
|
| 8 |
-
$imagePathFull = Mage::getBaseDir('media') . DS . $imagePath . DS . $imageName;
|
| 9 |
-
|
| 10 |
-
if($width == NULL && $height == NULL) {
|
| 11 |
-
$width = 100;
|
| 12 |
-
$height = 100;
|
| 13 |
-
}
|
| 14 |
-
$resizePath = $width . 'x' . $height;
|
| 15 |
-
$resizePathFull = Mage::getBaseDir('media') . DS . $imagePath . DS . $type. DS . $resizePath . DS . $imageName;
|
| 16 |
-
|
| 17 |
-
if (file_exists($imagePathFull) && !file_exists($resizePathFull)) {
|
| 18 |
-
$imageObj = new Varien_Image($imagePathFull);
|
| 19 |
-
$imageObj->keepTransparency(true);
|
| 20 |
-
//$imageObj->constrainOnly(TRUE);
|
| 21 |
-
$imageObj->keepAspectRatio(TRUE);
|
| 22 |
-
$imageObj->resize($width,$height);
|
| 23 |
-
$imageObj->save($resizePathFull);
|
| 24 |
-
}
|
| 25 |
-
|
| 26 |
-
$imagePath=str_replace(DS, "/", $imagePath);
|
| 27 |
-
return Mage::getBaseUrl("media") . $imagePath . "/" . $type . "/" . $resizePath . "/" . $imageName;
|
| 28 |
-
}
|
| 29 |
-
|
| 30 |
-
function initLabels()
|
| 31 |
-
{
|
| 32 |
-
if($this->labels)
|
| 33 |
-
return $this->labels;
|
| 34 |
-
|
| 35 |
-
$label = Mage::getModel('productlabels/productlabels');
|
| 36 |
-
$attributes = $label->getAttributes();
|
| 37 |
-
$collection = $label->getCollection();
|
| 38 |
-
foreach($attributes as $a)
|
| 39 |
-
{
|
| 40 |
-
$atrNameTbl = $a->getNameAttribute().'tbl';
|
| 41 |
-
$atrNameTblDefault = $a->getNameAttribute().'tbl_default';
|
| 42 |
-
$collection->getSelect()->joinLeft(array($atrNameTbl => $collection->getTable('productlabels/type_'.$a->getType())),
|
| 43 |
-
"$atrNameTbl.label_id = main_table.id
|
| 44 |
-
AND $atrNameTbl.attribute_id = ".$a->getId()."
|
| 45 |
-
AND $atrNameTbl.store_id = ".Mage::app()->getStore()->getId(), array(
|
| 46 |
-
))->joinLeft(array($atrNameTblDefault => $collection->getTable('productlabels/type_'.$a->getType())),
|
| 47 |
-
"$atrNameTblDefault.label_id = main_table.id
|
| 48 |
-
AND $atrNameTblDefault.attribute_id = ".$a->getId()."
|
| 49 |
-
AND $atrNameTblDefault.store_id = ".$this->_getDefaultStoreId(), array(
|
| 50 |
-
$a->getNameAttribute() => "if($atrNameTbl.value <> 'NULL',$atrNameTbl.value,$atrNameTblDefault.value)"
|
| 51 |
-
));
|
| 52 |
-
}
|
| 53 |
-
$this->labels = $collection;
|
| 54 |
-
return $this->labels;
|
| 55 |
-
}
|
| 56 |
-
|
| 57 |
-
function display($_product)
|
| 58 |
-
{
|
| 59 |
-
$labels = $this->initLabels();
|
| 60 |
-
$block = new Niveus_Productlabels_Block_Productlabels();
|
| 61 |
-
$labelShows = array();
|
| 62 |
-
foreach ($labels as $label)
|
| 63 |
-
{
|
| 64 |
-
$catalogRule = Mage::getModel('productlabels/rule');
|
| 65 |
-
$actionsArr = unserialize($label->getActions());
|
| 66 |
-
if (!empty($actionsArr) && is_array($actionsArr)) {
|
| 67 |
-
$catalogRule->getConditions()->loadArray($actionsArr);
|
| 68 |
-
}
|
| 69 |
-
$object = new Varien_Object();
|
| 70 |
-
$object->setData('product', $_product);
|
| 71 |
-
$object->setData('label', $label);
|
| 72 |
-
|
| 73 |
-
if($validate = (bool)$catalogRule->validate($object) && $label->getEnable() == 1)
|
| 74 |
-
{
|
| 75 |
-
$labelShows[] = $label;
|
| 76 |
-
|
| 77 |
-
}
|
| 78 |
-
|
| 79 |
-
}
|
| 80 |
-
if(!empty ($labelShows))
|
| 81 |
-
{
|
| 82 |
-
echo $block->addObject(array('labels'=>$labelShows,'product'=>$_product))->setTemplate('Niveus_productlabels/productlabels.phtml')->toHtml();
|
| 83 |
-
}
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
}
|
| 88 |
-
|
| 89 |
-
/**
|
| 90 |
-
* Default sore ID getter
|
| 91 |
-
*
|
| 92 |
-
* @return integer
|
| 93 |
-
*/
|
| 94 |
-
protected function _getDefaultStoreId()
|
| 95 |
-
{
|
| 96 |
-
return Mage_Catalog_Model_Abstract::DEFAULT_STORE_ID;
|
| 97 |
-
}
|
| 98 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Productlabels/Model/Attribute.php
DELETED
|
@@ -1,44 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
class Niveus_Productlabels_Model_Attribute extends Mage_Core_Model_Abstract
|
| 3 |
-
{
|
| 4 |
-
const SCOPE_STORE = 0;
|
| 5 |
-
const SCOPE_GLOBAL = 1;
|
| 6 |
-
const SCOPE_WEBSITE = 2;
|
| 7 |
-
public function _construct()
|
| 8 |
-
{
|
| 9 |
-
parent::_construct();
|
| 10 |
-
$this->_init('productlabels/attribute');
|
| 11 |
-
}
|
| 12 |
-
|
| 13 |
-
public function getIsGlobal()
|
| 14 |
-
{
|
| 15 |
-
return $this->getScopeGlobal();
|
| 16 |
-
}
|
| 17 |
-
|
| 18 |
-
/**
|
| 19 |
-
* Retrieve attribute is global scope flag
|
| 20 |
-
*
|
| 21 |
-
* @return bool
|
| 22 |
-
*/
|
| 23 |
-
public function isScopeGlobal()
|
| 24 |
-
{
|
| 25 |
-
return $this->getIsGlobal() == self::SCOPE_GLOBAL;
|
| 26 |
-
}
|
| 27 |
-
|
| 28 |
-
/**
|
| 29 |
-
* Retrieve attribute is website scope website
|
| 30 |
-
*
|
| 31 |
-
* @return bool
|
| 32 |
-
*/
|
| 33 |
-
public function isScopeWebsite()
|
| 34 |
-
{
|
| 35 |
-
return $this->getIsGlobal() == self::SCOPE_WEBSITE;
|
| 36 |
-
}
|
| 37 |
-
|
| 38 |
-
public function isScopeStore()
|
| 39 |
-
{
|
| 40 |
-
return !$this->isScopeGlobal() && !$this->isScopeWebsite();
|
| 41 |
-
}
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Productlabels/Model/Config/Listlabel.php
DELETED
|
@@ -1,28 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
class Niveus_Productlabels_Model_Config_Listlabel
|
| 3 |
-
{
|
| 4 |
-
protected $_options;
|
| 5 |
-
protected $_list = null;
|
| 6 |
-
public function toOptionArray()
|
| 7 |
-
{
|
| 8 |
-
if (!$this->_options) {
|
| 9 |
-
if($this->_list == null)
|
| 10 |
-
{
|
| 11 |
-
$this->_list = Mage::getModel('productlabels/productlabels')->getCollection();
|
| 12 |
-
}
|
| 13 |
-
|
| 14 |
-
$data = array();
|
| 15 |
-
if($this->_list->count())
|
| 16 |
-
{
|
| 17 |
-
foreach($this->_list as $l)
|
| 18 |
-
{
|
| 19 |
-
$data[] = array('value'=>$l->getId(),'label'=>$l->getName());
|
| 20 |
-
}
|
| 21 |
-
}
|
| 22 |
-
|
| 23 |
-
$this->_options = $data;
|
| 24 |
-
}
|
| 25 |
-
return $this->_options;
|
| 26 |
-
}
|
| 27 |
-
}
|
| 28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Productlabels/Model/Css.php
DELETED
|
@@ -1,53 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
class Niveus_Productlabels_Model_Css extends Mage_Core_Model_Abstract
|
| 4 |
-
{
|
| 5 |
-
const SCOPE_STORE = 0;
|
| 6 |
-
const SCOPE_GLOBAL = 1;
|
| 7 |
-
const SCOPE_WEBSITE = 2;
|
| 8 |
-
public function _construct()
|
| 9 |
-
{
|
| 10 |
-
parent::_construct();
|
| 11 |
-
$this->_init('productlabels/css');
|
| 12 |
-
}
|
| 13 |
-
|
| 14 |
-
public function getIsGlobal()
|
| 15 |
-
{
|
| 16 |
-
return $this->getScopeGlobal();
|
| 17 |
-
}
|
| 18 |
-
|
| 19 |
-
/**
|
| 20 |
-
* Retrieve attribute is global scope flag
|
| 21 |
-
*
|
| 22 |
-
* @return bool
|
| 23 |
-
*/
|
| 24 |
-
public function isScopeGlobal()
|
| 25 |
-
{
|
| 26 |
-
return $this->getIsGlobal() == self::SCOPE_GLOBAL;
|
| 27 |
-
}
|
| 28 |
-
|
| 29 |
-
/**
|
| 30 |
-
* Retrieve attribute is website scope website
|
| 31 |
-
*
|
| 32 |
-
* @return bool
|
| 33 |
-
*/
|
| 34 |
-
public function isScopeWebsite()
|
| 35 |
-
{
|
| 36 |
-
return $this->getIsGlobal() == self::SCOPE_WEBSITE;
|
| 37 |
-
}
|
| 38 |
-
|
| 39 |
-
public function isScopeStore()
|
| 40 |
-
{
|
| 41 |
-
return !$this->isScopeGlobal() && !$this->isScopeWebsite();
|
| 42 |
-
}
|
| 43 |
-
|
| 44 |
-
public function hasGlobal()
|
| 45 |
-
{
|
| 46 |
-
return $this->getCollection()->addFieldToFilter('store',0)->count() > 0;
|
| 47 |
-
}
|
| 48 |
-
|
| 49 |
-
public function getStoreId()
|
| 50 |
-
{
|
| 51 |
-
return Mage::app()->getRequest()->getParam('store',0);
|
| 52 |
-
}
|
| 53 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Productlabels/Model/Filter.php
DELETED
|
@@ -1,112 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
class Niveus_Productlabels_Model_Filter extends Mage_Widget_Model_Template_Filter
|
| 3 |
-
{
|
| 4 |
-
/**
|
| 5 |
-
* Filter the string as template.
|
| 6 |
-
*
|
| 7 |
-
* @param string $value
|
| 8 |
-
* @return string
|
| 9 |
-
*/
|
| 10 |
-
public function filter($object)
|
| 11 |
-
{
|
| 12 |
-
if(!is_string($object))
|
| 13 |
-
{
|
| 14 |
-
$value = $object->getText();
|
| 15 |
-
$product = $object->getProduct();
|
| 16 |
-
}
|
| 17 |
-
else
|
| 18 |
-
$value = $object;
|
| 19 |
-
$customVariables = $this->getCustomVariable();
|
| 20 |
-
// "depend" and "if" operands should be first
|
| 21 |
-
foreach (array(
|
| 22 |
-
self::CONSTRUCTION_DEPEND_PATTERN => 'dependDirective',
|
| 23 |
-
self::CONSTRUCTION_IF_PATTERN => 'ifDirective',
|
| 24 |
-
) as $pattern => $directive) {
|
| 25 |
-
if (preg_match_all($pattern, $value, $constructions, PREG_SET_ORDER)) {
|
| 26 |
-
foreach($constructions as $index => $construction) {
|
| 27 |
-
$replacedValue = '';
|
| 28 |
-
$callback = array($this, $directive);
|
| 29 |
-
if(!is_callable($callback)) {
|
| 30 |
-
continue;
|
| 31 |
-
}
|
| 32 |
-
try {
|
| 33 |
-
$replacedValue = call_user_func($callback, $construction);
|
| 34 |
-
} catch (Exception $e) {
|
| 35 |
-
throw $e;
|
| 36 |
-
}
|
| 37 |
-
$value = str_replace($construction[0], $replacedValue, $value);
|
| 38 |
-
}
|
| 39 |
-
}
|
| 40 |
-
}
|
| 41 |
-
|
| 42 |
-
if(preg_match_all(self::CONSTRUCTION_PATTERN, $value, $constructions, PREG_SET_ORDER)) {
|
| 43 |
-
|
| 44 |
-
foreach($constructions as $index=>$construction) {
|
| 45 |
-
$replacedValue = '';
|
| 46 |
-
$callback = array($this, $construction[1].'Directive');
|
| 47 |
-
if(!is_callable($callback)) {
|
| 48 |
-
continue;
|
| 49 |
-
}
|
| 50 |
-
try {
|
| 51 |
-
$replacedValue = call_user_func($callback, $construction);
|
| 52 |
-
|
| 53 |
-
if(in_array($construction[0], $customVariables))
|
| 54 |
-
{
|
| 55 |
-
$replacedValue = $this->getCustomVariableValue($construction,$product);
|
| 56 |
-
}
|
| 57 |
-
} catch (Exception $e) {
|
| 58 |
-
throw $e;
|
| 59 |
-
}
|
| 60 |
-
$value = str_replace($construction[0], $replacedValue, $value);
|
| 61 |
-
}
|
| 62 |
-
}
|
| 63 |
-
return $value;
|
| 64 |
-
}
|
| 65 |
-
|
| 66 |
-
public function getCustomVariable()
|
| 67 |
-
{
|
| 68 |
-
return array(
|
| 69 |
-
'{{var save_percent}}',
|
| 70 |
-
'{{var save_price}}',
|
| 71 |
-
'{{var product.price}}',
|
| 72 |
-
'{{var product.special_price}}',
|
| 73 |
-
'{{var product.qty}}'
|
| 74 |
-
);
|
| 75 |
-
}
|
| 76 |
-
|
| 77 |
-
public function getCustomVariableValue($construction,$_product)
|
| 78 |
-
{
|
| 79 |
-
$type = trim($construction[2]);
|
| 80 |
-
if($type == 'save_percent')
|
| 81 |
-
{
|
| 82 |
-
$specialPrice = $_product->getSpecialPrice();
|
| 83 |
-
$regularPrice = $_product->getPrice();
|
| 84 |
-
if($specialPrice > 0)
|
| 85 |
-
return number_format(100*(float)($regularPrice-$specialPrice)/$regularPrice,0);
|
| 86 |
-
else
|
| 87 |
-
return 0;
|
| 88 |
-
}
|
| 89 |
-
elseif($type == 'save_price'){
|
| 90 |
-
$specialPrice = $_product->getSpecialPrice();
|
| 91 |
-
$regularPrice = $_product->getPrice();
|
| 92 |
-
if($specialPrice > 0)
|
| 93 |
-
return rtrim(rtrim( number_format(($regularPrice-$specialPrice), 2, ".", ""),'0'),'.');
|
| 94 |
-
else
|
| 95 |
-
return Mage::helper('core')->formatPrice(0, false);
|
| 96 |
-
}
|
| 97 |
-
elseif($type == 'product.price')
|
| 98 |
-
{
|
| 99 |
-
return Mage::helper('core')->formatPrice($_product->getPrice(), false);
|
| 100 |
-
}
|
| 101 |
-
elseif($type == 'product.special_price'){
|
| 102 |
-
return Mage::helper('core')->formatPrice($_product->getSpecialPrice(), false);
|
| 103 |
-
}
|
| 104 |
-
else{
|
| 105 |
-
$stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product);
|
| 106 |
-
$qty = $stock->getQty();
|
| 107 |
-
if($stock->getIsQtyDecimal() == 0)
|
| 108 |
-
$qty = (int)$qty;
|
| 109 |
-
return $qty;
|
| 110 |
-
}
|
| 111 |
-
}
|
| 112 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Productlabels/Model/Mysql4/Attribute.php
DELETED
|
@@ -1,10 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
class Niveus_Productlabels_Model_Mysql4_Attribute extends Mage_Core_Model_Mysql4_Abstract
|
| 4 |
-
{
|
| 5 |
-
public function _construct()
|
| 6 |
-
{
|
| 7 |
-
// Note that the productlabels_id refers to the key field in your database table.
|
| 8 |
-
$this->_init('productlabels/attribute', 'id');
|
| 9 |
-
}
|
| 10 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Productlabels/Model/Mysql4/Attribute/Collection.php
DELETED
|
@@ -1,10 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
class Niveus_Productlabels_Model_Mysql4_Attribute_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
| 4 |
-
{
|
| 5 |
-
public function _construct()
|
| 6 |
-
{
|
| 7 |
-
parent::_construct();
|
| 8 |
-
$this->_init('productlabels/attribute');
|
| 9 |
-
}
|
| 10 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Productlabels/Model/Mysql4/Css.php
DELETED
|
@@ -1,10 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
class Niveus_Productlabels_Model_Mysql4_Css extends Mage_Core_Model_Mysql4_Abstract
|
| 4 |
-
{
|
| 5 |
-
public function _construct()
|
| 6 |
-
{
|
| 7 |
-
// Note that the productlabels_id refers to the key field in your database table.
|
| 8 |
-
$this->_init('productlabels/css', 'id');
|
| 9 |
-
}
|
| 10 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Productlabels/Model/Mysql4/Css/Collection.php
DELETED
|
@@ -1,23 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
class Niveus_Productlabels_Model_Mysql4_Css_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
| 4 |
-
{
|
| 5 |
-
public function _construct()
|
| 6 |
-
{
|
| 7 |
-
parent::_construct();
|
| 8 |
-
$this->_init('productlabels/css');
|
| 9 |
-
}
|
| 10 |
-
|
| 11 |
-
public function setStoreId($stores)
|
| 12 |
-
{
|
| 13 |
-
if(is_array($stores))
|
| 14 |
-
$this->addFieldToFilter('store',array('in' => $stores));
|
| 15 |
-
else
|
| 16 |
-
$this->addFieldToFilter('store',Mage::app()->getRequest()->getParam('store', 0));
|
| 17 |
-
$this->addOrder('store', 'ASC');
|
| 18 |
-
//echo (string)$this->getSelect();exit;
|
| 19 |
-
return $this;
|
| 20 |
-
}
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Productlabels/Model/Mysql4/Productlabels.php
DELETED
|
@@ -1,10 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
class Niveus_Productlabels_Model_Mysql4_Productlabels extends Mage_Core_Model_Mysql4_Abstract
|
| 4 |
-
{
|
| 5 |
-
public function _construct()
|
| 6 |
-
{
|
| 7 |
-
// Note that the productlabels_id refers to the key field in your database table.
|
| 8 |
-
$this->_init('productlabels/productlabels', 'id');
|
| 9 |
-
}
|
| 10 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Productlabels/Model/Mysql4/Productlabels/Collection.php
DELETED
|
@@ -1,104 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
class Niveus_Productlabels_Model_Mysql4_Productlabels_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
| 3 |
-
{
|
| 4 |
-
/**
|
| 5 |
-
* Joined attributes
|
| 6 |
-
*
|
| 7 |
-
* @var array
|
| 8 |
-
*/
|
| 9 |
-
protected $_joinAttributes = array();
|
| 10 |
-
|
| 11 |
-
public function _construct()
|
| 12 |
-
{
|
| 13 |
-
parent::_construct();
|
| 14 |
-
$this->_init('productlabels/productlabels');
|
| 15 |
-
}
|
| 16 |
-
|
| 17 |
-
public function addAttributesToSelect($label)
|
| 18 |
-
{
|
| 19 |
-
|
| 20 |
-
$attributes = $label->getAttributes();
|
| 21 |
-
|
| 22 |
-
foreach($attributes as $a)
|
| 23 |
-
{
|
| 24 |
-
$atrNameTbl = $a->getNameAttribute().'tbl';
|
| 25 |
-
$atrNameTblDefault = $a->getNameAttribute().'tbl_default';
|
| 26 |
-
$this->getSelect()->joinLeft(array($atrNameTbl => $this->getTable('productlabels/type_'.$a->getType())),
|
| 27 |
-
"$atrNameTbl.label_id = ".$label->getId()."
|
| 28 |
-
AND $atrNameTbl.attribute_id = ".$a->getId()."
|
| 29 |
-
AND $atrNameTbl.store_id = ".$this->getStore(), array(
|
| 30 |
-
))->joinLeft(array($atrNameTblDefault => $this->getTable('productlabels/type_'.$a->getType())),
|
| 31 |
-
"$atrNameTblDefault.label_id = ".$label->getId()."
|
| 32 |
-
AND $atrNameTblDefault.attribute_id = ".$a->getId()."
|
| 33 |
-
AND $atrNameTblDefault.store_id = ".$this->_getDefaultStoreId(), array(
|
| 34 |
-
$a->getNameAttribute() => "if($atrNameTbl.value <> 'NULL',$atrNameTbl.value,$atrNameTblDefault.value)",
|
| 35 |
-
$a->getNameAttribute().'_in_store' => "if($atrNameTbl.store_id <> 'NULL',$atrNameTbl.store_id,$atrNameTblDefault.store_id)"
|
| 36 |
-
));
|
| 37 |
-
}
|
| 38 |
-
$this->getSelect()->where('main_table.id='.$label->getId());
|
| 39 |
-
|
| 40 |
-
return $this;
|
| 41 |
-
}
|
| 42 |
-
|
| 43 |
-
public function getStore()
|
| 44 |
-
{
|
| 45 |
-
$urlRoot = Mage::app()->getRequest()->getPathInfo();
|
| 46 |
-
if(strstr($urlRoot, 'adminhtml_productlabels'))
|
| 47 |
-
return Mage::app()->getRequest()->getParam('store',0);
|
| 48 |
-
else
|
| 49 |
-
return Mage::app()->getStore()->getId();
|
| 50 |
-
}
|
| 51 |
-
|
| 52 |
-
public function addAttributeToSelect($arrAttribute = array())
|
| 53 |
-
{
|
| 54 |
-
if(!empty($arrAttribute))
|
| 55 |
-
{
|
| 56 |
-
$attributes = Mage::getModel('productlabels/attribute')->getCollection()
|
| 57 |
-
->addFieldToFilter('name_attribute',array(
|
| 58 |
-
'in' => $arrAttribute
|
| 59 |
-
));
|
| 60 |
-
foreach($attributes as $a)
|
| 61 |
-
{
|
| 62 |
-
$atrNameTbl = $a->getNameAttribute().'tbl';
|
| 63 |
-
$atrNameTblDefault = $a->getNameAttribute().'tbl_default';
|
| 64 |
-
$this->getSelect()->joinLeft(array($atrNameTbl => $this->getTable('productlabels/type_'.$a->getType())),
|
| 65 |
-
"$atrNameTbl.label_id = main_table.id
|
| 66 |
-
AND $atrNameTbl.attribute_id = ".$a->getId()."
|
| 67 |
-
AND $atrNameTbl.store_id = ".Mage::app()->getRequest()->getParam('store',0), array()
|
| 68 |
-
)->joinLeft(array($atrNameTblDefault => $this->getTable('productlabels/type_'.$a->getType())),
|
| 69 |
-
"$atrNameTblDefault.label_id = main_table.id
|
| 70 |
-
AND $atrNameTblDefault.attribute_id = ".$a->getId()."
|
| 71 |
-
AND $atrNameTblDefault.store_id = ".$this->_getDefaultStoreId(), array(
|
| 72 |
-
$a->getNameAttribute() => "if($atrNameTbl.value > 0,$atrNameTbl.value,$atrNameTblDefault.value)"
|
| 73 |
-
));
|
| 74 |
-
$this->_joinAttributes[$a->getNameAttribute()]['conditions_alias'] = "if($atrNameTbl.value > 0,$atrNameTbl.value,$atrNameTblDefault.value)";
|
| 75 |
-
|
| 76 |
-
}
|
| 77 |
-
|
| 78 |
-
}
|
| 79 |
-
|
| 80 |
-
return $this;
|
| 81 |
-
}
|
| 82 |
-
|
| 83 |
-
public function addFieldToFilter($field, $condition=null)
|
| 84 |
-
{
|
| 85 |
-
$field = $this->_getMappedField($field);
|
| 86 |
-
if($nameSelect = $this->_joinAttributes[$field]['conditions_alias'])
|
| 87 |
-
$this->_select->where($this->_getConditionSql($nameSelect, $condition), null, Varien_Db_Select::TYPE_CONDITION);
|
| 88 |
-
else
|
| 89 |
-
$this->_select->where($this->_getConditionSql($field, $condition), null, Varien_Db_Select::TYPE_CONDITION);
|
| 90 |
-
return $this;
|
| 91 |
-
}
|
| 92 |
-
|
| 93 |
-
/**
|
| 94 |
-
* Default sore ID getter
|
| 95 |
-
*
|
| 96 |
-
* @return integer
|
| 97 |
-
*/
|
| 98 |
-
protected function _getDefaultStoreId()
|
| 99 |
-
{
|
| 100 |
-
return Mage_Catalog_Model_Abstract::DEFAULT_STORE_ID;
|
| 101 |
-
}
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Productlabels/Model/Mysql4/Type/Int.php
DELETED
|
@@ -1,10 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
class Niveus_Productlabels_Model_Mysql4_Type_Int extends Mage_Core_Model_Mysql4_Abstract
|
| 4 |
-
{
|
| 5 |
-
public function _construct()
|
| 6 |
-
{
|
| 7 |
-
// Note that the productlabels_id refers to the key field in your database table.
|
| 8 |
-
$this->_init('productlabels/type_int', 'id');
|
| 9 |
-
}
|
| 10 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Productlabels/Model/Mysql4/Type/Int/Collection.php
DELETED
|
@@ -1,10 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
class Niveus_Productlabels_Model_Mysql4_Type_Int_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
| 4 |
-
{
|
| 5 |
-
public function _construct()
|
| 6 |
-
{
|
| 7 |
-
parent::_construct();
|
| 8 |
-
$this->_init('productlabels/type_int');
|
| 9 |
-
}
|
| 10 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Productlabels/Model/Mysql4/Type/Text.php
DELETED
|
@@ -1,10 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
class Niveus_Productlabels_Model_Mysql4_Type_Text extends Mage_Core_Model_Mysql4_Abstract
|
| 4 |
-
{
|
| 5 |
-
public function _construct()
|
| 6 |
-
{
|
| 7 |
-
// Note that the productlabels_id refers to the key field in your database table.
|
| 8 |
-
$this->_init('productlabels/type_text', 'id');
|
| 9 |
-
}
|
| 10 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Productlabels/Model/Mysql4/Type/Text/Collection.php
DELETED
|
@@ -1,10 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
class Niveus_Productlabels_Model_Mysql4_Type_Text_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
| 4 |
-
{
|
| 5 |
-
public function _construct()
|
| 6 |
-
{
|
| 7 |
-
parent::_construct();
|
| 8 |
-
$this->_init('productlabels/type_text');
|
| 9 |
-
}
|
| 10 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Productlabels/Model/Mysql4/Type/Varchar.php
DELETED
|
@@ -1,10 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
class Niveus_Productlabels_Model_Mysql4_Type_Varchar extends Mage_Core_Model_Mysql4_Abstract
|
| 4 |
-
{
|
| 5 |
-
public function _construct()
|
| 6 |
-
{
|
| 7 |
-
// Note that the productlabels_id refers to the key field in your database table.
|
| 8 |
-
$this->_init('productlabels/type_varchar', 'id');
|
| 9 |
-
}
|
| 10 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Productlabels/Model/Mysql4/Type/Varchar/Collection.php
DELETED
|
@@ -1,10 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
class Niveus_Productlabels_Model_Mysql4_Type_Varchar_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
| 4 |
-
{
|
| 5 |
-
public function _construct()
|
| 6 |
-
{
|
| 7 |
-
parent::_construct();
|
| 8 |
-
$this->_init('productlabels/type_varchar');
|
| 9 |
-
}
|
| 10 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Productlabels/Model/Productlabels.php
DELETED
|
@@ -1,59 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
class Niveus_Productlabels_Model_Productlabels extends Mage_Core_Model_Abstract
|
| 4 |
-
{
|
| 5 |
-
public function _construct()
|
| 6 |
-
{
|
| 7 |
-
parent::_construct();
|
| 8 |
-
$this->_init('productlabels/productlabels');
|
| 9 |
-
}
|
| 10 |
-
|
| 11 |
-
public function getStoreId()
|
| 12 |
-
{
|
| 13 |
-
if ($this->hasData('store_id')) {
|
| 14 |
-
return $this->getData('store_id');
|
| 15 |
-
}
|
| 16 |
-
return Mage::app()->getRequest()->getParam('store');
|
| 17 |
-
}
|
| 18 |
-
|
| 19 |
-
public function getAttributes()
|
| 20 |
-
{
|
| 21 |
-
return Mage::getModel('productlabels/attribute')->getCollection()
|
| 22 |
-
->addFieldToFilter('name_attribute',array(
|
| 23 |
-
'neq' => 'name'
|
| 24 |
-
));
|
| 25 |
-
|
| 26 |
-
}
|
| 27 |
-
|
| 28 |
-
public function addAttributeToSelect()
|
| 29 |
-
{
|
| 30 |
-
$collection = $this->getCollection()->addAttributesToSelect($this);
|
| 31 |
-
$this->setData($collection->getFirstItem()->getData());
|
| 32 |
-
return $this;
|
| 33 |
-
}
|
| 34 |
-
|
| 35 |
-
public function getAttributeDefault()
|
| 36 |
-
{
|
| 37 |
-
$attTable = array(
|
| 38 |
-
'text' => Mage::getModel('productlabels/type_text'),
|
| 39 |
-
'varchar' => Mage::getModel('productlabels/type_varchar'),
|
| 40 |
-
'int' => Mage::getModel('productlabels/type_int')
|
| 41 |
-
);
|
| 42 |
-
$attributes = $this->getAttributes();
|
| 43 |
-
foreach($atr as $a)
|
| 44 |
-
{
|
| 45 |
-
if(!$this->getData($a->getNameAttribute()))
|
| 46 |
-
{
|
| 47 |
-
$value = $attTable[$a->getType()]->getCollection()
|
| 48 |
-
->addFieldToFilter('label_id',$this->getId())
|
| 49 |
-
->addFieldToFilter('attribute_id',$a->getId())
|
| 50 |
-
->addFieldToFilter('store_id',0)
|
| 51 |
-
->getFirstItem()
|
| 52 |
-
->getValue();
|
| 53 |
-
$this->setData($a->getNameAttribute(),$value);
|
| 54 |
-
}
|
| 55 |
-
}
|
| 56 |
-
|
| 57 |
-
return $this;
|
| 58 |
-
}
|
| 59 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Productlabels/Model/Productrule.php
DELETED
|
@@ -1,314 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Magento
|
| 4 |
-
*
|
| 5 |
-
* NOTICE OF LICENSE
|
| 6 |
-
*
|
| 7 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
-
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
-
* It is also available through the world-wide-web at this URL:
|
| 10 |
-
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
-
* If you did not receive a copy of the license and are unable to
|
| 12 |
-
* obtain it through the world-wide-web, please send an email
|
| 13 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
-
*
|
| 15 |
-
* DISCLAIMER
|
| 16 |
-
*
|
| 17 |
-
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 18 |
-
* versions in the future. If you wish to customize Magento for your
|
| 19 |
-
* needs please refer to http://www.magentocommerce.com for more information.
|
| 20 |
-
*
|
| 21 |
-
* @category Mage
|
| 22 |
-
* @package Mage_CatalogRule
|
| 23 |
-
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
| 24 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 25 |
-
*/
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
class Niveus_Productlabels_Model_Productrule extends Mage_SalesRule_Model_Rule
|
| 29 |
-
{
|
| 30 |
-
const XML_NODE_RELATED_CACHE = 'global/catalogrule/related_cache_types';
|
| 31 |
-
|
| 32 |
-
/**
|
| 33 |
-
* Prefix of model events names
|
| 34 |
-
*
|
| 35 |
-
* @var string
|
| 36 |
-
*/
|
| 37 |
-
protected $_eventPrefix = 'catalogrule_rule';
|
| 38 |
-
|
| 39 |
-
/**
|
| 40 |
-
* Parameter name in event
|
| 41 |
-
*
|
| 42 |
-
* In observe method you can use $observer->getEvent()->getRule() in this case
|
| 43 |
-
*
|
| 44 |
-
* @var string
|
| 45 |
-
*/
|
| 46 |
-
protected $_eventObject = 'rule';
|
| 47 |
-
|
| 48 |
-
/**
|
| 49 |
-
* Matched product ids array
|
| 50 |
-
*
|
| 51 |
-
* @var array
|
| 52 |
-
*/
|
| 53 |
-
protected $_productIds;
|
| 54 |
-
|
| 55 |
-
protected $_now;
|
| 56 |
-
|
| 57 |
-
/**
|
| 58 |
-
* Cached data of prices calculated by price rules
|
| 59 |
-
*
|
| 60 |
-
* @var array
|
| 61 |
-
*/
|
| 62 |
-
protected static $_priceRulesData = array();
|
| 63 |
-
|
| 64 |
-
/**
|
| 65 |
-
* Init resource model and id field
|
| 66 |
-
*/
|
| 67 |
-
protected function _construct()
|
| 68 |
-
{
|
| 69 |
-
parent::_construct();
|
| 70 |
-
$this->_init('catalogrule/rule');
|
| 71 |
-
$this->setIdFieldName('rule_id');
|
| 72 |
-
}
|
| 73 |
-
|
| 74 |
-
public function getConditionsInstance()
|
| 75 |
-
{
|
| 76 |
-
return Mage::getModel('catalogrule/rule_condition_combine');
|
| 77 |
-
}
|
| 78 |
-
|
| 79 |
-
/*public function getActionsInstance()
|
| 80 |
-
{
|
| 81 |
-
return Mage::getModel('catalogrule/rule_action_collection');
|
| 82 |
-
}*/
|
| 83 |
-
|
| 84 |
-
public function getNow()
|
| 85 |
-
{
|
| 86 |
-
if (!$this->_now) {
|
| 87 |
-
return now();
|
| 88 |
-
}
|
| 89 |
-
return $this->_now;
|
| 90 |
-
}
|
| 91 |
-
|
| 92 |
-
public function setNow($now)
|
| 93 |
-
{
|
| 94 |
-
$this->_now = $now;
|
| 95 |
-
}
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
public function toString($format='')
|
| 99 |
-
{
|
| 100 |
-
$str = Mage::helper('catalogrule')->__("Name: %s", $this->getName()) ."\n"
|
| 101 |
-
. Mage::helper('catalogrule')->__("Start at: %s", $this->getStartAt()) ."\n"
|
| 102 |
-
. Mage::helper('catalogrule')->__("Expire at: %s", $this->getExpireAt()) ."\n"
|
| 103 |
-
. Mage::helper('catalogrule')->__("Customer Registered: %s", $this->getCustomerRegistered()) ."\n"
|
| 104 |
-
. Mage::helper('catalogrule')->__("Customer is a New Buyer: %s", $this->getCustomerNewBuyer()) ."\n"
|
| 105 |
-
. Mage::helper('catalogrule')->__("Description: %s", $this->getDescription()) ."\n\n"
|
| 106 |
-
. $this->getConditions()->toStringRecursive() ."\n\n"
|
| 107 |
-
. $this->getActions()->toStringRecursive() ."\n\n";
|
| 108 |
-
return $str;
|
| 109 |
-
}
|
| 110 |
-
|
| 111 |
-
/**
|
| 112 |
-
* Returns rule as an array for admin interface
|
| 113 |
-
*
|
| 114 |
-
* Output example:
|
| 115 |
-
* array(
|
| 116 |
-
* 'name'=>'Example rule',
|
| 117 |
-
* 'conditions'=>{condition_combine::toArray}
|
| 118 |
-
* 'actions'=>{action_collection::toArray}
|
| 119 |
-
* )
|
| 120 |
-
*
|
| 121 |
-
* @return array
|
| 122 |
-
*/
|
| 123 |
-
public function toArray(array $arrAttributes = array())
|
| 124 |
-
{
|
| 125 |
-
$out = parent::toArray($arrAttributes);
|
| 126 |
-
$out['customer_registered'] = $this->getCustomerRegistered();
|
| 127 |
-
$out['customer_new_buyer'] = $this->getCustomerNewBuyer();
|
| 128 |
-
|
| 129 |
-
return $out;
|
| 130 |
-
}
|
| 131 |
-
|
| 132 |
-
/**
|
| 133 |
-
* Invalidate related cache types
|
| 134 |
-
*
|
| 135 |
-
* @return Mage_CatalogRule_Model_Rule
|
| 136 |
-
*/
|
| 137 |
-
protected function _invalidateCache()
|
| 138 |
-
{
|
| 139 |
-
$types = Mage::getConfig()->getNode(self::XML_NODE_RELATED_CACHE);
|
| 140 |
-
if ($types) {
|
| 141 |
-
$types = $types->asArray();
|
| 142 |
-
Mage::app()->getCacheInstance()->invalidateType(array_keys($types));
|
| 143 |
-
}
|
| 144 |
-
return $this;
|
| 145 |
-
}
|
| 146 |
-
|
| 147 |
-
/**
|
| 148 |
-
* Process rule related data after rule save
|
| 149 |
-
*
|
| 150 |
-
* @return Mage_CatalogRule_Model_Rule
|
| 151 |
-
*/
|
| 152 |
-
protected function _afterSave()
|
| 153 |
-
{
|
| 154 |
-
$this->_getResource()->updateRuleProductData($this);
|
| 155 |
-
parent::_afterSave();
|
| 156 |
-
}
|
| 157 |
-
|
| 158 |
-
/**
|
| 159 |
-
* Get array of product ids which are matched by rule
|
| 160 |
-
*
|
| 161 |
-
* @return array
|
| 162 |
-
*/
|
| 163 |
-
public function getMatchingProductIds()
|
| 164 |
-
{
|
| 165 |
-
if (is_null($this->_productIds)) {
|
| 166 |
-
$this->_productIds = array();
|
| 167 |
-
$this->setCollectedAttributes(array());
|
| 168 |
-
$websiteIds = explode(',', $this->getWebsiteIds());
|
| 169 |
-
|
| 170 |
-
if ($websiteIds) {
|
| 171 |
-
$productCollection = Mage::getResourceModel('catalog/product_collection');
|
| 172 |
-
|
| 173 |
-
$productCollection->addWebsiteFilter($websiteIds);
|
| 174 |
-
$this->getActionsInstance()->collectValidatedAttributes($productCollection);
|
| 175 |
-
|
| 176 |
-
Mage::getSingleton('core/resource_iterator')->walk(
|
| 177 |
-
$productCollection->getSelect(),
|
| 178 |
-
array(array($this, 'callbackValidateProduct')),
|
| 179 |
-
array(
|
| 180 |
-
'attributes' => $this->getCollectedAttributes(),
|
| 181 |
-
'product' => Mage::getModel('catalog/product'),
|
| 182 |
-
)
|
| 183 |
-
);
|
| 184 |
-
}
|
| 185 |
-
}
|
| 186 |
-
|
| 187 |
-
return $this->_productIds;
|
| 188 |
-
}
|
| 189 |
-
|
| 190 |
-
/**
|
| 191 |
-
* Callback function for product matching
|
| 192 |
-
*
|
| 193 |
-
* @param $args
|
| 194 |
-
* @return void
|
| 195 |
-
*/
|
| 196 |
-
public function callbackValidateProduct($args)
|
| 197 |
-
{
|
| 198 |
-
$product = clone $args['product'];
|
| 199 |
-
$product->setData($args['row']);
|
| 200 |
-
|
| 201 |
-
if ($this->getConditions()->validate($product)) {
|
| 202 |
-
$this->_productIds[] = $product->getId();
|
| 203 |
-
}
|
| 204 |
-
}
|
| 205 |
-
|
| 206 |
-
/**
|
| 207 |
-
* Apply rule to product
|
| 208 |
-
*
|
| 209 |
-
* @param int|Mage_Catalog_Model_Product $product
|
| 210 |
-
* @param array $websiteIds
|
| 211 |
-
* @return void
|
| 212 |
-
*/
|
| 213 |
-
public function applyToProduct($product, $websiteIds=null)
|
| 214 |
-
{
|
| 215 |
-
if (is_numeric($product)) {
|
| 216 |
-
$product = Mage::getModel('catalog/product')->load($product);
|
| 217 |
-
}
|
| 218 |
-
if (is_null($websiteIds)) {
|
| 219 |
-
$websiteIds = explode(',', $this->getWebsiteIds());
|
| 220 |
-
}
|
| 221 |
-
$this->getResource()->applyToProduct($this, $product, $websiteIds);
|
| 222 |
-
}
|
| 223 |
-
|
| 224 |
-
/**
|
| 225 |
-
* Get array of assigned customer group ids
|
| 226 |
-
*
|
| 227 |
-
* @return array
|
| 228 |
-
*/
|
| 229 |
-
public function getCustomerGroupIds()
|
| 230 |
-
{
|
| 231 |
-
$ids = $this->getData('customer_group_ids');
|
| 232 |
-
if (($ids && !$this->getCustomerGroupChecked()) || is_string($ids)) {
|
| 233 |
-
if (is_string($ids)) {
|
| 234 |
-
$ids = explode(',', $ids);
|
| 235 |
-
}
|
| 236 |
-
|
| 237 |
-
$groupIds = Mage::getModel('customer/group')->getCollection()->getAllIds();
|
| 238 |
-
$ids = array_intersect($ids, $groupIds);
|
| 239 |
-
$this->setData('customer_group_ids', $ids);
|
| 240 |
-
$this->setCustomerGroupChecked(true);
|
| 241 |
-
}
|
| 242 |
-
return $ids;
|
| 243 |
-
}
|
| 244 |
-
|
| 245 |
-
/**
|
| 246 |
-
* Apply all price rules, invalidate related cache and refresh price index
|
| 247 |
-
*
|
| 248 |
-
* @return Mage_CatalogRule_Model_Rule
|
| 249 |
-
*/
|
| 250 |
-
public function applyAll()
|
| 251 |
-
{
|
| 252 |
-
$this->_getResource()->applyAllRulesForDateRange();
|
| 253 |
-
$this->_invalidateCache();
|
| 254 |
-
$indexProcess = Mage::getSingleton('index/indexer')->getProcessByCode('catalog_product_price');
|
| 255 |
-
if ($indexProcess) {
|
| 256 |
-
$indexProcess->reindexAll();
|
| 257 |
-
}
|
| 258 |
-
}
|
| 259 |
-
|
| 260 |
-
/**
|
| 261 |
-
* Apply all price rules to product
|
| 262 |
-
*
|
| 263 |
-
* @param int|Mage_Catalog_Model_Product $product
|
| 264 |
-
* @return Mage_CatalogRule_Model_Rule
|
| 265 |
-
*/
|
| 266 |
-
public function applyAllRulesToProduct($product)
|
| 267 |
-
{
|
| 268 |
-
$this->_getResource()->applyAllRulesForDateRange(NULL, NULL, $product);
|
| 269 |
-
$this->_invalidateCache();
|
| 270 |
-
$indexProcess = Mage::getSingleton('index/indexer')->getProcessByCode('catalog_product_price');
|
| 271 |
-
if ($indexProcess) {
|
| 272 |
-
$indexProcess->reindexAll();
|
| 273 |
-
}
|
| 274 |
-
}
|
| 275 |
-
|
| 276 |
-
/**
|
| 277 |
-
* Calculate price using catalog price rule of product
|
| 278 |
-
*
|
| 279 |
-
* @param Mage_Catalog_Model_Product $product
|
| 280 |
-
* @param float $price
|
| 281 |
-
* @return float|null
|
| 282 |
-
*/
|
| 283 |
-
public function calcProductPriceRule(Mage_Catalog_Model_Product $product, $price)
|
| 284 |
-
{
|
| 285 |
-
$priceRules = null;
|
| 286 |
-
$productId = $product->getId();
|
| 287 |
-
$storeId = $product->getStoreId();
|
| 288 |
-
$websiteId = Mage::app()->getStore($storeId)->getWebsiteId();
|
| 289 |
-
$customerGroupId = Mage::getSingleton('customer/session')->getCustomerGroupId();
|
| 290 |
-
$dateTs = Mage::app()->getLocale()->storeTimeStamp($storeId);
|
| 291 |
-
$cacheKey = date('Y-m-d', $dateTs)."|$websiteId|$customerGroupId|$productId|$price";
|
| 292 |
-
|
| 293 |
-
if (!array_key_exists($cacheKey, self::$_priceRulesData)) {
|
| 294 |
-
$rulesData = $this->_getResource()->getRulesFromProduct($dateTs, $websiteId, $customerGroupId, $productId);
|
| 295 |
-
if ($rulesData) {
|
| 296 |
-
foreach ($rulesData as $ruleData) {
|
| 297 |
-
$priceRules = Mage::helper('catalogrule')->calcPriceRule(
|
| 298 |
-
$ruleData['simple_action'],
|
| 299 |
-
$ruleData['discount_amount'],
|
| 300 |
-
$priceRules ? $priceRules :$price);
|
| 301 |
-
if ($ruleData['stop_rules_processing']) {
|
| 302 |
-
break;
|
| 303 |
-
}
|
| 304 |
-
}
|
| 305 |
-
return self::$_priceRulesData[$cacheKey] = $priceRules;
|
| 306 |
-
} else {
|
| 307 |
-
self::$_priceRulesData[$cacheKey] = null;
|
| 308 |
-
}
|
| 309 |
-
} else {
|
| 310 |
-
return self::$_priceRulesData[$cacheKey];
|
| 311 |
-
}
|
| 312 |
-
return null;
|
| 313 |
-
}
|
| 314 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Productlabels/Model/Rule.php
DELETED
|
@@ -1,14 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
class Niveus_Productlabels_Model_Rule extends Mage_SalesRule_Model_Rule
|
| 4 |
-
{
|
| 5 |
-
public function getActionsInstance()
|
| 6 |
-
{
|
| 7 |
-
return Mage::getModel('productlabels/rule_combine');
|
| 8 |
-
}
|
| 9 |
-
|
| 10 |
-
public function getConditionsInstance()
|
| 11 |
-
{
|
| 12 |
-
return Mage::getModel('productlabels/rule_combine');
|
| 13 |
-
}
|
| 14 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Productlabels/Model/Rule/Combine.php
DELETED
|
@@ -1,58 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
class Niveus_Productlabels_Model_Rule_Combine extends Mage_Rule_Model_Condition_Combine
|
| 4 |
-
{
|
| 5 |
-
public function getNewChildSelectOptions()
|
| 6 |
-
{
|
| 7 |
-
$productCondition = Mage::getModel('salesrule/rule_condition_product');
|
| 8 |
-
$productAttributes = $productCondition->loadAttributeOptions()->getAttributeOption();
|
| 9 |
-
$pAttributes = array();
|
| 10 |
-
$pAttributes[] = array('value'=>'productlabels/rule_condition_product|is_new', 'label'=>'Is New');
|
| 11 |
-
$pAttributes[] = array('value'=>'productlabels/rule_condition_product|is_special', 'label'=>'Is Special Price');
|
| 12 |
-
$pAttributes[] = array('value'=>'productlabels/rule_condition_product|qty', 'label'=>'Qty');
|
| 13 |
-
$pAttributes[] = array('value'=>'productlabels/rule_condition_product|out_of_stock', 'label'=>'Is Out Of Stock');
|
| 14 |
-
$pAttributes[] = array('value'=>'productlabels/rule_condition_product|best_seller', 'label'=>'Amount Best Seller');
|
| 15 |
-
$iAttributes = array();
|
| 16 |
-
foreach ($productAttributes as $code=>$label) {
|
| 17 |
-
if (strpos($code, 'quote_item_')===0) {
|
| 18 |
-
$iAttributes[] = array('value'=>'salesrule/rule_condition_product|'.$code, 'label'=>$label);
|
| 19 |
-
} else {
|
| 20 |
-
$pAttributes[] = array('value'=>'salesrule/rule_condition_product|'.$code, 'label'=>$label);
|
| 21 |
-
}
|
| 22 |
-
}
|
| 23 |
-
|
| 24 |
-
$conditions = parent::getNewChildSelectOptions();
|
| 25 |
-
$conditions = array_merge_recursive($conditions, array(
|
| 26 |
-
array('value'=>'salesrule/rule_condition_product_combine', 'label'=>Mage::helper('catalog')->__('Conditions Combination')),
|
| 27 |
-
//array('label'=>Mage::helper('catalog')->__('Cart Item Attribute'), 'value'=>$iAttributes),
|
| 28 |
-
array('label'=>Mage::helper('catalog')->__('Product Attribute'), 'value'=>$pAttributes),
|
| 29 |
-
));
|
| 30 |
-
return $conditions;
|
| 31 |
-
}
|
| 32 |
-
|
| 33 |
-
public function loadArray($arr, $key='conditions')
|
| 34 |
-
{
|
| 35 |
-
$this->setAggregator(isset($arr['aggregator']) ? $arr['aggregator']
|
| 36 |
-
: (isset($arr['attribute']) ? $arr['attribute'] : null))
|
| 37 |
-
->setValue(isset($arr['value']) ? $arr['value']
|
| 38 |
-
: (isset($arr['operator']) ? $arr['operator'] : null));
|
| 39 |
-
|
| 40 |
-
if (!empty($arr[$key]) && is_array($arr[$key])) {
|
| 41 |
-
foreach ($arr[$key] as $condArr) {
|
| 42 |
-
try {
|
| 43 |
-
if(trim($condArr['type']) == 'salesrule/rule_condition_product')
|
| 44 |
-
$cond = Mage::getModel('productlabels/rule_condition_product');
|
| 45 |
-
else
|
| 46 |
-
$cond = @Mage::getModel($condArr['type']);
|
| 47 |
-
if (!empty($cond)) {
|
| 48 |
-
$this->addCondition($cond);
|
| 49 |
-
$cond->loadArray($condArr, $key);
|
| 50 |
-
}
|
| 51 |
-
} catch (Exception $e) {
|
| 52 |
-
Mage::logException($e);
|
| 53 |
-
}
|
| 54 |
-
}
|
| 55 |
-
}
|
| 56 |
-
return $this;
|
| 57 |
-
}
|
| 58 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Productlabels/Model/Rule/Condition/Product.php
DELETED
|
@@ -1,325 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Magento
|
| 4 |
-
*
|
| 5 |
-
* NOTICE OF LICENSE
|
| 6 |
-
*
|
| 7 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
-
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
-
* It is also available through the world-wide-web at this URL:
|
| 10 |
-
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
-
* If you did not receive a copy of the license and are unable to
|
| 12 |
-
* obtain it through the world-wide-web, please send an email
|
| 13 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
-
*
|
| 15 |
-
* DISCLAIMER
|
| 16 |
-
*
|
| 17 |
-
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 18 |
-
* versions in the future. If you wish to customize Magento for your
|
| 19 |
-
* needs please refer to http://www.magentocommerce.com for more information.
|
| 20 |
-
*
|
| 21 |
-
* @category Mage
|
| 22 |
-
* @package Mage_CatalogRule
|
| 23 |
-
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
| 24 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 25 |
-
*/
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
class Niveus_Productlabels_Model_Rule_Condition_Product extends Mage_CatalogRule_Model_Rule_Condition_Product
|
| 29 |
-
{
|
| 30 |
-
|
| 31 |
-
protected $bestSelletListId = null;
|
| 32 |
-
protected function _addSpecialAttributes(array &$attributes)
|
| 33 |
-
{
|
| 34 |
-
parent::_addSpecialAttributes($attributes);
|
| 35 |
-
$attributes['quote_item_qty'] = Mage::helper('salesrule')->__('Quantity in cart');
|
| 36 |
-
$attributes['quote_item_price'] = Mage::helper('salesrule')->__('Price in cart');
|
| 37 |
-
$attributes['quote_item_row_total'] = Mage::helper('salesrule')->__('Row total in cart');
|
| 38 |
-
}
|
| 39 |
-
|
| 40 |
-
/**
|
| 41 |
-
* Validate Product Rule Condition
|
| 42 |
-
*
|
| 43 |
-
* @param Varien_Object $object
|
| 44 |
-
* @return bool
|
| 45 |
-
*/
|
| 46 |
-
public function validate(Varien_Object $object)
|
| 47 |
-
{
|
| 48 |
-
$op = $this->getOperator();
|
| 49 |
-
$product = false;
|
| 50 |
-
if ($object->getProduct() instanceof Mage_Catalog_Model_Product) {
|
| 51 |
-
$product = $object->getProduct();
|
| 52 |
-
} else {
|
| 53 |
-
$product = Mage::getModel('catalog/product')
|
| 54 |
-
->load($object->getProductId());
|
| 55 |
-
}
|
| 56 |
-
|
| 57 |
-
$product
|
| 58 |
-
->setQuoteItemQty($object->getQty())
|
| 59 |
-
->setQuoteItemPrice($object->getPrice()) // possible bug: need to use $object->getBasePrice()
|
| 60 |
-
->setQuoteItemRowTotal($object->getBaseRowTotal());
|
| 61 |
-
|
| 62 |
-
//Validate with attribute is is_new
|
| 63 |
-
if($this->getAttribute() == 'is_new')
|
| 64 |
-
{
|
| 65 |
-
$result = true;
|
| 66 |
-
if(!$product->getNewsFromDate() && !$product->getNewsToDate()){
|
| 67 |
-
$result = false;}
|
| 68 |
-
else
|
| 69 |
-
{
|
| 70 |
-
$today = new DateTime(date('Y-m-d 00:00:00'));
|
| 71 |
-
if($from = $product->getNewsFromDate())
|
| 72 |
-
{
|
| 73 |
-
$fromNewDate = new DateTime($from);
|
| 74 |
-
if($today < $fromNewDate)
|
| 75 |
-
$result = false;
|
| 76 |
-
}
|
| 77 |
-
if($to = $product->getNewsToDate())
|
| 78 |
-
{
|
| 79 |
-
$toNewDate = new DateTime($to);
|
| 80 |
-
if($today > $toNewDate)
|
| 81 |
-
$result = false;
|
| 82 |
-
}
|
| 83 |
-
}
|
| 84 |
-
|
| 85 |
-
$value = $this->getValueParsed();
|
| 86 |
-
|
| 87 |
-
if($value == 0)
|
| 88 |
-
$result = !$result;
|
| 89 |
-
|
| 90 |
-
return $result;
|
| 91 |
-
}
|
| 92 |
-
|
| 93 |
-
//validate with attribute is is_special
|
| 94 |
-
if($this->getAttribute() == 'is_special')
|
| 95 |
-
{
|
| 96 |
-
$result = true;
|
| 97 |
-
if(!$product->getSpecialPrice())
|
| 98 |
-
$result = false;
|
| 99 |
-
else
|
| 100 |
-
{
|
| 101 |
-
$today = new DateTime(date('Y-m-d 00:00:00'));
|
| 102 |
-
|
| 103 |
-
if(!$from = $product->getSpecialFromDate())
|
| 104 |
-
$fromNewDate = $today;
|
| 105 |
-
else
|
| 106 |
-
$fromNewDate = new DateTime($from);
|
| 107 |
-
|
| 108 |
-
if(!$to = $product->getSpecialToDate())
|
| 109 |
-
$toNewDate = $today;
|
| 110 |
-
else
|
| 111 |
-
$toNewDate = new DateTime($to);
|
| 112 |
-
|
| 113 |
-
if($today < $fromNewDate || $toNewDate < $today)
|
| 114 |
-
$result = false;
|
| 115 |
-
$value = $this->getValueParsed();
|
| 116 |
-
if($value == 0)
|
| 117 |
-
$result = !$result;
|
| 118 |
-
|
| 119 |
-
return $result;
|
| 120 |
-
|
| 121 |
-
}
|
| 122 |
-
|
| 123 |
-
}
|
| 124 |
-
|
| 125 |
-
//validate with attribute is qty
|
| 126 |
-
if($this->getAttribute() == 'qty')
|
| 127 |
-
{
|
| 128 |
-
$result = true;
|
| 129 |
-
|
| 130 |
-
$qty = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product)->getQty();
|
| 131 |
-
$value = $this->getValueParsed();
|
| 132 |
-
switch ($op) {
|
| 133 |
-
case '==': case '!=':
|
| 134 |
-
$result = ($qty == $value);
|
| 135 |
-
break;
|
| 136 |
-
case '>=': case '<':
|
| 137 |
-
$result = ($qty >= $value);
|
| 138 |
-
break;
|
| 139 |
-
case '<=': case '>':
|
| 140 |
-
$result = ($qty <= $value);
|
| 141 |
-
break;
|
| 142 |
-
}
|
| 143 |
-
|
| 144 |
-
if($op == '!=' || $op == '<' || $op == '>')
|
| 145 |
-
$result = !$result;
|
| 146 |
-
return $result;
|
| 147 |
-
|
| 148 |
-
}
|
| 149 |
-
|
| 150 |
-
//validate with attribute is qty
|
| 151 |
-
if($this->getAttribute() == 'out_of_stock')
|
| 152 |
-
{
|
| 153 |
-
$result = true;
|
| 154 |
-
|
| 155 |
-
if($product->isSaleable())
|
| 156 |
-
{
|
| 157 |
-
$result = false;
|
| 158 |
-
}
|
| 159 |
-
if($this->getValueParsed() == 0)
|
| 160 |
-
$result = !$result;
|
| 161 |
-
return $result;
|
| 162 |
-
|
| 163 |
-
}
|
| 164 |
-
|
| 165 |
-
//validate best seller
|
| 166 |
-
if($this->getAttribute() == 'best_seller')
|
| 167 |
-
{
|
| 168 |
-
$result = true;
|
| 169 |
-
$value = $this->getValueParsed();
|
| 170 |
-
|
| 171 |
-
// Get Best Seller product
|
| 172 |
-
$storeId = Mage::app()->getStore()->getId();
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
if(Mage::registry('bestSelletListId'))
|
| 176 |
-
$bestSellerId = Mage::registry('bestSelletListId');
|
| 177 |
-
else
|
| 178 |
-
{
|
| 179 |
-
$products = Mage::getResourceModel('reports/product_collection')
|
| 180 |
-
->addOrderedQty()
|
| 181 |
-
//->addAttributeToSelect('*')
|
| 182 |
-
//->addAttributeToSelect(array('name', 'price', 'small_image', 'short_description', 'description')) //edit to suit tastes
|
| 183 |
-
->setStoreId($storeId)
|
| 184 |
-
->addStoreFilter($storeId)
|
| 185 |
-
->setOrder('ordered_qty', 'desc') //best sellers on top
|
| 186 |
-
->setPageSize($value);
|
| 187 |
-
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($products);
|
| 188 |
-
//Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($products);
|
| 189 |
-
|
| 190 |
-
$bestSellerId = array();
|
| 191 |
-
foreach($products as $p){
|
| 192 |
-
$bestSellerId[] = $p->getId();
|
| 193 |
-
}
|
| 194 |
-
Mage::register('bestSelletListId',$bestSellerId);
|
| 195 |
-
}
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
if(!count($bestSellerId))
|
| 200 |
-
$result = false;
|
| 201 |
-
else{
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
if($product->getTypeId() == 'configurable'){
|
| 205 |
-
$childProducts = Mage::getModel('catalog/product_type_configurable')
|
| 206 |
-
->getUsedProducts(null,$product);
|
| 207 |
-
}
|
| 208 |
-
elseif($product->getTypeId() == 'grouped'){
|
| 209 |
-
$childProducts = Mage::getModel('catalog/product_type_grouped')->getAssociatedProducts($product);
|
| 210 |
-
}
|
| 211 |
-
elseif($product->getTypeId() == 'bundle'){
|
| 212 |
-
$childProducts = $product->getTypeInstance(true)->getSelectionsCollection(
|
| 213 |
-
$product->getTypeInstance(true)->getOptionsIds($product), $product
|
| 214 |
-
);
|
| 215 |
-
}
|
| 216 |
-
else{
|
| 217 |
-
if(!in_array($product->getId(), $bestSellerId))
|
| 218 |
-
return false;
|
| 219 |
-
}
|
| 220 |
-
$flag = 0;
|
| 221 |
-
foreach($childProducts as $c){
|
| 222 |
-
if(in_array($c->getId(),$bestSellerId))
|
| 223 |
-
{
|
| 224 |
-
$flag = 1;
|
| 225 |
-
break;
|
| 226 |
-
}
|
| 227 |
-
}
|
| 228 |
-
|
| 229 |
-
if($flag == 0)
|
| 230 |
-
$result = false;
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
}
|
| 234 |
-
|
| 235 |
-
return $result;
|
| 236 |
-
|
| 237 |
-
}
|
| 238 |
-
|
| 239 |
-
if(!$product->getData($this->getAttribute()) && ('!='==$op || '>'==$op || '<'==$op || '!{}'==$op || '!()'==$op ))
|
| 240 |
-
return false;
|
| 241 |
-
return parent::validate($product);
|
| 242 |
-
}
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
public function getAttributeName()
|
| 247 |
-
{
|
| 248 |
-
$attributeName = array('is_new' => 'Is new','is_special' => 'Is special','qty' => 'Qty','out_of_stock' => 'Is Out Of Stock','best_seller' => 'Amount Best seller');
|
| 249 |
-
if(!array_key_exists($this->getAttribute(),$attributeName))
|
| 250 |
-
return parent::getAttributeName ();
|
| 251 |
-
return $attributeName[$this->getAttribute()];
|
| 252 |
-
}
|
| 253 |
-
|
| 254 |
-
public function getValueSelectOptions()
|
| 255 |
-
{
|
| 256 |
-
$attributeName = array('is_new' => 'Is new','is_special' => 'Is special','qty' => 'Qty','out_of_stock' => 'Is Out Of Stock');
|
| 257 |
-
if(!array_key_exists($this->getAttribute(),$attributeName))
|
| 258 |
-
return parent::getValueSelectOptions ();
|
| 259 |
-
return array(
|
| 260 |
-
|
| 261 |
-
array(
|
| 262 |
-
'label' => 'No',
|
| 263 |
-
'value' => 0
|
| 264 |
-
),
|
| 265 |
-
array(
|
| 266 |
-
'label' => 'Yes',
|
| 267 |
-
'value' => 1
|
| 268 |
-
),
|
| 269 |
-
);
|
| 270 |
-
}
|
| 271 |
-
|
| 272 |
-
public function getValueElementType()
|
| 273 |
-
{
|
| 274 |
-
$attributeName = array('is_new' => 'Is new','is_special' => 'Is special','out_of_stock' => 'Is Out Of Stock');
|
| 275 |
-
if($this->getAttribute() == 'qty')
|
| 276 |
-
return 'text';
|
| 277 |
-
elseif(!array_key_exists($this->getAttribute(),$attributeName))
|
| 278 |
-
return parent::getValueElementType ();
|
| 279 |
-
return 'select';
|
| 280 |
-
}
|
| 281 |
-
|
| 282 |
-
public function getOperatorSelectOptions()
|
| 283 |
-
{
|
| 284 |
-
$attributeName = array('is_new' => 'Is new','is_special' => 'Is special','out_of_stock' => 'Is Out Of Stock','best_seller' => 'Amount Best seller');
|
| 285 |
-
if($this->getAttribute() == 'qty')
|
| 286 |
-
return array(
|
| 287 |
-
array(
|
| 288 |
-
'label' => 'is',
|
| 289 |
-
'value' => '=='
|
| 290 |
-
),
|
| 291 |
-
array(
|
| 292 |
-
'label' => 'is not',
|
| 293 |
-
'value' => '!='
|
| 294 |
-
),
|
| 295 |
-
array(
|
| 296 |
-
'label' => 'equals or greater than',
|
| 297 |
-
'value' => '>='
|
| 298 |
-
),
|
| 299 |
-
array(
|
| 300 |
-
'label' => 'equals or less than',
|
| 301 |
-
'value' => '<='
|
| 302 |
-
),
|
| 303 |
-
array(
|
| 304 |
-
'label' => 'greater than',
|
| 305 |
-
'value' => '>'
|
| 306 |
-
),
|
| 307 |
-
array(
|
| 308 |
-
'label' => 'less than',
|
| 309 |
-
'value' => '<'
|
| 310 |
-
)
|
| 311 |
-
);
|
| 312 |
-
if(!array_key_exists($this->getAttribute(),$attributeName))
|
| 313 |
-
return parent::getOperatorSelectOptions ();
|
| 314 |
-
return array(
|
| 315 |
-
array(
|
| 316 |
-
'label' => 'is',
|
| 317 |
-
'value' => '=='
|
| 318 |
-
)
|
| 319 |
-
/* array(
|
| 320 |
-
'label' => 'is not',
|
| 321 |
-
'value' => '!='
|
| 322 |
-
)*/
|
| 323 |
-
);
|
| 324 |
-
}
|
| 325 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Productlabels/Model/Status.php
DELETED
|
@@ -1,15 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
class Niveus_Productlabels_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('productlabels')->__('Enabled'),
|
| 12 |
-
self::STATUS_DISABLED => Mage::helper('productlabels')->__('Disabled')
|
| 13 |
-
);
|
| 14 |
-
}
|
| 15 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Productlabels/Model/Type/Int.php
DELETED
|
@@ -1,10 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
class Niveus_Productlabels_Model_Type_Int extends Mage_Core_Model_Abstract
|
| 3 |
-
{
|
| 4 |
-
public function _construct()
|
| 5 |
-
{
|
| 6 |
-
parent::_construct();
|
| 7 |
-
$this->_init('productlabels/type_int');
|
| 8 |
-
}
|
| 9 |
-
|
| 10 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Productlabels/Model/Type/Text.php
DELETED
|
@@ -1,10 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
class Niveus_Productlabels_Model_Type_Text extends Mage_Core_Model_Abstract
|
| 3 |
-
{
|
| 4 |
-
public function _construct()
|
| 5 |
-
{
|
| 6 |
-
parent::_construct();
|
| 7 |
-
$this->_init('productlabels/type_text');
|
| 8 |
-
}
|
| 9 |
-
|
| 10 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Productlabels/Model/Type/Varchar.php
DELETED
|
@@ -1,10 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
class Niveus_Productlabels_Model_Type_Varchar extends Mage_Core_Model_Abstract
|
| 3 |
-
{
|
| 4 |
-
public function _construct()
|
| 5 |
-
{
|
| 6 |
-
parent::_construct();
|
| 7 |
-
$this->_init('productlabels/type_varchar');
|
| 8 |
-
}
|
| 9 |
-
|
| 10 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Productlabels/controllers/Adminhtml/CssController.php
DELETED
|
@@ -1,76 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
class Niveus_Productlabels_Adminhtml_CssController extends Mage_Adminhtml_Controller_Action
|
| 3 |
-
{
|
| 4 |
-
public function editAction() {
|
| 5 |
-
$this->loadLayout();
|
| 6 |
-
$this->_setActiveMenu('productlabels/items');
|
| 7 |
-
$stores = array(0,$this->getRequest()->getParam('store',0));
|
| 8 |
-
$model = Mage::getModel('productlabels/css')->getCollection()->setStoreId($stores)->getLastItem();
|
| 9 |
-
$model->setData('cur_store',$this->getRequest()->getParam('store',0));
|
| 10 |
-
Mage::register('productlabels_css_data', $model);
|
| 11 |
-
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Css Manager'), Mage::helper('adminhtml')->__('Css Manager'));
|
| 12 |
-
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Css News'), Mage::helper('adminhtml')->__('Css News'));
|
| 13 |
-
|
| 14 |
-
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
| 15 |
-
$this->getLayout()->getBlock('head')->setTitle(Mage::helper('productlabels')->__("Css Editor"));
|
| 16 |
-
$editBlock = $this->getLayout()->createBlock('productlabels/adminhtml_css_edit');
|
| 17 |
-
$editBlock->setChild('form',
|
| 18 |
-
$this->getLayout()->createBlock('productlabels/adminhtml_css_edit_tab_css')
|
| 19 |
-
);
|
| 20 |
-
|
| 21 |
-
if($model->hasGlobal())
|
| 22 |
-
{
|
| 23 |
-
$editBlock->setChild('store_switcher',
|
| 24 |
-
$this->getLayout()->createBlock('adminhtml/store_switcher')
|
| 25 |
-
);
|
| 26 |
-
}
|
| 27 |
-
$this->_addContent($editBlock);
|
| 28 |
-
//->_addLeft($this->getLayout()->createBlock('productlabels/adminhtml_css_edit_tabs'));
|
| 29 |
-
|
| 30 |
-
$this->renderLayout();
|
| 31 |
-
}
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
public function saveAction() {
|
| 36 |
-
try {
|
| 37 |
-
if($data = $this->getRequest()->getPost())
|
| 38 |
-
{
|
| 39 |
-
$css = Mage::getModel('productlabels/css');
|
| 40 |
-
$data['store'] = $data['cur_store'];
|
| 41 |
-
$css->setData($data);
|
| 42 |
-
//print_r($css->getData());exit;
|
| 43 |
-
if(!count($data['use_default']))
|
| 44 |
-
$css->save();
|
| 45 |
-
elseif($data['id'])
|
| 46 |
-
{
|
| 47 |
-
$css->setId($data['id']);
|
| 48 |
-
$css->delete();
|
| 49 |
-
}
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
}
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('productlabels')->__('Css was successfully saved'));
|
| 56 |
-
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
| 57 |
-
|
| 58 |
-
if ($this->getRequest()->getParam('back')) {
|
| 59 |
-
$this->_redirect('*/*/edit', array('store' => $this->getRequest()->getParam('cur_store',0)));
|
| 60 |
-
return;
|
| 61 |
-
}
|
| 62 |
-
$this->_redirect('*/adminhtml_productlabels',array('store' => $this->getRequest()->getParam('cur_store',0)));
|
| 63 |
-
return;
|
| 64 |
-
} catch (Exception $e) {
|
| 65 |
-
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
| 66 |
-
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
| 67 |
-
$this->_redirect('*/*/edit', array('store' => $this->getRequest()->getParam('cur_store',0)));
|
| 68 |
-
return;
|
| 69 |
-
}
|
| 70 |
-
|
| 71 |
-
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('productlabels')->__('Unable to find css to save'));
|
| 72 |
-
$this->_redirect('*/*/',array('store' => $this->getRequest()->getParam('cur_store',0)));
|
| 73 |
-
}
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Productlabels/controllers/Adminhtml/ProductlabelsController.php
DELETED
|
@@ -1,490 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
class Niveus_Productlabels_Adminhtml_ProductlabelsController extends Mage_Adminhtml_Controller_Action
|
| 3 |
-
{
|
| 4 |
-
protected function _initAction() {
|
| 5 |
-
$this->loadLayout()
|
| 6 |
-
->_setActiveMenu('productlabels/items')
|
| 7 |
-
->_addBreadcrumb(Mage::helper('adminhtml')->__('Labels Manager'), Mage::helper('adminhtml')->__('Labels Manager'));
|
| 8 |
-
|
| 9 |
-
return $this;
|
| 10 |
-
}
|
| 11 |
-
|
| 12 |
-
public function indexAction() {
|
| 13 |
-
$this->_initAction();
|
| 14 |
-
$this->getLayout()->getBlock('head')->setTitle(Mage::helper('productlabels')->__('Manage labels'));
|
| 15 |
-
$this->renderLayout();
|
| 16 |
-
}
|
| 17 |
-
|
| 18 |
-
public function loadCondition($conditions)
|
| 19 |
-
{
|
| 20 |
-
$rule = Mage::getModel('rule/rule');
|
| 21 |
-
$actionsArr = unserialize($rule->getActionsSerialized());
|
| 22 |
-
if (!empty($actionsArr) && is_array($actionsArr)) {
|
| 23 |
-
$rule->getActions()->loadArray($actionsArr);
|
| 24 |
-
}
|
| 25 |
-
}
|
| 26 |
-
|
| 27 |
-
public function editAction() {
|
| 28 |
-
$id = $this->getRequest()->getParam('id');
|
| 29 |
-
$label = Mage::getModel('productlabels/productlabels');
|
| 30 |
-
|
| 31 |
-
if($id){
|
| 32 |
-
$label->load($id)->addAttributeToSelect();
|
| 33 |
-
|
| 34 |
-
}
|
| 35 |
-
$label->setData('variables',Zend_Json::encode($this->getVariables()));
|
| 36 |
-
$label->setData('store',$this->getRequest()->getParam('store',0));
|
| 37 |
-
if(!$label->getEnable())
|
| 38 |
-
$label->setEnable(1);
|
| 39 |
-
|
| 40 |
-
if ($label->getId() || $id == 0) {
|
| 41 |
-
$data = Mage::getSingleton('adminhtml/session')->getFormData(true);
|
| 42 |
-
if (!empty($data)) {
|
| 43 |
-
$label->setData($data);
|
| 44 |
-
}
|
| 45 |
-
|
| 46 |
-
Mage::register('productlabels_data', $label);
|
| 47 |
-
|
| 48 |
-
$this->loadLayout();
|
| 49 |
-
$this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
|
| 50 |
-
if($id)
|
| 51 |
-
$this->getLayout()->getBlock('head')->setTitle(Mage::helper('productlabels')->__("Edit Label %s",$label->getName()));
|
| 52 |
-
else
|
| 53 |
-
$this->getLayout()->getBlock('head')->setTitle(Mage::helper('productlabels')->__("Add New Label"));
|
| 54 |
-
$this->_setActiveMenu('productlabels/items');
|
| 55 |
-
|
| 56 |
-
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
|
| 57 |
-
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
|
| 58 |
-
|
| 59 |
-
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
| 60 |
-
$editBlock = $this->getLayout()->createBlock('productlabels/adminhtml_productlabels_edit');
|
| 61 |
-
$editBlock->setChild('form',
|
| 62 |
-
$this->getLayout()->createBlock('productlabels/adminhtml_productlabels_edit_tab_form')
|
| 63 |
-
);
|
| 64 |
-
if($id)
|
| 65 |
-
{
|
| 66 |
-
$editBlock->setChild('store_switcher',
|
| 67 |
-
$this->getLayout()->createBlock('adminhtml/store_switcher')
|
| 68 |
-
);
|
| 69 |
-
}
|
| 70 |
-
|
| 71 |
-
$this->_addContent($editBlock);
|
| 72 |
-
|
| 73 |
-
//->_addLeft($this->getLayout()->createBlock('productlabels/adminhtml_productlabels_edit_tabs'));
|
| 74 |
-
|
| 75 |
-
$this->renderLayout();
|
| 76 |
-
} else {
|
| 77 |
-
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('productlabels')->__('Item does not exist'));
|
| 78 |
-
$this->_redirect('*/*/');
|
| 79 |
-
}
|
| 80 |
-
}
|
| 81 |
-
|
| 82 |
-
public function newAction() {
|
| 83 |
-
$this->_forward('edit');
|
| 84 |
-
|
| 85 |
-
}
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
public function saveImages()
|
| 90 |
-
{
|
| 91 |
-
$data = array();
|
| 92 |
-
$oldPic = $this->getRequest()->getPost();
|
| 93 |
-
///////////////Save Image for Label////////////////////
|
| 94 |
-
if(isset($_FILES['image']['name']) && $_FILES['image']['name'] != '') {
|
| 95 |
-
try {
|
| 96 |
-
/* Starting upload */
|
| 97 |
-
$uploader = new Varien_File_Uploader('image');
|
| 98 |
-
|
| 99 |
-
// Any extention would work
|
| 100 |
-
$uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
|
| 101 |
-
$uploader->setAllowRenameFiles(true);
|
| 102 |
-
|
| 103 |
-
// Set the file upload mode
|
| 104 |
-
// false -> get the file directly in the specified folder
|
| 105 |
-
// true -> get the file in the product like folders
|
| 106 |
-
// (file.jpg will go in something like /media/f/i/file.jpg)
|
| 107 |
-
$uploader->setFilesDispersion(false);
|
| 108 |
-
|
| 109 |
-
// We set media as the upload dir
|
| 110 |
-
$store = "store_".$this->getRequest()->getParam('store',0);
|
| 111 |
-
$_FILES['image']['name'] = $store.'_'.$_FILES['image']['name'];
|
| 112 |
-
$path = Mage::getBaseDir('media') . DS . 'niveus_productlabels' . DS . 'image' . DS ;
|
| 113 |
-
|
| 114 |
-
//delete old image
|
| 115 |
-
if($oldPic['curimage'] && $oldPic['curimage'] != 'nopic' && strstr($oldPic['curimage'],$store.'_'))
|
| 116 |
-
{
|
| 117 |
-
$width = Mage::getStoreConfig('productlabels/general/thumbnail_width_image');
|
| 118 |
-
$height = Mage::getStoreConfig('productlabels/general/thumbnail_height_image');
|
| 119 |
-
$res = $width."x".$height;
|
| 120 |
-
if(is_file($path.$oldPic['curimage']))
|
| 121 |
-
unlink($path.$oldPic['curimage']);
|
| 122 |
-
if(is_file($path."admin".DS."50x50".DS.$oldPic['curimage']))
|
| 123 |
-
unlink($path."admin".DS."50x50".DS.$oldPic['curimage']);
|
| 124 |
-
if(is_file($path."thumbnail".DS.$res.DS.$oldPic['curimage']))
|
| 125 |
-
unlink($path."thumbnail".DS.$res.DS.$oldPic['curimage']);
|
| 126 |
-
}
|
| 127 |
-
|
| 128 |
-
$uploader->save($path, $_FILES['image']['name'] );
|
| 129 |
-
|
| 130 |
-
} catch (Exception $e) {
|
| 131 |
-
|
| 132 |
-
}
|
| 133 |
-
|
| 134 |
-
//this way the name is saved in DB
|
| 135 |
-
$data['image'] = $_FILES['image']['name'];
|
| 136 |
-
}
|
| 137 |
-
///////////////End save Image for Label////////////////////
|
| 138 |
-
|
| 139 |
-
///////////////Save background for Label////////////////////
|
| 140 |
-
if(isset($_FILES['background']['name']) && $_FILES['background']['name'] != '') {
|
| 141 |
-
try {
|
| 142 |
-
/* Starting upload */
|
| 143 |
-
$uploader = new Varien_File_Uploader('background');
|
| 144 |
-
|
| 145 |
-
// Any extention would work
|
| 146 |
-
$uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
|
| 147 |
-
$uploader->setAllowRenameFiles(true);
|
| 148 |
-
|
| 149 |
-
// Set the file upload mode
|
| 150 |
-
// false -> get the file directly in the specified folder
|
| 151 |
-
// true -> get the file in the product like folders
|
| 152 |
-
// (file.jpg will go in something like /media/f/i/file.jpg)
|
| 153 |
-
$uploader->setFilesDispersion(false);
|
| 154 |
-
|
| 155 |
-
// We set media as the upload dir
|
| 156 |
-
$store = "store_".$this->getRequest()->getParam('store',0);
|
| 157 |
-
$_FILES['background']['name'] = $store.'_'.$_FILES['background']['name'];
|
| 158 |
-
$path = Mage::getBaseDir('media') . DS . 'niveus_productlabels' . DS . 'background' . DS ;
|
| 159 |
-
//delete old background
|
| 160 |
-
if($oldPic['curbackground'] && $oldPic['curbackground'] != 'nopic' && strstr($oldPic['curbackground'],$store.'_'))
|
| 161 |
-
{
|
| 162 |
-
$width = Mage::getStoreConfig('productlabels/general/thumbnail_width_background');
|
| 163 |
-
$height = Mage::getStoreConfig('productlabels/general/thumbnail_height_background');
|
| 164 |
-
$res = $width."x".$height;
|
| 165 |
-
if(is_file($path.$oldPic['curbackground']))
|
| 166 |
-
unlink($path.$oldPic['curbackground']);
|
| 167 |
-
if(is_file($path."admin".DS."50x50".DS.$oldPic['curbackground']))
|
| 168 |
-
unlink($path."admin".DS."50x50".DS.$oldPic['curbackground']);
|
| 169 |
-
if(is_file($path."thumbnail".DS.$res.DS.$oldPic['curbackground']))
|
| 170 |
-
unlink($path."thumbnail".DS.$res.DS.$oldPic['curbackground']);
|
| 171 |
-
}
|
| 172 |
-
$uploader->save($path, $_FILES['background']['name'] );
|
| 173 |
-
|
| 174 |
-
} catch (Exception $e) {
|
| 175 |
-
|
| 176 |
-
}
|
| 177 |
-
|
| 178 |
-
//this way the name is saved in DB
|
| 179 |
-
$data['background'] = $_FILES['background']['name'];
|
| 180 |
-
}
|
| 181 |
-
///////////////End save background for Label////////////////////
|
| 182 |
-
|
| 183 |
-
return $data;
|
| 184 |
-
}
|
| 185 |
-
|
| 186 |
-
public function initLabelSave()
|
| 187 |
-
{
|
| 188 |
-
$label = Mage::getModel('productlabels/productlabels');
|
| 189 |
-
if($data = $this->getRequest()->getPost())
|
| 190 |
-
{
|
| 191 |
-
if(!$data['enable'])
|
| 192 |
-
$data['enable'] = 2;
|
| 193 |
-
|
| 194 |
-
$data = array_merge($data,$this->saveImages());
|
| 195 |
-
|
| 196 |
-
//$tmp['actions'] = $data['rule']['actions'];
|
| 197 |
-
//print_r($data);exit;
|
| 198 |
-
//unset($data['rule']);
|
| 199 |
-
$data['actions'] = $this->initCondition($data['rule']);
|
| 200 |
-
if(!$data['id'])
|
| 201 |
-
unset($data['id']);
|
| 202 |
-
/*unset($data['rule']);
|
| 203 |
-
unset($data['id']);
|
| 204 |
-
unset($data['variables']);*/
|
| 205 |
-
//echo $data['actions'];exit;
|
| 206 |
-
//unset($data['name']);
|
| 207 |
-
$label->setData($data);
|
| 208 |
-
}
|
| 209 |
-
|
| 210 |
-
$atrTbl = array('text' => array(),'varchar' => array(),'int' => array());
|
| 211 |
-
$attributes = $label->getAttributes();
|
| 212 |
-
|
| 213 |
-
if (!$useDefaults = $this->getRequest()->getPost('use_default'))
|
| 214 |
-
$useDefaults = array();
|
| 215 |
-
foreach ($attributes as $a) {
|
| 216 |
-
if(in_array($a->getNameAttribute(),$useDefaults))
|
| 217 |
-
{
|
| 218 |
-
$label->setData($a->getNameAttribute(), false);
|
| 219 |
-
|
| 220 |
-
$atrTbl[$a->getType()][] = $a->getId();
|
| 221 |
-
}elseif($a->getNameAttribute() == 'image' || $a->getNameAttribute() == 'background')
|
| 222 |
-
{
|
| 223 |
-
if($data['no'.$a->getNameAttribute()] == 1 && !$data[$a->getNameAttribute()]){
|
| 224 |
-
$label->setData($a->getNameAttribute(),'nopic');
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
if($data['cur'.$a->getNameAttribute()] && strstr($data['cur'.$a->getNameAttribute()],'store_'.$data['store'].'_'))
|
| 228 |
-
{
|
| 229 |
-
$path = Mage::getBaseDir('media').DS."niveus_productlabels".DS.$a->getNameAttribute().DS;
|
| 230 |
-
$width = Mage::getStoreConfig('productlabels/general/thumbnail_width_'.$a->getNameAttribute());
|
| 231 |
-
$height = Mage::getStoreConfig('productlabels/general/thumbnail_height_'.$a->getNameAttribute());
|
| 232 |
-
$res = $width."x".$height;
|
| 233 |
-
if(is_file($path.$data['cur'.$a->getNameAttribute()]))
|
| 234 |
-
unlink($path.$data['cur'.$a->getNameAttribute()]);
|
| 235 |
-
if(is_file($path."admin".DS."50x50".DS.$data['cur'.$a->getNameAttribute()]))
|
| 236 |
-
unlink($path."admin".DS."50x50".DS.$data['cur'.$a->getNameAttribute()]);
|
| 237 |
-
if(is_file($path."thumbnail".DS.$res.DS.$data['cur'.$a->getNameAttribute()]))
|
| 238 |
-
unlink($path."thumbnail".DS.$res.DS.$data['cur'.$a->getNameAttribute()]);
|
| 239 |
-
}
|
| 240 |
-
|
| 241 |
-
}
|
| 242 |
-
}
|
| 243 |
-
|
| 244 |
-
}
|
| 245 |
-
|
| 246 |
-
//Delete attribute use default at store != default
|
| 247 |
-
if(!empty($useDefaults))
|
| 248 |
-
{
|
| 249 |
-
foreach($atrTbl as $key => $value)
|
| 250 |
-
{
|
| 251 |
-
if(!empty($key))
|
| 252 |
-
{
|
| 253 |
-
$collection = Mage::getModel('productlabels/type_'.$key)->getCollection()
|
| 254 |
-
->addFieldToFilter('label_id',$data['id'])
|
| 255 |
-
->addFieldToFilter('store_id',$this->getRequest()->getParam('store'))
|
| 256 |
-
->addFieldToFilter('attribute_id',array('in' => $value));
|
| 257 |
-
|
| 258 |
-
if($collection->count())
|
| 259 |
-
{
|
| 260 |
-
|
| 261 |
-
foreach($collection as $c)
|
| 262 |
-
{
|
| 263 |
-
|
| 264 |
-
$c->delete();
|
| 265 |
-
}
|
| 266 |
-
|
| 267 |
-
}
|
| 268 |
-
}
|
| 269 |
-
}
|
| 270 |
-
}
|
| 271 |
-
|
| 272 |
-
|
| 273 |
-
|
| 274 |
-
//print_r($label->getData());exit;
|
| 275 |
-
|
| 276 |
-
//$label->setId($this->getRequest()->getParam('id'));
|
| 277 |
-
|
| 278 |
-
return $label;
|
| 279 |
-
|
| 280 |
-
}
|
| 281 |
-
|
| 282 |
-
public function saveAttribute($label)
|
| 283 |
-
{
|
| 284 |
-
$attributes = $label->getAttributes();
|
| 285 |
-
|
| 286 |
-
$labelId = $label->getId();
|
| 287 |
-
$attTable = array(
|
| 288 |
-
'text' => Mage::getModel('productlabels/type_text'),
|
| 289 |
-
'varchar' => Mage::getModel('productlabels/type_varchar'),
|
| 290 |
-
'int' => Mage::getModel('productlabels/type_int')
|
| 291 |
-
);
|
| 292 |
-
$storeId = $this->getRequest()->getParam('store',0);
|
| 293 |
-
|
| 294 |
-
foreach($attributes as $a)
|
| 295 |
-
{
|
| 296 |
-
$value = $label->getData($a->getNameAttribute());
|
| 297 |
-
$data = array(
|
| 298 |
-
'label_id'=>$labelId,
|
| 299 |
-
'attribute_id'=>$a->getId(),
|
| 300 |
-
'store_id'=>$storeId,
|
| 301 |
-
'value'=>$value);
|
| 302 |
-
|
| 303 |
-
$attTable[$a->getType()]->setData($data);
|
| 304 |
-
|
| 305 |
-
$attId = $attTable[$a->getType()]->getCollection()
|
| 306 |
-
->addFieldToFilter('label_id',$labelId)
|
| 307 |
-
->addFieldToFilter('attribute_id',$a->getId())
|
| 308 |
-
->addFieldToFilter('store_id',$storeId)
|
| 309 |
-
->getFirstItem()->getId();
|
| 310 |
-
$attTable[$a->getType()]->setId($attId);
|
| 311 |
-
$attTable[$a->getType()]->save();
|
| 312 |
-
}
|
| 313 |
-
}
|
| 314 |
-
|
| 315 |
-
public function initCondition($actions)
|
| 316 |
-
{
|
| 317 |
-
$rule = Mage::getModel('salesrule/rule');
|
| 318 |
-
$rule->loadPost($actions);
|
| 319 |
-
|
| 320 |
-
|
| 321 |
-
if ($rule->getActions()) {
|
| 322 |
-
$rule->setActionsSerialized(serialize($rule->getActions()->asArray()));
|
| 323 |
-
$rule->unsActions();
|
| 324 |
-
}
|
| 325 |
-
return $rule->getActionsSerialized();
|
| 326 |
-
}
|
| 327 |
-
|
| 328 |
-
public function saveAction() {
|
| 329 |
-
if ($label = $this->initLabelSave()) {
|
| 330 |
-
|
| 331 |
-
try {
|
| 332 |
-
|
| 333 |
-
$label->save();
|
| 334 |
-
$this->saveAttribute($label);
|
| 335 |
-
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('productlabels')->__('Label was successfully saved'));
|
| 336 |
-
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
| 337 |
-
|
| 338 |
-
if ($this->getRequest()->getParam('back')) {
|
| 339 |
-
$this->_redirect('*/*/edit', array('id' => $label->getId(),
|
| 340 |
-
'store' => $this->getRequest()->getParam('store',0)
|
| 341 |
-
)
|
| 342 |
-
);
|
| 343 |
-
return;
|
| 344 |
-
}
|
| 345 |
-
$this->_redirect('*/*/',array('store' => $this->getRequest()->getParam('store',0)));
|
| 346 |
-
return;
|
| 347 |
-
} catch (Exception $e) {
|
| 348 |
-
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
| 349 |
-
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
| 350 |
-
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id'),
|
| 351 |
-
'store' => $this->getRequest()->getParam('store',0))
|
| 352 |
-
);
|
| 353 |
-
return;
|
| 354 |
-
}
|
| 355 |
-
}
|
| 356 |
-
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('productlabels')->__('Unable to find label to save'));
|
| 357 |
-
$this->_redirect('*/*/',array('store' => $this->getRequest()->getParam('store',0)));
|
| 358 |
-
}
|
| 359 |
-
|
| 360 |
-
public function deleteAction() {
|
| 361 |
-
if( $this->getRequest()->getParam('id') > 0 ) {
|
| 362 |
-
try {
|
| 363 |
-
$model = Mage::getModel('productlabels/productlabels');
|
| 364 |
-
|
| 365 |
-
$model->setId($this->getRequest()->getParam('id'))
|
| 366 |
-
->delete();
|
| 367 |
-
|
| 368 |
-
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Label was successfully deleted'));
|
| 369 |
-
$this->_redirect('*/*/');
|
| 370 |
-
} catch (Exception $e) {
|
| 371 |
-
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
| 372 |
-
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id'),'store' => $this->getRequest()->getParam('store',0)));
|
| 373 |
-
}
|
| 374 |
-
}
|
| 375 |
-
$this->_redirect('*/*/',array('store' => $this->getRequest()->getParam('store',0)));
|
| 376 |
-
}
|
| 377 |
-
|
| 378 |
-
public function massDeleteAction() {
|
| 379 |
-
$productlabelsIds = $this->getRequest()->getParam('productlabels');
|
| 380 |
-
if(!is_array($productlabelsIds)) {
|
| 381 |
-
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select label(s)'));
|
| 382 |
-
} else {
|
| 383 |
-
try {
|
| 384 |
-
foreach ($productlabelsIds as $productlabelsId) {
|
| 385 |
-
$productlabels = Mage::getModel('productlabels/productlabels')->load($productlabelsId);
|
| 386 |
-
$productlabels->delete();
|
| 387 |
-
}
|
| 388 |
-
Mage::getSingleton('adminhtml/session')->addSuccess(
|
| 389 |
-
Mage::helper('adminhtml')->__(
|
| 390 |
-
'Total of %d record(s) were successfully deleted', count($productlabelsIds)
|
| 391 |
-
)
|
| 392 |
-
);
|
| 393 |
-
} catch (Exception $e) {
|
| 394 |
-
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
| 395 |
-
}
|
| 396 |
-
}
|
| 397 |
-
$this->_redirect('*/*/index',array('store' => $this->getRequest()->getParam('store',0)));
|
| 398 |
-
}
|
| 399 |
-
|
| 400 |
-
public function massStatusAction()
|
| 401 |
-
{
|
| 402 |
-
$productlabelsIds = $this->getRequest()->getParam('productlabels');
|
| 403 |
-
if(!is_array($productlabelsIds)) {
|
| 404 |
-
Mage::getSingleton('adminhtml/session')->addError($this->__('Please select label(s)'));
|
| 405 |
-
} else {
|
| 406 |
-
try {
|
| 407 |
-
|
| 408 |
-
foreach ($productlabelsIds as $productlabelsId) {
|
| 409 |
-
$productlabels = Mage::getSingleton('productlabels/productlabels')
|
| 410 |
-
->load($productlabelsId);
|
| 411 |
-
$productlabels->setEnable($this->getRequest()->getParam('status'));
|
| 412 |
-
$this->saveAttribute($productlabels);
|
| 413 |
-
|
| 414 |
-
}
|
| 415 |
-
$this->_getSession()->addSuccess(
|
| 416 |
-
$this->__('Total of %d record(s) were successfully updated', count($productlabelsIds))
|
| 417 |
-
);
|
| 418 |
-
} catch (Exception $e) {
|
| 419 |
-
$this->_getSession()->addError($e->getMessage());
|
| 420 |
-
}
|
| 421 |
-
}
|
| 422 |
-
$this->_redirect('*/*/index',array('store' => $this->getRequest()->getParam('store',0)));
|
| 423 |
-
}
|
| 424 |
-
|
| 425 |
-
public function exportCsvAction()
|
| 426 |
-
{
|
| 427 |
-
$fileName = 'productlabels.csv';
|
| 428 |
-
$content = $this->getLayout()->createBlock('productlabels/adminhtml_productlabels_grid')
|
| 429 |
-
->getCsv();
|
| 430 |
-
|
| 431 |
-
$this->_sendUploadResponse($fileName, $content);
|
| 432 |
-
}
|
| 433 |
-
|
| 434 |
-
public function exportXmlAction()
|
| 435 |
-
{
|
| 436 |
-
$fileName = 'productlabels.xml';
|
| 437 |
-
$content = $this->getLayout()->createBlock('productlabels/adminhtml_productlabels_grid')
|
| 438 |
-
->getXml();
|
| 439 |
-
|
| 440 |
-
$this->_sendUploadResponse($fileName, $content);
|
| 441 |
-
}
|
| 442 |
-
|
| 443 |
-
protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
|
| 444 |
-
{
|
| 445 |
-
$response = $this->getResponse();
|
| 446 |
-
$response->setHeader('HTTP/1.1 200 OK','');
|
| 447 |
-
$response->setHeader('Pragma', 'public', true);
|
| 448 |
-
$response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
|
| 449 |
-
$response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
|
| 450 |
-
$response->setHeader('Last-Modified', date('r'));
|
| 451 |
-
$response->setHeader('Accept-Ranges', 'bytes');
|
| 452 |
-
$response->setHeader('Content-Length', strlen($content));
|
| 453 |
-
$response->setHeader('Content-type', $contentType);
|
| 454 |
-
$response->setBody($content);
|
| 455 |
-
$response->sendResponse();
|
| 456 |
-
die;
|
| 457 |
-
}
|
| 458 |
-
|
| 459 |
-
public function getVariables()
|
| 460 |
-
{
|
| 461 |
-
$data = array(
|
| 462 |
-
'label' => 'Variables',
|
| 463 |
-
'value' => array(
|
| 464 |
-
array(
|
| 465 |
-
'label' => 'Save Percent',
|
| 466 |
-
'value' => '{{var save_percent}}'
|
| 467 |
-
),
|
| 468 |
-
array(
|
| 469 |
-
'label' => 'Save Price',
|
| 470 |
-
'value' => '{{var save_price}}'
|
| 471 |
-
),
|
| 472 |
-
array(
|
| 473 |
-
'label' => 'Product Price',
|
| 474 |
-
'value' => '{{var product.price}}'
|
| 475 |
-
),
|
| 476 |
-
array(
|
| 477 |
-
'label' => 'Product Special Price',
|
| 478 |
-
'value' => '{{var product.special_price}}'
|
| 479 |
-
),
|
| 480 |
-
array(
|
| 481 |
-
'label' => 'The Quantity Of Product',
|
| 482 |
-
'value' => '{{var product.qty}}'
|
| 483 |
-
)
|
| 484 |
-
)
|
| 485 |
-
);
|
| 486 |
-
$variables = array($data);
|
| 487 |
-
|
| 488 |
-
return $variables;
|
| 489 |
-
}
|
| 490 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Productlabels/controllers/IndexController.php
DELETED
|
@@ -1,47 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
class Niveus_Productlabels_IndexController extends Mage_Core_Controller_Front_Action
|
| 3 |
-
{
|
| 4 |
-
public function indexAction()
|
| 5 |
-
{
|
| 6 |
-
|
| 7 |
-
/*
|
| 8 |
-
* Load an object by id
|
| 9 |
-
* Request looking like:
|
| 10 |
-
* http://site.com/productlabels?id=15
|
| 11 |
-
* or
|
| 12 |
-
* http://site.com/productlabels/id/15
|
| 13 |
-
*/
|
| 14 |
-
/*
|
| 15 |
-
$productlabels_id = $this->getRequest()->getParam('id');
|
| 16 |
-
|
| 17 |
-
if($productlabels_id != null && $productlabels_id != '') {
|
| 18 |
-
$productlabels = Mage::getModel('productlabels/productlabels')->load($productlabels_id)->getData();
|
| 19 |
-
} else {
|
| 20 |
-
$productlabels = null;
|
| 21 |
-
}
|
| 22 |
-
*/
|
| 23 |
-
|
| 24 |
-
/*
|
| 25 |
-
* If no param we load a the last created item
|
| 26 |
-
*/
|
| 27 |
-
/*
|
| 28 |
-
if($productlabels == null) {
|
| 29 |
-
$resource = Mage::getSingleton('core/resource');
|
| 30 |
-
$read= $resource->getConnection('core_read');
|
| 31 |
-
$productlabelsTable = $resource->getTableName('productlabels');
|
| 32 |
-
|
| 33 |
-
$select = $read->select()
|
| 34 |
-
->from($productlabelsTable,array('productlabels_id','title','content','status'))
|
| 35 |
-
->where('status',1)
|
| 36 |
-
->order('created_time DESC') ;
|
| 37 |
-
|
| 38 |
-
$productlabels = $read->fetchRow($select);
|
| 39 |
-
}
|
| 40 |
-
Mage::register('productlabels', $productlabels);
|
| 41 |
-
*/
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
$this->loadLayout();
|
| 45 |
-
$this->renderLayout();
|
| 46 |
-
}
|
| 47 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Productlabels/etc/config.xml
DELETED
|
@@ -1,183 +0,0 @@
|
|
| 1 |
-
<?xml version="1.0"?>
|
| 2 |
-
<!--
|
| 3 |
-
/**
|
| 4 |
-
* @category Niveus
|
| 5 |
-
* @package Niveus_Productlabels
|
| 6 |
-
* @author ModuleCreator
|
| 7 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 8 |
-
*/
|
| 9 |
-
-->
|
| 10 |
-
<config>
|
| 11 |
-
<modules>
|
| 12 |
-
<Niveus_Productlabels>
|
| 13 |
-
<version>0.1.0</version>
|
| 14 |
-
</Niveus_Productlabels>
|
| 15 |
-
</modules>
|
| 16 |
-
<frontend>
|
| 17 |
-
<routers>
|
| 18 |
-
<productlabels>
|
| 19 |
-
<use>standard</use>
|
| 20 |
-
<args>
|
| 21 |
-
<module>Niveus_Productlabels</module>
|
| 22 |
-
<frontName>productlabels</frontName>
|
| 23 |
-
</args>
|
| 24 |
-
</productlabels>
|
| 25 |
-
</routers>
|
| 26 |
-
<layout>
|
| 27 |
-
<updates>
|
| 28 |
-
<productlabels>
|
| 29 |
-
<file>niveus_productlabels.xml</file>
|
| 30 |
-
</productlabels>
|
| 31 |
-
</updates>
|
| 32 |
-
</layout>
|
| 33 |
-
</frontend>
|
| 34 |
-
<admin>
|
| 35 |
-
<routers>
|
| 36 |
-
<productlabels>
|
| 37 |
-
<use>admin</use>
|
| 38 |
-
<args>
|
| 39 |
-
<module>Niveus_Productlabels</module>
|
| 40 |
-
<frontName>productlabels_admin</frontName>
|
| 41 |
-
</args>
|
| 42 |
-
</productlabels>
|
| 43 |
-
</routers>
|
| 44 |
-
</admin>
|
| 45 |
-
<adminhtml>
|
| 46 |
-
<menu>
|
| 47 |
-
<productlabels module="productlabels">
|
| 48 |
-
<title>Product Labels</title>
|
| 49 |
-
<sort_order>71</sort_order>
|
| 50 |
-
<children>
|
| 51 |
-
<manage_label module="productlabels">
|
| 52 |
-
<title>Manage Product Labels</title>
|
| 53 |
-
<sort_order>0</sort_order>
|
| 54 |
-
<action>productlabels_admin/adminhtml_productlabels</action>
|
| 55 |
-
</manage_label>
|
| 56 |
-
<css_editor module="productlabels">
|
| 57 |
-
<title>Css Editor</title>
|
| 58 |
-
<sort_order>1</sort_order>
|
| 59 |
-
<action>productlabels_admin/adminhtml_css/edit</action>
|
| 60 |
-
</css_editor>
|
| 61 |
-
</children>
|
| 62 |
-
</productlabels>
|
| 63 |
-
</menu>
|
| 64 |
-
<acl>
|
| 65 |
-
<resources>
|
| 66 |
-
<all>
|
| 67 |
-
<title>Allow Everything</title>
|
| 68 |
-
</all>
|
| 69 |
-
<admin>
|
| 70 |
-
<children>
|
| 71 |
-
<productlabels translate="title" module="productlabels">
|
| 72 |
-
<title>Product Labels</title>
|
| 73 |
-
<sort_order>71</sort_order>
|
| 74 |
-
<children>
|
| 75 |
-
<manage_label translate="title">
|
| 76 |
-
<title>Manage Product Labels</title>
|
| 77 |
-
<sort_order>10</sort_order>
|
| 78 |
-
</manage_label>
|
| 79 |
-
<css_editor translate="title">
|
| 80 |
-
<title>Css Editor</title>
|
| 81 |
-
<sort_order>1</sort_order>
|
| 82 |
-
</css_editor>
|
| 83 |
-
</children>
|
| 84 |
-
</productlabels>
|
| 85 |
-
</children>
|
| 86 |
-
</admin>
|
| 87 |
-
</resources>
|
| 88 |
-
</acl>
|
| 89 |
-
<layout>
|
| 90 |
-
<updates>
|
| 91 |
-
<productlabels>
|
| 92 |
-
<file>niveus_productlabels.xml</file>
|
| 93 |
-
</productlabels>
|
| 94 |
-
</updates>
|
| 95 |
-
</layout>
|
| 96 |
-
</adminhtml>
|
| 97 |
-
<global>
|
| 98 |
-
<models>
|
| 99 |
-
<productlabels>
|
| 100 |
-
<class>Niveus_Productlabels_Model</class>
|
| 101 |
-
<resourceModel>productlabels_mysql4</resourceModel>
|
| 102 |
-
</productlabels>
|
| 103 |
-
<productlabels_mysql4>
|
| 104 |
-
<class>Niveus_Productlabels_Model_Mysql4</class>
|
| 105 |
-
<entities>
|
| 106 |
-
<productlabels>
|
| 107 |
-
<table>label_entity</table>
|
| 108 |
-
</productlabels>
|
| 109 |
-
<css>
|
| 110 |
-
<table>label_css</table>
|
| 111 |
-
</css>
|
| 112 |
-
<attribute>
|
| 113 |
-
<table>label_eav_attribute</table>
|
| 114 |
-
</attribute>
|
| 115 |
-
<type_text>
|
| 116 |
-
<table>label_attribute_value_text</table>
|
| 117 |
-
</type_text>
|
| 118 |
-
<type_varchar>
|
| 119 |
-
<table>label_attribute_value_varchar</table>
|
| 120 |
-
</type_varchar>
|
| 121 |
-
<type_int>
|
| 122 |
-
<table>label_attribute_value_int</table>
|
| 123 |
-
</type_int>
|
| 124 |
-
</entities>
|
| 125 |
-
</productlabels_mysql4>
|
| 126 |
-
</models>
|
| 127 |
-
<resources>
|
| 128 |
-
<productlabels_setup>
|
| 129 |
-
<setup>
|
| 130 |
-
<module>Niveus_Productlabels</module>
|
| 131 |
-
</setup>
|
| 132 |
-
<connection>
|
| 133 |
-
<use>core_setup</use>
|
| 134 |
-
</connection>
|
| 135 |
-
</productlabels_setup>
|
| 136 |
-
<productlabels_write>
|
| 137 |
-
<connection>
|
| 138 |
-
<use>core_write</use>
|
| 139 |
-
</connection>
|
| 140 |
-
</productlabels_write>
|
| 141 |
-
<productlabels_read>
|
| 142 |
-
<connection>
|
| 143 |
-
<use>core_read</use>
|
| 144 |
-
</connection>
|
| 145 |
-
</productlabels_read>
|
| 146 |
-
</resources>
|
| 147 |
-
<blocks>
|
| 148 |
-
<productlabels>
|
| 149 |
-
<class>Niveus_Productlabels_Block</class>
|
| 150 |
-
</productlabels>
|
| 151 |
-
</blocks>
|
| 152 |
-
<helpers>
|
| 153 |
-
<productlabels>
|
| 154 |
-
<class>Niveus_Productlabels_Helper</class>
|
| 155 |
-
</productlabels>
|
| 156 |
-
</helpers>
|
| 157 |
-
<default>
|
| 158 |
-
<productlabels>
|
| 159 |
-
<wysiwyg>
|
| 160 |
-
<enabled>enabled</enabled>
|
| 161 |
-
</wysiwyg>
|
| 162 |
-
</productlabels>
|
| 163 |
-
</default>
|
| 164 |
-
</global>
|
| 165 |
-
<default>
|
| 166 |
-
<productlabels>
|
| 167 |
-
<general>
|
| 168 |
-
<thumbnail_width_image>50</thumbnail_width_image>
|
| 169 |
-
<thumbnail_height_image>50</thumbnail_height_image>
|
| 170 |
-
<thumbnail_width_background>74</thumbnail_width_background>
|
| 171 |
-
<thumbnail_height_background>76</thumbnail_height_background>
|
| 172 |
-
</general>
|
| 173 |
-
<which_show_label>
|
| 174 |
-
<product_list>36</product_list>
|
| 175 |
-
<product_detail>36</product_detail>
|
| 176 |
-
<crossel>36</crossel>
|
| 177 |
-
<upsell>36</upsell>
|
| 178 |
-
<related>36</related>
|
| 179 |
-
<widget>36</widget>
|
| 180 |
-
</which_show_label>
|
| 181 |
-
</productlabels>
|
| 182 |
-
</default>
|
| 183 |
-
</config>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Productlabels/sql/productlabels_setup/mysql4-install-0.1.0.php
DELETED
|
@@ -1,123 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
$installer = $this;
|
| 4 |
-
|
| 5 |
-
$installer->startSetup();
|
| 6 |
-
|
| 7 |
-
$installer->run("
|
| 8 |
-
SET FOREIGN_KEY_CHECKS=0;
|
| 9 |
-
DROP TABLE IF EXISTS {$this->getTable('productlabels/css')};
|
| 10 |
-
DROP TABLE IF EXISTS {$this->getTable('productlabels/type_varchar')};
|
| 11 |
-
DROP TABLE IF EXISTS {$this->getTable('productlabels/type_text')};
|
| 12 |
-
DROP TABLE IF EXISTS {$this->getTable('productlabels/type_int')};
|
| 13 |
-
DROP TABLE IF EXISTS {$this->getTable('productlabels/attribute')};
|
| 14 |
-
DROP TABLE IF EXISTS {$this->getTable('productlabels/productlabels')};
|
| 15 |
-
|
| 16 |
-
CREATE TABLE IF NOT EXISTS {$this->getTable('productlabels/productlabels')} (
|
| 17 |
-
`id` int(11) NOT NULL AUTO_INCREMENT,
|
| 18 |
-
`name` varchar(255) NOT NULL,
|
| 19 |
-
`actions` text CHARACTER SET utf8,
|
| 20 |
-
PRIMARY KEY (`id`)
|
| 21 |
-
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=39 ;
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
CREATE TABLE IF NOT EXISTS {$this->getTable('productlabels/attribute')} (
|
| 25 |
-
`id` int(11) NOT NULL AUTO_INCREMENT,
|
| 26 |
-
`name_attribute` varchar(255) NOT NULL,
|
| 27 |
-
`type` varchar(255) NOT NULL,
|
| 28 |
-
`scope_global` smallint(1) NOT NULL DEFAULT '0',
|
| 29 |
-
`title` varchar(255) NOT NULL,
|
| 30 |
-
`require` tinyint(1) NOT NULL DEFAULT '0',
|
| 31 |
-
`class` varchar(255) NOT NULL,
|
| 32 |
-
`type_backend` varchar(255) NOT NULL,
|
| 33 |
-
PRIMARY KEY (`id`)
|
| 34 |
-
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
CREATE TABLE IF NOT EXISTS {$this->getTable('productlabels/css')} (
|
| 38 |
-
`id` int(11) NOT NULL AUTO_INCREMENT,
|
| 39 |
-
`content` text NOT NULL,
|
| 40 |
-
`store` smallint(5) NOT NULL,
|
| 41 |
-
`scope_global` smallint(1) NOT NULL DEFAULT '0',
|
| 42 |
-
PRIMARY KEY (`id`),
|
| 43 |
-
KEY `store_id` (`store`)
|
| 44 |
-
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=12 ;
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
CREATE TABLE IF NOT EXISTS {$this->getTable('productlabels/type_varchar')} (
|
| 48 |
-
`id` int(11) NOT NULL AUTO_INCREMENT,
|
| 49 |
-
`label_id` int(11) NOT NULL,
|
| 50 |
-
`attribute_id` int(11) NOT NULL,
|
| 51 |
-
`store_id` smallint(5) unsigned NOT NULL,
|
| 52 |
-
`value` varchar(555) NOT NULL,
|
| 53 |
-
PRIMARY KEY (`id`),
|
| 54 |
-
KEY `store_id` (`store_id`),
|
| 55 |
-
KEY `label_id` (`label_id`),
|
| 56 |
-
KEY `attribute_id` (`attribute_id`)
|
| 57 |
-
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=32 ;
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
CREATE TABLE IF NOT EXISTS {$this->getTable('productlabels/type_text')} (
|
| 61 |
-
`id` int(11) NOT NULL AUTO_INCREMENT,
|
| 62 |
-
`label_id` int(11) NOT NULL,
|
| 63 |
-
`attribute_id` int(11) NOT NULL,
|
| 64 |
-
`store_id` smallint(5) unsigned NOT NULL,
|
| 65 |
-
`value` text CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
|
| 66 |
-
PRIMARY KEY (`id`),
|
| 67 |
-
KEY `store_id` (`store_id`),
|
| 68 |
-
KEY `label_id` (`label_id`,`attribute_id`)
|
| 69 |
-
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=18 ;
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
CREATE TABLE IF NOT EXISTS {$this->getTable('productlabels/type_int')} (
|
| 73 |
-
`id` int(11) NOT NULL AUTO_INCREMENT,
|
| 74 |
-
`label_id` int(11) NOT NULL,
|
| 75 |
-
`attribute_id` int(11) NOT NULL,
|
| 76 |
-
`store_id` smallint(5) unsigned NOT NULL,
|
| 77 |
-
`value` tinyint(1) NOT NULL,
|
| 78 |
-
PRIMARY KEY (`id`),
|
| 79 |
-
KEY `store_id` (`store_id`),
|
| 80 |
-
KEY `label_id` (`label_id`),
|
| 81 |
-
KEY `attribute_id` (`attribute_id`)
|
| 82 |
-
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=40 ;
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
ALTER TABLE {$this->getTable('productlabels/type_varchar')}
|
| 88 |
-
ADD CONSTRAINT {$this->getTable('productlabels/type_varchar')} FOREIGN KEY (`store_id`) REFERENCES {$this->getTable('core_store')} (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
| 89 |
-
ADD CONSTRAINT `{$this->getTable('productlabels/type_varchar')}_ibfk_1` FOREIGN KEY (`label_id`) REFERENCES {$this->getTable('productlabels/productlabels')} (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
| 90 |
-
|
| 91 |
-
ALTER TABLE {$this->getTable('productlabels/type_text')}
|
| 92 |
-
ADD CONSTRAINT {$this->getTable('productlabels/type_text')} FOREIGN KEY (`store_id`) REFERENCES {$this->getTable('core_store')} (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
| 93 |
-
ADD CONSTRAINT `{$this->getTable('productlabels/type_text')}_ibfk_1` FOREIGN KEY (`label_id`) REFERENCES {$this->getTable('productlabels/productlabels')} (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
| 94 |
-
|
| 95 |
-
ALTER TABLE {$this->getTable('productlabels/type_int')}
|
| 96 |
-
ADD CONSTRAINT {$this->getTable('productlabels/type_int')} FOREIGN KEY (`store_id`) REFERENCES {$this->getTable('core_store')} (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
| 97 |
-
ADD CONSTRAINT `{$this->getTable('productlabels/type_int')}_ibfk_1` FOREIGN KEY (`label_id`) REFERENCES {$this->getTable('productlabels/productlabels')} (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
| 98 |
-
|
| 99 |
-
INSERT INTO {$this->getTable('productlabels/productlabels')} (`id`, `name`, `actions`) VALUES
|
| 100 |
-
(1, 'Sale off', 'a:7:{s:4:\"type\";s:40:\"salesrule/rule_condition_product_combine\";s:9:\"attribute\";N;s:8:\"operator\";N;s:5:\"value\";s:1:\"1\";s:18:\"is_value_processed\";N;s:10:\"aggregator\";s:3:\"all\";s:10:\"conditions\";a:1:{i:0;a:5:{s:4:\"type\";s:32:\"salesrule/rule_condition_product\";s:9:\"attribute\";s:13:\"special_price\";s:8:\"operator\";s:1:\">\";s:5:\"value\";d:0;s:18:\"is_value_processed\";b:0;}}}'),
|
| 101 |
-
(2, 'Hot deal', 'a:7:{s:4:\"type\";s:40:\"salesrule/rule_condition_product_combine\";s:9:\"attribute\";N;s:8:\"operator\";N;s:5:\"value\";s:1:\"1\";s:18:\"is_value_processed\";N;s:10:\"aggregator\";s:3:\"all\";s:10:\"conditions\";a:1:{i:0;a:5:{s:4:\"type\";s:32:\"salesrule/rule_condition_product\";s:9:\"attribute\";s:5:\"price\";s:8:\"operator\";s:2:\">=\";s:5:\"value\";d:50;s:18:\"is_value_processed\";b:0;}}}');
|
| 102 |
-
|
| 103 |
-
INSERT INTO {$this->getTable('productlabels/attribute')} (`id`, `name_attribute`, `type`, `scope_global`, `title`, `require`, `class`, `type_backend`) VALUES
|
| 104 |
-
(1, 'name', '', 1, 'Label Name', 1, 'required-entry', 'text'),
|
| 105 |
-
(2, 'image', 'varchar', 0, 'Image', 0, '', 'file'),
|
| 106 |
-
(3, 'background', 'varchar', 0, 'Background', 0, '', 'file'),
|
| 107 |
-
(4, 'texthtml', 'text', 0, 'Text', 0, '', 'editor'),
|
| 108 |
-
(5, 'css_class', 'varchar', 0, 'Css Class', 0, '', 'text'),
|
| 109 |
-
(6, 'enable', 'int', 2, 'Enable', 0, '', 'checkbox');
|
| 110 |
-
|
| 111 |
-
INSERT INTO {$this->getTable('productlabels/type_varchar')} (`id`, `label_id`, `attribute_id`, `store_id`, `value`) VALUES
|
| 112 |
-
(NULL, 1, 2, 0, 'store_0_saleof.png'),
|
| 113 |
-
(NULL, 2, 2, 0, 'store_0_hotdeal.png');
|
| 114 |
-
|
| 115 |
-
INSERT INTO {$this->getTable('productlabels/type_int')} (`id`, `label_id`, `attribute_id`, `store_id`, `value`) VALUES
|
| 116 |
-
(NULL, 1, 6, 0, 1),
|
| 117 |
-
(NULL, 2, 6, 0, 1);
|
| 118 |
-
|
| 119 |
-
");
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
$installer->endSetup();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Requestproduct/Block/Adminhtml/Requestnewproduct.php
DELETED
|
@@ -1,16 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* @copyright Niveus Solutoins.
|
| 4 |
-
*/
|
| 5 |
-
class Niveus_Requestproduct_Block_Adminhtml_Requestnewproduct extends Mage_Adminhtml_Block_Widget_Grid_Container
|
| 6 |
-
{
|
| 7 |
-
public function __construct()
|
| 8 |
-
{
|
| 9 |
-
$this->_blockGroup = 'niveus_requestproduct';
|
| 10 |
-
$this->_controller = 'adminhtml_requestnewproduct';
|
| 11 |
-
$this->_headerText = $this->__('Request New Product');
|
| 12 |
-
|
| 13 |
-
parent::__construct();
|
| 14 |
-
$this->_removeButton('add');
|
| 15 |
-
}
|
| 16 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Requestproduct/Block/Adminhtml/Requestnewproduct/Grid.php
DELETED
|
@@ -1,85 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* @copyright Niveus Solutoins.
|
| 4 |
-
*/
|
| 5 |
-
class Niveus_Requestproduct_Block_Adminhtml_Requestnewproduct_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
| 6 |
-
{
|
| 7 |
-
public function __construct()
|
| 8 |
-
{
|
| 9 |
-
parent::__construct();
|
| 10 |
-
|
| 11 |
-
// Set some defaults for our grid
|
| 12 |
-
$this->setDefaultSort('id');
|
| 13 |
-
$this->setId('niveus_requestproduct_requestnewproduct_grid');
|
| 14 |
-
$this->setDefaultDir('asc');
|
| 15 |
-
$this->setSaveParametersInSession(true);
|
| 16 |
-
}
|
| 17 |
-
|
| 18 |
-
protected function _getCollectionClass()
|
| 19 |
-
{
|
| 20 |
-
// This is the model we are using for the grid
|
| 21 |
-
return 'niveus_requestproduct/requestnewproduct_collection';
|
| 22 |
-
}
|
| 23 |
-
|
| 24 |
-
protected function _prepareCollection()
|
| 25 |
-
{
|
| 26 |
-
// Get and set our collection for the grid
|
| 27 |
-
$collection = Mage::getResourceModel($this->_getCollectionClass());
|
| 28 |
-
$this->setCollection($collection);
|
| 29 |
-
|
| 30 |
-
return parent::_prepareCollection();
|
| 31 |
-
}
|
| 32 |
-
|
| 33 |
-
protected function _prepareColumns()
|
| 34 |
-
{
|
| 35 |
-
// Add the columns that should appear in the grid
|
| 36 |
-
$this->addColumn('id',
|
| 37 |
-
array(
|
| 38 |
-
'header'=> $this->__('ID'),
|
| 39 |
-
'align' =>'right',
|
| 40 |
-
'width' => '50px',
|
| 41 |
-
'index' => 'id'
|
| 42 |
-
)
|
| 43 |
-
);
|
| 44 |
-
|
| 45 |
-
$this->addColumn('name',
|
| 46 |
-
array(
|
| 47 |
-
'header'=> $this->__('Name'),
|
| 48 |
-
'index' => 'name'
|
| 49 |
-
)
|
| 50 |
-
);
|
| 51 |
-
$this->addColumn('email',
|
| 52 |
-
array(
|
| 53 |
-
'header'=> $this->__('Email'),
|
| 54 |
-
'index' => 'email'
|
| 55 |
-
)
|
| 56 |
-
);
|
| 57 |
-
$this->addColumn('productname',
|
| 58 |
-
array(
|
| 59 |
-
'header'=> $this->__('Product Name'),
|
| 60 |
-
'index' => 'productname'
|
| 61 |
-
)
|
| 62 |
-
);
|
| 63 |
-
$this->addColumn('brand',
|
| 64 |
-
array(
|
| 65 |
-
'header'=> $this->__('Brand'),
|
| 66 |
-
'index' => 'brand'
|
| 67 |
-
)
|
| 68 |
-
);
|
| 69 |
-
$this->addColumn('seenproduct',
|
| 70 |
-
array(
|
| 71 |
-
'header'=> $this->__('where have you seen this product'),
|
| 72 |
-
'index' => 'seenproduct'
|
| 73 |
-
)
|
| 74 |
-
);
|
| 75 |
-
$this->addColumn('aboutproduct',
|
| 76 |
-
array(
|
| 77 |
-
'header'=> $this->__('Tell us about this product'),
|
| 78 |
-
'index' => 'aboutproduct'
|
| 79 |
-
)
|
| 80 |
-
);
|
| 81 |
-
return parent::_prepareColumns();
|
| 82 |
-
}
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Requestproduct/Block/Requestnewproduct.php
DELETED
|
@@ -1,8 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* @copyright Niveus Solutoins.
|
| 4 |
-
*/
|
| 5 |
-
class Niveus_Requestproduct_Block_Requestnewproduct extends Mage_Core_Block_Template
|
| 6 |
-
{
|
| 7 |
-
|
| 8 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Requestproduct/Helper/Data.php
DELETED
|
@@ -1,7 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* @copyright Niveus Solutoins.
|
| 4 |
-
*/
|
| 5 |
-
class Niveus_Requestproduct_Helper_Data extends Mage_Core_Helper_Abstract
|
| 6 |
-
{
|
| 7 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Requestproduct/Model/Mysql4/Requestnewproduct.php
DELETED
|
@@ -1,11 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* @copyright Niveus Solutoins.
|
| 4 |
-
*/
|
| 5 |
-
class Niveus_Requestproduct_Model_Mysql4_Requestnewproduct extends Mage_Core_Model_Mysql4_Abstract
|
| 6 |
-
{
|
| 7 |
-
protected function _construct()
|
| 8 |
-
{
|
| 9 |
-
$this->_init('niveus_requestproduct/requestnewproduct', 'id');
|
| 10 |
-
}
|
| 11 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Requestproduct/Model/Mysql4/Requestnewproduct/Collection.php
DELETED
|
@@ -1,11 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* @copyright Niveus Solutoins.
|
| 4 |
-
*/
|
| 5 |
-
class Niveus_Requestproduct_Model_Mysql4_Requestnewproduct_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
| 6 |
-
{
|
| 7 |
-
protected function _construct()
|
| 8 |
-
{
|
| 9 |
-
$this->_init('niveus_requestproduct/requestnewproduct');
|
| 10 |
-
}
|
| 11 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Requestproduct/Model/Requestnewproduct.php
DELETED
|
@@ -1,11 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* @copyright Niveus Solutoins.
|
| 4 |
-
*/
|
| 5 |
-
class Niveus_Requestproduct_Model_Requestnewproduct extends Mage_Core_Model_Abstract
|
| 6 |
-
{
|
| 7 |
-
protected function _construct()
|
| 8 |
-
{
|
| 9 |
-
$this->_init('niveus_requestproduct/requestnewproduct');
|
| 10 |
-
}
|
| 11 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Requestproduct/controllers/Adminhtml/RequestnewproductController.php
DELETED
|
@@ -1,44 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* @copyright Niveus Solutoins.
|
| 4 |
-
*/
|
| 5 |
-
class Niveus_Requestproduct_Adminhtml_RequestnewproductController extends Mage_Adminhtml_Controller_Action
|
| 6 |
-
{
|
| 7 |
-
public function indexAction()
|
| 8 |
-
{
|
| 9 |
-
// Let's call our initAction method which will set some basic params for each action
|
| 10 |
-
$this->_initAction()
|
| 11 |
-
->renderLayout();
|
| 12 |
-
}
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
/**
|
| 17 |
-
* Initialize action
|
| 18 |
-
*
|
| 19 |
-
* Here, we set the breadcrumbs and the active menu
|
| 20 |
-
*
|
| 21 |
-
* @return Mage_Adminhtml_Controller_Action
|
| 22 |
-
*/
|
| 23 |
-
protected function _initAction()
|
| 24 |
-
{
|
| 25 |
-
$this->loadLayout()
|
| 26 |
-
// Make the active menu match the menu config nodes (without 'children' inbetween)
|
| 27 |
-
->_setActiveMenu('sales/niveus_requestproduct_requestnewproduct')
|
| 28 |
-
->_title($this->__('Sales'))->_title($this->__('Request New Product'))
|
| 29 |
-
->_addBreadcrumb($this->__('Sales'), $this->__('Sales'))
|
| 30 |
-
->_addBreadcrumb($this->__('Request New Product'), $this->__('Request New Product'));
|
| 31 |
-
|
| 32 |
-
return $this;
|
| 33 |
-
}
|
| 34 |
-
|
| 35 |
-
/**
|
| 36 |
-
* Check currently called action by permissions for current user
|
| 37 |
-
*
|
| 38 |
-
* @return bool
|
| 39 |
-
*/
|
| 40 |
-
protected function _isAllowed()
|
| 41 |
-
{
|
| 42 |
-
return Mage::getSingleton('admin/session')->isAllowed('sales/niveus_requestproduct_requestnewproduct');
|
| 43 |
-
}
|
| 44 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Requestproduct/controllers/IndexController.php
DELETED
|
@@ -1,47 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* @copyright Niveus Solutoins.
|
| 4 |
-
*/
|
| 5 |
-
class Niveus_Requestproduct_IndexController extends Mage_Core_Controller_Front_Action
|
| 6 |
-
{
|
| 7 |
-
/**
|
| 8 |
-
* index method for the controller
|
| 9 |
-
*/
|
| 10 |
-
public function indexAction()
|
| 11 |
-
{
|
| 12 |
-
$this->loadLayout(array('default'));
|
| 13 |
-
$this->renderLayout();
|
| 14 |
-
}
|
| 15 |
-
|
| 16 |
-
/**
|
| 17 |
-
* This method save the requested new product
|
| 18 |
-
* into the database
|
| 19 |
-
*/
|
| 20 |
-
public function saveRequestedProductAction(){
|
| 21 |
-
|
| 22 |
-
$name = $this->getRequest()->getParam("yourname");
|
| 23 |
-
$email = $this->getRequest()->getParam("youremail");
|
| 24 |
-
$productname= $this->getRequest()->getParam("productname");
|
| 25 |
-
$brand= $this->getRequest()->getParam("brand");
|
| 26 |
-
$seenproduct= $this->getRequest()->getParam("seenproduct");
|
| 27 |
-
$aboutproduct= $this->getRequest()->getParam("aboutproduct");
|
| 28 |
-
|
| 29 |
-
try {
|
| 30 |
-
$model = Mage::getModel('niveus_requestproduct/requestnewproduct');
|
| 31 |
-
|
| 32 |
-
$model->setData(
|
| 33 |
-
array( 'name' => $name,
|
| 34 |
-
'email' => $email,
|
| 35 |
-
'productname' => $productname,
|
| 36 |
-
'brand' => $brand,
|
| 37 |
-
'seenproduct' => $seenproduct,
|
| 38 |
-
'aboutproduct' => $aboutproduct
|
| 39 |
-
))->save();
|
| 40 |
-
Mage::getSingleton('core/session')->addSuccess('Proudct Requested Successfully.');
|
| 41 |
-
$this->_redirect('requestproduct');
|
| 42 |
-
} catch (Exception $e) {
|
| 43 |
-
throw $e;
|
| 44 |
-
}
|
| 45 |
-
}
|
| 46 |
-
}
|
| 47 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Requestproduct/etc/adminhtml.xml
DELETED
|
@@ -1,40 +0,0 @@
|
|
| 1 |
-
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
-
<config>
|
| 3 |
-
<menu>
|
| 4 |
-
<!--
|
| 5 |
-
This item will be created in the Admin menu under Sales
|
| 6 |
-
- If you want another section, reference the appropriate adminhtml.xml file in app/code/core/Mage/Modulename/etc
|
| 7 |
-
- For example, we found out this was 'sales' by referencing the config/menu node of app/code/core/Mage/Sales/etc/adminhtml.xml
|
| 8 |
-
-->
|
| 9 |
-
<catalog>
|
| 10 |
-
<children>
|
| 11 |
-
<!-- Here, I like to use the namespacename_modulename_controllername naming convention -->
|
| 12 |
-
<niveus_requestproduct_requestnewproduct translate="title" module="niveus_requestproduct">
|
| 13 |
-
<!-- This is how the menu text will be displayed -->
|
| 14 |
-
<title>Request New Product</title>
|
| 15 |
-
<!-- This is the URL of what we want the menu item to link to -->
|
| 16 |
-
<action>adminhtml/requestnewproduct</action>
|
| 17 |
-
</niveus_requestproduct_requestnewproduct>
|
| 18 |
-
</children>
|
| 19 |
-
</catalog>
|
| 20 |
-
</menu>
|
| 21 |
-
|
| 22 |
-
<acl>
|
| 23 |
-
<resources>
|
| 24 |
-
<admin>
|
| 25 |
-
<children>
|
| 26 |
-
<!-- Same as above, but instead of referencing the config/menu node, you reference the acl/resources node of adminhtml.xml -->
|
| 27 |
-
<catalog>
|
| 28 |
-
<children>
|
| 29 |
-
<!-- Keep the same naming convention as above -->
|
| 30 |
-
<niveus_requestproduct_requestnewproduct>
|
| 31 |
-
<!-- This is how the ACL text will be displayed on System > Permissions > Roles > Role > Role Resources -->
|
| 32 |
-
<title>Request New Product</title>
|
| 33 |
-
</niveus_requestproduct_requestnewproduct>
|
| 34 |
-
</children>
|
| 35 |
-
</catalog>
|
| 36 |
-
</children>
|
| 37 |
-
</admin>
|
| 38 |
-
</resources>
|
| 39 |
-
</acl>
|
| 40 |
-
</config>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Requestproduct/etc/config.xml
DELETED
|
@@ -1,99 +0,0 @@
|
|
| 1 |
-
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
-
<config>
|
| 3 |
-
<modules>
|
| 4 |
-
<Niveus_Requestproduct>
|
| 5 |
-
<version>1.0.0</version>
|
| 6 |
-
</Niveus_Requestproduct>
|
| 7 |
-
</modules>
|
| 8 |
-
<frontend>
|
| 9 |
-
<routers>
|
| 10 |
-
<requestproduct>
|
| 11 |
-
<use>standard</use>
|
| 12 |
-
<args>
|
| 13 |
-
<module>Niveus_Requestproduct</module>
|
| 14 |
-
<frontName>requestnewproduct</frontName>
|
| 15 |
-
</args>
|
| 16 |
-
</requestproduct>
|
| 17 |
-
</routers>
|
| 18 |
-
<layout>
|
| 19 |
-
<updates>
|
| 20 |
-
<requestproduct>
|
| 21 |
-
<file>requestproduct.xml</file>
|
| 22 |
-
</requestproduct>
|
| 23 |
-
</updates>
|
| 24 |
-
</layout>
|
| 25 |
-
</frontend>
|
| 26 |
-
|
| 27 |
-
<global>
|
| 28 |
-
<helpers>
|
| 29 |
-
<niveus_requestproduct>
|
| 30 |
-
<!-- This is where we define our helper directory -->
|
| 31 |
-
<class>Niveus_Requestproduct_Helper</class>
|
| 32 |
-
</niveus_requestproduct>
|
| 33 |
-
</helpers>
|
| 34 |
-
|
| 35 |
-
<blocks>
|
| 36 |
-
<niveus_requestproduct>
|
| 37 |
-
<!-- Set a block definition and lookup directory -->
|
| 38 |
-
<class>Niveus_Requestproduct_Block</class>
|
| 39 |
-
</niveus_requestproduct>
|
| 40 |
-
</blocks>
|
| 41 |
-
|
| 42 |
-
<models>
|
| 43 |
-
<niveus_requestproduct>
|
| 44 |
-
<!-- This is where we define our model directory -->
|
| 45 |
-
<class>Niveus_Requestproduct_Model</class>
|
| 46 |
-
<!-- Define a resource to create a custom table -->
|
| 47 |
-
<resourceModel>niveus_requestproduct_mysql4</resourceModel>
|
| 48 |
-
</niveus_requestproduct>
|
| 49 |
-
|
| 50 |
-
<!-- Here's our resource model we'll use to create a database table -->
|
| 51 |
-
<niveus_requestproduct_mysql4>
|
| 52 |
-
<class>Niveus_Requestproduct_Model_Mysql4</class>
|
| 53 |
-
<entities>
|
| 54 |
-
<!-- Let's define our table, we'll call it with the baz name, but the real table is foo_bar_baz -->
|
| 55 |
-
<!-- After we define our entity, we can call it with our model by calling foo_bar/baz -->
|
| 56 |
-
<requestnewproduct>
|
| 57 |
-
<table>niveus_requestproduct_requestnewproduct</table>
|
| 58 |
-
</requestnewproduct>
|
| 59 |
-
</entities>
|
| 60 |
-
</niveus_requestproduct_mysql4>
|
| 61 |
-
</models>
|
| 62 |
-
|
| 63 |
-
<!-- And finally we define our resource setup script -->
|
| 64 |
-
<resources>
|
| 65 |
-
<niveus_requestproduct_setup>
|
| 66 |
-
<setup>
|
| 67 |
-
<module>Niveus_Requestproduct</module>
|
| 68 |
-
</setup>
|
| 69 |
-
</niveus_requestproduct_setup>
|
| 70 |
-
</resources>
|
| 71 |
-
</global>
|
| 72 |
-
|
| 73 |
-
<admin>
|
| 74 |
-
<routers>
|
| 75 |
-
<adminhtml>
|
| 76 |
-
<args>
|
| 77 |
-
<!-- This is how we load our Adminhtml controllers -->
|
| 78 |
-
<modules>
|
| 79 |
-
<Niveus_Requestproduct before="Mage_Adminhtml">Niveus_Requestproduct_Adminhtml</Niveus_Requestproduct>
|
| 80 |
-
</modules>
|
| 81 |
-
</args>
|
| 82 |
-
</adminhtml>
|
| 83 |
-
</routers>
|
| 84 |
-
</admin>
|
| 85 |
-
|
| 86 |
-
<adminhtml>
|
| 87 |
-
<layout>
|
| 88 |
-
<updates>
|
| 89 |
-
<niveus_requestproduct>
|
| 90 |
-
<!--
|
| 91 |
-
We again keep a nice naming convention and make our module upgrade proof by placing it in a separate folder
|
| 92 |
-
- Since we are in the adminhtml node, this will look for the XML file in the app/design/adminhtml/default/default root folder
|
| 93 |
-
-->
|
| 94 |
-
<file>niveus/requestproduct.xml</file>
|
| 95 |
-
</niveus_requestproduct>
|
| 96 |
-
</updates>
|
| 97 |
-
</layout>
|
| 98 |
-
</adminhtml>
|
| 99 |
-
</config>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Niveus/Requestproduct/sql/niveus_requestproduct_setup/mysql4-install-1.0.0.php
DELETED
|
@@ -1,37 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/* @var $installer Mage_Core_Model_Resource_Setup */
|
| 3 |
-
$installer = $this;
|
| 4 |
-
$installer->startSetup();
|
| 5 |
-
|
| 6 |
-
/**
|
| 7 |
-
* Create table 'niveus_requestproduct_requestnewproduct'
|
| 8 |
-
*/
|
| 9 |
-
$table = $installer->getConnection()
|
| 10 |
-
->newTable($installer->getTable('niveus_requestproduct/requestnewproduct'))
|
| 11 |
-
->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
| 12 |
-
'identity' => true,
|
| 13 |
-
'unsigned' => true,
|
| 14 |
-
'nullable' => false,
|
| 15 |
-
'primary' => true,
|
| 16 |
-
), 'ID')
|
| 17 |
-
->addColumn('name', Varien_Db_Ddl_Table::TYPE_CLOB, 0, array(
|
| 18 |
-
'nullable' => false,
|
| 19 |
-
), 'Name')
|
| 20 |
-
->addColumn('email', Varien_Db_Ddl_Table::TYPE_VARCHAR, 0, array(
|
| 21 |
-
'nullable' => false,
|
| 22 |
-
), 'Email')
|
| 23 |
-
->addColumn('productname', Varien_Db_Ddl_Table::TYPE_VARCHAR, 0, array(
|
| 24 |
-
'nullable' => false,
|
| 25 |
-
), 'Product Name')
|
| 26 |
-
->addColumn('brand', Varien_Db_Ddl_Table::TYPE_VARCHAR, 0, array(
|
| 27 |
-
'nullable' => false,
|
| 28 |
-
), 'Brand')
|
| 29 |
-
->addColumn('seenproduct', Varien_Db_Ddl_Table::TYPE_VARCHAR, 0, array(
|
| 30 |
-
'nullable' => false,
|
| 31 |
-
), 'Seen Product')
|
| 32 |
-
->addColumn('aboutproduct', Varien_Db_Ddl_Table::TYPE_VARCHAR, 0, array(
|
| 33 |
-
'nullable' => false,
|
| 34 |
-
), 'About Product');
|
| 35 |
-
$installer->getConnection()->createTable($table);
|
| 36 |
-
|
| 37 |
-
$installer->endSetup();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
package.xml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Niveus_ProductVideo</name>
|
| 4 |
-
<version>1.
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
| 7 |
<channel>community</channel>
|
|
@@ -10,9 +10,9 @@
|
|
| 10 |
<description>Niveus Youtube product Video extension</description>
|
| 11 |
<notes>Installation steps</notes>
|
| 12 |
<authors><author><name>Niveus Solutions</name><user>niveussolutions</user><email>support@niveussolutions.com</email></author></authors>
|
| 13 |
-
<date>2013-10-
|
| 14 |
-
<time>
|
| 15 |
-
<contents><target name="magecommunity"><dir name="Niveus"><dir name="ProductVideo"><dir name="Block"><dir name="Adminhtml"><dir name="Catalog"><dir name="Product"><dir name="Edit"><dir name="Tab"><file name="Videos.php" hash="0e4ea8296cdf584cf9756cc086acec13"/><file name="Videos.php~" hash="c21edc574c4c186b23dbccc2d067b503"/></dir></dir></dir></dir></dir><dir name="Product"><dir name="View"><file name="Attribute.php~" hash="629d0759593202ee9d8886d863eff0c1"/><file name="List.php~" hash="9f52ae0257c000b26538daa0a6b5320c"/><file name="Media.php" hash="87141206ee837993560d66872c8f80b1"/><file name="Media.php~" hash="a512858484654f67e015b59def270d13"/></dir></dir><dir name="Rewrite"><file name="AdminhtmlCatalogProductEditTabs.php" hash="d4fcf87e7c895f792927b57dd9af9625"/><file name="AdminhtmlCatalogProductEditTabs.php~" hash="01e2d8cbbee88a7bbc68e5c05e933d54"/></dir><file name="Video.php" hash="234d015965cc9ca9fedac78d5db52ebf"/><file name="Video.php~" hash="77668e1600fbb49e7884167842e1a6a3"/></dir><dir name="Helper"><file name="Data.php" hash="ab2f4060c3e9182f197f075b8e7faf50"/><file name="Data.php~" hash="ab2f4060c3e9182f197f075b8e7faf50"/></dir><dir name="Model"><dir name="Config"><dir name="Source"><file name="Scrolling.php" hash="1d095e7d24d4e640fb3b11baa4027b77"/><file name="Scrolling.php~" hash="29faa4933274ad9848784b751730b7dc"/><file name="Titleposition.php" hash="af43b76604b69f24c58c4bf35bab40a3"/><file name="Titleposition.php~" hash="eca314ba351356270cd362da50f974f4"/><file name="Transition.php" hash="387dfb1df77743b982bb0cd8de7c85a1"/><file name="Transition.php~" hash="974787453cece93a0a85cf0fc3046c65"/></dir></dir><file name="Observer.php" hash="1965676480638ee512c57c03016af894"/><file name="Observer.php~" hash="1965676480638ee512c57c03016af894"/><dir name="Resource"><dir name="Eav"><dir name="Mysql4"><file name="Setup.php" hash="0b890d0edf9f635c34d84e80410ab230"/><file name="Setup.php~" hash="392ab06b2156327c4a9e8a3d77160f4a"/></dir></dir><dir name="Videos"><file name="Collection.php" hash="1d5a542d7a919ddeccef1cf3c9607b2f"/><file name="Collection.php~" hash="701b62fdd06add657539e507a3212971"/></dir><file name="Videos.php" hash="4ac319ed11931591649f9ac4569d107b"/><file name="Videos.php~" hash="2d56dcba2e2548597e48bf1afbdb9a58"/></dir><file name="Videos.php" hash="d35074b3b0acd6426ec5df12cf63d077"/><file name="Videos.php~" hash="8bcb8be4da9a0a642722ac4a38ac6729"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="VideosController.php" hash="7174a2ff3564f654110d94a16138bf5a"/><file name="VideosController.php~" hash="d5d5dff399e2a59559e8f635e58258a0"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="a00ffae61be96cd04e435c830cf3fd4d"/><file name="adminhtml.xml~" hash="3d6cc4da367e365a43f9ad9bd7884b79"/><file name="config.xml" hash="
|
| 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>Niveus_ProductVideo</name>
|
| 4 |
+
<version>1.1.0</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
| 7 |
<channel>community</channel>
|
| 10 |
<description>Niveus Youtube product Video extension</description>
|
| 11 |
<notes>Installation steps</notes>
|
| 12 |
<authors><author><name>Niveus Solutions</name><user>niveussolutions</user><email>support@niveussolutions.com</email></author></authors>
|
| 13 |
+
<date>2013-10-25</date>
|
| 14 |
+
<time>09:20:04</time>
|
| 15 |
+
<contents><target name="magecommunity"><dir name="Niveus"><dir name="ProductVideo"><dir name="Block"><dir name="Adminhtml"><dir name="Catalog"><dir name="Product"><dir name="Edit"><dir name="Tab"><file name="Videos.php" hash="0e4ea8296cdf584cf9756cc086acec13"/><file name="Videos.php~" hash="c21edc574c4c186b23dbccc2d067b503"/></dir></dir></dir></dir></dir><dir name="Product"><dir name="View"><file name="Attribute.php~" hash="629d0759593202ee9d8886d863eff0c1"/><file name="List.php~" hash="9f52ae0257c000b26538daa0a6b5320c"/><file name="Media.php" hash="87141206ee837993560d66872c8f80b1"/><file name="Media.php~" hash="a512858484654f67e015b59def270d13"/></dir></dir><dir name="Rewrite"><file name="AdminhtmlCatalogProductEditTabs.php" hash="d4fcf87e7c895f792927b57dd9af9625"/><file name="AdminhtmlCatalogProductEditTabs.php~" hash="01e2d8cbbee88a7bbc68e5c05e933d54"/></dir><file name="Video.php" hash="234d015965cc9ca9fedac78d5db52ebf"/><file name="Video.php~" hash="77668e1600fbb49e7884167842e1a6a3"/></dir><dir name="Helper"><file name="Data.php" hash="ab2f4060c3e9182f197f075b8e7faf50"/><file name="Data.php~" hash="ab2f4060c3e9182f197f075b8e7faf50"/></dir><dir name="Model"><dir name="Config"><dir name="Source"><file name="Scrolling.php" hash="1d095e7d24d4e640fb3b11baa4027b77"/><file name="Scrolling.php~" hash="29faa4933274ad9848784b751730b7dc"/><file name="Titleposition.php" hash="af43b76604b69f24c58c4bf35bab40a3"/><file name="Titleposition.php~" hash="eca314ba351356270cd362da50f974f4"/><file name="Transition.php" hash="387dfb1df77743b982bb0cd8de7c85a1"/><file name="Transition.php~" hash="974787453cece93a0a85cf0fc3046c65"/></dir></dir><file name="Observer.php" hash="1965676480638ee512c57c03016af894"/><file name="Observer.php~" hash="1965676480638ee512c57c03016af894"/><dir name="Resource"><dir name="Eav"><dir name="Mysql4"><file name="Setup.php" hash="0b890d0edf9f635c34d84e80410ab230"/><file name="Setup.php~" hash="392ab06b2156327c4a9e8a3d77160f4a"/></dir></dir><dir name="Videos"><file name="Collection.php" hash="1d5a542d7a919ddeccef1cf3c9607b2f"/><file name="Collection.php~" hash="701b62fdd06add657539e507a3212971"/></dir><file name="Videos.php" hash="4ac319ed11931591649f9ac4569d107b"/><file name="Videos.php~" hash="2d56dcba2e2548597e48bf1afbdb9a58"/></dir><file name="Videos.php" hash="d35074b3b0acd6426ec5df12cf63d077"/><file name="Videos.php~" hash="8bcb8be4da9a0a642722ac4a38ac6729"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="VideosController.php" hash="7174a2ff3564f654110d94a16138bf5a"/><file name="VideosController.php~" hash="d5d5dff399e2a59559e8f635e58258a0"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="a00ffae61be96cd04e435c830cf3fd4d"/><file name="adminhtml.xml~" hash="3d6cc4da367e365a43f9ad9bd7884b79"/><file name="config.xml" hash="547e4a1bb6ec79d428a30b2aaef4024e"/><file name="config.xml~" hash="31e04f56504768122775237092c66119"/><file name="system.xml" hash="b8f38b5efc46ec5a9e0ae6c7d02d6232"/><file name="system.xml~" hash="153a4c149fbb890c81ff6f2cabe9ff61"/></dir><dir name="sql"><dir name="productvideo_setup"><file name="mysql4-install-0.1.0.php" hash="4022ec194b52e4800bbe6061ecf8d61c"/><file name="mysql4-install-0.1.0.php~" hash="a0c584b076e48fa0d7f9ced873df3ae7"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Niveus_ProductVideo.xml" hash="7d2fb29c666116bb33c0867e383e0788"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="niveusproductvideo.xml" hash="61f41423688de05affbfd3f0287d609d"/></dir><dir name="template"><dir name="niveusproductvideo"><dir name="tab"><file name="videos.phtml" hash="4374353dec1adea731a75181407b8490"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="niveusproductvideo.xml" hash="de98ce985d056729d5f0f86e57809f7f"/></dir><dir name="template"><dir name="niveusproductvideo"><file name="video.phtml" hash="d659f4a028076d328819319447fde673"/></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>
|
