Version Notes
First Release
Download this release
Release Info
| Developer | Unicode Systems |
| Extension | Autocart_Extension |
| Version | 1.0.0 |
| Comparing to | |
| See all releases | |
Version 1.0.0
- app/code/community/Uni/Autocart/Block/Adminhtml/Autocart.php +20 -0
- app/code/community/Uni/Autocart/Block/Adminhtml/Autocart/Edit.php +43 -0
- app/code/community/Uni/Autocart/Block/Adminhtml/Autocart/Edit/Form.php +29 -0
- app/code/community/Uni/Autocart/Block/Adminhtml/Autocart/Edit/Tab/Form.php +42 -0
- app/code/community/Uni/Autocart/Block/Adminhtml/Autocart/Edit/Tab/Form2.php +71 -0
- app/code/community/Uni/Autocart/Block/Adminhtml/Autocart/Edit/Tab/Form3.php +24 -0
- app/code/community/Uni/Autocart/Block/Adminhtml/Autocart/Edit/Tab/Product.php +113 -0
- app/code/community/Uni/Autocart/Block/Adminhtml/Autocart/Edit/Tabs.php +44 -0
- app/code/community/Uni/Autocart/Block/Adminhtml/Autocart/Grid.php +112 -0
- app/code/community/Uni/Autocart/Block/Autocart.php +26 -0
- app/code/community/Uni/Autocart/Helper/Data.php +12 -0
- app/code/community/Uni/Autocart/Model/Autocart.php +18 -0
- app/code/community/Uni/Autocart/Model/Mysql4/Autocart.php +18 -0
- app/code/community/Uni/Autocart/Model/Mysql4/Autocart/Collection.php +19 -0
- app/code/community/Uni/Autocart/Model/Observer.php +45 -0
- app/code/community/Uni/Autocart/controllers/Adminhtml/AutocartController.php +167 -0
- app/code/community/Uni/Autocart/controllers/IndexController.php +19 -0
- app/code/community/Uni/Autocart/etc/adminhtml.xml +45 -0
- app/code/community/Uni/Autocart/etc/config.xml +95 -0
- app/code/community/Uni/Autocart/sql/autocart_setup/mysql4-install-1.0.0.php +31 -0
- app/design/adminhtml/default/default/layout/autocart.xml +40 -0
- app/etc/modules/Uni_Autocart.xml +19 -0
- package.xml +18 -0
app/code/community/Uni/Autocart/Block/Adminhtml/Autocart.php
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Unicode Systems
|
| 4 |
+
* @category Uni
|
| 5 |
+
* @package Uni_Autocart
|
| 6 |
+
* @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
|
| 7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
| 8 |
+
*/
|
| 9 |
+
|
| 10 |
+
class Uni_Autocart_Block_Adminhtml_Autocart extends Mage_Adminhtml_Block_Widget_Grid_Container {
|
| 11 |
+
|
| 12 |
+
public function __construct() {
|
| 13 |
+
$this->_controller = 'adminhtml_autocart';
|
| 14 |
+
$this->_blockGroup = 'autocart';
|
| 15 |
+
$this->_headerText = Mage::helper('autocart')->__('Manage Auto Add To Cart Rules');
|
| 16 |
+
$this->_addButtonLabel = Mage::helper('autocart')->__('Add New Rule');
|
| 17 |
+
parent::__construct();
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
}
|
app/code/community/Uni/Autocart/Block/Adminhtml/Autocart/Edit.php
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Unicode Systems
|
| 4 |
+
* @category Uni
|
| 5 |
+
* @package Uni_Autocart
|
| 6 |
+
* @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
|
| 7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
| 8 |
+
*/
|
| 9 |
+
|
| 10 |
+
class Uni_Autocart_Block_Adminhtml_Autocart_Edit extends Mage_Adminhtml_Block_Widget_Form_Container {
|
| 11 |
+
|
| 12 |
+
public function __construct() {
|
| 13 |
+
parent::__construct();
|
| 14 |
+
|
| 15 |
+
$this->_objectId = 'id';
|
| 16 |
+
$this->_blockGroup = 'autocart';
|
| 17 |
+
$this->_controller = 'adminhtml_autocart';
|
| 18 |
+
$this->_mode = 'edit';
|
| 19 |
+
$this->_updateButton('save', 'label', Mage::helper('autocart')->__('Save Rule'));
|
| 20 |
+
$this->_updateButton('delete', 'label', Mage::helper('autocart')->__('Delete Rule'));
|
| 21 |
+
$this->_addButton("saveandcontinue", array(
|
| 22 |
+
"label" => Mage::helper("autocart")->__("Save And Continue Edit"),
|
| 23 |
+
"onclick" => "saveAndContinueEdit()",
|
| 24 |
+
"class" => "save",
|
| 25 |
+
), -100);
|
| 26 |
+
$this->_formScripts[] = "
|
| 27 |
+
function saveAndContinueEdit(){
|
| 28 |
+
editForm.submit($('edit_form').action+'back/edit/');
|
| 29 |
+
}
|
| 30 |
+
";
|
| 31 |
+
$model = Mage::getModel('autocart/autocart')->load($this->getRequest()->getParam($this->_objectId));
|
| 32 |
+
Mage::register('autocart', $model);
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
public function getHeaderText() {
|
| 36 |
+
if (Mage::registry('autocart') && Mage::registry('autocart')->getId()) {
|
| 37 |
+
return Mage::helper('autocart')->__('Edit Rule');
|
| 38 |
+
} else {
|
| 39 |
+
return Mage::helper('autocart')->__('Add Rule');
|
| 40 |
+
}
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
}
|
app/code/community/Uni/Autocart/Block/Adminhtml/Autocart/Edit/Form.php
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Unicode Systems
|
| 4 |
+
* @category Uni
|
| 5 |
+
* @package Uni_Autocart
|
| 6 |
+
* @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
|
| 7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
| 8 |
+
*/
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
class Uni_Autocart_Block_Adminhtml_Autocart_Edit_Form extends Mage_Adminhtml_Block_Widget_Form {
|
| 12 |
+
|
| 13 |
+
protected function _prepareForm() {
|
| 14 |
+
$form = new Varien_Data_Form(array(
|
| 15 |
+
"id" => "edit_form",
|
| 16 |
+
"action" => $this->getUrl("*/*/save", array("id" => $this->getRequest()->getParam("id"))),
|
| 17 |
+
"method" => "post",
|
| 18 |
+
"enctype" => "multipart/form-data",
|
| 19 |
+
)
|
| 20 |
+
);
|
| 21 |
+
if (Mage::registry('autocart')) {
|
| 22 |
+
$form->setValues(Mage::registry('autocart')->getData());
|
| 23 |
+
}
|
| 24 |
+
$form->setUseContainer(true);
|
| 25 |
+
$this->setForm($form);
|
| 26 |
+
return parent::_prepareForm();
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
}
|
app/code/community/Uni/Autocart/Block/Adminhtml/Autocart/Edit/Tab/Form.php
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Unicode Systems
|
| 4 |
+
* @category Uni
|
| 5 |
+
* @package Uni_Autocart
|
| 6 |
+
* @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
|
| 7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
| 8 |
+
*/
|
| 9 |
+
|
| 10 |
+
class Uni_Autocart_Block_Adminhtml_Autocart_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form {
|
| 11 |
+
|
| 12 |
+
protected function _prepareForm() {
|
| 13 |
+
$form = new Varien_Data_Form();
|
| 14 |
+
$this->setForm($form);
|
| 15 |
+
$fieldset = $form->addFieldset("autocart_form", array("legend" => Mage::helper("autocart")->__("Rule information")));
|
| 16 |
+
|
| 17 |
+
$fieldset->addField("rule_name", "text", array(
|
| 18 |
+
"label" => Mage::helper("autocart")->__("Rule Name"),
|
| 19 |
+
"class" => "required-entry",
|
| 20 |
+
"required" => true,
|
| 21 |
+
"name" => "rule_name",
|
| 22 |
+
));
|
| 23 |
+
|
| 24 |
+
$fieldset->addField("description", "textarea", array(
|
| 25 |
+
"label" => Mage::helper("autocart")->__("Description"),
|
| 26 |
+
"class" => "required-entry",
|
| 27 |
+
"required" => true,
|
| 28 |
+
"name" => "description",
|
| 29 |
+
));
|
| 30 |
+
$fieldset->addField("is_active", "select", array(
|
| 31 |
+
"label" => Mage::helper("autocart")->__("Is Active"),
|
| 32 |
+
"class" => "required-entry",
|
| 33 |
+
"required" => true,
|
| 34 |
+
"values" => Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray(),
|
| 35 |
+
"name" => "is_active",
|
| 36 |
+
));
|
| 37 |
+
if (Mage::registry('autocart')) {
|
| 38 |
+
$form->setValues(Mage::registry('autocart')->getData());
|
| 39 |
+
}
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
}
|
app/code/community/Uni/Autocart/Block/Adminhtml/Autocart/Edit/Tab/Form2.php
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Unicode Systems
|
| 4 |
+
* @category Uni
|
| 5 |
+
* @package Uni_Autocart
|
| 6 |
+
* @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
|
| 7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
| 8 |
+
*/
|
| 9 |
+
|
| 10 |
+
class Uni_Autocart_Block_Adminhtml_Autocart_Edit_Tab_Form2 extends Mage_Adminhtml_Block_Widget_Form {
|
| 11 |
+
|
| 12 |
+
protected function _prepareForm() {
|
| 13 |
+
$form = new Varien_Data_Form();
|
| 14 |
+
$afterElementHtml = '<p class="note"><span><b>' . ' If user add a product of this category then selected products from the next tab will add automatically.' . '</b></span></p>';
|
| 15 |
+
$this->setForm($form);
|
| 16 |
+
$fieldset = $form->addFieldset("autocart_form", array("legend" => Mage::helper("autocart")->__("Condition")));
|
| 17 |
+
$fieldset->addField('category_ids', 'multiselect', array(
|
| 18 |
+
'label' => 'Category',
|
| 19 |
+
'class' => 'required-entry',
|
| 20 |
+
'required' => true,
|
| 21 |
+
'name' => 'category_ids',
|
| 22 |
+
'values' => $this->get_categories(),
|
| 23 |
+
'disabled' => false,
|
| 24 |
+
'readonly' => false,
|
| 25 |
+
'tabindex' => 5,
|
| 26 |
+
'after_element_html' => $afterElementHtml
|
| 27 |
+
));
|
| 28 |
+
$allCatIds='';
|
| 29 |
+
$_ruleId=Mage::registry('autocart')->getId();
|
| 30 |
+
$_currIds = Mage::registry('autocart')->getCategoryIds();
|
| 31 |
+
$collection= Mage::getModel('autocart/autocart')->getCollection()
|
| 32 |
+
->addFieldToSelect('category_ids')
|
| 33 |
+
->addFieldToFilter('id',array('neq' => $_ruleId));
|
| 34 |
+
foreach($collection as $col):
|
| 35 |
+
$allCatIds.= $col->getCategoryIds();
|
| 36 |
+
$allCatIds.= ',';
|
| 37 |
+
endforeach;
|
| 38 |
+
$arr_allCatIds= explode(',', $allCatIds);
|
| 39 |
+
$arr_currIds= explode(',', $_currIds);
|
| 40 |
+
$result = array_intersect($arr_allCatIds, $arr_currIds);
|
| 41 |
+
if(count($result)>0 && $collection->getSize()>0):
|
| 42 |
+
$fieldset->addField('note', 'note', array(
|
| 43 |
+
'text' => '<b style="color:red">Note: Some Categories in this rule are also used in another autocart rules.</b>'
|
| 44 |
+
));
|
| 45 |
+
endif;
|
| 46 |
+
if (Mage::registry('autocart')) {
|
| 47 |
+
$form->setValues(Mage::registry('autocart')->getData());
|
| 48 |
+
}
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
protected function get_categories() {
|
| 52 |
+
|
| 53 |
+
$category = Mage::getModel('catalog/category');
|
| 54 |
+
$tree = $category->getTreeModel();
|
| 55 |
+
$tree->load();
|
| 56 |
+
$ids = $tree->getCollection()->getAllIds();
|
| 57 |
+
$arr = array();
|
| 58 |
+
if ($ids) {
|
| 59 |
+
foreach ($ids as $k => $id) {
|
| 60 |
+
$cat = Mage::getModel('catalog/category');
|
| 61 |
+
$cat->load($id);
|
| 62 |
+
if ($cat->getId() > 3):
|
| 63 |
+
$arr[$k]['value'] = $cat->getId();
|
| 64 |
+
$arr[$k]['label'] = $cat->getName();
|
| 65 |
+
endif;
|
| 66 |
+
}
|
| 67 |
+
}
|
| 68 |
+
return $arr;
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
}
|
app/code/community/Uni/Autocart/Block/Adminhtml/Autocart/Edit/Tab/Form3.php
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Unicode Systems
|
| 4 |
+
* @category Uni
|
| 5 |
+
* @package Uni_Autocart
|
| 6 |
+
* @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
|
| 7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
| 8 |
+
*/
|
| 9 |
+
|
| 10 |
+
class Uni_Autocart_Block_Adminhtml_Autocart_Edit_Tab_Form3 extends Mage_Adminhtml_Block_Widget_Form {
|
| 11 |
+
|
| 12 |
+
protected function _prepareForm() {
|
| 13 |
+
$form = new Varien_Data_Form();
|
| 14 |
+
$this->setForm($form);
|
| 15 |
+
$fieldset = $form->addFieldset("autocart_form", array("legend" => Mage::helper("autocart")->__("Condition")));
|
| 16 |
+
$_saveUrl = Mage::helper("adminhtml")->getUrl("adminhtml/promo_quote/new");
|
| 17 |
+
$addRule = "editForm.submit($('edit_form').action+'back/edit/');window.setLocation('$_saveUrl')";
|
| 18 |
+
$fieldset->addField('some_field', 'hidden', array(
|
| 19 |
+
'after_element_html' => '<button type="button" onclick="' . $addRule . '">Save & Create Shopping Cart Price Rule</button>',
|
| 20 |
+
'popup' => true
|
| 21 |
+
));
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
}
|
app/code/community/Uni/Autocart/Block/Adminhtml/Autocart/Edit/Tab/Product.php
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Unicode Systems
|
| 4 |
+
* @category Uni
|
| 5 |
+
* @package Uni_Autocart
|
| 6 |
+
* @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
|
| 7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
| 8 |
+
*/
|
| 9 |
+
|
| 10 |
+
class Uni_Autocart_Block_Adminhtml_Autocart_Edit_Tab_Product extends Mage_Adminhtml_Block_Widget_Grid {
|
| 11 |
+
|
| 12 |
+
public function __construct() {
|
| 13 |
+
parent::__construct();
|
| 14 |
+
$this->setId('productGrid');
|
| 15 |
+
$this->setDefaultSort('entity_id');
|
| 16 |
+
$this->setDefaultDir('DESC');
|
| 17 |
+
$this->setSaveParametersInSession(true);
|
| 18 |
+
$this->setUseAjax(true);
|
| 19 |
+
$this->setVarNameFilter('product_filter');
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
protected function _addColumnFilterToCollection($column) {
|
| 23 |
+
if ($column->getId() == 'in_category') {
|
| 24 |
+
$productIds = $this->_getSelectedProducts();
|
| 25 |
+
if (empty($productIds)) {
|
| 26 |
+
$productIds = 0;
|
| 27 |
+
}
|
| 28 |
+
if ($column->getFilter()->getValue()) {
|
| 29 |
+
$this->getCollection()->addFieldToFilter('entity_id', array('in' => $productIds));
|
| 30 |
+
} elseif (!empty($productIds)) {
|
| 31 |
+
$this->getCollection()->addFieldToFilter('entity_id', array('nin' => $productIds));
|
| 32 |
+
}
|
| 33 |
+
} else {
|
| 34 |
+
parent::_addColumnFilterToCollection($column);
|
| 35 |
+
}
|
| 36 |
+
return $this;
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
protected function _prepareCollection() {
|
| 40 |
+
|
| 41 |
+
$collection = Mage::getModel('catalog/product')->getCollection()
|
| 42 |
+
->addAttributeToSelect('sku')
|
| 43 |
+
->addAttributeToSelect('name')
|
| 44 |
+
->addAttributeToSelect('attribute_set_id')
|
| 45 |
+
->addAttributeToSelect('type_id')
|
| 46 |
+
->addAttributeToFilter('type_id', 'simple')
|
| 47 |
+
->addAttributeToFilter('status', 1);
|
| 48 |
+
Mage::getSingleton('cataloginventory/stock')->addInStockFilterToCollection($collection);
|
| 49 |
+
$this->setCollection($collection);
|
| 50 |
+
|
| 51 |
+
parent::_prepareCollection();
|
| 52 |
+
return $this;
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
protected function _prepareColumns() {
|
| 56 |
+
$paramId = $this->getRequest()->getParam('id');
|
| 57 |
+
$autocartCollection = Mage::getModel('autocart/autocart')->getCollection()
|
| 58 |
+
->addFieldToFilter('id', $paramId);
|
| 59 |
+
$data = $autocartCollection->getData();
|
| 60 |
+
$idArray = explode(',', $data[0]['product_ids']);
|
| 61 |
+
$this->addColumn('in_category', array(
|
| 62 |
+
'header_css_class' => 'a-center',
|
| 63 |
+
'type' => 'checkbox',
|
| 64 |
+
'values' => $idArray,
|
| 65 |
+
'align' => 'center',
|
| 66 |
+
'index' => 'entity_id',
|
| 67 |
+
'name' => 'in_category',
|
| 68 |
+
'field_name' => 'product_ids[]'
|
| 69 |
+
));
|
| 70 |
+
|
| 71 |
+
$this->addColumn('entity_id', array(
|
| 72 |
+
'header' => Mage::helper('catalog')->__('ID'),
|
| 73 |
+
'width' => '50px',
|
| 74 |
+
'type' => 'number',
|
| 75 |
+
'index' => 'entity_id',
|
| 76 |
+
));
|
| 77 |
+
$this->addColumn('name', array(
|
| 78 |
+
'header' => Mage::helper('catalog')->__('Name'),
|
| 79 |
+
'index' => 'name',
|
| 80 |
+
));
|
| 81 |
+
$this->addColumn('type', array(
|
| 82 |
+
'header' => Mage::helper('catalog')->__('Type'),
|
| 83 |
+
'width' => '60px',
|
| 84 |
+
'index' => 'type_id',
|
| 85 |
+
'type' => 'options',
|
| 86 |
+
'options' => Mage::getSingleton('catalog/product_type')->getOptionArray(),
|
| 87 |
+
));
|
| 88 |
+
$this->addColumn('sku', array(
|
| 89 |
+
'header' => Mage::helper('catalog')->__('SKU'),
|
| 90 |
+
'width' => '80px',
|
| 91 |
+
'index' => 'sku',
|
| 92 |
+
));
|
| 93 |
+
|
| 94 |
+
if (Mage::helper('catalog')->isModuleEnabled('Mage_Rss')) {
|
| 95 |
+
$this->addRssList('rss/catalog/notifystock', Mage::helper('catalog')->__('Notify Low Stock RSS'));
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
return parent::_prepareColumns();
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
public function getGridUrl() {
|
| 102 |
+
return $this->_getData('grid_url') ? $this->_getData('grid_url') : $this->getUrl('*/*/productgrid', array('_current' => true));
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
protected function _getProductIds() {
|
| 106 |
+
$products = $this->getRequest()->getPost('product_ids');
|
| 107 |
+
if (is_null($products)) {
|
| 108 |
+
return array_keys($products);
|
| 109 |
+
}
|
| 110 |
+
return $products;
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
}
|
app/code/community/Uni/Autocart/Block/Adminhtml/Autocart/Edit/Tabs.php
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Unicode Systems
|
| 4 |
+
* @category Uni
|
| 5 |
+
* @package Uni_Autocart
|
| 6 |
+
* @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
|
| 7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
| 8 |
+
*/
|
| 9 |
+
|
| 10 |
+
class Uni_Autocart_Block_Adminhtml_Autocart_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs {
|
| 11 |
+
|
| 12 |
+
public function __construct() {
|
| 13 |
+
parent::__construct();
|
| 14 |
+
$this->setId("autocart_tabs");
|
| 15 |
+
$this->setDestElementId("edit_form");
|
| 16 |
+
$this->setTitle(Mage::helper("autocart")->__("Autocart Rule Information"));
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
protected function _beforeToHtml() {
|
| 20 |
+
$this->addTab("form_section", array(
|
| 21 |
+
"label" => Mage::helper("autocart")->__("Rule Information"),
|
| 22 |
+
"title" => Mage::helper("autocart")->__("Rule Information"),
|
| 23 |
+
"content" => $this->getLayout()->createBlock("autocart/adminhtml_autocart_edit_tab_form")->toHtml(),
|
| 24 |
+
));
|
| 25 |
+
$this->addTab("form_section2", array(
|
| 26 |
+
"label" => Mage::helper("autocart")->__("Conditions"),
|
| 27 |
+
"title" => Mage::helper("autocart")->__("Conditions"),
|
| 28 |
+
"content" => $this->getLayout()->createBlock("autocart/adminhtml_autocart_edit_tab_form2")->toHtml(),
|
| 29 |
+
));
|
| 30 |
+
$this->addTab('form_section4', array(
|
| 31 |
+
'label' => Mage::helper('autocart')->__('Products'),
|
| 32 |
+
'title' => Mage::helper('autocart')->__('Products'),
|
| 33 |
+
'url' => $this->getUrl('*/*/product', array('_current' => true)),
|
| 34 |
+
'class' => 'ajax',
|
| 35 |
+
));
|
| 36 |
+
$this->addTab("form_section3", array(
|
| 37 |
+
"label" => Mage::helper("autocart")->__("Actions"),
|
| 38 |
+
"title" => Mage::helper("autocart")->__("Actions"),
|
| 39 |
+
"content" => $this->getLayout()->createBlock("autocart/adminhtml_autocart_edit_tab_form3")->toHtml(),
|
| 40 |
+
));
|
| 41 |
+
return parent::_beforeToHtml();
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
}
|
app/code/community/Uni/Autocart/Block/Adminhtml/Autocart/Grid.php
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Unicode Systems
|
| 4 |
+
* @category Uni
|
| 5 |
+
* @package Uni_Autocart
|
| 6 |
+
* @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
|
| 7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
| 8 |
+
*/
|
| 9 |
+
|
| 10 |
+
class Uni_Autocart_Block_Adminhtml_Autocart_Grid extends Mage_Adminhtml_Block_Widget_Grid {
|
| 11 |
+
|
| 12 |
+
public function __construct() {
|
| 13 |
+
parent::__construct();
|
| 14 |
+
$this->setId('autocartGrid');
|
| 15 |
+
$this->setDefaultSort('id');
|
| 16 |
+
$this->setDefaultDir('ASC');
|
| 17 |
+
$this->setSaveParametersInSession(true);
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
protected function _prepareCollection() {
|
| 21 |
+
$this->setCollection(Mage::getModel('autocart/autocart')->getCollection());
|
| 22 |
+
|
| 23 |
+
return parent::_prepareCollection();
|
| 24 |
+
}
|
| 25 |
+
/**
|
| 26 |
+
*
|
| 27 |
+
* @return type
|
| 28 |
+
*/
|
| 29 |
+
protected function _prepareColumns() {
|
| 30 |
+
|
| 31 |
+
$this->addColumn('id', array(
|
| 32 |
+
'header' => Mage::helper('autocart')->__('Id'),
|
| 33 |
+
'align' => 'left',
|
| 34 |
+
'index' => 'id',
|
| 35 |
+
));
|
| 36 |
+
|
| 37 |
+
$this->addColumn('rule_name', array(
|
| 38 |
+
'header' => Mage::helper('autocart')->__('Rule Name'),
|
| 39 |
+
'align' => 'left',
|
| 40 |
+
'index' => 'rule_name',
|
| 41 |
+
));
|
| 42 |
+
$this->addColumn('is_active', array(
|
| 43 |
+
'header' => Mage::helper('autocart')->__('Status'),
|
| 44 |
+
'align' => 'left',
|
| 45 |
+
'type' => 'options',
|
| 46 |
+
'options' => array(
|
| 47 |
+
0 => 'Inactive',
|
| 48 |
+
1 => 'Active',
|
| 49 |
+
),
|
| 50 |
+
'index' => 'is_active',
|
| 51 |
+
));
|
| 52 |
+
$this->addColumn('update_time', array(
|
| 53 |
+
'header' => Mage::helper('autocart')->__('Last Updated'),
|
| 54 |
+
'align' => 'left',
|
| 55 |
+
'index' => 'update_time',
|
| 56 |
+
));
|
| 57 |
+
|
| 58 |
+
$this->addColumn('action', array(
|
| 59 |
+
'header' => Mage::helper('autocart')->__('Action'),
|
| 60 |
+
'width' => '100',
|
| 61 |
+
'type' => 'action',
|
| 62 |
+
'getter' => 'getId',
|
| 63 |
+
'actions' => array(
|
| 64 |
+
array(
|
| 65 |
+
'caption' => Mage::helper('autocart')->__('Edit'),
|
| 66 |
+
'url' => array('base' => '*/*/edit'),
|
| 67 |
+
'field' => 'id'
|
| 68 |
+
),
|
| 69 |
+
),
|
| 70 |
+
'filter' => false,
|
| 71 |
+
'sortable' => false,
|
| 72 |
+
'index' => 'stores',
|
| 73 |
+
'is_system' => true,
|
| 74 |
+
));
|
| 75 |
+
return parent::_prepareColumns();
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
public function getRowUrl($row) {
|
| 79 |
+
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
|
| 80 |
+
}
|
| 81 |
+
protected function _prepareMassaction()
|
| 82 |
+
{
|
| 83 |
+
$this->setMassactionIdField('id');
|
| 84 |
+
$this->getMassactionBlock()->setFormFieldName('id');
|
| 85 |
+
|
| 86 |
+
$this->getMassactionBlock()->addItem('delete', array(
|
| 87 |
+
'label' => Mage::helper('autocart')->__('Delete'),
|
| 88 |
+
'url' => $this->getUrl('*/*/massDelete'),
|
| 89 |
+
'confirm' => Mage::helper('autocart')->__('Are you sure?')
|
| 90 |
+
));
|
| 91 |
+
|
| 92 |
+
$statuses = array(
|
| 93 |
+
0 => 'Inactive',
|
| 94 |
+
1 => 'Active'
|
| 95 |
+
);
|
| 96 |
+
|
| 97 |
+
$this->getMassactionBlock()->addItem('status', array(
|
| 98 |
+
'label'=> Mage::helper('autocart')->__('Change status'),
|
| 99 |
+
'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
|
| 100 |
+
'additional' => array(
|
| 101 |
+
'visibility' => array(
|
| 102 |
+
'name' => 'is_active',
|
| 103 |
+
'type' => 'select',
|
| 104 |
+
'class' => 'required-entry',
|
| 105 |
+
'label' => Mage::helper('autocart')->__('Status'),
|
| 106 |
+
'values' => $statuses
|
| 107 |
+
)
|
| 108 |
+
)
|
| 109 |
+
));
|
| 110 |
+
return $this;
|
| 111 |
+
}
|
| 112 |
+
}
|
app/code/community/Uni/Autocart/Block/Autocart.php
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Unicode Systems
|
| 4 |
+
* @category Uni
|
| 5 |
+
* @package Uni_Autocart
|
| 6 |
+
* @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
|
| 7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
| 8 |
+
*/
|
| 9 |
+
|
| 10 |
+
class Uni_Autocart_Block_Autocart extends Mage_Core_Block_Template {
|
| 11 |
+
|
| 12 |
+
protected function _beforeToHtml() {
|
| 13 |
+
$this->_prepareCollection();
|
| 14 |
+
return parent::_beforeToHtml();
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
protected function _prepareCollection() {
|
| 18 |
+
$collection = Mage::getModel("autocart/autocart")->getCollection();
|
| 19 |
+
|
| 20 |
+
$collection->setOrder('id', 'ASC')
|
| 21 |
+
->load();
|
| 22 |
+
$this->setAutocartRules($collection);
|
| 23 |
+
return $this;
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
}
|
app/code/community/Uni/Autocart/Helper/Data.php
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Unicode Systems
|
| 4 |
+
* @category Uni
|
| 5 |
+
* @package Uni_Autocart
|
| 6 |
+
* @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
|
| 7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
| 8 |
+
*/
|
| 9 |
+
|
| 10 |
+
class Uni_Autocart_Helper_Data extends Mage_Core_Helper_Abstract {
|
| 11 |
+
|
| 12 |
+
}
|
app/code/community/Uni/Autocart/Model/Autocart.php
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Unicode Systems
|
| 4 |
+
* @category Uni
|
| 5 |
+
* @package Uni_Autocart
|
| 6 |
+
* @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
|
| 7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
| 8 |
+
*/
|
| 9 |
+
|
| 10 |
+
class Uni_Autocart_Model_Autocart extends Mage_Core_Model_Abstract
|
| 11 |
+
{
|
| 12 |
+
public function _construct()
|
| 13 |
+
{
|
| 14 |
+
parent::_construct();
|
| 15 |
+
$this->_init('autocart/autocart');
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
}
|
app/code/community/Uni/Autocart/Model/Mysql4/Autocart.php
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Unicode Systems
|
| 4 |
+
* @category Uni
|
| 5 |
+
* @package Uni_Autocart
|
| 6 |
+
* @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
|
| 7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
| 8 |
+
*/
|
| 9 |
+
|
| 10 |
+
class Uni_Autocart_Model_Mysql4_Autocart extends Mage_Core_Model_Mysql4_Abstract
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
public function _construct()
|
| 14 |
+
{
|
| 15 |
+
$this->_init('autocart/autocart', 'id');
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
}
|
app/code/community/Uni/Autocart/Model/Mysql4/Autocart/Collection.php
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Unicode Systems
|
| 4 |
+
* @category Uni
|
| 5 |
+
* @package Uni_Autocart
|
| 6 |
+
* @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
|
| 7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
| 8 |
+
*/
|
| 9 |
+
|
| 10 |
+
class Uni_Autocart_Model_Mysql4_Autocart_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
public function _construct()
|
| 14 |
+
{
|
| 15 |
+
parent::_construct();
|
| 16 |
+
$this->_init('autocart/autocart');
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
}
|
app/code/community/Uni/Autocart/Model/Observer.php
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Unicode Systems
|
| 4 |
+
* @category Uni
|
| 5 |
+
* @package Uni_Autocart
|
| 6 |
+
* @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
|
| 7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
| 8 |
+
*/
|
| 9 |
+
|
| 10 |
+
class Uni_Autocart_Model_Observer {
|
| 11 |
+
|
| 12 |
+
public function checkAutocart($observer) {
|
| 13 |
+
$event = $observer->getEvent();
|
| 14 |
+
$quote_item = $event->getQuoteItem();
|
| 15 |
+
$_a = Mage::getSingleton('core/session')->getAutoFree();
|
| 16 |
+
$cartModel = Mage::getModel('checkout/cart');
|
| 17 |
+
$quote = Mage::getSingleton('checkout/session')->getQuote();
|
| 18 |
+
$_catCollection = $quote_item->getProduct()->getCategoryCollection();
|
| 19 |
+
$_autoCartRuleCollection = Mage::getModel('autocart/autocart')->getCollection();
|
| 20 |
+
|
| 21 |
+
foreach ($_catCollection as $_category):
|
| 22 |
+
foreach ($_autoCartRuleCollection as $_autocartCol):
|
| 23 |
+
if ($_autocartCol->getIsActive()) {
|
| 24 |
+
$_autoCat = explode(',', $_autocartCol->getCategoryIds());
|
| 25 |
+
if (in_array($_category->getId(), $_autoCat)) {
|
| 26 |
+
$_autoProducts = explode(',', $_autocartCol->getProductIds());
|
| 27 |
+
for ($i = 0; $i < count($_autoProducts); $i++):
|
| 28 |
+
if (is_numeric($_autoProducts[$i])) {
|
| 29 |
+
$_product = Mage::getModel('catalog/product')->load($_autoProducts[$i]);
|
| 30 |
+
$cartModel->init();
|
| 31 |
+
$stockItem = $_product->getStockItem();
|
| 32 |
+
if ($stockItem->getIsInStock()) {
|
| 33 |
+
if (!$quote->hasProductId($_autoProducts[$i])) {
|
| 34 |
+
$cartModel->addProduct($_product, array('qty' => 1));
|
| 35 |
+
}
|
| 36 |
+
}
|
| 37 |
+
}
|
| 38 |
+
endfor;
|
| 39 |
+
}
|
| 40 |
+
}
|
| 41 |
+
endforeach;
|
| 42 |
+
endforeach;
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
}
|
app/code/community/Uni/Autocart/controllers/Adminhtml/AutocartController.php
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Unicode Systems
|
| 5 |
+
* @category Uni
|
| 6 |
+
* @package Uni_Autocart
|
| 7 |
+
* @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
|
| 8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
| 9 |
+
*/
|
| 10 |
+
|
| 11 |
+
class Uni_Autocart_Adminhtml_AutocartController extends Mage_Adminhtml_Controller_Action {
|
| 12 |
+
|
| 13 |
+
protected function _initAction() {
|
| 14 |
+
$this->loadLayout();
|
| 15 |
+
$this->_setActiveMenu('autocart');
|
| 16 |
+
$this->_addBreadcrumb(Mage::helper('autocart')->__('Autocarts'), Mage::helper('autocart')->__('Autocarts'));
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
public function indexAction() {
|
| 20 |
+
$this->_initAction();
|
| 21 |
+
$this->renderLayout();
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
/**
|
| 25 |
+
* View edit form action
|
| 26 |
+
*/
|
| 27 |
+
public function editAction() {
|
| 28 |
+
$this->_initAction();
|
| 29 |
+
$this->_addContent($this->getLayout()->createBlock('autocart/adminhtml_autocart_edit'))->_addLeft($this->getLayout()->createBlock("autocart/adminhtml_autocart_edit_tabs"));
|
| 30 |
+
$this->renderLayout();
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
/**
|
| 34 |
+
* View new form action
|
| 35 |
+
*/
|
| 36 |
+
public function newAction() {
|
| 37 |
+
$this->_forward('edit');
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
/**
|
| 41 |
+
* Save form action
|
| 42 |
+
*/
|
| 43 |
+
public function saveAction() {
|
| 44 |
+
if ($this->getRequest()->getPost()) {
|
| 45 |
+
|
| 46 |
+
try {
|
| 47 |
+
|
| 48 |
+
$data = $this->getRequest()->getPost();
|
| 49 |
+
$model = Mage::getModel('autocart/autocart');
|
| 50 |
+
$products = $this->getRequest()->getPost('products', -1);
|
| 51 |
+
if ($products != -1) {
|
| 52 |
+
$model->setProductIds(Mage::helper('adminhtml/js')->decodeGridSerializedInput($products));
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
$model->setData($data);
|
| 56 |
+
$model->setWebsiteIds(implode(",", $data['website_ids']));
|
| 57 |
+
$model->setCategoryIds(implode(",", $data['category_ids']));
|
| 58 |
+
$model->setCustomerGroupIds(implode(",", $data['customer_group_ids']));
|
| 59 |
+
$model->setProductIds(implode(",", $data['product_ids']));
|
| 60 |
+
$model->setId($this->getRequest()->getParam('id'))->save();
|
| 61 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('autocart')->__('Autocart rule was successfully saved'));
|
| 62 |
+
} catch (Exception $e) {
|
| 63 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
| 64 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
| 65 |
+
return;
|
| 66 |
+
}
|
| 67 |
+
}
|
| 68 |
+
if ($this->getRequest()->getParam('back')) {
|
| 69 |
+
$this->_redirect(
|
| 70 |
+
'*/*/edit', array(
|
| 71 |
+
'id' => $model->getId(),
|
| 72 |
+
)
|
| 73 |
+
);
|
| 74 |
+
return;
|
| 75 |
+
}
|
| 76 |
+
$this->_redirect('*/*/');
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
/**
|
| 80 |
+
* Delete action
|
| 81 |
+
*/
|
| 82 |
+
public function deleteAction() {
|
| 83 |
+
if ($this->getRequest()->getParam('id') > 0) {
|
| 84 |
+
try {
|
| 85 |
+
$model = Mage::getModel('autocart/autocart');
|
| 86 |
+
$model->setId($this->getRequest()->getParam('id'))
|
| 87 |
+
->delete();
|
| 88 |
+
if (isset($x)):
|
| 89 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('autocart')->__('Autocart rule was successfully deleted'));
|
| 90 |
+
endif;
|
| 91 |
+
$this->_redirect('*/*/');
|
| 92 |
+
} catch (Exception $e) {
|
| 93 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
| 94 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
| 95 |
+
}
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
$this->_redirect('*/*/');
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
public function massDeleteAction() {
|
| 102 |
+
$entryIds = $this->getRequest()->getParam('id');
|
| 103 |
+
if (!is_array($entryIds)) {
|
| 104 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('autocart')->__('Please select entries.'));
|
| 105 |
+
} else {
|
| 106 |
+
try {
|
| 107 |
+
$myModel = Mage::getModel('autocart/autocart');
|
| 108 |
+
foreach ($entryIds as $entryId) {
|
| 109 |
+
$myModel->load($entryId)->delete();
|
| 110 |
+
}
|
| 111 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
| 112 |
+
Mage::helper('autocart')->__(
|
| 113 |
+
'Total of %d record(s) were deleted.', count($entryIds)
|
| 114 |
+
)
|
| 115 |
+
);
|
| 116 |
+
} catch (Exception $e) {
|
| 117 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
| 118 |
+
}
|
| 119 |
+
}
|
| 120 |
+
$this->_redirect('*/*/index');
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
public function massStatusAction() {
|
| 124 |
+
$entryIds = $this->getRequest()->getParam('id');
|
| 125 |
+
$isActive = $this->getRequest()->getParam('is_active');
|
| 126 |
+
if (!is_array($entryIds)) {
|
| 127 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('autocart')->__('Please select entries.'));
|
| 128 |
+
} else {
|
| 129 |
+
try {
|
| 130 |
+
$myModel = Mage::getModel('autocart/autocart');
|
| 131 |
+
foreach ($entryIds as $entryId) {
|
| 132 |
+
$myModel->load($entryId)->setIsActive($isActive);
|
| 133 |
+
$myModel->save();
|
| 134 |
+
}
|
| 135 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
| 136 |
+
Mage::helper('autocart')->__(
|
| 137 |
+
'Total of %d rules(s) were Updated.', count($entryIds)
|
| 138 |
+
)
|
| 139 |
+
);
|
| 140 |
+
} catch (Exception $e) {
|
| 141 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
| 142 |
+
}
|
| 143 |
+
}
|
| 144 |
+
$this->_redirect('*/*/index');
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
protected function _isAllowed() {
|
| 148 |
+
return Mage::getSingleton('admin/session')->isAllowed('autocart');
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
public function productAction() {
|
| 152 |
+
|
| 153 |
+
$this->loadLayout();
|
| 154 |
+
$this->getLayout()->getBlock('product.grid')
|
| 155 |
+
->setProducts($this->getRequest()->getPost('products', null));
|
| 156 |
+
$this->renderLayout();
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
public function productGridAction() {
|
| 160 |
+
|
| 161 |
+
$this->loadLayout();
|
| 162 |
+
$this->getLayout()->getBlock('product.grid')
|
| 163 |
+
->setProducts($this->getRequest()->getPost('products', null));
|
| 164 |
+
$this->renderLayout();
|
| 165 |
+
}
|
| 166 |
+
|
| 167 |
+
}
|
app/code/community/Uni/Autocart/controllers/IndexController.php
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Unicode Systems
|
| 4 |
+
* @category Uni
|
| 5 |
+
* @package Uni_Autocart
|
| 6 |
+
* @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
|
| 7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
| 8 |
+
*/
|
| 9 |
+
|
| 10 |
+
class Uni_Autocart_IndexController extends Mage_Core_Controller_Front_Action
|
| 11 |
+
{
|
| 12 |
+
public function indexAction()
|
| 13 |
+
{
|
| 14 |
+
$this->loadLayout();
|
| 15 |
+
$this->renderLayout();
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
}
|
app/code/community/Uni/Autocart/etc/adminhtml.xml
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<!--
|
| 3 |
+
/**
|
| 4 |
+
* Unicode Systems
|
| 5 |
+
* @category Uni
|
| 6 |
+
* @package Uni_Autocart
|
| 7 |
+
* @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
|
| 8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
| 9 |
+
*/
|
| 10 |
+
-->
|
| 11 |
+
<config>
|
| 12 |
+
<menu>
|
| 13 |
+
<promo>
|
| 14 |
+
<children>
|
| 15 |
+
<autocart module="autocart">
|
| 16 |
+
<title>Auto Add To Cart Rules</title>
|
| 17 |
+
<sort_order>151</sort_order>
|
| 18 |
+
<action>adminhtml/autocart</action>
|
| 19 |
+
</autocart>
|
| 20 |
+
</children>
|
| 21 |
+
</promo>
|
| 22 |
+
</menu>
|
| 23 |
+
<acl>
|
| 24 |
+
<resources>
|
| 25 |
+
<all>
|
| 26 |
+
<title>Allow Everything</title>
|
| 27 |
+
</all>
|
| 28 |
+
<admin>
|
| 29 |
+
<children>
|
| 30 |
+
<system>
|
| 31 |
+
<children>
|
| 32 |
+
<config>
|
| 33 |
+
<children>
|
| 34 |
+
<addfree>
|
| 35 |
+
<title>AddFree</title>
|
| 36 |
+
</addfree>
|
| 37 |
+
</children>
|
| 38 |
+
</config>
|
| 39 |
+
</children>
|
| 40 |
+
</system>
|
| 41 |
+
</children>
|
| 42 |
+
</admin>
|
| 43 |
+
</resources>
|
| 44 |
+
</acl>
|
| 45 |
+
</config>
|
app/code/community/Uni/Autocart/etc/config.xml
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<!--
|
| 3 |
+
/**
|
| 4 |
+
* Unicode Systems
|
| 5 |
+
* @category Uni
|
| 6 |
+
* @package Uni_Autocart
|
| 7 |
+
* @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
|
| 8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
| 9 |
+
*/
|
| 10 |
+
-->
|
| 11 |
+
|
| 12 |
+
<config>
|
| 13 |
+
<modules>
|
| 14 |
+
<Uni_Autocart>
|
| 15 |
+
<version>1.0.0</version>
|
| 16 |
+
</Uni_Autocart>
|
| 17 |
+
</modules>
|
| 18 |
+
<adminhtml>
|
| 19 |
+
<layout>
|
| 20 |
+
<updates>
|
| 21 |
+
<autocart>
|
| 22 |
+
<file>autocart.xml</file>
|
| 23 |
+
</autocart>
|
| 24 |
+
</updates>
|
| 25 |
+
</layout>
|
| 26 |
+
</adminhtml>
|
| 27 |
+
<admin>
|
| 28 |
+
<routers>
|
| 29 |
+
<adminhtml>
|
| 30 |
+
<args>
|
| 31 |
+
<modules>
|
| 32 |
+
<autocart before="Mage_Adminhtml">Uni_Autocart_Adminhtml</autocart>
|
| 33 |
+
</modules>
|
| 34 |
+
</args>
|
| 35 |
+
</adminhtml>
|
| 36 |
+
</routers>
|
| 37 |
+
</admin>
|
| 38 |
+
<global>
|
| 39 |
+
<blocks>
|
| 40 |
+
<autocart>
|
| 41 |
+
<class>Uni_Autocart_Block</class>
|
| 42 |
+
</autocart>
|
| 43 |
+
</blocks>
|
| 44 |
+
<models>
|
| 45 |
+
<autocart>
|
| 46 |
+
<class>Uni_Autocart_Model</class>
|
| 47 |
+
<resourceModel>autocart_mysql4</resourceModel>
|
| 48 |
+
</autocart>
|
| 49 |
+
<autocart_mysql4>
|
| 50 |
+
<class>Uni_Autocart_Model_Mysql4</class>
|
| 51 |
+
<entities>
|
| 52 |
+
<autocart>
|
| 53 |
+
<table>uni_autocart</table>
|
| 54 |
+
</autocart>
|
| 55 |
+
</entities>
|
| 56 |
+
</autocart_mysql4>
|
| 57 |
+
</models>
|
| 58 |
+
<helpers>
|
| 59 |
+
<autocart>
|
| 60 |
+
<class>Uni_Autocart_Helper</class>
|
| 61 |
+
</autocart>
|
| 62 |
+
</helpers>
|
| 63 |
+
<resources>
|
| 64 |
+
<autocart_setup>
|
| 65 |
+
<setup>
|
| 66 |
+
<module>Uni_Autocart</module>
|
| 67 |
+
</setup>
|
| 68 |
+
<connection>
|
| 69 |
+
<use>core_setup</use>
|
| 70 |
+
</connection>
|
| 71 |
+
</autocart_setup>
|
| 72 |
+
<autocart_write>
|
| 73 |
+
<connection>
|
| 74 |
+
<use>core_write</use>
|
| 75 |
+
</connection>
|
| 76 |
+
</autocart_write>
|
| 77 |
+
<autocart_read>
|
| 78 |
+
<connection>
|
| 79 |
+
<use>core_read</use>
|
| 80 |
+
</connection>
|
| 81 |
+
</autocart_read>
|
| 82 |
+
</resources>
|
| 83 |
+
<events>
|
| 84 |
+
<sales_quote_add_item>
|
| 85 |
+
<observers>
|
| 86 |
+
<uni_autocart>
|
| 87 |
+
<type>singleton</type>
|
| 88 |
+
<class>Uni_Autocart_Model_Observer</class>
|
| 89 |
+
<method>checkAutocart</method>
|
| 90 |
+
</uni_autocart>
|
| 91 |
+
</observers>
|
| 92 |
+
</sales_quote_add_item>
|
| 93 |
+
</events>
|
| 94 |
+
</global>
|
| 95 |
+
</config>
|
app/code/community/Uni/Autocart/sql/autocart_setup/mysql4-install-1.0.0.php
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
<?php
|
| 3 |
+
|
| 4 |
+
/**
|
| 5 |
+
* Unicode Systems
|
| 6 |
+
* @category Uni
|
| 7 |
+
* @package Uni_Autocart
|
| 8 |
+
* @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
|
| 9 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
| 10 |
+
*/
|
| 11 |
+
|
| 12 |
+
$installer = $this;
|
| 13 |
+
|
| 14 |
+
$installer->startSetup();
|
| 15 |
+
|
| 16 |
+
$installer->run("
|
| 17 |
+
|
| 18 |
+
DROP TABLE IF EXISTS {$this->getTable('uni_autocart')};
|
| 19 |
+
|
| 20 |
+
CREATE TABLE {$this->getTable('uni_autocart')} (
|
| 21 |
+
`id` bigint(20) NOT NULL primary key auto_increment,
|
| 22 |
+
`rule_name` VARCHAR( 255 ) NOT NULL,
|
| 23 |
+
`description` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
| 24 |
+
`is_active` tinyint(4) NOT NULL default '2',
|
| 25 |
+
`category_ids` VARCHAR( 255 ) NOT NULL,
|
| 26 |
+
`product_ids` VARCHAR( 2555 ) NOT NULL,
|
| 27 |
+
`update_time` TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
| 28 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
| 29 |
+
");
|
| 30 |
+
|
| 31 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/layout/autocart.xml
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<!--
|
| 3 |
+
/**
|
| 4 |
+
* Unicode Systems
|
| 5 |
+
* @category Uni
|
| 6 |
+
* @package Uni_Autocart
|
| 7 |
+
* @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
|
| 8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
| 9 |
+
*/
|
| 10 |
+
-->
|
| 11 |
+
<layout version="0.1.0">
|
| 12 |
+
<adminhtml_autocart_index>
|
| 13 |
+
<reference name="content">
|
| 14 |
+
<block type="autocart/adminhtml_autocart" name="autocart" />
|
| 15 |
+
</reference>
|
| 16 |
+
</adminhtml_autocart_index>
|
| 17 |
+
<adminhtml_autocart_product>
|
| 18 |
+
<block type="core/text_list" name="root" output="toHtml">
|
| 19 |
+
<block type="autocart/adminhtml_autocart_edit_tab_product" name="product.grid"/>
|
| 20 |
+
<block type="adminhtml/widget_grid_serializer" name="grid_serializer">
|
| 21 |
+
<reference name="grid_serializer">
|
| 22 |
+
<action method="initSerializerBlock">
|
| 23 |
+
<grid_block_name>product.grid</grid_block_name>
|
| 24 |
+
<data_callback>getSelectedProducts</data_callback>
|
| 25 |
+
<hidden_input_name>links[products]</hidden_input_name>
|
| 26 |
+
<reload_param_name>products</reload_param_name>
|
| 27 |
+
</action>
|
| 28 |
+
<action method="addColumnInputName">
|
| 29 |
+
<input_name>position</input_name>
|
| 30 |
+
</action>
|
| 31 |
+
</reference>
|
| 32 |
+
</block>
|
| 33 |
+
</block>
|
| 34 |
+
</adminhtml_autocart_product>
|
| 35 |
+
<adminhtml_autocart_productgrid>
|
| 36 |
+
<block type="core/text_list" name="root" output="toHtml">
|
| 37 |
+
<block type="autocart/adminhtml_autocart_edit_tab_product" name="product.grid"/>
|
| 38 |
+
</block>
|
| 39 |
+
</adminhtml_autocart_productgrid>
|
| 40 |
+
</layout>
|
app/etc/modules/Uni_Autocart.xml
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<!--
|
| 3 |
+
/**
|
| 4 |
+
* Unicode Systems
|
| 5 |
+
* @category Uni
|
| 6 |
+
* @package Uni_Autocart
|
| 7 |
+
* @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
|
| 8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
| 9 |
+
*/
|
| 10 |
+
-->
|
| 11 |
+
|
| 12 |
+
<config>
|
| 13 |
+
<modules>
|
| 14 |
+
<Uni_Autocart>
|
| 15 |
+
<active>true</active>
|
| 16 |
+
<codePool>community</codePool>
|
| 17 |
+
</Uni_Autocart>
|
| 18 |
+
</modules>
|
| 19 |
+
</config>
|
package.xml
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<package>
|
| 3 |
+
<name>Autocart_Extension</name>
|
| 4 |
+
<version>1.0.0</version>
|
| 5 |
+
<stability>stable</stability>
|
| 6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
|
| 7 |
+
<channel>community</channel>
|
| 8 |
+
<extends/>
|
| 9 |
+
<summary>This extension add products to cart automatically based on other products already in cart by set of rules.</summary>
|
| 10 |
+
<description>This extension add products to cart automatically based on other products already in cart by set of rules. This is good for advertising etc.</description>
|
| 11 |
+
<notes>First Release</notes>
|
| 12 |
+
<authors><author><name>Unicode Systems</name><user>Unicode_Systems</user><email>magento@unicodesystems.in</email></author></authors>
|
| 13 |
+
<date>2014-11-14</date>
|
| 14 |
+
<time>05:03:20</time>
|
| 15 |
+
<contents><target name="magecommunity"><dir name="Uni"><dir name="Autocart"><dir name="Block"><dir name="Adminhtml"><dir name="Autocart"><dir name="Edit"><file name="Form.php" hash="62ef5a53e74b1b20f9d4ef461a3322fa"/><dir name="Tab"><file name="Form.php" hash="9ca9305b45d8189d9446498078fded03"/><file name="Form2.php" hash="d2dbaeacfbb94c4592e1a0dd0fb7d371"/><file name="Form3.php" hash="ca21646b9b3514c8b32e54d1526712d2"/><file name="Product.php" hash="3c3525135488a0d5a73256a77647ef65"/></dir><file name="Tabs.php" hash="b0d2314a88fb907638cf8f788686f193"/></dir><file name="Edit.php" hash="ef472bde54fadff7c05e087a989cb63f"/><file name="Grid.php" hash="2a77545a66086022489bff021b93d83d"/></dir><file name="Autocart.php" hash="a7255b9dd4b3ddfe59414e712e346285"/></dir><file name="Autocart.php" hash="263c83ceb6c7c48600bd049fc8c33592"/></dir><dir name="Helper"><file name="Data.php" hash="00f2d90f52b13b3e28b35ab41a265d44"/></dir><dir name="Model"><file name="Autocart.php" hash="e62d7e6a4d110a9e465a2cca7888cd8e"/><dir name="Mysql4"><dir name="Autocart"><file name="Collection.php" hash="ef8fa8288a7e787ed5d936d84a181e85"/></dir><file name="Autocart.php" hash="e8f7173d6f886f59a4b92781fe0b0c80"/></dir><file name="Observer.php" hash="6505eec8a3daecf37354b4138f3fd018"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="AutocartController.php" hash="d9b4cf4b90df31f81231f0690b39702c"/></dir><file name="IndexController.php" hash="c51125f04554046d3bad2d1db8cc140a"/></dir><dir name="etc"><file name="adminhtml.xml" hash="3632dd8a383240eb785dbe435442a4d3"/><file name="config.xml" hash="9896ce482483034205e2116fb0c55e36"/></dir><dir name="sql"><dir name="autocart_setup"><file name="mysql4-install-1.0.0.php" hash="5706c1dc029cc83516e7f171a641fc1b"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Uni_Autocart.xml" hash="cb5d93e4c8c2efe78e20b6a09f93616c"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="autocart.xml" hash="339ca60b5f7c1cbbddab27607e84ab6e"/></dir></dir></dir></dir></target></contents>
|
| 16 |
+
<compatible/>
|
| 17 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.6.0.0</min><max>1.8.1.0</max></package><extension><name>gd</name><min>2.0.28</min><max>3.0</max></extension></required></dependencies>
|
| 18 |
+
</package>
|
