Wholesale_Customer_Activation - Version 4.0.0

Version Notes

Design Fixes

Download this release

Release Info

Developer Team FireGento
Extension Wholesale_Customer_Activation
Version 4.0.0
Comparing to
See all releases


Code changes from version 3.0.0 to 4.0.0

Files changed (49) hide show
  1. app/code/community/Exinent/CustomerActivation/Block/Adminhtml/Customer/Edit/Tab/Customerimages.php +44 -0
  2. app/code/community/Exinent/CustomerActivation/Block/Adminhtml/System/Config/Date.php +23 -0
  3. app/code/community/Exinent/CustomerActivation/Block/Adminhtml/Widget/Grid/Column/Renderer/Boolean.php +25 -0
  4. app/code/community/Exinent/CustomerActivation/Block/Orderproduct.php +119 -0
  5. app/code/community/Exinent/CustomerActivation/Block/Page/Html/Topmenu.php +29 -0
  6. app/code/community/Exinent/CustomerActivation/Block/Purchaseorder.php +10 -0
  7. app/code/community/Exinent/CustomerActivation/Block/Purchaseorderinfo.php +15 -0
  8. app/code/community/Exinent/CustomerActivation/Helper/Data.php +168 -0
  9. app/code/community/Exinent/CustomerActivation/Model/Adminhtml/System/Config/Source/Categories/Group/Multiselect.php +27 -0
  10. app/code/community/Exinent/CustomerActivation/Model/Adminhtml/System/Config/Source/Customer/Group/Multiselect.php +18 -0
  11. app/code/community/Exinent/CustomerActivation/Model/Adminhtml/System/Config/Source/Pages/Group/Multiselect.php +15 -0
  12. app/code/community/Exinent/CustomerActivation/Model/Adminhtml/System/Config/Source/Products/Group/Multiselect.php +25 -0
  13. app/code/community/Exinent/CustomerActivation/Model/Adminhtml/System/Config/Source/Products/Price/Multiselect.php +25 -0
  14. app/code/community/Exinent/CustomerActivation/Model/Customer.php +15 -0
  15. app/code/community/Exinent/CustomerActivation/Model/Net15.php +25 -0
  16. app/code/community/Exinent/CustomerActivation/Model/Net30.php +25 -0
  17. app/code/community/Exinent/CustomerActivation/Model/Observer.php +327 -0
  18. app/code/community/Exinent/CustomerActivation/Model/Order.php +88 -0
  19. app/code/community/Exinent/CustomerActivation/Model/Resource/Attribute/Source/Customeractivation.php +41 -0
  20. app/code/community/Exinent/CustomerActivation/Model/Resource/Attribute/Source/Customerpayment.php +64 -0
  21. app/code/community/Exinent/CustomerActivation/Model/Resource/Attribute/Source/Customershippingmethods.php +63 -0
  22. app/code/community/Exinent/CustomerActivation/Model/Resource/Attribute/Source/Iswebsitelive.php +63 -0
  23. app/code/community/Exinent/CustomerActivation/Model/Resource/Attribute/Source/StoreType.php +91 -0
  24. app/code/community/Exinent/CustomerActivation/Model/Resource/Customer.php +63 -0
  25. app/code/community/Exinent/CustomerActivation/Model/Thirdparty.php +61 -0
  26. app/code/community/Exinent/CustomerActivation/Model/Thirdpartyfed.php +62 -0
  27. app/code/community/Exinent/CustomerActivation/Model/Thirdpartyfedex.php +68 -0
  28. app/code/community/Exinent/CustomerActivation/Model/Thirdpartyups.php +67 -0
  29. app/code/community/Exinent/CustomerActivation/controllers/AccountController.php +171 -0
  30. app/code/community/Exinent/CustomerActivation/controllers/AdminController.php +93 -0
  31. app/code/community/Exinent/CustomerActivation/controllers/CategoryController.php +77 -0
  32. app/code/community/Exinent/CustomerActivation/controllers/IndexController.php +29 -0
  33. app/code/community/Exinent/CustomerActivation/controllers/PageController.php +53 -0
  34. app/code/community/Exinent/CustomerActivation/controllers/ProductController.php +73 -0
  35. app/code/community/Exinent/CustomerActivation/controllers/productOrderController.php +93 -0
  36. app/code/community/Exinent/CustomerActivation/etc/config.xml +288 -0
  37. app/code/community/Exinent/CustomerActivation/etc/system.xml +383 -0
  38. app/code/community/Exinent/CustomerActivation/sql/customeractivation_setup/install-0.1.0.php +9 -0
  39. app/code/community/Exinent/CustomerActivation/sql/customeractivation_setup/mysql4-install-0.1.0.php +18 -0
  40. app/code/community/Exinent/CustomerActivation/sql/customeractivation_setup/mysql4-upgrade-0.2.3-0.2.4.php +8 -0
  41. app/code/community/Exinent/CustomerActivation/sql/customeractivation_setup/mysql4-upgrade-0.2.4-0.2.5.php +11 -0
  42. app/code/community/Exinent/CustomerActivation/sql/customeractivation_setup/mysql4-upgrade-0.2.7-0.2.8.php +14 -0
  43. app/code/community/Exinent/CustomerActivation/sql/customeractivation_setup/mysql4-upgrade-0.2.8-0.2.9.php +68 -0
  44. app/code/community/Exinent/CustomerActivation/sql/customeractivation_setup/mysql4-upgrade-0.2.9-0.3.0.php +10 -0
  45. app/code/community/Exinent/CustomerActivation/sql/customeractivation_setup/mysql4-upgrade-0.3.0-0.3.1.php +24 -0
  46. app/code/community/Exinent/CustomerActivation/sql/customeractivation_setup/mysql4-upgrade-0.3.1-0.3.2.php +156 -0
  47. app/code/community/Exinent/CustomerActivation/sql/customeractivation_setup/mysql4-upgrade-0.3.2-0.3.3.php +14 -0
  48. app/code/community/Exinent/CustomerActivation/sql/customeractivation_setup/mysql4-upgrade-0.3.3-0.3.4.php +34 -0
  49. package.xml +3 -3
app/code/community/Exinent/CustomerActivation/Block/Adminhtml/Customer/Edit/Tab/Customerimages.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Exinent_CustomerActivation_Block_Adminhtml_Customer_Edit_Tab_Customerimages extends Mage_Adminhtml_Block_Template implements Mage_Adminhtml_Block_Widget_Tab_Interface {
4
+
5
+ public function __construct() {
6
+ parent::_construct();
7
+ $this->setTemplate('customerActivation/customerImages.phtml');
8
+ }
9
+
10
+ public function getCustomtabInfo() {
11
+ $customer = Mage::registry('current_customer');
12
+ $customtab = 'My Custom tab Action Contents Here';
13
+ return $customtab;
14
+ }
15
+
16
+ public function getTabLabel() {
17
+ return $this->__('CustomerImages');
18
+ }
19
+
20
+ public function getTabTitle() {
21
+ return $this->__('Customer Uploded Images');
22
+ }
23
+
24
+ public function canShowTab() {
25
+ $customer = Mage::registry('current_customer');
26
+ return (bool) $customer->getId();
27
+ }
28
+
29
+ public function isHidden() {
30
+ return false;
31
+ }
32
+
33
+ public function getAfter() {
34
+ return 'tags';
35
+ }
36
+
37
+ public function getCustomerimages() {
38
+ $customerId = $this->getRequest()->getParam('id');
39
+ $customerObject = Mage::getModel('customer/customer')->load($customerId);
40
+
41
+ return $customerObject;
42
+ }
43
+
44
+ }
app/code/community/Exinent/CustomerActivation/Block/Adminhtml/System/Config/Date.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Exinent_CustomerActivation_Block_Adminhtml_System_Config_Date extends Mage_Adminhtml_Block_System_Config_Form_Field
3
+ {
4
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
5
+ {
6
+ $date = new Varien_Data_Form_Element_Date;
7
+ $format = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
8
+
9
+ $data = array(
10
+ 'name' => $element->getName(),
11
+ 'html_id' => $element->getId(),
12
+ 'image' => $this->getSkinUrl('images/grid-cal.gif'),
13
+ );
14
+ $date->setData($data);
15
+ $date->setValue($element->getValue(), $format);
16
+ $date->setFormat(Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT));
17
+ $date->setClass($element->getFieldConfig()->validate->asArray());
18
+ $date->setForm($element->getForm());
19
+
20
+ return $date->getElementHtml();
21
+ }
22
+ }
23
+ ?>
app/code/community/Exinent/CustomerActivation/Block/Adminhtml/Widget/Grid/Column/Renderer/Boolean.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Exinent_CustomerActivation_Block_Adminhtml_Widget_Grid_Column_Renderer_Boolean extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Text {
4
+
5
+ public function render(Varien_Object $row) {
6
+ $data = $row->getCustomerActivated();
7
+ if ($data == 'New')
8
+ $data = 3;
9
+ switch ($data) {
10
+ case 1:
11
+ return $this->__('Approved');
12
+ case 2:
13
+ return $this->__('Pending');
14
+ case 0:
15
+ return $this->__('Rejected');
16
+ case 3:
17
+ return $this->__('New');
18
+ case 4:
19
+ return $this->__('In Active');
20
+ case 5:
21
+ return $this->__('On Hold');
22
+ }
23
+ }
24
+
25
+ }
app/code/community/Exinent/CustomerActivation/Block/Orderproduct.php ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Exinent_CustomerActivation_Block_Orderproduct extends Mage_Core_Block_Template {
4
+
5
+ public function getSubCategories() {
6
+ $cat = Mage::getModel('catalog/category')->load(2);
7
+ return $cat->getChildren();
8
+ }
9
+
10
+ public function getCategoryObject($subCatid) {
11
+ return Mage::getModel('catalog/category')->load($subCatid);
12
+ }
13
+
14
+ public function getProductCollection($_category) {
15
+ $productCollection = Mage::getResourceModel('catalog/product_collection')
16
+ ->addCategoryFilter($_category)
17
+ ->addAttributeToFilter('type_id', 'configurable')
18
+ ->addAttributeToSelect('*');
19
+ return $productCollection;
20
+ }
21
+
22
+ public function loadProduct($productId) {
23
+ return Mage::getModel('catalog/product')->load($productId);
24
+ }
25
+
26
+ public function getAttributes($product) {
27
+ $attributes = $product->getTypeInstance(true)->getConfigurableAttributes($product);
28
+ return $attributes;
29
+ }
30
+
31
+ public function getQty($product) {
32
+ $conf = Mage::getModel('catalog/product_type_configurable')->setProduct($product);
33
+ $simple_collection = $conf->getUsedProductCollection()->addAttributeToSelect('*')->addFilterByRequiredOptions();
34
+ $stockArray = array();
35
+ foreach ($simple_collection as $simple_product) {
36
+ if ($simple_product->isSaleable()) {
37
+ $stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($simple_product);
38
+ array_push($stockArray, $stock->getQty());
39
+ }
40
+ }
41
+ return $stockArray;
42
+ }
43
+
44
+ public function getSku($product) {
45
+ $conf = Mage::getModel('catalog/product_type_configurable')->setProduct($product);
46
+ $simple_collection = $conf->getUsedProductCollection()->addAttributeToSelect('*')->addFilterByRequiredOptions();
47
+ $stockArray = array();
48
+ foreach ($simple_collection as $simple_product) {
49
+ if ($simple_product->isSaleable()) {
50
+ array_push($stockArray, $simple_product->getId());
51
+ }
52
+ }
53
+ return $stockArray;
54
+ }
55
+
56
+ public function getOrderSimpleProducts() {
57
+
58
+ $collectionSimple = Mage::getResourceModel('catalog/product_collection')
59
+ ->addAttributeToFilter('type_id', array('eq' => 'simple'))->addAttributeToSelect('*');
60
+ $i = 0;
61
+ foreach ($collectionSimple as $product) {
62
+ if ($product->isSaleable()) {
63
+ $orderProduct[$i]['product_id'] = $product->getId();
64
+ $orderProduct[$i]['product_url'] = $product->getUrlKey();
65
+ $orderProduct[$i]['name'] = $product->getName();
66
+ $orderProduct[$i]['price'] = $product->getPrice();
67
+ $orderProduct[$i]['sku'] = $product->getSku();
68
+ $orderProduct[$i]['image'] = $product->getImageUrl();
69
+ $i++;
70
+ }
71
+ }
72
+ return $orderProduct;
73
+ }
74
+
75
+ public function getOrderProduct() {
76
+ $orderProducts = array();
77
+ $categoryArray = array();
78
+ $data = array();
79
+ $collectionSimple = Mage::getResourceModel('catalog/product_collection')
80
+ ->addAttributeToFilter('type_id', array('eq' => 'simple'));
81
+ $orderProduct['category'] = $_category->getName();
82
+ array_push($categoryArray, $_category->getName());
83
+ $orderProduct['name'] = $product->getName();
84
+ $orderProduct['image'] = $product->getImageUrl();
85
+ $orderProduct['qty'] = $this->getQty($product);
86
+ $orderProduct['sku'] = $this->getSku($product);
87
+
88
+ $subcats = $this->getSubCategories();
89
+ foreach (explode(',', $subcats) as $subCatid) {
90
+ $_category = $this->getCategoryObject($subCatid);
91
+ if ($_category->getIsActive()) {
92
+ $productCollection = $this->getProductCollection($_category);
93
+ foreach ($productCollection as $product) {
94
+ $orderProduct = array();
95
+ $product = $this->loadProduct($product->getId());
96
+ $orderProduct['category'] = $_category->getName();
97
+ array_push($categoryArray, $_category->getName());
98
+ $orderProduct['confsku'] = $product->getSku();
99
+ $orderProduct['conf_id'] = $product->getId();
100
+ $orderProduct['name'] = $product->getName();
101
+ $orderProduct['image'] = $product->getImageUrl();
102
+ $orderProduct['qty'] = $this->getQty($product);
103
+ $orderProduct['sku'] = $this->getSku($product);
104
+ if (empty($orderProduct['qty'])) {
105
+ continue;
106
+ }
107
+ array_push($orderProducts, $orderProduct);
108
+ }
109
+ }
110
+ }
111
+ $categoryuniquearray = array_unique($categoryArray);
112
+ $data[0] = $categoryuniquearray;
113
+ $data[1] = $orderProducts;
114
+ return $data;
115
+ }
116
+
117
+ }
118
+
119
+ ?>
app/code/community/Exinent/CustomerActivation/Block/Page/Html/Topmenu.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Exinent_CustomerActivation_Block_Page_Html_Topmenu extends Mage_Page_Block_Html_Topmenu {
4
+
5
+ protected $additionalLinks = array();
6
+
7
+ public function addLink($label, $type, $value) {
8
+ $ModuleStatus = Mage::getStoreConfig('customer/customeractivation/disable_ext');
9
+
10
+ if ('path' == $type && $ModuleStatus == 1) {
11
+ $_coreUrlHelper = $this->helper('core/url');
12
+ $currentPath = str_replace(Mage::getBaseUrl(), '', $_coreUrlHelper->getCurrentUrl());
13
+ $url = Mage::getUrl($value);
14
+ $data = array(
15
+ 'label' => $label,
16
+ 'url' => $url,
17
+ 'is_active' => (int) ($value == $currentPath),
18
+ );
19
+ $this->additionalLinks[$url] = $data;
20
+ }
21
+ }
22
+
23
+ public function getAdditionalLinks() {
24
+ return $this->additionalLinks;
25
+ }
26
+
27
+ }
28
+
29
+ ?>
app/code/community/Exinent/CustomerActivation/Block/Purchaseorder.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Exinent_CustomerActivation_Block_Purchaseorder extends Mage_Payment_Block_Form_Purchaseorder {
4
+
5
+ protected function _construct() {
6
+ parent::_construct();
7
+ $this->setTemplate('customerActivation/form/purchaseorder.phtml');
8
+ }
9
+
10
+ }
app/code/community/Exinent/CustomerActivation/Block/Purchaseorderinfo.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Exinent_CustomerActivation_Block_Purchaseorderinfo extends Mage_Payment_Block_Info {
4
+
5
+ protected function _construct() {
6
+ parent::_construct();
7
+ $this->setTemplate('customerActivation/info/purchaseorder.phtml');
8
+ }
9
+
10
+ public function toPdf() {
11
+ $this->setTemplate('payment/info/pdf/purchaseorder.phtml');
12
+ return $this->toHtml();
13
+ }
14
+
15
+ }
app/code/community/Exinent/CustomerActivation/Helper/Data.php ADDED
@@ -0,0 +1,168 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Exinent_CustomerActivation_Helper_Data extends Mage_Core_Helper_Abstract {
4
+
5
+ const XML_PATH_EMAIL_ADMIN_NOTIFICATION = 'customer/customeractivation/admin_email';
6
+ const XML_PATH_EMAIL_ADMIN_NOTIFICATION_TEMPLATE = 'customer/customeractivation/registration_admin_template';
7
+ const XML_PATH_EMAIL_CUSTOMER_NOTIFICATION_TEMPLATE = 'customer/customeractivation/activation_template';
8
+ const XML_PATH_ALERT_CUSTOMER = 'customer/customeractivation/alert_customer';
9
+ const XML_PATH_ALERT_ADMIN = 'customer/customeractivation/alert_admin';
10
+ const XML_PATH_DEFAULT_STATUS = 'customer/customeractivation/activation_status_default';
11
+ const XML_PATH_DEFAULT_STATUS_BY_GROUP = 'customer/customeractivation/require_activation_for_specific_groups';
12
+ const XML_PATH_DEFAULT_STATUS_GROUPS = 'customer/customeractivation/require_activation_groups';
13
+ const STATUS_ACTIVATE_WITHOUT_EMAIL = 1;
14
+ const STATUS_ACTIVATE_WITH_EMAIL = 2;
15
+ const STATUS_DEACTIVATE = 0;
16
+
17
+ protected $_origEmailDesignConfig;
18
+
19
+ public function sendAdminNotificationEmail(Mage_Customer_Model_Customer $customer) {
20
+ $storeId = $this->getCustomerStoreId($customer);
21
+ if (Mage::getStoreConfig(self::XML_PATH_ALERT_ADMIN, $storeId)) {
22
+ $to = $this->_getEmails(self::XML_PATH_EMAIL_ADMIN_NOTIFICATION, $storeId);
23
+ $storeId = Mage_Core_Model_App::ADMIN_STORE_ID;
24
+ $this->_sendNotificationEmail($to, $customer, self::XML_PATH_EMAIL_ADMIN_NOTIFICATION_TEMPLATE, $storeId);
25
+ }
26
+ return $this;
27
+ }
28
+
29
+ public function sendCustomerNotificationEmail(Mage_Customer_Model_Customer $customer) {
30
+ if (Mage::getStoreConfig(self::XML_PATH_ALERT_CUSTOMER, $this->getCustomerStoreId($customer))) {
31
+ $to = array(array(
32
+ 'name' => $customer->getName(),
33
+ 'email' => $customer->getEmail(),
34
+ ));
35
+ $this->_sendNotificationEmail($to, $customer, self::XML_PATH_EMAIL_CUSTOMER_NOTIFICATION_TEMPLATE);
36
+ }
37
+ return $this;
38
+ }
39
+
40
+ protected function _sendNotificationEmail($to, $customer, $templateConfigPath, $storeId = null) {
41
+ if (!$to)
42
+ return;
43
+ if (is_null($storeId)) {
44
+ $storeId = $this->getCustomerStoreId($customer);
45
+ }
46
+ $translate = Mage::getSingleton('core/translate')
47
+ ->setTranslateInline(false);
48
+ $mailTemplate = Mage::getModel('core/email_template');
49
+ $template = Mage::getStoreConfig($templateConfigPath, $storeId);
50
+ $sendTo = array();
51
+ foreach ($to as $recipient) {
52
+ if (is_array($recipient)) {
53
+ $sendTo[] = $recipient;
54
+ } else {
55
+ $sendTo[] = array('email' => $recipient, 'name' => null);
56
+ }
57
+ }
58
+
59
+ $this->_setEmailDesignConfig($mailTemplate, $storeId);
60
+ foreach ($sendTo as $recipient) {
61
+ $mailTemplate->sendTransactional(
62
+ $template, Mage::getStoreConfig(Mage_Customer_Model_Customer::XML_PATH_REGISTER_EMAIL_IDENTITY, $storeId), $recipient['email'], $recipient['name'], array(
63
+ 'customer' => $customer,
64
+ 'shipping' => $customer->getPrimaryShippingAddress(),
65
+ 'billing' => $customer->getPrimaryBillingAddress(),
66
+ 'store' => Mage::app()->getStore(
67
+ // In case of admin store emails, $storeId is set to 0.
68
+ // We want 'store' to always be set to the customers store.
69
+ $this->getCustomerStoreId($customer)
70
+ ),
71
+ )
72
+ );
73
+ }
74
+ $this->_revertEmailDesignConfig($mailTemplate);
75
+ $translate->setTranslateInline(true);
76
+ return $this;
77
+ }
78
+
79
+ protected function _setEmailDesignConfig(Mage_Core_Model_Email_Template $mailTemplate, $storeId) {
80
+ $this->_origEmailDesignConfig = null;
81
+
82
+ // Workaround for bug in Mage_Core_Model_Template where getDesignConfig is protected
83
+ if (is_callable(array($mailTemplate, 'getDesignConfig'))) {
84
+ // Use standard way to fetch the current design config (if possible)
85
+ $this->_origEmailDesignConfig = $mailTemplate->getDesignConfig();
86
+ } elseif (version_compare(phpversion(), '5.3.2', '>=')) {
87
+ // ReflectionMethod::setAccessible() is only available in 5.3.2 or newer
88
+ $method = new ReflectionMethod($mailTemplate, 'getDesignConfig');
89
+ if ($method->isProtected()) {
90
+ $method->setAccessible(true);
91
+ }
92
+ if ($this->_origEmailDesignConfig = $method->invoke($mailTemplate)) {
93
+ $this->_origEmailDesignConfig = $this->_origEmailDesignConfig->getData();
94
+ }
95
+ }
96
+
97
+ // Fallback if neither of the previous versions is available or if
98
+ // there was no design configuration set on the mail template instance
99
+ if (!$this->_origEmailDesignConfig) {
100
+ $this->_origEmailDesignConfig = array(
101
+ 'area' => Mage::app()->getStore()->isAdmin() ? 'adminhtml' : 'frontend',
102
+ 'store' => Mage::app()->getStore()->getId()
103
+ );
104
+ }
105
+
106
+ $mailTemplate->setDesignConfig(array(
107
+ 'area' => Mage::app()->getStore($storeId)->isAdmin() ? 'adminhtml' : 'frontend',
108
+ 'store' => $storeId)
109
+ );
110
+
111
+ return $this;
112
+ }
113
+
114
+ protected function _revertEmailDesignConfig(Mage_Core_Model_Email_Template $mailTemplate) {
115
+ $mailTemplate->setDesignConfig($this->_origEmailDesignConfig);
116
+ return $this;
117
+ }
118
+
119
+ protected function _getEmails($configPath, $storeId = null) {
120
+ $data = Mage::getStoreConfig($configPath, $storeId);
121
+ if (!empty($data)) {
122
+ return explode(',', $data);
123
+ }
124
+ return false;
125
+ }
126
+
127
+ public function getCustomerStoreId(Mage_Customer_Model_Customer $customer) {
128
+ if (!($storeId = $customer->getSendemailStoreId())) {
129
+ /*
130
+ * store_id might be zero if the account was created in the admin interface
131
+ */
132
+ $storeId = $customer->getStoreId();
133
+ if (!$storeId && $customer->getWebsiteId()) {
134
+ /*
135
+ * Use the default store groups store of the customers website
136
+ */
137
+ if ($store = Mage::app()->getWebsite($customer->getWebsiteId())->getDefaultStore()) {
138
+ $storeId = $store->getId();
139
+ }
140
+ }
141
+ // In case the website_id is not yet set on the customer, and the
142
+ // current store is a frontend store, use the current store ID
143
+ if (!$storeId && !Mage::app()->getStore()->isAdmin()) {
144
+ $storeId = Mage::app()->getStore()->getId();
145
+ }
146
+ }
147
+ return $storeId;
148
+ }
149
+
150
+ public function getDefaultActivationStatus($groupId, $storeId) {
151
+ $defaultIsActive = Mage::getStoreConfig(self::XML_PATH_DEFAULT_STATUS, $storeId);
152
+ $activateByGroup = Mage::getStoreConfig(self::XML_PATH_DEFAULT_STATUS_BY_GROUP, $storeId);
153
+
154
+ if (!$defaultIsActive && $activateByGroup) {
155
+ $notActiveGroups = explode(',', Mage::getStoreConfig(self::XML_PATH_DEFAULT_STATUS_GROUPS, $storeId));
156
+ $isActive = in_array($groupId, $notActiveGroups) ? false : true;
157
+ } else {
158
+ $isActive = $defaultIsActive;
159
+ }
160
+
161
+ return $isActive;
162
+ }
163
+
164
+ public function getCustomerGroupId() {
165
+ return Mage::getStoreConfig(self::XML_PATH_DEFAULT_STATUS_GROUPS);
166
+ }
167
+
168
+ }
app/code/community/Exinent/CustomerActivation/Model/Adminhtml/System/Config/Source/Categories/Group/Multiselect.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Exinent_CustomerActivation_Model_Adminhtml_System_Config_Source_Categories_Group_Multiselect {
4
+
5
+ protected $_options;
6
+
7
+ public function toOptionArray() {
8
+ if (!$this->_options) {
9
+ $categoryCollection = Mage::getModel('catalog/category')
10
+ ->getCollection()
11
+ ->addAttributeToFilter('parent_id', array('gt' => 1))
12
+ ->addAttributeToSelect('*')
13
+ ->addIsActiveFilter();
14
+ }
15
+ $optionArrays = array();
16
+ foreach ($categoryCollection as $category) {
17
+ $optionArray = array();
18
+ $optionArray['value'] = $category->getUrlKey();
19
+ $optionArray['label'] = $category->getName();
20
+ array_push($optionArrays, $optionArray);
21
+ }
22
+ $this->_options = $optionArrays;
23
+ array_unshift($this->_options, array('value' => '', 'label' => Mage::helper('adminhtml')->__('No Category Selected')));
24
+ return $this->_options;
25
+ }
26
+
27
+ }
app/code/community/Exinent/CustomerActivation/Model/Adminhtml/System/Config/Source/Customer/Group/Multiselect.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Exinent_CustomerActivation_Model_Adminhtml_System_Config_Source_Customer_Group_Multiselect {
4
+
5
+ protected $_options;
6
+
7
+ public function toOptionArray() {
8
+ if (!$this->_options) {
9
+ $this->_options = Mage::getResourceModel('customer/group_collection')
10
+ ->setRealGroupsFilter()
11
+ ->addFieldToFilter('customer_group_id', array('neq' => 1))
12
+ ->loadData()->toOptionArray();
13
+ array_unshift($this->_options, array('value' => '', 'label' => Mage::helper('adminhtml')->__('No Group Selected')));
14
+ }
15
+ return $this->_options;
16
+ }
17
+
18
+ }
app/code/community/Exinent/CustomerActivation/Model/Adminhtml/System/Config/Source/Pages/Group/Multiselect.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Exinent_CustomerActivation_Model_Adminhtml_System_Config_Source_Pages_Group_Multiselect {
4
+
5
+ protected $_options;
6
+
7
+ public function toOptionArray() {
8
+ if (!$this->_options) {
9
+ $this->_options = Mage::getModel('cms/page')->getCollection()->toOptionArray();
10
+ array_unshift($this->_options, array('value' => '', 'label' => Mage::helper('adminhtml')->__('No page Selected')));
11
+ }
12
+ return $this->_options;
13
+ }
14
+
15
+ }
app/code/community/Exinent/CustomerActivation/Model/Adminhtml/System/Config/Source/Products/Group/Multiselect.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Exinent_CustomerActivation_Model_Adminhtml_System_Config_Source_Products_Group_Multiselect {
4
+
5
+ protected $_options;
6
+
7
+ public function toOptionArray() {
8
+ if (!$this->_options) {
9
+ $categoryCollection = Mage::getModel('catalog/product')
10
+ ->getCollection()
11
+ ->addAttributeToSelect('*');
12
+ }
13
+ $optionArrays = array();
14
+ foreach ($categoryCollection as $category) {
15
+ $optionArray = array();
16
+ $optionArray['value'] = $category->getUrlKey();
17
+ $optionArray['label'] = $category->getName();
18
+ array_push($optionArrays, $optionArray);
19
+ }
20
+ $this->_options = $optionArrays;
21
+ array_unshift($this->_options, array('value' => '', 'label' => Mage::helper('adminhtml')->__('No Product Selected')));
22
+ return $this->_options;
23
+ }
24
+
25
+ }
app/code/community/Exinent/CustomerActivation/Model/Adminhtml/System/Config/Source/Products/Price/Multiselect.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Exinent_CustomerActivation_Model_Adminhtml_System_Config_Source_Products_Price_Multiselect {
4
+
5
+ protected $_options;
6
+
7
+ public function toOptionArray() {
8
+ if (!$this->_options) {
9
+ $categoryCollection = Mage::getModel('catalog/product')
10
+ ->getCollection()
11
+ ->addAttributeToSelect('*');
12
+ }
13
+ $optionArrays = array();
14
+ foreach ($categoryCollection as $category) {
15
+ $optionArray = array();
16
+ $optionArray['value'] = $category->getUrlKey();
17
+ $optionArray['label'] = $category->getName();
18
+ array_push($optionArrays, $optionArray);
19
+ }
20
+ $this->_options = $optionArrays;
21
+ array_unshift($this->_options, array('value' => '', 'label' => Mage::helper('adminhtml')->__('No Product Selected')));
22
+ return $this->_options;
23
+ }
24
+
25
+ }
app/code/community/Exinent/CustomerActivation/Model/Customer.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Exinent_CustomerActivation_Model_Customer extends Mage_Customer_Model_Customer {
4
+
5
+ public function authenticate($login, $password) {
6
+ $groupid = Mage::registry('groupId');
7
+ if ($groupid == 2) {
8
+ $collection = Mage::getModel('customer/customer')->getCollection()->addFieldToFilter('uniquelogin_id', $login);
9
+ $custData = $collection->getData();
10
+ $login = $custData[0]['email'];
11
+ }
12
+ return parent::authenticate($login, $password);
13
+ }
14
+
15
+ }
app/code/community/Exinent/CustomerActivation/Model/Net15.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Exinent_CustomerActivation_Model_Net15 extends Mage_Payment_Model_Method_Abstract {
4
+
5
+ /**
6
+ * unique internal payment method identifier
7
+ *
8
+ * @var string [a-z0-9_]
9
+ */
10
+ protected $_code = 'net15';
11
+ protected $_formBlockType = 'customeractivation/purchaseorder';
12
+ protected $_infoBlockType = 'customeractivation/purchaseorderinfo';
13
+
14
+ public function assignData($data) {
15
+ if (!($data instanceof Varien_Object)) {
16
+ $data = new Varien_Object($data);
17
+ }
18
+
19
+ $this->getInfoInstance()->setPoNumber($data->getPoNumber());
20
+
21
+
22
+ return $this;
23
+ }
24
+
25
+ }
app/code/community/Exinent/CustomerActivation/Model/Net30.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Exinent_CustomerActivation_Model_Net30 extends Mage_Payment_Model_Method_Purchaseorder {
4
+
5
+ /**
6
+ * unique internal payment method identifier
7
+ *
8
+ * @var string [a-z0-9_]
9
+ */
10
+ protected $_code = 'net30';
11
+ protected $_formBlockType = 'customeractivation/purchaseorder';
12
+ protected $_infoBlockType = 'customeractivation/purchaseorderinfo';
13
+
14
+ public function assignData($data) {
15
+ if (!($data instanceof Varien_Object)) {
16
+ $data = new Varien_Object($data);
17
+ }
18
+
19
+ $this->getInfoInstance()->setPoNumber($data->getPoNumber());
20
+
21
+
22
+ return $this;
23
+ }
24
+
25
+ }
app/code/community/Exinent/CustomerActivation/Model/Observer.php ADDED
@@ -0,0 +1,327 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Exinent_CustomerActivation_Model_Observer {
4
+
5
+ const XML_PATH_MODULE_DISABLED = 'customer/customeractivation/disable_ext';
6
+ const XML_PATH_ALWAYS_NOTIFY_ADMIN = 'customer/customeractivation/always_send_admin_email';
7
+ const XML_PATH_ACTIVATION_STATUS = 'customer/customeractivation/activation_status_default';
8
+ const XML_PATH_ACTIVATION_START_DATE = 'customer/customeractivation/date_start';
9
+ const XML_PATH_ACTIVATION_END_DATE = 'customer/customeractivation/date_end';
10
+
11
+ public function page_block_html_topmenu_gethtml_before(Varien_Event_Observer $observer) {
12
+
13
+ $session = Mage::getSingleton('customer/session');
14
+ $customerGroupId = $session->getCustomerGroupId();
15
+ if ($customerGroupId == 2) {
16
+ $event = $observer->getEvent();
17
+ $menu = $event->getMenu();
18
+ $menuCollection = $menu->getChildren();
19
+
20
+ if ($block = Mage::app()->getLayout()->getBlock('catalog.topnav')) {
21
+ if ($links = $block->getAdditionalLinks()) {
22
+ foreach ($links as $link) {
23
+ $data = array(
24
+ 'id' => 'category-additionalnode-' . crc32($link['url']),
25
+ 'name' => $link['label'],
26
+ 'url' => $link['url'],
27
+ 'is_active' => $link['is_active'],
28
+ );
29
+
30
+ $node = new Varien_Data_Tree_Node($data, 'id', $menu->getTree());
31
+ $menuCollection->add($node);
32
+ }
33
+ }
34
+ }
35
+ }
36
+ }
37
+
38
+ public function customerLogin($observer) {
39
+
40
+ if (Mage::getStoreConfig(self::XML_PATH_MODULE_DISABLED) == 0) {
41
+ return;
42
+ }
43
+
44
+ if ($this->_isApiRequest()) {
45
+ return;
46
+ }
47
+
48
+ $customer = $observer->getEvent()->getCustomer();
49
+ if ($customer->getGroupId() == '1') {
50
+ return;
51
+ }
52
+ $session = Mage::getSingleton('customer/session');
53
+
54
+ if ($customer->getCustomerActivated() == 'New' || $customer->getCustomerActivated() == 2 || $customer->getCustomerActivated() == 0 || $customer->getCustomerActivated() == 4 || $customer->getCustomerActivated() == 5) {
55
+ /*
56
+ * Fake the old logout() method without deleting the session and all messages
57
+ *///echo 'status'.$customer->getCustomerActivated();
58
+
59
+ $session->setCustomer(Mage::getModel('customer/customer'))
60
+ ->setId(null)
61
+ ->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID);
62
+ if ($this->_checkRequestRoute('customer', 'account', 'createpost') || $session->getNewRegistration() == 1) {
63
+ /*
64
+ * If this is a regular registration, simply display message
65
+ */
66
+ $message = Mage::helper('customeractivation')->__('Thank you! Admin representative will contact you shortly regarding your application.');
67
+
68
+ $session->addSuccess($message);
69
+ $session->setNewRegistration(0);
70
+ } else {
71
+ /*
72
+ * All other types of login
73
+ */
74
+ Mage::throwException(Mage::helper('customeractivation')->__('This account is not approved.'));
75
+ }
76
+ }
77
+ }
78
+
79
+ public function customerSaveBefore($observer) {
80
+ $customer = $observer->getEvent()->getCustomer();
81
+
82
+ $storeId = Mage::helper('customeractivation')->getCustomerStoreId($customer);
83
+
84
+ if (Mage::getStoreConfig(self::XML_PATH_MODULE_DISABLED, $storeId) == 0) {
85
+ return;
86
+ }
87
+
88
+ if (!$customer->getId()) {
89
+ $customer->setCustomerActivationNewAccount(true);
90
+ if (!(Mage::app()->getStore()->isAdmin() && $this->_checkControllerAction('customer', 'save'))) {
91
+ // Do not set the default status on the admin customer edit save action
92
+ $groupId = $customer->getGroupId();
93
+ $defaultStatus = Mage::helper('customeractivation')->getDefaultActivationStatus($groupId, $storeId);
94
+ $startdate = Mage::getStoreConfig(self::XML_PATH_ACTIVATION_START_DATE);
95
+ $enddate = Mage::getStoreConfig(self::XML_PATH_ACTIVATION_END_DATE);
96
+
97
+ $paymentDate = date('Y-m-d');
98
+ $paymentDate = date('Y-m-d', strtotime($paymentDate));
99
+
100
+ $contractDateBegin = date('Y-m-d', strtotime($startdate));
101
+ $contractDateEnd = date('Y-m-d', strtotime($enddate));
102
+
103
+ if ($paymentDate > $contractDateBegin && $paymentDate < $contractDateEnd) {
104
+ $date_range = 'between';
105
+ } else if ($enddate == '') {
106
+ $date_range = 'notmentioned';
107
+ } else {
108
+ $date_range = 'notin';
109
+ }
110
+
111
+ $groupId = $customer->getGroupId();
112
+ $defaultStatus = Mage::helper('customeractivation')->getDefaultActivationStatus($groupId, $storeId);
113
+ if ($customer->getGroupId() == 1) {
114
+ $customer->setCustomerActivated('1');
115
+ } else if (Mage::getStoreConfig(self::XML_PATH_ACTIVATION_STATUS) == 1 && ($date_range == 'between') || ($date_range == 'notmentioned')) {
116
+ $customer->setCustomerActivated('1');
117
+ } else {
118
+ $customer->setCustomerActivated('New');
119
+ }
120
+
121
+
122
+ if (!$defaultStatus) {
123
+ // Suppress the "enter your billing address for VAT validation" message.
124
+ // This setting will not be saved, its just for this request.
125
+ $helper = Mage::helper('customer/address');
126
+ if (method_exists($helper, 'isVatValidationEnabled')) {
127
+ if (is_callable(array($helper, 'isVatValidationEnabled'))) {
128
+ if (Mage::helper('customer/address')->isVatValidationEnabled($storeId)) {
129
+ Mage::app()->getStore($storeId)->setConfig(
130
+ Mage_Customer_Helper_Address::XML_PATH_VAT_VALIDATION_ENABLED, false
131
+ );
132
+ }
133
+ }
134
+ }
135
+ }
136
+ }
137
+ }
138
+ }
139
+
140
+ public function customerSaveAfter($observer) {
141
+ /** @var Mage_Customer_Model_Customer $customer */
142
+ $customer = $observer->getEvent()->getCustomer();
143
+
144
+ $storeId = Mage::helper('customeractivation')->getCustomerStoreId($customer);
145
+
146
+ if (Mage::getStoreConfig(self::XML_PATH_MODULE_DISABLED, $storeId) == 0) {
147
+ return;
148
+ }
149
+
150
+ $startdate = Mage::getStoreConfig(self::XML_PATH_ACTIVATION_START_DATE);
151
+ $enddate = Mage::getStoreConfig(self::XML_PATH_ACTIVATION_END_DATE);
152
+
153
+ $paymentDate = date('Y-m-d');
154
+ $paymentDate = date('Y-m-d', strtotime($paymentDate));
155
+
156
+ $contractDateBegin = date('Y-m-d', strtotime($startdate));
157
+ $contractDateEnd = date('Y-m-d', strtotime($enddate));
158
+
159
+ if ($paymentDate > $contractDateBegin && $paymentDate < $contractDateEnd) {
160
+ $date_range = 'between';
161
+ } else if ($enddate == '') {
162
+ $date_range = 'notmentioned';
163
+ } else {
164
+ $date_range = 'notin';
165
+ }
166
+
167
+ $groupId = $customer->getGroupId();
168
+ $defaultStatus = Mage::helper('customeractivation')->getDefaultActivationStatus($groupId, $storeId);
169
+ if ($customer->getGroupId() == 1) {
170
+ $customer->setCustomerActivated('1');
171
+ } else if (Mage::getStoreConfig(self::XML_PATH_ACTIVATION_STATUS) == 1 && ($date_range == 'between') || ($date_range == 'notmentioned')) {
172
+ $customer->setCustomerActivated('1');
173
+ } else {
174
+ $customer->setCustomerActivated('New');
175
+ }
176
+
177
+ try {
178
+ if (Mage::app()->getStore()->isAdmin()) {
179
+ if (!$customer->getOrigData('customer_activated') && $customer->getCustomerActivated()) {
180
+ // Send customer email only if it isn't a new account and it isn't activated by default
181
+ if (!($customer->getCustomerActivationNewAccount() && $defaultStatus)) {
182
+ Mage::helper('customeractivation')->sendCustomerNotificationEmail($customer);
183
+ }
184
+ }
185
+ } else {
186
+ if ($customer->getCustomerActivationNewAccount()) {
187
+ // Only notify the admin if the default is deactivated or the "always notify" flag is configured
188
+ $alwaysNotify = Mage::getStoreConfig(self::XML_PATH_ALWAYS_NOTIFY_ADMIN, $storeId);
189
+ if (!$defaultStatus || $alwaysNotify) {
190
+ Mage::helper('customeractivation')->sendAdminNotificationEmail($customer);
191
+ }
192
+ }
193
+ $customer->setCustomerActivationNewAccount(false);
194
+ }
195
+ } catch (Exception $e) {
196
+ Mage::throwException($e->getMessage());
197
+ }
198
+ }
199
+
200
+ public function salesCovertQuoteAddressToOrder(Varien_Event_Observer $observer) {
201
+ /** @var $address Mage_Sales_Model_Quote_Address */
202
+ $address = $observer->getEvent()->getAddress();
203
+ $this->_abortCheckoutRegistration($address->getQuote());
204
+ }
205
+
206
+ protected function _abortCheckoutRegistration(Mage_Sales_Model_Quote $quote) {
207
+ if (Mage::getStoreConfig(self::XML_PATH_MODULE_DISABLED, $quote->getStoreId()) == 0) {
208
+ return;
209
+ }
210
+
211
+ if ($this->_isApiRequest()) {
212
+ return;
213
+ }
214
+
215
+ if (!Mage::getSingleton('customer/session')->isLoggedIn() && !$quote->getCustomerIsGuest()) {
216
+ // Order is being created by non-activated customer
217
+ $customer = $quote->getCustomer()->save();
218
+ if ($customer->getGroupId() == 1) {
219
+ return;
220
+ }
221
+ if ($customer->getCustomerActivated() == 'New' || $customer->getCustomerActivated() == 2 || $customer->getCustomerActivated() == 0 || $customer->getCustomerActivated() == 4 || $customer->getCustomerActivated() == 5) {
222
+
223
+ $message = Mage::helper('customeractivation')->__(
224
+ 'Please wait for your account to be activated, then log in and continue with the checkout'
225
+ );
226
+ Mage::getSingleton('core/session')->addSuccess($message);
227
+
228
+ // Handle redirect to login page
229
+ $targetUrl = Mage::getUrl('customer/account/login');
230
+ $response = Mage::app()->getResponse();
231
+
232
+ if (Mage::app()->getRequest()->isAjax()) {
233
+ // Assume one page checkout
234
+ $result = array('redirect' => $targetUrl);
235
+ $response->setBody(Mage::helper('core')->jsonEncode($result));
236
+ } else if ($response->canSendHeaders(true)) {
237
+ // Assume multishipping checkout
238
+ $response->clearHeader('location')
239
+ ->setRedirect($targetUrl);
240
+ }
241
+ $response->sendResponse();
242
+ /* ugly, but we need to stop the further order processing */
243
+ exit();
244
+ }
245
+ }
246
+ }
247
+
248
+ protected function _isApiRequest() {
249
+ return Mage::app()->getRequest()->getModuleName() === 'api';
250
+ }
251
+
252
+ protected function _checkRequestRoute($module, $controller, $action) {
253
+ $req = Mage::app()->getRequest();
254
+ if (strtolower($req->getModuleName()) == $module && strtolower($req->getControllerName()) == $controller && strtolower($req->getActionName()) == $action
255
+ ) {
256
+ return true;
257
+ }
258
+ return false;
259
+ }
260
+
261
+ protected function _checkControllerAction($controller, $action) {
262
+ $req = Mage::app()->getRequest();
263
+ return $this->_checkRequestRoute($req->getModuleName(), $controller, $action);
264
+ }
265
+
266
+ public function adminhtmlBlockHtmlBefore(Varien_Event_Observer $observer) {
267
+ // Check the grid is the customer grid
268
+ if ($observer->getBlock()->getId() != 'customerGrid') {
269
+ return;
270
+ }
271
+
272
+ // Check if there is a massaction block and if yes, add the massaction for customeractivation
273
+ $massBlock = $observer->getBlock()->getMassactionBlock();
274
+ if ($massBlock) {
275
+ /** @var $helper Exinent_CustomerActivation_Helper_Data */
276
+ $helper = Mage::helper('customeractivation');
277
+
278
+ $noEmail = Exinent_CustomerActivation_Helper_Data::STATUS_ACTIVATE_WITHOUT_EMAIL;
279
+ $withEmail = Exinent_CustomerActivation_Helper_Data::STATUS_ACTIVATE_WITH_EMAIL;
280
+ $deactivate = Exinent_CustomerActivation_Helper_Data::STATUS_DEACTIVATE;
281
+
282
+ $massBlock->addItem(
283
+ 'customer_activated', array(
284
+ 'label' => $helper->__('Activate Customer'),
285
+ 'url' => Mage::getUrl('customeractivation/admin/massActivation'),
286
+ 'additional' => array(
287
+ 'status' => array(
288
+ 'name' => 'customer_activated',
289
+ 'type' => 'select',
290
+ 'class' => 'required-entry',
291
+ 'label' => $helper->__('Customer Activated'),
292
+ 'values' => array(
293
+ 2 => $helper->__('Pending'),
294
+ 1 => $helper->__('Approved'),
295
+ 0 => $helper->__('Rejected'),
296
+ 4 => $helper->__('In Active'),
297
+ 5 => $helper->__('On Hold')
298
+ )
299
+ )
300
+ )
301
+ )
302
+ );
303
+ }
304
+ }
305
+
306
+ public function eavCollectionAbstractLoadBefore(Varien_Event_Observer $observer) {
307
+ if (Mage::getStoreConfig(self::XML_PATH_MODULE_DISABLED) == 0) {
308
+ return;
309
+ }
310
+
311
+ // Cheap check to reduce overhead on product and category collections
312
+ if (Mage::app()->getRequest()->getControllerName() !== 'customer') {
313
+ return;
314
+ }
315
+
316
+ /** @var $collection Mage_Customer_Model_Resource_Customer_Collection */
317
+ $collection = $observer->getEvent()->getCollection();
318
+
319
+ // Only add attribute to customer collections
320
+ $customerTypeId = Mage::getSingleton('eav/config')->getEntityType('customer')->getId();
321
+ $collectionTypeId = $collection->getEntity()->getTypeId();
322
+ if ($customerTypeId == $collectionTypeId) {
323
+ $collection->addAttributeToSelect('customer_activated');
324
+ }
325
+ }
326
+
327
+ }
app/code/community/Exinent/CustomerActivation/Model/Order.php ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Exinent_CustomerActivation_Model_Order extends Mage_Sales_Model_Order {
4
+
5
+ public function sendNewOrderEmail() {
6
+ $storeId = $this->getStore()->getId();
7
+ if (!Mage::helper('sales')->canSendNewOrderEmail($storeId)) {
8
+ return $this;
9
+ }
10
+ $emailSentAttributeValue = $this->hasEmailSent() ? $this->getEmailSent() : Mage::getModel('sales/order')->load($this->getId())->getData('email_sent');
11
+ $this->setEmailSent((bool) $emailSentAttributeValue);
12
+ if ($this->getEmailSent()) {
13
+ return $this;
14
+ }
15
+ // Get the destination email addresses to send copies to
16
+ $copyTo = $this->_getEmails(self::XML_PATH_EMAIL_COPY_TO);
17
+ $copyMethod = Mage::getStoreConfig(self::XML_PATH_EMAIL_COPY_METHOD, $storeId);
18
+
19
+ // Start store emulation process
20
+ $appEmulation = Mage::getSingleton('core/app_emulation');
21
+ $initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation($storeId);
22
+
23
+ try {
24
+ // Retrieve specified view block from appropriate design package (depends on emulated store)
25
+ $paymentBlock = Mage::helper('payment')->getInfoBlock($this->getPayment())
26
+ ->setIsSecureMode(true);
27
+ $paymentBlock->getMethod()->setStore($storeId);
28
+ $paymentBlockHtml = $paymentBlock->toHtml();
29
+ } catch (Exception $exception) {
30
+ // Stop store emulation process
31
+ $appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo);
32
+ throw $exception;
33
+ }
34
+
35
+ // Stop store emulation process
36
+ $appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo);
37
+
38
+ // Retrieve corresponding email template id and customer name
39
+ if ($this->getCustomerIsGuest()) {
40
+ $templateId = Mage::getStoreConfig(self::XML_PATH_EMAIL_GUEST_TEMPLATE, $storeId);
41
+ $customerName = $this->getBillingAddress()->getName();
42
+ } else {
43
+ $templateId = Mage::getStoreConfig(self::XML_PATH_EMAIL_TEMPLATE, $storeId);
44
+ $customerName = $this->getCustomerName();
45
+ }
46
+
47
+ $mailer = Mage::getModel('core/email_template_mailer');
48
+ $emailInfo = Mage::getModel('core/email_info');
49
+ $emailInfo->addTo($this->getCustomerEmail(), $customerName);
50
+ if ($copyTo && $copyMethod == 'bcc') {
51
+ // Add bcc to customer email
52
+ foreach ($copyTo as $email) {
53
+ $emailInfo->addBcc($email);
54
+ }
55
+ }
56
+ $customerId = $this->getCustomerId();
57
+ $customerObject = Mage::getModel('customer/customer')->load($customerId);
58
+ if ($customerObject->getGroupId() == 2) {
59
+ $emailInfo->addBcc($customerObject->getRepresentativeEmail());
60
+ }
61
+ $mailer->addEmailInfo($emailInfo);
62
+
63
+ // Email copies are sent as separated emails if their copy method is 'copy'
64
+ if ($copyTo && $copyMethod == 'copy') {
65
+ foreach ($copyTo as $email) {
66
+ $emailInfo = Mage::getModel('core/email_info');
67
+ $emailInfo->addTo($email);
68
+ $mailer->addEmailInfo($emailInfo);
69
+ }
70
+ }
71
+
72
+ // Set all required params and send emails
73
+ $mailer->setSender(Mage::getStoreConfig(self::XML_PATH_EMAIL_IDENTITY, $storeId));
74
+ $mailer->setStoreId($storeId);
75
+ $mailer->setTemplateId($templateId);
76
+ $mailer->setTemplateParams(array(
77
+ 'order' => $this,
78
+ 'billing' => $this->getBillingAddress(),
79
+ 'payment_html' => $paymentBlockHtml
80
+ )
81
+ );
82
+ $mailer->send();
83
+ $this->setEmailSent(true);
84
+ $this->_getResource()->saveAttribute($this, 'email_sent');
85
+ return $this;
86
+ }
87
+
88
+ }
app/code/community/Exinent/CustomerActivation/Model/Resource/Attribute/Source/Customeractivation.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Exinent_CustomerActivation_Model_Resource_Attribute_Source_Customeractivation extends Mage_Eav_Model_Entity_Attribute_Source_Abstract {
4
+
5
+ public function getAllOptions() {
6
+ if ($this->_options === null) {
7
+ $this->_options = array(
8
+ array(
9
+ 'value' => 'New',
10
+ 'label' => 'New',
11
+ ),
12
+
13
+ array(
14
+ 'value' => '1',
15
+ 'label' => 'Approved',
16
+ ),
17
+
18
+ );
19
+ }
20
+ return $this->_options;
21
+ }
22
+
23
+ public function getOptionArray() {
24
+ $_options = array();
25
+ foreach ($this->getAllOptions() as $option) {
26
+ $_options[$option['value']] = $option['label'];
27
+ }
28
+ return $_options;
29
+ }
30
+
31
+ public function getOptionText($value) {
32
+ $options = $this->getAllOptions();
33
+ foreach ($options as $option) {
34
+ if ($option['value'] == $value) {
35
+ return $option['label'];
36
+ }
37
+ }
38
+ return false;
39
+ }
40
+
41
+ }
app/code/community/Exinent/CustomerActivation/Model/Resource/Attribute/Source/Customerpayment.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Exinent_CustomerActivation_Model_Resource_Attribute_Source_Customerpayment extends Mage_Eav_Model_Entity_Attribute_Source_Abstract {
4
+
5
+ public function getAllOptions() {
6
+ if (is_null($this->_options)) {
7
+ $payments = Mage::getSingleton('payment/config')->getActiveMethods();
8
+ $payMethods = array();
9
+ foreach ($payments as $paymentCode => $paymentModel) {
10
+ $payMethods[$paymentCode] = array('value' => $paymentCode, 'label' => Mage::getStoreConfig('payment/' . $paymentCode . '/title'));
11
+ }
12
+ return $payMethods;
13
+ }
14
+ }
15
+
16
+ public function getOptionArray() {
17
+ $_options = array();
18
+ foreach ($this->getAllOptions() as $option) {
19
+ $_options[$option["value"]] = $option["label"];
20
+ }
21
+ return $_options;
22
+ }
23
+
24
+ public function getOptionText($value) {
25
+ $options = $this->getAllOptions();
26
+ foreach ($options as $option) {
27
+ if ($option["value"] == $value) {
28
+ return $option["label"];
29
+ }
30
+ }
31
+ return false;
32
+ }
33
+
34
+ public function getFlatColums() {
35
+ $columns = array();
36
+ $columns[$this->getAttribute()->getAttributeCode()] = array(
37
+ "type" => "tinyint(1)",
38
+ "unsigned" => false,
39
+ "is_null" => true,
40
+ "default" => null,
41
+ "extra" => null
42
+ );
43
+
44
+ return $columns;
45
+ }
46
+
47
+ public function getFlatIndexes() {
48
+ $indexes = array();
49
+
50
+ $index = "IDX_" . strtoupper($this->getAttribute()->getAttributeCode());
51
+ $indexes[$index] = array(
52
+ "type" => "index",
53
+ "fields" => array($this->getAttribute()->getAttributeCode())
54
+ );
55
+
56
+ return $indexes;
57
+ }
58
+
59
+ public function getFlatUpdateSelect($store) {
60
+ return Mage::getResourceModel("eav/entity_attribute")
61
+ ->getFlatUpdateSelect($this->getAttribute(), $store);
62
+ }
63
+
64
+ }
app/code/community/Exinent/CustomerActivation/Model/Resource/Attribute/Source/Customershippingmethods.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Exinent_CustomerActivation_Model_Resource_Attribute_Source_Customershippingmethods extends Mage_Eav_Model_Entity_Attribute_Source_Abstract {
4
+
5
+ public function getAllOptions() {
6
+ if (is_null($this->_options)) {
7
+ $activeCarriers = Mage::getSingleton('shipping/config')->getActiveCarriers();
8
+ foreach ($activeCarriers as $carrierCode => $carrierModel) {
9
+ $allCarriers[$carrierCode] = array('value' => Mage::getStoreConfig('carriers/' . $carrierCode . '/title'), 'label' => Mage::getStoreConfig('carriers/' . $carrierCode . '/title'));
10
+ }
11
+ return $allCarriers;
12
+ }
13
+ }
14
+
15
+ public function getOptionArray() {
16
+ $_options = array();
17
+ foreach ($this->getAllOptions() as $option) {
18
+ $_options[$option["value"]] = $option["label"];
19
+ }
20
+ return $_options;
21
+ }
22
+
23
+ public function getOptionText($value) {
24
+ $options = $this->getAllOptions();
25
+ foreach ($options as $option) {
26
+ if ($option["value"] == $value) {
27
+ return $option["label"];
28
+ }
29
+ }
30
+ return false;
31
+ }
32
+
33
+ public function getFlatColums() {
34
+ $columns = array();
35
+ $columns[$this->getAttribute()->getAttributeCode()] = array(
36
+ "type" => "tinyint(1)",
37
+ "unsigned" => false,
38
+ "is_null" => true,
39
+ "default" => null,
40
+ "extra" => null
41
+ );
42
+
43
+ return $columns;
44
+ }
45
+
46
+ public function getFlatIndexes() {
47
+ $indexes = array();
48
+
49
+ $index = "IDX_" . strtoupper($this->getAttribute()->getAttributeCode());
50
+ $indexes[$index] = array(
51
+ "type" => "index",
52
+ "fields" => array($this->getAttribute()->getAttributeCode())
53
+ );
54
+
55
+ return $indexes;
56
+ }
57
+
58
+ public function getFlatUpdateSelect($store) {
59
+ return Mage::getResourceModel("eav/entity_attribute")
60
+ ->getFlatUpdateSelect($this->getAttribute(), $store);
61
+ }
62
+
63
+ }
app/code/community/Exinent/CustomerActivation/Model/Resource/Attribute/Source/Iswebsitelive.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Exinent_CustomerActivation_Model_Resource_Attribute_Source_Iswebsitelive extends Mage_Eav_Model_Entity_Attribute_Source_Abstract {
4
+
5
+ /**
6
+ * Retrieve all options array
7
+ *
8
+ * @return array
9
+ */
10
+ public function getAllOptions() {
11
+
12
+ if (is_null($this->_options)) {
13
+ $this->_options = array(
14
+ array(
15
+ 'label' => 'Yes',
16
+ 'value' => 1
17
+ ),
18
+ array(
19
+ 'label' => 'No',
20
+ 'value' => 0
21
+ ),
22
+ );
23
+ }
24
+ return $this->_options;
25
+ }
26
+
27
+ public function getOptionArray() {
28
+ $_options = array();
29
+ foreach ($this->getAllOptions() as $option) {
30
+ $_options[$option['value']] = $option['label'];
31
+ }
32
+ return $_options;
33
+ }
34
+
35
+ public function getOptionText($value) {
36
+ $options = $this->getAllOptions();
37
+ foreach ($options as $option) {
38
+ if ($option["value"] == $value) {
39
+ return $option["label"];
40
+ }
41
+ }
42
+ return false;
43
+ }
44
+
45
+ public function getFlatColums() {
46
+ $columns = array(
47
+ $this->getAttribute()->getAttributeCode() => array(
48
+ 'type' => 'int',
49
+ 'unsigned' => false,
50
+ 'is_null' => true,
51
+ 'default' => null,
52
+ 'extra' => null
53
+ )
54
+ );
55
+ return $columns;
56
+ }
57
+
58
+ public function getFlatUpdateSelect($store) {
59
+ return Mage::getResourceModel('eav/entity_attribute')
60
+ ->getFlatUpdateSelect($this->getAttribute(), $store);
61
+ }
62
+
63
+ }
app/code/community/Exinent/CustomerActivation/Model/Resource/Attribute/Source/StoreType.php ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Exinent_CustomerActivation_Model_Resource_Attribute_Source_StoreType extends Mage_Eav_Model_Entity_Attribute_Source_Abstract {
4
+
5
+ /**
6
+ * Retrieve all options array
7
+ *
8
+ * @return array
9
+ */
10
+ public function getAllOptions() {
11
+
12
+ if (is_null($this->_options)) {
13
+ $this->_options = array(
14
+ array(
15
+ 'label' => 'Outdoor',
16
+ 'value' => 'outdoor'
17
+ ),
18
+ array(
19
+ 'label' => 'Surf',
20
+ 'value' => 'surf'
21
+ ),
22
+ array(
23
+ 'label' => 'Fashion',
24
+ 'value' => 'fashion'
25
+ ),
26
+ array(
27
+ 'label' => 'Natural_Food',
28
+ 'value' => 'naturalfood'
29
+ ),
30
+ array(
31
+ 'label' => 'Wellness - Yoga/Pilates/Medical/Spa/Beauty',
32
+ 'value' => 'wellness'
33
+ ),
34
+ array(
35
+ 'label' => 'Hospitality - Hotels',
36
+ 'value' => 'hospitalityh'
37
+ ),
38
+ array(
39
+ 'label' => 'Sporting_Goods',
40
+ 'value' => 'sportinggoods'
41
+ ),
42
+ array(
43
+ 'label' => 'Gift_Shop',
44
+ 'value' => 'giftshop'
45
+ ),
46
+ array(
47
+ 'label' => 'Footwear_Only',
48
+ 'value' => 'footwear'
49
+ ),
50
+ );
51
+ }
52
+ return $this->_options;
53
+ }
54
+
55
+ public function getOptionArray() {
56
+ $_options = array();
57
+ foreach ($this->getAllOptions() as $option) {
58
+ $_options[$option['value']] = $option['label'];
59
+ }
60
+ return $_options;
61
+ }
62
+
63
+ public function getOptionText($value) {
64
+ $options = $this->getAllOptions();
65
+ foreach ($options as $option) {
66
+ if ($option["value"] == $value) {
67
+ return $option["label"];
68
+ }
69
+ }
70
+ return false;
71
+ }
72
+
73
+ public function getFlatColums() {
74
+ $columns = array(
75
+ $this->getAttribute()->getAttributeCode() => array(
76
+ 'type' => 'int',
77
+ 'unsigned' => false,
78
+ 'is_null' => true,
79
+ 'default' => null,
80
+ 'extra' => null
81
+ )
82
+ );
83
+ return $columns;
84
+ }
85
+
86
+ public function getFlatUpdateSelect($store) {
87
+ return Mage::getResourceModel('eav/entity_attribute')
88
+ ->getFlatUpdateSelect($this->getAttribute(), $store);
89
+ }
90
+
91
+ }
app/code/community/Exinent/CustomerActivation/Model/Resource/Customer.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Exinent_CustomerActivation_Model_Resource_Customer extends Mage_Eav_Model_Entity_Abstract {
4
+
5
+ protected function _construct() {
6
+ $this->setType('customer');
7
+ $this->setConnection('customer_read', 'customer_write');
8
+ return parent::_construct();
9
+ }
10
+
11
+ public function massSetActivationStatus(array $customerIds, $value) {
12
+ $customerIds = $this->_getValidCustomerIds($customerIds);
13
+
14
+ if ($customerIds) {
15
+ $attribute = $this->getAttribute('customer_activated');
16
+ $table = $attribute->getBackend()->getTable();
17
+ $select = $this->getReadConnection()->select()
18
+ ->from($table, 'entity_id')
19
+ ->where('entity_id IN (?)', $customerIds)
20
+ ->where('attribute_id = ?', $attribute->getId())
21
+ ->where('value = ?', $value);
22
+ $noChangeIds = $this->_getReadAdapter()->fetchCol($select);
23
+
24
+ $changeIds = array_diff($customerIds, $noChangeIds);
25
+ $select = $this->_getReadAdapter()->select()
26
+ ->from($table, 'entity_id')
27
+ ->where('entity_id IN (?)', $changeIds)
28
+ ->where('attribute_id = ?', $attribute->getId());
29
+
30
+ $updateIds = $this->_getReadAdapter()->fetchCol($select);
31
+ $insertIds = array_diff($changeIds, $updateIds);
32
+
33
+ if ($updateIds) {
34
+ $cond = $this->_getWriteAdapter()->quoteInto('entity_type_id = ?', $this->getEntityType()->getId());
35
+ $cond .= $this->_getWriteAdapter()->quoteInto(' AND attribute_id = ?', $attribute->getId());
36
+ $cond .= $this->_getWriteAdapter()->quoteInto(' AND entity_id IN (?)', $updateIds);
37
+ $this->_getWriteAdapter()->update($table, array('value' => $value), $cond);
38
+ }
39
+ if ($insertIds) {
40
+ $rows = array();
41
+ foreach ($insertIds as $customerId) {
42
+ $rows[] = array(
43
+ 'entity_type_id' => $this->getEntityType()->getId(),
44
+ 'attribute_id' => $attribute->getId(),
45
+ 'entity_id' => $customerId,
46
+ 'value' => $value
47
+ );
48
+ }
49
+ $this->_getWriteAdapter()->insertMultiple($table, $rows);
50
+ }
51
+ }
52
+ return $changeIds;
53
+ }
54
+
55
+ protected function _getValidCustomerIds(array $customerIds) {
56
+ $column = $this->getEntityIdField();
57
+ $select = $this->_getReadAdapter()->select()
58
+ ->from($this->getEntityTable(), $column)
59
+ ->where($column . ' IN (?)', $customerIds);
60
+ return $this->_getReadAdapter()->fetchCol($select);
61
+ }
62
+
63
+ }
app/code/community/Exinent/CustomerActivation/Model/Thirdparty.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Exinent_CustomerActivation_Model_Thirdparty extends Mage_Shipping_Model_Carrier_Abstract implements Mage_Shipping_Model_Carrier_Interface {
4
+
5
+ protected $_code = 'thirdparty';
6
+
7
+ public function collectRates(Mage_Shipping_Model_Rate_Request $request) {
8
+ $result = Mage::getModel('shipping/rate_result');
9
+ /* @var $result Mage_Shipping_Model_Rate_Result */
10
+ $result->append($this->_getStandardShippingRate());
11
+ return $result;
12
+ }
13
+
14
+ protected function _getStandardShippingRate() {
15
+ $rate = Mage::getModel('shipping/rate_result_method');
16
+ /* @var $rate Mage_Shipping_Model_Rate_Result_Method */
17
+
18
+ $rate->setCarrier($this->_code);
19
+ /**
20
+ * getConfigData(config_key) returns the configuration value for the
21
+ * carriers/[carrier_code]/[config_key]
22
+ */
23
+ $rate->setCarrierTitle($this->getConfigData('title'));
24
+ $rate->setMethod('standand');
25
+ $rate->setMethodTitle('Standard');
26
+ $rate->setPrice(0);
27
+ $rate->setCost(0);
28
+ return $rate;
29
+ }
30
+
31
+ protected function _getExpressShippingRate() {
32
+ $rate = Mage::getModel('shipping/rate_result_method');
33
+ /* @var $rate Mage_Shipping_Model_Rate_Result_Method */
34
+ $rate->setCarrier($this->_code);
35
+ $rate->setCarrierTitle($this->getConfigData('title'));
36
+ $rate->setMethod('express');
37
+ $rate->setMethodTitle('Express (Next day)');
38
+ $rate->setPrice(12.99);
39
+ $rate->setCost(0);
40
+ return $rate;
41
+ }
42
+
43
+ protected function _getFreeShippingRate() {
44
+ $rate = Mage::getModel('shipping/rate_result_method');
45
+ /* @var $rate Mage_Shipping_Model_Rate_Result_Method */
46
+ $rate->setCarrier($this->_code);
47
+ $rate->setCarrierTitle($this->getConfigData('title'));
48
+ $rate->setMethod('free_shipping');
49
+ $rate->setMethodTitle('Free Shipping (3 - 5 days)');
50
+ $rate->setPrice(0);
51
+ $rate->setCost(0);
52
+ return $rate;
53
+ }
54
+
55
+ public function getAllowedMethods() {
56
+ return array(
57
+ 'standard' => 'Standard',
58
+ );
59
+ }
60
+
61
+ }
app/code/community/Exinent/CustomerActivation/Model/Thirdpartyfed.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Exinent_CustomerActivation_Model_Thirdpartyfed extends Mage_Shipping_Model_Carrier_Abstract implements Mage_Shipping_Model_Carrier_Interface {
4
+
5
+ protected $_code = 'thirdpartyfed';
6
+
7
+ public function collectRates(Mage_Shipping_Model_Rate_Request $request) {
8
+ $result = Mage::getModel('shipping/rate_result');
9
+ /* @var $result Mage_Shipping_Model_Rate_Result */
10
+
11
+ $result->append($this->_getStandardShippingRate());
12
+ return $result;
13
+ }
14
+
15
+ protected function _getStandardShippingRate() {
16
+ $rate = Mage::getModel('shipping/rate_result_method');
17
+ /* @var $rate Mage_Shipping_Model_Rate_Result_Method */
18
+
19
+ $rate->setCarrier($this->_code);
20
+ /**
21
+ * getConfigData(config_key) returns the configuration value for the
22
+ * carriers/[carrier_code]/[config_key]
23
+ */
24
+ $rate->setCarrierTitle($this->getConfigData('title'));
25
+ $rate->setMethod('standand');
26
+ $rate->setMethodTitle('Standard');
27
+ $rate->setPrice(0);
28
+ $rate->setCost(0);
29
+ return $rate;
30
+ }
31
+
32
+ protected function _getExpressShippingRate() {
33
+ $rate = Mage::getModel('shipping/rate_result_method');
34
+ /* @var $rate Mage_Shipping_Model_Rate_Result_Method */
35
+ $rate->setCarrier($this->_code);
36
+ $rate->setCarrierTitle($this->getConfigData('title'));
37
+ $rate->setMethod('express');
38
+ $rate->setMethodTitle('Express (Next day)');
39
+ $rate->setPrice(12.99);
40
+ $rate->setCost(0);
41
+ return $rate;
42
+ }
43
+
44
+ protected function _getFreeShippingRate() {
45
+ $rate = Mage::getModel('shipping/rate_result_method');
46
+ /* @var $rate Mage_Shipping_Model_Rate_Result_Method */
47
+ $rate->setCarrier($this->_code);
48
+ $rate->setCarrierTitle($this->getConfigData('title'));
49
+ $rate->setMethod('free_shipping');
50
+ $rate->setMethodTitle('Free Shipping (3 - 5 days)');
51
+ $rate->setPrice(0);
52
+ $rate->setCost(0);
53
+ return $rate;
54
+ }
55
+
56
+ public function getAllowedMethods() {
57
+ return array(
58
+ 'standard' => 'Standard',
59
+ );
60
+ }
61
+
62
+ }
app/code/community/Exinent/CustomerActivation/Model/Thirdpartyfedex.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Exinent_CustomerActivation_Model_Thirdpartyfedex extends Mage_Shipping_Model_Carrier_Abstract implements Mage_Shipping_Model_Carrier_Interface {
4
+
5
+ protected $_code = 'thirdpartyfedex';
6
+
7
+ public function collectRates(Mage_Shipping_Model_Rate_Request $request) {
8
+ $result = Mage::getModel('shipping/rate_result');
9
+ /* @var $result Mage_Shipping_Model_Rate_Result */
10
+
11
+ $result->append($this->_getStandardShippingRate());
12
+
13
+
14
+
15
+ return $result;
16
+ }
17
+
18
+ protected function _getStandardShippingRate() {
19
+ $rate = Mage::getModel('shipping/rate_result_method');
20
+ /* @var $rate Mage_Shipping_Model_Rate_Result_Method */
21
+
22
+ $rate->setCarrier($this->_code);
23
+ /**
24
+ * getConfigData(config_key) returns the configuration value for the
25
+ * carriers/[carrier_code]/[config_key]
26
+ */
27
+ $rate->setCarrierTitle($this->getConfigData('title'));
28
+
29
+ $rate->setMethod('standand');
30
+ $rate->setMethodTitle('Standard');
31
+
32
+ $rate->setPrice(0);
33
+ $rate->setCost(0);
34
+
35
+ return $rate;
36
+ }
37
+
38
+ protected function _getExpressShippingRate() {
39
+ $rate = Mage::getModel('shipping/rate_result_method');
40
+ /* @var $rate Mage_Shipping_Model_Rate_Result_Method */
41
+ $rate->setCarrier($this->_code);
42
+ $rate->setCarrierTitle($this->getConfigData('title'));
43
+ $rate->setMethod('express');
44
+ $rate->setMethodTitle('Express (Next day)');
45
+ $rate->setPrice(12.99);
46
+ $rate->setCost(0);
47
+ return $rate;
48
+ }
49
+
50
+ protected function _getFreeShippingRate() {
51
+ $rate = Mage::getModel('shipping/rate_result_method');
52
+ /* @var $rate Mage_Shipping_Model_Rate_Result_Method */
53
+ $rate->setCarrier($this->_code);
54
+ $rate->setCarrierTitle($this->getConfigData('title'));
55
+ $rate->setMethod('free_shipping');
56
+ $rate->setMethodTitle('Free Shipping (3 - 5 days)');
57
+ $rate->setPrice(0);
58
+ $rate->setCost(0);
59
+ return $rate;
60
+ }
61
+
62
+ public function getAllowedMethods() {
63
+ return array(
64
+ 'standard' => 'Standard',
65
+ );
66
+ }
67
+
68
+ }
app/code/community/Exinent/CustomerActivation/Model/Thirdpartyups.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Exinent_CustomerActivation_Model_Thirdpartyups extends Mage_Shipping_Model_Carrier_Abstract implements Mage_Shipping_Model_Carrier_Interface {
4
+
5
+ protected $_code = 'thirdpartyups';
6
+
7
+ public function collectRates(Mage_Shipping_Model_Rate_Request $request) {
8
+ $result = Mage::getModel('shipping/rate_result');
9
+ /* @var $result Mage_Shipping_Model_Rate_Result */
10
+
11
+ $result->append($this->_getStandardShippingRate());
12
+
13
+
14
+ return $result;
15
+ }
16
+
17
+ protected function _getStandardShippingRate() {
18
+ $rate = Mage::getModel('shipping/rate_result_method');
19
+ /* @var $rate Mage_Shipping_Model_Rate_Result_Method */
20
+
21
+ $rate->setCarrier($this->_code);
22
+ /**
23
+ * getConfigData(config_key) returns the configuration value for the
24
+ * carriers/[carrier_code]/[config_key]
25
+ */
26
+ $rate->setCarrierTitle($this->getConfigData('title'));
27
+
28
+ $rate->setMethod('standand');
29
+ $rate->setMethodTitle('Standard');
30
+
31
+ $rate->setPrice(0);
32
+ $rate->setCost(0);
33
+
34
+ return $rate;
35
+ }
36
+
37
+ protected function _getExpressShippingRate() {
38
+ $rate = Mage::getModel('shipping/rate_result_method');
39
+ /* @var $rate Mage_Shipping_Model_Rate_Result_Method */
40
+ $rate->setCarrier($this->_code);
41
+ $rate->setCarrierTitle($this->getConfigData('title'));
42
+ $rate->setMethod('express');
43
+ $rate->setMethodTitle('Express (Next day)');
44
+ $rate->setPrice(12.99);
45
+ $rate->setCost(0);
46
+ return $rate;
47
+ }
48
+
49
+ protected function _getFreeShippingRate() {
50
+ $rate = Mage::getModel('shipping/rate_result_method');
51
+ /* @var $rate Mage_Shipping_Model_Rate_Result_Method */
52
+ $rate->setCarrier($this->_code);
53
+ $rate->setCarrierTitle($this->getConfigData('title'));
54
+ $rate->setMethod('free_shipping');
55
+ $rate->setMethodTitle('Free Shipping (3 - 5 days)');
56
+ $rate->setPrice(0);
57
+ $rate->setCost(0);
58
+ return $rate;
59
+ }
60
+
61
+ public function getAllowedMethods() {
62
+ return array(
63
+ 'standard' => 'Standard',
64
+ );
65
+ }
66
+
67
+ }
app/code/community/Exinent/CustomerActivation/controllers/AccountController.php ADDED
@@ -0,0 +1,171 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ include_once "Mage/Customer/controllers/AccountController.php";
4
+
5
+ class Exinent_CustomerActivation_AccountController extends Mage_Customer_AccountController {
6
+
7
+ public function createPostAction() {
8
+
9
+ /** @var $session Mage_Customer_Model_Session */
10
+ $session = $this->_getSession();
11
+ if ($session->isLoggedIn()) {
12
+
13
+ $this->_redirect('*/*/');
14
+ return;
15
+ }
16
+ $session->setEscapeMessages(true); // prevent XSS injection in user input
17
+ if (!$this->getRequest()->isPost()) {
18
+
19
+ $errUrl = $this->_getUrl('*/*/create', array('_secure' => true));
20
+ $this->_redirectError($errUrl);
21
+ return;
22
+ }
23
+
24
+ $customer = $this->_getCustomer();
25
+
26
+ try {
27
+ /* Extra Content Strart for add assign group to customer and wholesale */
28
+
29
+ if ($this->getRequest()->getPost('group_id')) {
30
+ $customer->setGroupId($this->getRequest()->getPost('group_id'));
31
+ } else {
32
+ $customer->getGroupId();
33
+ }
34
+
35
+ /* Extra Content End for add assign group to customer and wholesale */
36
+
37
+ $errors = $this->_getCustomerErrors($customer);
38
+
39
+ if (empty($errors)) {
40
+ if ($this->getRequest()->getPost('group_id')) {
41
+ $customer->setGroupId($this->getRequest()->getPost('group_id'));
42
+ } else {
43
+ $customer->getGroupId();
44
+ }
45
+
46
+ $customer->setUniqueloginId(Mage::helper('core')->getRandomString(9, '0123456789'));
47
+ $customer->setUpsNumber($this->getRequest()->getPost('upsnumber'));
48
+ $customer->setFedexNumber($this->getRequest()->getPost('fedexnumber'));
49
+ $customer->setAccountspayableEmail($this->getRequest()->getPost('accountpayble_email'));
50
+ $customer->setStoreType($this->getRequest()->getPost('storetype'));
51
+ $customer->setWebsiteUrl($this->getRequest()->getPost('website_url'));
52
+ $customer->setIswebsiteLive($this->getRequest()->getPost('iswebsitelive'));
53
+ $customer->setDateFounded($this->getRequest()->getPost('datefounded'));
54
+ $customer->setPaymentmethods($this->getRequest()->getPost('paymentterms'));
55
+ $brandsCarry = $this->getRequest()->getPost('brandsyoucarry');
56
+ $brands = implode(',', $brandsCarry);
57
+ $customer->setBrandsCarry($brands);
58
+ try {
59
+ $uploader = new Varien_File_Uploader('attachment');
60
+ $uploader->setAllowedExtensions(array('jpg', 'jpeg', 'gif', 'png'));
61
+ $uploader->setAllowRenameFiles(true);
62
+ $path = Mage::getBaseDir('media') . DS . 'customerlogs' . DS;
63
+ $img = $uploader->save($path, $_FILES['attachment']['name']);
64
+ $logoImage = 'customerlogs/' . $_FILES['attachment']['name'];
65
+ } catch (Exception $e) {
66
+ echo $e->getMessage();
67
+ Mage::log($e->getMessage());
68
+ }
69
+ $customer->setLogoImage($logoImage);
70
+ try {
71
+ $paymentreference = new Varien_File_Uploader('net30reference');
72
+ $uploader->setAllowedExtensions(array('doc', 'pdf', 'txt', 'docx', 'jpg', 'jpeg', 'gif', 'png'));
73
+ $paymentreference->setAllowRenameFiles(true);
74
+ $paymentreferencepath = Mage::getBaseDir('media') . DS . 'net30Reference' . DS;
75
+ $imgpath = $paymentreference->save($paymentreferencepath, $_FILES['net30reference']['name']);
76
+ $paymentreferenceImage = 'net30Reference/' . $_FILES['net30reference']['name'];
77
+ } catch (Exception $e) {
78
+ echo $e->getMessage();
79
+ Mage::log($e->getMessage());
80
+ }
81
+ $customer->setNet30Reference($paymentreferenceImage);
82
+ $customer->save();
83
+ $this->_dispatchRegisterSuccess($customer);
84
+ $this->_successProcessRegistration($customer);
85
+ return;
86
+ } else {
87
+ $this->_addSessionError($errors);
88
+ }
89
+ } catch (Mage_Core_Exception $e) {
90
+ $variable = $this->getRequest()->getPost('customer_activation');
91
+ $session->setCustomerFormData($this->getRequest()->getPost());
92
+ if ($e->getCode() === Mage_Customer_Model_Customer::EXCEPTION_EMAIL_EXISTS) {
93
+ $url = $this->_getUrl('customer/account/forgotpassword');
94
+ if ($variable != 'customerActivation') {
95
+ $message = $this->__('There is already an account with this email address. If you are sure that it is your email address, <a href="%s">click here</a> to get your password and access your account.', $url);
96
+ }
97
+ $session->setEscapeMessages(false);
98
+ } else {
99
+ $message = $e->getMessage();
100
+ }
101
+ if ($variable != 'customerActivation') {
102
+ $session->addError($message);
103
+ }
104
+ } catch (Exception $e) {
105
+ $session->setCustomerFormData($this->getRequest()->getPost())
106
+ ->addException($e, $this->__('Cannot save the customer.'));
107
+ }
108
+ if ($variable == 'customerActivation') {
109
+ $errUrl = $this->_getUrl('customerActivation/index/wholesale', array('_secure' => true));
110
+ $emailError = 'emailerror';
111
+ Mage::getSingleton('core/session')->setEmailError($emailError);
112
+ } else {
113
+ $errUrl = $this->_getUrl('*/*/create', array('_secure' => true));
114
+ }
115
+
116
+ $this->_redirectError($errUrl);
117
+ }
118
+
119
+ public function loginPostAction() {
120
+
121
+ $groupid = $this->getRequest()->getParam('groupname');
122
+
123
+ Mage::register('groupId', $groupid);
124
+ if (!$this->_validateFormKey()) {
125
+ $this->_redirect('*/*/');
126
+ return;
127
+ }
128
+
129
+ if ($this->_getSession()->isLoggedIn()) {
130
+ $this->_redirect('*/*/');
131
+ return;
132
+ }
133
+ $session = $this->_getSession();
134
+
135
+ if ($this->getRequest()->isPost()) {
136
+ $login = $this->getRequest()->getPost('login');
137
+
138
+ if (!empty($login['username']) && !empty($login['password'])) {
139
+ try {
140
+ $session->login($login['username'], $login['password']);
141
+ if ($session->getCustomer()->getIsJustConfirmed()) {
142
+ $this->_welcomeCustomer($session->getCustomer(), true);
143
+ }
144
+ } catch (Mage_Core_Exception $e) {
145
+ switch ($e->getCode()) {
146
+ case Mage_Customer_Model_Customer::EXCEPTION_EMAIL_NOT_CONFIRMED:
147
+ $value = $this->_getHelper('customer')->getEmailConfirmationUrl($login['username']);
148
+ $message = $this->_getHelper('customer')->__('This account is not confirmed. <a href="%s">Click here</a> to resend confirmation email.', $value);
149
+ break;
150
+ case Mage_Customer_Model_Customer::EXCEPTION_INVALID_EMAIL_OR_PASSWORD:
151
+ $message = $e->getMessage();
152
+ break;
153
+ default:
154
+ $message = $e->getMessage();
155
+ }
156
+ $session->addError($message);
157
+ $session->setUsername($login['username']);
158
+ } catch (Exception $e) {
159
+ // Mage::logException($e); // PA DSS violation: this exception log can disclose customer password
160
+ }
161
+ } else {
162
+ $session->addError($this->__('Login and password are required.'));
163
+ }
164
+ }
165
+
166
+ $this->_loginPostRedirect();
167
+ }
168
+
169
+ }
170
+
171
+ ?>
app/code/community/Exinent/CustomerActivation/controllers/AdminController.php ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Exinent_CustomerActivation_AdminController extends Mage_Adminhtml_Controller_Action {
4
+
5
+ public function massActivationAction() {
6
+
7
+ $customerIds = $this->getRequest()->getParam('customer');
8
+
9
+
10
+ if (!is_array($customerIds)) {
11
+ Mage::getSingleton('adminhtml/session')->addError(
12
+ Mage::helper('customeractivation')->__('Please select item(s)')
13
+ );
14
+ } else {
15
+ $paramValue = $this->getRequest()->getParam('customer_activated');
16
+
17
+
18
+ try {
19
+ $updatedCustomerIds = Mage::getResourceModel('customeractivation/customer')->massSetActivationStatus(
20
+ $customerIds, $this->_shouldSetToActivated($paramValue)
21
+ );
22
+
23
+ Mage::getSingleton('adminhtml/session')->addSuccess(
24
+ Mage::helper('customeractivation')->__(
25
+ 'Total of %d record(s) were successfully saved', count($updatedCustomerIds)
26
+ )
27
+ );
28
+
29
+ if ($this->_shouldSendActivationNotification($paramValue)) {
30
+ $this->_sendActivationNotificationEmails($updatedCustomerIds);
31
+ }
32
+ } catch (Exception $e) {
33
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
34
+ }
35
+ }
36
+
37
+ $this->_redirect('adminhtml/customer');
38
+ }
39
+
40
+ protected function _shouldSetToActivated($paramValue) {
41
+ switch ($paramValue) {
42
+ case 0:
43
+ $activationStatus = 0;
44
+ break;
45
+ case 1:
46
+ $activationStatus = 1;
47
+ break;
48
+ case 2:
49
+ $activationStatus = 2;
50
+ break;
51
+ case 4:
52
+ $activationStatus = 4;
53
+ break;
54
+ case 5:
55
+ $activationStatus = 5;
56
+ break;
57
+ default:
58
+ $activationStatus = 'New';
59
+ break;
60
+ }
61
+ return $activationStatus;
62
+ }
63
+
64
+ protected function _shouldSendActivationNotification($paramValue) {
65
+ switch ($paramValue) {
66
+ case Exinent_CustomerActivation_Helper_Data::STATUS_ACTIVATE_WITH_EMAIL:
67
+ $sendEmail = true;
68
+ break;
69
+ case Exinent_CustomerActivation_Helper_Data::STATUS_ACTIVATE_WITHOUT_EMAIL:
70
+ case Exinent_CustomerActivation_Helper_Data::STATUS_DEACTIVATE:
71
+ default:
72
+ $sendEmail = false;
73
+ break;
74
+ }
75
+ return $sendEmail;
76
+ }
77
+
78
+ protected function _sendActivationNotificationEmails(array $customerIds) {
79
+ $helper = Mage::helper('customeractivation');
80
+ $customers = Mage::getResourceModel('customer/customer_collection')
81
+ ->addAttributeToFilter('entity_id', array('in' => $customerIds))
82
+ ->addAttributeToSelect('*')
83
+ ->addNameToSelect();
84
+ foreach ($customers as $customer) {
85
+ $helper->sendCustomerNotificationEmail($customer);
86
+ }
87
+ }
88
+
89
+ protected function _isAllowed() {
90
+ return Mage::getSingleton('admin/session')->isAllowed('customer/manage');
91
+ }
92
+
93
+ }
app/code/community/Exinent/CustomerActivation/controllers/CategoryController.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ include(Mage::getBaseDir() . "/app/code/core/Mage/Catalog/controllers/CategoryController.php");
4
+
5
+ class Exinent_CustomerActivation_CategoryController extends Mage_Catalog_CategoryController {
6
+
7
+ protected function _initCatagory() {
8
+ $ModuleStatus = Mage::getStoreConfig('customer/customeractivation/disable_ext');
9
+ if ($ModuleStatus == 1) {
10
+ $cmsPagesList = Mage::getStoreConfig('customer/customeractivation/require_aunthenticate_categories');
11
+ $pages = explode(',', $cmsPagesList);
12
+ $currentUrl = Mage::helper('core/url')->getCurrentUrl();
13
+ $baseUrl = Mage::getBaseUrl();
14
+ $cmspage = explode($baseUrl, $currentUrl);
15
+ $cmspage = explode('.html', $cmspage[1]);
16
+
17
+ $position = strrpos($cmspage[0], "/");
18
+ if ($position) {
19
+ $cmspage = substr($cmspage[0], $position + 1);
20
+ } else {
21
+ $cmspage = substr($cmspage[0], $position + 0);
22
+ }
23
+ if (in_array($cmspage, $pages)) {
24
+
25
+ if (!Mage::getSingleton('customer/session')->isLoggedIn()) {
26
+
27
+ Mage::app()->getFrontController()->getResponse()
28
+ ->setRedirect(Mage::getUrl('customer/account/login'))
29
+ ->sendResponse();
30
+ } else {
31
+ $customerGroups = Mage::getStoreConfig('customer/customeractivation/require_activation_groups');
32
+ $customers = explode(',', $customerGroups);
33
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
34
+ $customerId = $customer->getGroupId();
35
+ if (in_array($customerId, $customers)) {
36
+
37
+ } else {
38
+ Mage::app()->getFrontController()->getResponse()
39
+ ->setRedirect(Mage::getBaseUrl())
40
+ ->sendResponse();
41
+ }
42
+ }
43
+ }
44
+ }
45
+ Mage::dispatchEvent('catalog_controller_category_init_before', array('controller_action' => $this));
46
+ $categoryId = (int) $this->getRequest()->getParam('id', false);
47
+ if (!$categoryId) {
48
+ return false;
49
+ }
50
+
51
+ $category = Mage::getModel('catalog/category')
52
+ ->setStoreId(Mage::app()->getStore()->getId())
53
+ ->load($categoryId);
54
+
55
+ if (!Mage::helper('catalog/category')->canShow($category)) {
56
+ return false;
57
+ }
58
+ Mage::getSingleton('catalog/session')->setLastVisitedCategoryId($category->getId());
59
+ Mage::register('current_category', $category);
60
+ Mage::register('current_entity_key', $category->getPath());
61
+
62
+ try {
63
+ Mage::dispatchEvent(
64
+ 'catalog_controller_category_init_after', array(
65
+ 'category' => $category,
66
+ 'controller_action' => $this
67
+ )
68
+ );
69
+ } catch (Mage_Core_Exception $e) {
70
+ Mage::logException($e);
71
+ return false;
72
+ }
73
+
74
+ return $category;
75
+ }
76
+
77
+ }
app/code/community/Exinent/CustomerActivation/controllers/IndexController.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require_once 'Mage/Cms/controllers/IndexController.php';
4
+ class Exinent_CustomerActivation_IndexController extends Mage_Cms_IndexController
5
+ {
6
+
7
+ public function indexAction($coreRoute = null) {
8
+
9
+ $pageId = Mage::getStoreConfig(Mage_Cms_Helper_Page::XML_PATH_HOME_PAGE);
10
+ if (!Mage::helper('cms/page')->renderPage($this, $pageId)) {
11
+ $this->_forward('defaultIndex');
12
+ }
13
+ $this->loadLayout();
14
+ // $this->renderLayout();
15
+
16
+ }
17
+
18
+ public function wholesaleAction() {
19
+
20
+ $this->loadLayout();
21
+ $this->renderLayout();
22
+ }
23
+
24
+ public function wholesaleloginAction() {
25
+ $this->loadLayout();
26
+ $this->renderLayout();
27
+ }
28
+
29
+ }
app/code/community/Exinent/CustomerActivation/controllers/PageController.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require_once 'Mage/Cms/controllers/PageController.php';
4
+ class Exinent_CustomerActivation_PageController extends Mage_Cms_PageController
5
+ {
6
+
7
+ public function viewAction()
8
+ {
9
+ // echo 'hii';exit;
10
+ $ModuleStatus = Mage::getStoreConfig('customer/customeractivation/disable_ext');
11
+ if($ModuleStatus==1){
12
+ $cmsPagesList = Mage::getStoreConfig('customer/customeractivation/require_aunthenticate_cms');
13
+ $pages = explode(',', $cmsPagesList);
14
+ $currentUrl = Mage::helper('core/url')->getCurrentUrl();
15
+ $baseUrl = Mage::getBaseUrl();
16
+ $cmspage = explode($baseUrl, $currentUrl);
17
+ $strlen = strlen($cmspage[1]);
18
+ $slashchar = substr($cmspage[1], $strlen-1, $strlen);
19
+ if($slashchar=='/'){
20
+ $cmspage = substr($cmspage[1], 0, -1);
21
+ }else{
22
+ $cmspage = $cmspage[1];
23
+ }
24
+ if(in_array($cmspage, $pages)){
25
+
26
+ if(!Mage::getSingleton('customer/session')->isLoggedIn()) {
27
+
28
+ Mage::app()->getFrontController()->getResponse()
29
+ ->setRedirect(Mage::getUrl('customer/account/login'))
30
+ ->sendResponse();
31
+ }else{
32
+ $customerGroups = Mage::getStoreConfig('customer/customeractivation/require_activation_groups');
33
+ $customers = explode(',', $customerGroups);
34
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
35
+ $customerId = $customer->getGroupId();
36
+ if(in_array($customerId, $customers)){
37
+
38
+
39
+ }else{
40
+ Mage::app()->getFrontController()->getResponse()
41
+ ->setRedirect(Mage::getBaseUrl())
42
+ ->sendResponse();
43
+ }
44
+ }
45
+ }
46
+ }
47
+ $pageId = $this->getRequest()
48
+ ->getParam('page_id', $this->getRequest()->getParam('id', false));
49
+ if (!Mage::helper('cms/page')->renderPage($this, $pageId)) {
50
+ $this->_forward('noRoute');
51
+ }
52
+ }
53
+ }
app/code/community/Exinent/CustomerActivation/controllers/ProductController.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ include(Mage::getBaseDir() . "/app/code/core/Mage/Catalog/controllers/ProductController.php");
4
+
5
+ class Exinent_CustomerActivation_ProductController extends Mage_Catalog_ProductController {
6
+
7
+ public function viewAction() {
8
+ $ModuleStatus = Mage::getStoreConfig('customer/customeractivation/disable_ext');
9
+ if($ModuleStatus==1){
10
+ $cmsPagesList = Mage::getStoreConfig('customer/customeractivation/require_aunthenticate_products');
11
+ $pages = explode(',', $cmsPagesList);
12
+ $currentUrl = Mage::helper('core/url')->getCurrentUrl();
13
+ $baseUrl = Mage::getBaseUrl();
14
+ $cmspage = explode($baseUrl, $currentUrl);
15
+ $cmspage = explode('.html', $cmspage[1]);
16
+ $position = strrpos($cmspage[0], "/");
17
+ if ($position) {
18
+ $cmspage = substr($cmspage[0], $position + 1);
19
+ } else {
20
+ $cmspage = substr($cmspage[0], $position + 0);
21
+ }
22
+
23
+ if (in_array($cmspage, $pages)) {
24
+ if (!Mage::getSingleton('customer/session')->isLoggedIn()) {
25
+ Mage::app()->getFrontController()->getResponse()
26
+ ->setRedirect(Mage::getUrl('customer/account/login'))
27
+ ->sendResponse();
28
+ }else{
29
+ $customerGroups = Mage::getStoreConfig('customer/customeractivation/require_activation_groups');
30
+ $customers = explode(',', $customerGroups);
31
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
32
+ $customerId = $customer->getGroupId();
33
+ if(in_array($customerId, $customers)){
34
+
35
+
36
+ }else{
37
+ Mage::app()->getFrontController()->getResponse()
38
+ ->setRedirect(Mage::getBaseUrl())
39
+ ->sendResponse();
40
+ }
41
+ }
42
+ }
43
+ }
44
+ // Get initial data from request
45
+ $categoryId = (int) $this->getRequest()->getParam('category', false);
46
+ $productId = (int) $this->getRequest()->getParam('id');
47
+ $specifyOptions = $this->getRequest()->getParam('options');
48
+
49
+ // Prepare helper and params
50
+ $viewHelper = Mage::helper('catalog/product_view');
51
+
52
+ $params = new Varien_Object();
53
+ $params->setCategoryId($categoryId);
54
+ $params->setSpecifyOptions($specifyOptions);
55
+
56
+ // Render page
57
+ try {
58
+ $viewHelper->prepareAndRender($productId, $this, $params);
59
+ } catch (Exception $e) {
60
+ if ($e->getCode() == $viewHelper->ERR_NO_PRODUCT_LOADED) {
61
+ if (isset($_GET['store']) && !$this->getResponse()->isRedirect()) {
62
+ $this->_redirect('');
63
+ } elseif (!$this->getResponse()->isRedirect()) {
64
+ $this->_forward('noRoute');
65
+ }
66
+ } else {
67
+ Mage::logException($e);
68
+ $this->_forward('noRoute');
69
+ }
70
+ }
71
+ }
72
+
73
+ }
app/code/community/Exinent/CustomerActivation/controllers/productOrderController.php ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Exinent_CustomerActivation_productOrderController extends Mage_Core_Controller_Front_Action {
4
+
5
+ public function preDispatch() {
6
+ parent::preDispatch();
7
+ $action = $this->getRequest()->getActionName();
8
+ $loginUrl = Mage::helper('customer')->getLoginUrl();
9
+ $ModuleStatus = Mage::getStoreConfig('customer/customeractivation/disable_ext');
10
+
11
+ $customerGroups = Mage::getStoreConfig('customer/customeractivation/require_activation_groups');
12
+ $customers = explode(',', $customerGroups);
13
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
14
+ $customerId = $customer->getGroupId();
15
+ if (in_array($customerId, $customers)) {
16
+
17
+ } else {
18
+ Mage::app()->getFrontController()->getResponse()
19
+ ->setRedirect(Mage::getBaseUrl())
20
+ ->sendResponse();
21
+ }
22
+ if (!Mage::getSingleton('customer/session')->authenticate($this, $loginUrl)) {
23
+ $this->setFlag('', self::FLAG_NO_DISPATCH, true);
24
+ } else if ($ModuleStatus == 0) {
25
+ Mage::app()->getFrontController()->getResponse()
26
+ ->setRedirect(Mage::getBaseUrl())
27
+ ->sendResponse();
28
+ }
29
+ }
30
+
31
+ public function indexAction() {
32
+ $this->loadLayout();
33
+ $this->renderLayout();
34
+ }
35
+
36
+ public function quickorderproductAction() {
37
+ $this->loadLayout();
38
+ $this->renderLayout();
39
+ }
40
+
41
+ public function submitorderbySimpleproductAction() {
42
+ $minQty = Mage::getStoreConfig('customer/customeractivation/min_qty');
43
+
44
+ $params = $this->getRequest()->getParams();
45
+ $cart = Mage::getModel('checkout/cart');
46
+ foreach ($params as $sku => $qty) {
47
+
48
+ $ids = explode('_', $sku);
49
+ $productId = $ids[0];
50
+ $product = Mage::getModel('catalog/product')->load($productId);
51
+
52
+ if (($qty != null || $qty != '') && is_numeric($qty)) {
53
+
54
+ $stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product);
55
+ $productQty = $stock->getQty();
56
+
57
+ if ($qty < $minQty )
58
+ $qty = $minQty;
59
+ if($qty > $productQty){
60
+ $message = Mage::helper('cataloginventory')->__('The requested quantity for "%s" is not available.', $product->getName());
61
+ Mage::getSingleton('core/session')->addError($message);
62
+ $options = array("product" => $productId, "qty" => $productQty);
63
+ $cart->addProduct($product, $options);
64
+ }else{
65
+ $options = array("product" => $productId, "qty" => $qty);
66
+ $cart->addProduct($product, $options);
67
+ }
68
+ }
69
+ }
70
+ $cart->save();
71
+ $this->_redirect('checkout/cart');
72
+ }
73
+
74
+ public function submitorderbyproductAction() {
75
+ $params = $this->getRequest()->getParams();
76
+ $cart = Mage::getModel('checkout/cart');
77
+ foreach ($params as $sku => $qty) {
78
+ $ids = explode('_', $sku);
79
+ $confId = $ids[0];
80
+ $productId = $ids[1];
81
+ $_product = Mage::getModel('catalog/product')->load($productId);
82
+ $optionvalue = $_product->getSize();
83
+ $product = Mage::getModel('catalog/product')->load($confId);
84
+ $options = array("product" => $productId, "super_attribute" => array(134 => $optionvalue), "qty" => $qty);
85
+ if (($qty != null || $qty != '') && is_numeric($qty)) {
86
+ $cart->addProduct($product, $options);
87
+ }
88
+ }
89
+ $cart->save();
90
+ $this->_redirect('checkout/cart');
91
+ }
92
+
93
+ }
app/code/community/Exinent/CustomerActivation/etc/config.xml ADDED
@@ -0,0 +1,288 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Exinent_CustomerActivation>
5
+ <version>0.3.4</version>
6
+ </Exinent_CustomerActivation>
7
+ </modules>
8
+ <global>
9
+ <rewrite>
10
+ <customeractivation>
11
+ <from><![CDATA[#^/customer/account/createpost/#]]></from>
12
+ <to>/customerActivation/account/createpost/</to>
13
+ </customeractivation>
14
+ </rewrite>
15
+ <models>
16
+ <customeractivation>
17
+ <class>Exinent_CustomerActivation_Model</class>
18
+ <resourceModel>customeractivation_resource</resourceModel>
19
+ </customeractivation>
20
+ <customeractivation_resource>
21
+ <class>Exinent_CustomerActivation_Model_Resource</class>
22
+ </customeractivation_resource>
23
+ <customer>
24
+ <rewrite>
25
+ <customer>Exinent_CustomerActivation_Model_Customer</customer>
26
+ </rewrite>
27
+ </customer>
28
+ <sales>
29
+ <rewrite>
30
+ <order>Exinent_CustomerActivation_Model_Order</order>
31
+ </rewrite>
32
+ </sales>
33
+ </models>
34
+ <helpers>
35
+ <customeractivation>
36
+ <class>Exinent_CustomerActivation_Helper</class>
37
+ </customeractivation>
38
+ </helpers>
39
+ <blocks>
40
+ <customeractivation>
41
+ <class>Exinent_CustomerActivation_Block</class>
42
+ </customeractivation>
43
+ <page>
44
+ <rewrite>
45
+ <html_topmenu>Exinent_CustomerActivation_Block_Page_Html_Topmenu</html_topmenu>
46
+ </rewrite>
47
+ </page>
48
+ </blocks>
49
+ <resources>
50
+ <customeractivation_setup>
51
+ <setup>
52
+ <module>Exinent_CustomerActivation</module>
53
+ <class>Mage_Customer_Model_Entity_Setup</class>
54
+ </setup>
55
+ </customeractivation_setup>
56
+ </resources>
57
+ <template>
58
+ <email>
59
+ <customer_customeractivation_registration_admin_template translate="label" module="customeractivation">
60
+ <label>Customer Registration Admin Notification</label>
61
+ <file>Exinent/customeractivation/customer_registration_admin.html</file>
62
+ <type>html</type>
63
+ </customer_customeractivation_registration_admin_template>
64
+ <customer_customeractivation_activation_template translate="label" module="customeractivation">
65
+ <label>Customer Activation Notification</label>
66
+ <file>Exinent/customeractivation/customer_activation.html</file>
67
+ <type>html</type>
68
+ </customer_customeractivation_activation_template>
69
+ </email>
70
+ </template>
71
+ <events>
72
+
73
+
74
+ <customer_save_before>
75
+ <observers>
76
+ <customeractivation>
77
+ <type>singleton</type>
78
+ <class>customeractivation/observer</class>
79
+ <method>customerSaveBefore</method>
80
+ </customeractivation>
81
+ </observers>
82
+ </customer_save_before>
83
+ <customer_save_after>
84
+ <observers>
85
+ <customeractivation>
86
+ <type>model</type>
87
+ <class>customeractivation/observer</class>
88
+ <method>customerSaveAfter</method>
89
+ </customeractivation>
90
+ </observers>
91
+ </customer_save_after>
92
+
93
+ </events>
94
+ </global>
95
+ <frontend>
96
+
97
+ <events>
98
+ <page_block_html_topmenu_gethtml_before>
99
+ <observers>
100
+ <customeractivation>
101
+ <type>singleton</type>
102
+ <class>customeractivation/observer</class>
103
+ <method>page_block_html_topmenu_gethtml_before</method>
104
+ </customeractivation>
105
+ </observers>
106
+ </page_block_html_topmenu_gethtml_before>
107
+ </events>
108
+ <routers>
109
+ <customeractivation>
110
+ <use>standard</use>
111
+ <args>
112
+ <module>Exinent_CustomerActivation</module>
113
+ <frontName>customerActivation</frontName>
114
+ </args>
115
+ </customeractivation>
116
+
117
+ <cms>
118
+ <use>standard</use>
119
+ <args>
120
+ <modules>
121
+ <Exinent_CustomerActivation before="Mage_Cms">Exinent_CustomerActivation</Exinent_CustomerActivation>
122
+ </modules>
123
+ </args>
124
+ </cms>
125
+ <catalog>
126
+ <args>
127
+ <modules>
128
+ <Exinent_CustomerActivation before="Mage_Catalog">Exinent_CustomerActivation</Exinent_CustomerActivation>
129
+ </modules>
130
+ </args>
131
+ </catalog>
132
+ </routers>
133
+ <layout>
134
+ <updates>
135
+ <customeractivation>
136
+ <file>customerActivation.xml</file>
137
+ </customeractivation>
138
+ </updates>
139
+ </layout>
140
+ </frontend>
141
+ <admin>
142
+ <routers>
143
+ <customeractivation>
144
+ <use>admin</use>
145
+ <args>
146
+ <module>Exinent_CustomerActivation</module>
147
+ <frontName>customeractivation</frontName>
148
+ </args>
149
+ </customeractivation>
150
+ </routers>
151
+ </admin>
152
+ <frontend>
153
+ <events>
154
+ <customer_login>
155
+ <observers>
156
+ <customeractivation>
157
+ <type>singleton</type>
158
+ <class>customeractivation/observer</class>
159
+ <method>customerLogin</method>
160
+ </customeractivation>
161
+ </observers>
162
+ </customer_login>
163
+ <sales_convert_quote_address_to_order>
164
+ <observers>
165
+ <customeractivation>
166
+ <type>singleton</type>
167
+ <class>customeractivation/observer</class>
168
+ <method>salesCovertQuoteAddressToOrder</method>
169
+ </customeractivation>
170
+ </observers>
171
+ </sales_convert_quote_address_to_order>
172
+ </events>
173
+ <translate>
174
+ <modules>
175
+ <Exinent_CustomerActivation>
176
+ <files>
177
+ <default>Exinent_CustomerActivation.csv</default>
178
+ </files>
179
+ </Exinent_CustomerActivation>
180
+ </modules>
181
+ </translate>
182
+ </frontend>
183
+ <default>
184
+ <customer>
185
+ <customeractivation>
186
+ <disable_ext>0</disable_ext>
187
+ <always_active_in_admin>1</always_active_in_admin>
188
+ <alert_admin>1</alert_admin>
189
+ <admin_email></admin_email>
190
+ <registration_admin_template>customer_customeractivation_registration_admin_template</registration_admin_template>
191
+ <alert_customer>0</alert_customer>
192
+ <activation_template>customer_customeractivation_activation_template</activation_template>
193
+ <activation_status_default>0</activation_status_default>
194
+ <always_send_admin_email>0</always_send_admin_email>
195
+ <require_activation_for_specific_groups>0</require_activation_for_specific_groups>
196
+ <require_activation_groups></require_activation_groups>
197
+ </customeractivation>
198
+ </customer>
199
+ <payment>
200
+ <net30>
201
+ <active>0</active>
202
+ <model>customeractivation/net30</model>
203
+ <order_status>pending</order_status>
204
+ <title>NET 30</title>
205
+ <group>offline</group>
206
+ <allowspecific>0</allowspecific>
207
+ </net30>
208
+ <net15>
209
+ <active>0</active>
210
+ <model>customeractivation/net15</model>
211
+ <order_status>pending</order_status>
212
+ <title>NET 15</title>
213
+ <group>offline</group>
214
+ <allowspecific>0</allowspecific>
215
+ </net15>
216
+ </payment>
217
+
218
+ <carriers>
219
+ <thirdpartyfedex>
220
+ <active>1</active>
221
+
222
+ <model>Exinent_CustomerActivation_Model_Thirdpartyfedex</model>
223
+ <title>3rd Party Fed Ex</title>
224
+ <sort_order>10</sort_order>
225
+ <sallowspecific>0</sallowspecific>
226
+ </thirdpartyfedex>
227
+
228
+ <thirdpartyups>
229
+ <active>1</active>
230
+ <model>Exinent_CustomerActivation_Model_Thirdpartyups</model>
231
+ <title>3rd Party UPS</title>
232
+ <sort_order>10</sort_order>
233
+ <sallowspecific>0</sallowspecific>
234
+ </thirdpartyups>
235
+
236
+ </carriers>
237
+ </default>
238
+ <adminhtml>
239
+ <layout>
240
+ <updates>
241
+ <customeractivation>
242
+ <file>customerActivation.xml</file>
243
+ </customeractivation>
244
+ </updates>
245
+ </layout>
246
+ <translate>
247
+ <modules>
248
+ <Exinent_CustomerActivation>
249
+ <files>
250
+ <default>Exinent_CustomerActivation.csv</default>
251
+ </files>
252
+ </Exinent_CustomerActivation>
253
+ </modules>
254
+ </translate>
255
+ <events>
256
+ <!-- The massaction block can't be added in the block abstract event, this needs to be used -->
257
+ <adminhtml_block_html_before>
258
+ <observers>
259
+ <customeractivation>
260
+ <type>model</type>
261
+ <class>customeractivation/observer</class>
262
+ <method>adminhtmlBlockHtmlBefore</method>
263
+ </customeractivation>
264
+ </observers>
265
+ </adminhtml_block_html_before>
266
+
267
+ <!-- Add attribute to grid collection -->
268
+ <eav_collection_abstract_load_before>
269
+ <observers>
270
+ <customeractivation>
271
+ <type>model</type>
272
+ <class>customeractivation/observer</class>
273
+ <method>eavCollectionAbstractLoadBefore</method>
274
+ </customeractivation>
275
+ </observers>
276
+ </eav_collection_abstract_load_before>
277
+
278
+
279
+ </events>
280
+ </adminhtml>
281
+ <phpunit>
282
+ <suite>
283
+ <modules>
284
+ <Exinent_CustomerActivation/>
285
+ </modules>
286
+ </suite>
287
+ </phpunit>
288
+ </config>
app/code/community/Exinent/CustomerActivation/etc/system.xml ADDED
@@ -0,0 +1,383 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+
3
+ <config>
4
+ <sections>
5
+ <customer translate="label" module="customer">
6
+ <groups>
7
+ <customeractivation translate="label" module="customeractivation">
8
+ <label>Customer Activation</label>
9
+ <sort_order>768</sort_order>
10
+ <show_in_default>1</show_in_default>
11
+ <show_in_website>1</show_in_website>
12
+ <show_in_store>1</show_in_store>
13
+ <fields>
14
+ <disable_ext translate="label" module="customeractivation">
15
+ <label>CustomerActivation</label>
16
+ <frontend_type>select</frontend_type>
17
+ <source_model>adminhtml/system_config_source_yesno</source_model>
18
+ <sort_order>10</sort_order>
19
+ <show_in_default>1</show_in_default>
20
+ <show_in_website>1</show_in_website>
21
+ <show_in_store>1</show_in_store>
22
+ </disable_ext>
23
+
24
+ <always_active_in_admin translate="label" module="customeractivation">
25
+ <label>Always enable in admin interface</label>
26
+ <frontend_type>select</frontend_type>
27
+ <source_model>adminhtml/system_config_source_yesno</source_model>
28
+ <sort_order>11</sort_order>
29
+ <show_in_default>1</show_in_default>
30
+ <show_in_website>0</show_in_website>
31
+ <show_in_store>0</show_in_store>
32
+ <comment>If you want to activate accounts created via the admin interface</comment>
33
+ <depends>
34
+ <disable_ext>1</disable_ext>
35
+ </depends>
36
+ </always_active_in_admin>
37
+
38
+ <require_activation_groups>
39
+ <label>Require Activation for Groups</label>
40
+ <frontend_type>multiselect</frontend_type>
41
+ <source_model>customeractivation/adminhtml_system_config_source_customer_group_multiselect</source_model>
42
+ <sort_order>12</sort_order>
43
+ <show_in_default>1</show_in_default>
44
+ <show_in_website>1</show_in_website>
45
+ <show_in_store>1</show_in_store>
46
+ </require_activation_groups>
47
+
48
+ <address_field translate="label" module="customeractivation">
49
+ <label>Enable Address Fields on Register Form</label>
50
+ <frontend_type>select</frontend_type>
51
+ <source_model>adminhtml/system_config_source_yesno</source_model>
52
+ <sort_order>13</sort_order>
53
+ <show_in_default>1</show_in_default>
54
+ <show_in_website>1</show_in_website>
55
+ <show_in_store>1</show_in_store>
56
+ </address_field>
57
+
58
+ <min_qty translate="label" module="customeractivation">
59
+ <label>Minimum Quantity allowed in Quick order Form</label>
60
+ <fontend_type>text</fontend_type>
61
+ <sort_order>14</sort_order>
62
+ <show_in_default>1</show_in_default>
63
+ <show_in_website>1</show_in_website>
64
+ <show_in_store>0</show_in_store>
65
+ </min_qty>
66
+
67
+ <require_aunthenticate_cms>
68
+ <label>Authentication required for pages</label>
69
+ <frontend_type>multiselect</frontend_type>
70
+ <source_model>customeractivation/adminhtml_system_config_source_pages_group_multiselect</source_model>
71
+ <sort_order>15</sort_order>
72
+ <show_in_default>1</show_in_default>
73
+ <show_in_website>1</show_in_website>
74
+ <show_in_store>1</show_in_store>
75
+ </require_aunthenticate_cms>
76
+
77
+ <require_aunthenticate_categories>
78
+ <label>Authentication required for Categories</label>
79
+ <frontend_type>multiselect</frontend_type>
80
+ <source_model>customeractivation/adminhtml_system_config_source_categories_group_multiselect</source_model>
81
+ <sort_order>16</sort_order>
82
+ <show_in_default>1</show_in_default>
83
+ <show_in_website>1</show_in_website>
84
+ <show_in_store>1</show_in_store>
85
+ </require_aunthenticate_categories>
86
+
87
+ <require_aunthenticate_products>
88
+ <label>Authentication required for Products</label>
89
+ <frontend_type>multiselect</frontend_type>
90
+ <source_model>customeractivation/adminhtml_system_config_source_products_group_multiselect</source_model>
91
+ <sort_order>17</sort_order>
92
+ <show_in_default>1</show_in_default>
93
+ <show_in_website>1</show_in_website>
94
+ <show_in_store>1</show_in_store>
95
+ </require_aunthenticate_products>
96
+
97
+ <!-- <price_field translate="label" module="customeractivation">
98
+ <label>Hide Price</label>
99
+ <frontend_type>select</frontend_type>
100
+ <source_model>adminhtml/system_config_source_yesno</source_model>
101
+ <sort_order>18</sort_order>
102
+ <show_in_default>1</show_in_default>
103
+ <show_in_website>1</show_in_website>
104
+ <show_in_store>1</show_in_store>
105
+ </price_field>
106
+
107
+ <price_hide_products>
108
+ <label>Price Hide Products List</label>
109
+ <frontend_type>multiselect</frontend_type>
110
+ <source_model>customeractivation/adminhtml_system_config_source_products_price_multiselect</source_model>
111
+ <sort_order>19</sort_order>
112
+ <show_in_default>1</show_in_default>
113
+ <show_in_website>1</show_in_website>
114
+ <show_in_store>1</show_in_store>
115
+ <depends>
116
+ <price_field>1</price_field>
117
+ </depends>
118
+ </price_hide_products>-->
119
+
120
+ <activation_status_default translate="label" module="customeractivation">
121
+ <label>Activate Wholesaler Accounts by Default</label>
122
+ <frontend_type>select</frontend_type>
123
+ <source_model>adminhtml/system_config_source_yesno</source_model>
124
+ <sort_order>20</sort_order>
125
+ <show_in_default>1</show_in_default>
126
+ <show_in_website>1</show_in_website>
127
+ <show_in_store>1</show_in_store>
128
+ </activation_status_default>
129
+ <date_start>
130
+ <label>Start Date</label>
131
+ <frontend_type>text</frontend_type>
132
+ <frontend_model>customeractivation/adminhtml_system_config_date</frontend_model>
133
+ <sort_order>21</sort_order>
134
+ <show_in_default>1</show_in_default>
135
+ <show_in_website>1</show_in_website>
136
+ <show_in_store>1</show_in_store>
137
+ <depends>
138
+ <activation_status_default>1</activation_status_default>
139
+ </depends>
140
+ </date_start>
141
+
142
+ <date_end>
143
+ <label>End Date</label>
144
+ <frontend_type>text</frontend_type>
145
+ <frontend_model>customeractivation/adminhtml_system_config_date</frontend_model>
146
+ <sort_order>22</sort_order>
147
+ <show_in_default>1</show_in_default>
148
+ <show_in_website>1</show_in_website>
149
+ <show_in_store>1</show_in_store>
150
+ <depends>
151
+ <activation_status_default>1</activation_status_default>
152
+ </depends>
153
+ </date_end>
154
+
155
+
156
+ </fields>
157
+ </customeractivation>
158
+ </groups>
159
+ </customer>
160
+ <carriers translate="label" module="shipping">
161
+ <groups>
162
+ <thirdpartyfedex translate="label">
163
+ <label>3rd Party Fed Ex</label>
164
+ <frontend_type>text</frontend_type>
165
+ <sort_order>2</sort_order>
166
+ <show_in_default>1</show_in_default>
167
+ <show_in_website>1</show_in_website>
168
+ <show_in_store>1</show_in_store>
169
+ <fields>
170
+
171
+ <active translate="label">
172
+ <label>Enabled</label>
173
+ <frontend_type>select</frontend_type>
174
+ <source_model>adminhtml/system_config_source_yesno</source_model>
175
+ <sort_order>1</sort_order>
176
+ <show_in_default>1</show_in_default>
177
+ <show_in_website>1</show_in_website>
178
+ <show_in_store>0</show_in_store>
179
+ </active>
180
+
181
+ <title translate="label">
182
+ <label>Title</label>
183
+ <frontend_type>text</frontend_type>
184
+ <sort_order>2</sort_order>
185
+ <show_in_default>1</show_in_default>
186
+ <show_in_website>1</show_in_website>
187
+ <show_in_store>1</show_in_store>
188
+ </title>
189
+
190
+ <sort_order translate="label">
191
+ <label>Sort Order</label>
192
+ <frontend_type>text</frontend_type>
193
+ <sort_order>100</sort_order>
194
+ <show_in_default>1</show_in_default>
195
+ <show_in_website>1</show_in_website>
196
+ <show_in_store>0</show_in_store>
197
+ </sort_order>
198
+
199
+ <sallowspecific translate="label">
200
+ <label>Ship to Applicable Countries</label>
201
+ <frontend_type>select</frontend_type>
202
+ <sort_order>90</sort_order>
203
+ <frontend_class>shipping-applicable-country</frontend_class>
204
+ <source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model>
205
+ <show_in_default>1</show_in_default>
206
+ <show_in_website>1</show_in_website>
207
+ <show_in_store>0</show_in_store>
208
+ </sallowspecific>
209
+
210
+ <specificcountry translate="label">
211
+ <label>Ship to Specific Countries</label>
212
+ <frontend_type>multiselect</frontend_type>
213
+ <sort_order>91</sort_order>
214
+ <source_model>adminhtml/system_config_source_country</source_model>
215
+ <show_in_default>1</show_in_default>
216
+ <show_in_website>1</show_in_website>
217
+ <show_in_store>0</show_in_store>
218
+ <can_be_empty>1</can_be_empty>
219
+ </specificcountry>
220
+
221
+ </fields>
222
+ </thirdpartyfedex>
223
+
224
+ <thirdpartyups translate="label">
225
+ <label>3rd Party UPS</label>
226
+ <frontend_type>text</frontend_type>
227
+ <sort_order>2</sort_order>
228
+ <show_in_default>1</show_in_default>
229
+ <show_in_website>1</show_in_website>
230
+ <show_in_store>1</show_in_store>
231
+ <fields>
232
+
233
+ <active translate="label">
234
+ <label>Enabled</label>
235
+ <frontend_type>select</frontend_type>
236
+ <source_model>adminhtml/system_config_source_yesno</source_model>
237
+ <sort_order>1</sort_order>
238
+ <show_in_default>1</show_in_default>
239
+ <show_in_website>1</show_in_website>
240
+ <show_in_store>0</show_in_store>
241
+ </active>
242
+
243
+ <title translate="label">
244
+ <label>Title</label>
245
+ <frontend_type>text</frontend_type>
246
+ <sort_order>2</sort_order>
247
+ <show_in_default>1</show_in_default>
248
+ <show_in_website>1</show_in_website>
249
+ <show_in_store>1</show_in_store>
250
+ </title>
251
+
252
+ <sort_order translate="label">
253
+ <label>Sort Order</label>
254
+ <frontend_type>text</frontend_type>
255
+ <sort_order>100</sort_order>
256
+ <show_in_default>1</show_in_default>
257
+ <show_in_website>1</show_in_website>
258
+ <show_in_store>0</show_in_store>
259
+ </sort_order>
260
+
261
+ <sallowspecific translate="label">
262
+ <label>Ship to Applicable Countries</label>
263
+ <frontend_type>select</frontend_type>
264
+ <sort_order>90</sort_order>
265
+ <frontend_class>shipping-applicable-country</frontend_class>
266
+ <source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model>
267
+ <show_in_default>1</show_in_default>
268
+ <show_in_website>1</show_in_website>
269
+ <show_in_store>0</show_in_store>
270
+ </sallowspecific>
271
+
272
+ <specificcountry translate="label">
273
+ <label>Ship to Specific Countries</label>
274
+ <frontend_type>multiselect</frontend_type>
275
+ <sort_order>91</sort_order>
276
+ <source_model>adminhtml/system_config_source_country</source_model>
277
+ <show_in_default>1</show_in_default>
278
+ <show_in_website>1</show_in_website>
279
+ <show_in_store>0</show_in_store>
280
+ <can_be_empty>1</can_be_empty>
281
+ </specificcountry>
282
+
283
+ </fields>
284
+ </thirdpartyups>
285
+ </groups>
286
+ </carriers>
287
+
288
+ <payment>
289
+ <groups>
290
+ <net30 translate="label" module="paygate">
291
+ <!-- will have title 'New Module' -->
292
+ <label>NET 30</label>
293
+ <!-- position between other payment methods -->
294
+ <sort_order>670</sort_order>
295
+ <!-- do not show this configuration options in store scope -->
296
+ <show_in_default>1</show_in_default>
297
+ <show_in_website>1</show_in_website>
298
+ <show_in_store>0</show_in_store>
299
+ <fields>
300
+ <!-- is this payment method active for the website? -->
301
+ <active translate="label">
302
+ <!-- label for the field -->
303
+ <label>Enabled</label>
304
+ <!-- input type for configuration value -->
305
+ <frontend_type>select</frontend_type>
306
+ <!-- model to take the option values from -->
307
+ <source_model>adminhtml/system_config_source_yesno</source_model>
308
+ <!-- field position -->
309
+ <sort_order>1</sort_order>
310
+ <!-- do not show this field in store scope -->
311
+ <show_in_default>1</show_in_default>
312
+ <show_in_website>1</show_in_website>
313
+ <show_in_store>0</show_in_store>
314
+ </active>
315
+ <order_status translate="label">
316
+ <label>New order status</label>
317
+ <frontend_type>select</frontend_type>
318
+ <source_model>adminhtml/system_config_source_order_status_new</source_model>
319
+ <sort_order>4</sort_order>
320
+ <show_in_default>1</show_in_default>
321
+ <show_in_website>1</show_in_website>
322
+ <show_in_store>0</show_in_store>
323
+ </order_status>
324
+ <title translate="label">
325
+ <label>Title</label>
326
+ <frontend_type>text</frontend_type>
327
+ <sort_order>2</sort_order>
328
+ <show_in_default>1</show_in_default>
329
+ <show_in_website>1</show_in_website>
330
+ <show_in_store>0</show_in_store>
331
+ </title>
332
+ </fields>
333
+ </net30>
334
+
335
+ <net15 translate="label" module="paygate">
336
+ <!-- will have title 'New Module' -->
337
+ <label>NET 15</label>
338
+ <!-- position between other payment methods -->
339
+ <sort_order>670</sort_order>
340
+ <!-- do not show this configuration options in store scope -->
341
+ <show_in_default>1</show_in_default>
342
+ <show_in_website>1</show_in_website>
343
+ <show_in_store>0</show_in_store>
344
+ <fields>
345
+ <!-- is this payment method active for the website? -->
346
+ <active translate="label">
347
+ <!-- label for the field -->
348
+ <label>Enabled</label>
349
+ <!-- input type for configuration value -->
350
+ <frontend_type>select</frontend_type>
351
+ <!-- model to take the option values from -->
352
+ <source_model>adminhtml/system_config_source_yesno</source_model>
353
+ <!-- field position -->
354
+ <sort_order>1</sort_order>
355
+ <!-- do not show this field in store scope -->
356
+ <show_in_default>1</show_in_default>
357
+ <show_in_website>1</show_in_website>
358
+ <show_in_store>0</show_in_store>
359
+ </active>
360
+ <order_status translate="label">
361
+ <label>New order status</label>
362
+ <frontend_type>select</frontend_type>
363
+ <source_model>adminhtml/system_config_source_order_status_new</source_model>
364
+ <sort_order>4</sort_order>
365
+ <show_in_default>1</show_in_default>
366
+ <show_in_website>1</show_in_website>
367
+ <show_in_store>0</show_in_store>
368
+ </order_status>
369
+ <title translate="label">
370
+ <label>Title</label>
371
+ <frontend_type>text</frontend_type>
372
+ <sort_order>2</sort_order>
373
+ <show_in_default>1</show_in_default>
374
+ <show_in_website>1</show_in_website>
375
+ <show_in_store>0</show_in_store>
376
+ </title>
377
+ </fields>
378
+ </net15>
379
+
380
+ </groups>
381
+ </payment>
382
+ </sections>
383
+ </config>
app/code/community/Exinent/CustomerActivation/sql/customeractivation_setup/install-0.1.0.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $installer->startSetup();
5
+ $installer->run("
6
+ ALTER TABLE `{$installer->getTable('sales/quote_payment')}` ADD `cancel_date` VARCHAR( 255 ) NOT NULL ;
7
+ ALTER TABLE `{$installer->getTable('sales/order_payment')}` ADD `cancel_date` VARCHAR( 255 ) NOT NULL ;
8
+ ");
9
+ $installer->endSetup();
app/code/community/Exinent/CustomerActivation/sql/customeractivation_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $this->startSetup();
4
+
5
+ $this->addAttribute('customer', 'customer_activated', array(
6
+ 'type' => 'varchar',
7
+ 'input' => 'text',
8
+ 'label' => 'Is activated',
9
+ 'global' => 1,
10
+ 'visible' => 1,
11
+ 'required' => 0,
12
+ 'user_defined' => 1,
13
+ 'visible_on_front' => 0,
14
+ ));
15
+
16
+ $this->endSetup();
17
+
18
+
app/code/community/Exinent/CustomerActivation/sql/customeractivation_setup/mysql4-upgrade-0.2.3-0.2.4.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $this->startSetup();
4
+
5
+ $this->updateAttribute('customer', 'customer_activated', 'frontend_input', 'select');
6
+ $this->updateAttribute('customer', 'customer_activated', 'source_model', 'customeractivation/resource_attribute_source_customeractivation');
7
+
8
+ $this->endSetup();
app/code/community/Exinent/CustomerActivation/sql/customeractivation_setup/mysql4-upgrade-0.2.4-0.2.5.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $this->startSetup();
4
+
5
+ $customer = Mage::getModel('customer/customer');
6
+ $attrSetId = $customer->getResource()->getEntityType()->getDefaultAttributeSetId();
7
+
8
+ $this->addAttributeToSet('customer', $attrSetId, 'General', 'customer_activated');
9
+
10
+ $this->endSetup();
11
+
app/code/community/Exinent/CustomerActivation/sql/customeractivation_setup/mysql4-upgrade-0.2.7-0.2.8.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ if (version_compare(Mage::getVersion(), '1.4.2', '>=')) {
8
+ Mage::getSingleton('eav/config')
9
+ ->getAttribute('customer', 'customer_activated')
10
+ ->setData('used_in_forms', array('adminhtml_customer'))
11
+ ->save();
12
+ }
13
+
14
+ $installer->endSetup();
app/code/community/Exinent/CustomerActivation/sql/customeractivation_setup/mysql4-upgrade-0.2.8-0.2.9.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $installer->startSetup();
5
+
6
+
7
+ $installer->addAttribute("customer", "paymentmethods", array(
8
+ "type" => "varchar",
9
+ "backend" => "",
10
+ "label" => "Payment Methods",
11
+ "input" => "multiselect",
12
+ "source" => "customeractivation/resource_attribute_source_Customerpayment",
13
+ "backend" => "",
14
+ "user_defined" => "1",
15
+ "visible" => true,
16
+ "required" => false,
17
+ "default" => "",
18
+ "frontend" => "",
19
+ "unique" => false,
20
+ "note" => ""
21
+ ));
22
+
23
+ $attribute = Mage::getSingleton("eav/config")->getAttribute("customer", "paymentmethods");
24
+
25
+
26
+ $used_in_forms = array();
27
+
28
+ $used_in_forms[] = "adminhtml_customer";
29
+ $attribute->setData("used_in_forms", $used_in_forms)
30
+ ->setData("is_used_for_customer_segment", true)
31
+ ->setData("is_system", 0)
32
+ ->setData("is_user_defined", 1)
33
+ ->setData("is_visible", 1)
34
+ ->setData("sort_order", 100)
35
+ ;
36
+ $attribute->save();
37
+
38
+
39
+ $installer->addAttribute("customer", "logo_image", array(
40
+ "type" => "varchar",
41
+ "backend" => "",
42
+ "label" => "Logo Image",
43
+ "input" => "text",
44
+ "source" => "",
45
+ "visible" => true,
46
+ "required" => false,
47
+ "default" => "",
48
+ "frontend" => "",
49
+ "user_defined" => "0",
50
+ "unique" => false,
51
+ "note" => "Logo Image"
52
+ ));
53
+
54
+ $attribute = Mage::getSingleton("eav/config")->getAttribute("customer", "logo_image");
55
+
56
+
57
+ $used_in_forms = array();
58
+
59
+ $used_in_forms[] = "adminhtml_customer";
60
+ $attribute->setData("used_in_forms", $used_in_forms)
61
+ ->setData("is_used_for_customer_segment", true)
62
+ ->setData("is_system", 0)
63
+ ->setData("is_user_defined", 0)
64
+ ->setData("is_visible", 1)
65
+ ->setData("sort_order", 100)
66
+ ;
67
+ $attribute->save();
68
+ $installer->endSetup();
app/code/community/Exinent/CustomerActivation/sql/customeractivation_setup/mysql4-upgrade-0.2.9-0.3.0.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*$installer = new Mage_Sales_Model_Resource_Setup('core_setup');
3
+ $installer ->addAttribute('order', 'rep_name', array(
4
+ 'label' => 'Rep Name',
5
+ 'type' => 'text',
6
+ 'input' => 'text',
7
+ 'visible' => true,
8
+ 'required' => false,
9
+ ));
10
+ $installer->endSetup();*/
app/code/community/Exinent/CustomerActivation/sql/customeractivation_setup/mysql4-upgrade-0.3.0-0.3.1.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*$installer = $this;
3
+ $installer->startSetup();
4
+ Mage::register('isSecureArea', 1);
5
+
6
+ // Force the store to be admin
7
+ Mage::app()->setUpdateMode(false);
8
+ Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
9
+
10
+ $category = Mage::getModel('catalog/category');
11
+ $category->setPath('1/2') // set parent to be root category
12
+ ->setStoreId(Mage_Core_Model_App::ADMIN_STORE_ID)
13
+ ->setName('Wholesale')
14
+ ->setUrlKey('wholesale')
15
+ ->setDescription('Description')
16
+ ->setIsActive(1)
17
+ ->setIsAnchor(1)
18
+ ->setIncludeInMenu(1)
19
+ ->setInfinitescroll(1)
20
+ ->setDisplayMode('PRODUCTS')
21
+ ->save();
22
+ $installer->endSetup();*/
23
+
24
+ ?>
app/code/community/Exinent/CustomerActivation/sql/customeractivation_setup/mysql4-upgrade-0.3.1-0.3.2.php ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $installer->startSetup();
5
+ $installer->addAttribute("customer", "store_type", array(
6
+ "type" => "varchar",
7
+ "backend" => "",
8
+ "label" => "Store Type",
9
+ "input" => "select",
10
+ "source" => "customeractivation/resource_attribute_source_StoreType",
11
+ "visible" => true,
12
+ "required" => false,
13
+ "default" => "",
14
+ "frontend" => "",
15
+ "user_defined" => "1",
16
+ "unique" => false,
17
+ "note" => "Store Type"
18
+ ));
19
+
20
+ $attribute = Mage::getSingleton("eav/config")->getAttribute("customer", "store_type");
21
+
22
+
23
+ $used_in_forms = array();
24
+
25
+ $used_in_forms[] = "adminhtml_customer";
26
+ $attribute->setData("used_in_forms", $used_in_forms)
27
+ ->setData("is_used_for_customer_segment", true)
28
+ ->setData("is_system", 0)
29
+ ->setData("is_user_defined", 1)
30
+ ->setData("is_visible", 1)
31
+ ->setData("sort_order", 100)
32
+ ;
33
+ $attribute->save();
34
+
35
+
36
+ $installer->addAttribute("customer", "iswebsite_live", array(
37
+ "type" => "varchar",
38
+ "backend" => "",
39
+ "label" => "Iswebsite Live",
40
+ "input" => "select",
41
+ "source" => "customeractivation/resource_attribute_source_Iswebsitelive",
42
+ "visible" => true,
43
+ "required" => false,
44
+ "default" => "",
45
+ "frontend" => "",
46
+ "user_defined" => "1",
47
+ "unique" => false,
48
+ "note" => "Iswebsite Live"
49
+ ));
50
+
51
+ $attribute = Mage::getSingleton("eav/config")->getAttribute("customer", "iswebsite_live");
52
+
53
+
54
+ $used_in_forms = array();
55
+
56
+ $used_in_forms[] = "adminhtml_customer";
57
+ $attribute->setData("used_in_forms", $used_in_forms)
58
+ ->setData("is_used_for_customer_segment", true)
59
+ ->setData("is_system", 0)
60
+ ->setData("is_user_defined", 1)
61
+ ->setData("is_visible", 1)
62
+ ->setData("sort_order", 100)
63
+ ;
64
+ $attribute->save();
65
+
66
+ $installer->addAttribute("customer", "date_founded", array(
67
+ "type" => "varchar",
68
+ "backend" => "",
69
+ "label" => "Date Founded",
70
+ "input" => "text",
71
+ "source" => "",
72
+ "visible" => true,
73
+ "required" => false,
74
+ "default" => "",
75
+ "frontend" => "",
76
+ "user_defined" => "1",
77
+ "unique" => false,
78
+ "note" => "Date Founded"
79
+ ));
80
+
81
+ $attribute = Mage::getSingleton("eav/config")->getAttribute("customer", "date_founded");
82
+
83
+
84
+ $used_in_forms = array();
85
+
86
+ $used_in_forms[] = "adminhtml_customer";
87
+ $attribute->setData("used_in_forms", $used_in_forms)
88
+ ->setData("is_used_for_customer_segment", true)
89
+ ->setData("is_system", 0)
90
+ ->setData("is_user_defined", 1)
91
+ ->setData("is_visible", 1)
92
+ ->setData("sort_order", 100)
93
+ ;
94
+ $attribute->save();
95
+
96
+
97
+ $installer->addAttribute("customer", "accountspayable_email", array(
98
+ "type" => "varchar",
99
+ "backend" => "",
100
+ "label" => "Accounts Payable Email Address",
101
+ "input" => "text",
102
+ "source" => "",
103
+ "visible" => true,
104
+ "required" => false,
105
+ "default" => "",
106
+ "frontend" => "",
107
+ "user_defined" => "1",
108
+ "unique" => false,
109
+ "note" => "Accounts Payable Email Address"
110
+ ));
111
+
112
+ $attribute = Mage::getSingleton("eav/config")->getAttribute("customer", "accountspayable_email");
113
+
114
+
115
+ $used_in_forms = array();
116
+
117
+ $used_in_forms[] = "adminhtml_customer";
118
+ $attribute->setData("used_in_forms", $used_in_forms)
119
+ ->setData("is_used_for_customer_segment", true)
120
+ ->setData("is_system", 0)
121
+ ->setData("is_user_defined", 1)
122
+ ->setData("is_visible", 1)
123
+ ->setData("sort_order", 100)
124
+ ;
125
+ $attribute->save();
126
+
127
+ $installer->addAttribute("customer", "website_url", array(
128
+ "type" => "varchar",
129
+ "backend" => "",
130
+ "label" => "Website URL",
131
+ "input" => "text",
132
+ "source" => "",
133
+ "visible" => true,
134
+ "required" => false,
135
+ "default" => "",
136
+ "frontend" => "",
137
+ "user_defined" => "1",
138
+ "unique" => false,
139
+ "note" => "Website URL"
140
+ ));
141
+
142
+ $attribute = Mage::getSingleton("eav/config")->getAttribute("customer", "website_url");
143
+
144
+
145
+ $used_in_forms = array();
146
+
147
+ $used_in_forms[] = "adminhtml_customer";
148
+ $attribute->setData("used_in_forms", $used_in_forms)
149
+ ->setData("is_used_for_customer_segment", true)
150
+ ->setData("is_system", 0)
151
+ ->setData("is_user_defined", 1)
152
+ ->setData("is_visible", 1)
153
+ ->setData("sort_order", 100)
154
+ ;
155
+ $attribute->save();
156
+ ?>
app/code/community/Exinent/CustomerActivation/sql/customeractivation_setup/mysql4-upgrade-0.3.2-0.3.3.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*$installer = $this;
3
+ $installer->startSetup();
4
+ $installer->getConnection()->addColumn(
5
+ $this->getTable('sales/order_grid'),
6
+ 'rep_name',
7
+ "varchar(255) DEFAULT NULL"
8
+ );
9
+
10
+ $installer->getConnection()->addKey(
11
+ $this->getTable('sales/order_grid'),
12
+ 'rep_name',
13
+ 'rep_name');
14
+ $installer->endSetup();*/
app/code/community/Exinent/CustomerActivation/sql/customeractivation_setup/mysql4-upgrade-0.3.3-0.3.4.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $installer->startSetup();
5
+
6
+ $installer->addAttribute("customer", "shippingmethods", array(
7
+ "type" => "varchar",
8
+ "backend" => "",
9
+ "label" => "Shipping Methods",
10
+ "input" => "multiselect",
11
+ "source" => "customeractivation/resource_attribute_source_Customershippingmethods",
12
+ "backend" => "",
13
+ "user_defined" => "1",
14
+ "visible" => true,
15
+ "required" => false,
16
+ "default" => "",
17
+ "frontend" => "",
18
+ "unique" => false,
19
+ "note" => ""
20
+ ));
21
+
22
+ $attribute = Mage::getSingleton("eav/config")->getAttribute("customer", "shippingmethods");
23
+
24
+ $used_in_forms = array();
25
+ $used_in_forms[] = "adminhtml_customer";
26
+ $attribute->setData("used_in_forms", $used_in_forms)
27
+ ->setData("is_used_for_customer_segment", true)
28
+ ->setData("is_system", 0)
29
+ ->setData("is_user_defined", 1)
30
+ ->setData("is_visible", 1)
31
+ ->setData("sort_order", 100);
32
+
33
+ $attribute->save();
34
+ $installer->endSetup();
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Wholesale_Customer_Activation</name>
4
- <version>3.0.0</version>
5
  <stability>stable</stability>
6
  <license>Open Software License (OSL)</license>
7
  <channel>community</channel>
@@ -11,8 +11,8 @@
11
  <notes>Design Fixes </notes>
12
  <authors><author><name>Development </name><user>Team</user><email>developer@exinent.com</email></author></authors>
13
  <date>2015-03-12</date>
14
- <time>10:49:05</time>
15
- <contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="customerActivation"><file name="customerActivation.phtml" hash="617232d6030f4d5dc8f115886f576009"/><file name="customerImages.phtml" hash="40df0fb4b7eddfec77faf04f91284117"/><dir name="info"><file name="purchaseorder.phtml" hash="8288341954620536133ce8f388b1864c"/></dir></dir></dir><dir name="layout"><file name="customerActivation.xml" hash="7a6febaadede7863ef1b640fcab762df"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="customerActivation"><dir name="checkout"><dir name="onepage"><dir name="payment"><file name="methods.phtml" hash="771f8c61ca0baa431b0a7aa70b2e1546"/></dir><dir name="shipping_method"><file name="available.phtml" hash="ab11683efa3f497e8c06c7a1176f9d66"/></dir></dir></dir><file name="customerActivation.phtml" hash="83d6ecadd3dfbb95d4cf37ff22261bc1"/><dir name="form"><file name="purchaseorder.phtml" hash="94707f241d7203a08860891c909142dd"/></dir><dir name="info"><file name="purchaseorder.phtml" hash="d3f2a08ee55199680d563929493d0973"/></dir><dir name="onepage"><dir name="shipping_method"><file name="available.phtml" hash="343efe739dab39cd62da8d80c591f8e5"/></dir></dir><file name="quickorderproduct.phtml" hash="ba034c95ebf2cf8258c0815323f22985"/><file name="wholesaleLogin.phtml" hash="16455d9db43ab72c1b385d0ab8e8caee"/><file name="wholesaleRegister.phtml" hash="6b31f2ff96bd041cf21582ffb6744fc5"/></dir></dir><dir name="layout"><file name="customerActivation.xml" hash="fc32c426151f8ffeb9f69bf7321080cd"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Exinent_CustomerActivation.xml" hash="1c70d1597abb1a6401935436754cfc50"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Wholesale_Customer_Activation</name>
4
+ <version>4.0.0</version>
5
  <stability>stable</stability>
6
  <license>Open Software License (OSL)</license>
7
  <channel>community</channel>
11
  <notes>Design Fixes </notes>
12
  <authors><author><name>Development </name><user>Team</user><email>developer@exinent.com</email></author></authors>
13
  <date>2015-03-12</date>
14
+ <time>10:56:39</time>
15
+ <contents><target name="magecommunity"><dir name="Exinent"><dir name="CustomerActivation"><dir name="Block"><dir name="Adminhtml"><dir name="Customer"><dir name="Edit"><dir name="Tab"><file name="Customerimages.php" hash="fc322ed911049ea1482ece66d107b248"/></dir></dir></dir><dir name="System"><dir name="Config"><file name="Date.php" hash="d2f7482b63e9737fd0974828fd644ab5"/></dir></dir><dir name="Widget"><dir name="Grid"><dir name="Column"><dir name="Renderer"><file name="Boolean.php" hash="52734afb3fac7f81717aa83842371d1d"/></dir></dir></dir></dir></dir><file name="Orderproduct.php" hash="ec5f2831bb78470510604e71ac35ebae"/><dir name="Page"><dir name="Html"><file name="Topmenu.php" hash="f37cedb38f22f7e60ba3f9c263cd3366"/></dir></dir><file name="Purchaseorder.php" hash="523393a9a08456231a552576f9a9623d"/><file name="Purchaseorderinfo.php" hash="0f21876ad1e1d7870a56e842e34b2c79"/></dir><dir name="Helper"><file name="Data.php" hash="1391011773d402f2d8eb62afe955663b"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Source"><dir name="Categories"><dir name="Group"><file name="Multiselect.php" hash="a8dc5c2fbff41fa315043ec348ca360b"/></dir></dir><dir name="Customer"><dir name="Group"><file name="Multiselect.php" hash="21f9f4f675cf60dce1a8ce945084f1bd"/></dir></dir><dir name="Pages"><dir name="Group"><file name="Multiselect.php" hash="a046171ced682c2efa786d95b9437e0e"/></dir></dir><dir name="Products"><dir name="Group"><file name="Multiselect.php" hash="dee448615074417ce5fa0b072c21db06"/></dir><dir name="Price"><file name="Multiselect.php" hash="490373ac424eade10f0479a5e14d2a9c"/></dir></dir></dir></dir></dir></dir><file name="Customer.php" hash="4124537f87d8f57809525875c79d5eb2"/><file name="Net15.php" hash="bcb24ede3b498f7488a1986b3a33acb5"/><file name="Net30.php" hash="2dcface31c58114c204db5aca3ca65f8"/><file name="Observer.php" hash="da0126cedb54a661267e3bd50ea7b859"/><file name="Order.php" hash="7eaebf565655776cd7bcba2fce39b641"/><dir name="Resource"><dir name="Attribute"><dir name="Source"><file name="Customeractivation.php" hash="ac458e05c1bb963d73cbd19d3c2aecd9"/><file name="Customerpayment.php" hash="f11636b19de571c5f50de686b813e30d"/><file name="Customershippingmethods.php" hash="a6f870b8425acd1dab692f2e1494e859"/><file name="Iswebsitelive.php" hash="7d8ae067b8885639e6dd5f4f443226b1"/><file name="StoreType.php" hash="8bd57ac868cb24486a9361d8146a965d"/></dir></dir><file name="Customer.php" hash="d4909a22628e2c448a7be2f98cb4a011"/></dir><file name="Thirdparty.php" hash="ad9ba9fe7110b8ef640f4ddc7aad51ee"/><file name="Thirdpartyfed.php" hash="f29004693ca109b35e26a1ede67a7e1b"/><file name="Thirdpartyfedex.php" hash="9074b87a23c4648ecb76e4c7faee211e"/><file name="Thirdpartyups.php" hash="13898e8a383d27fd33c6f587e574228d"/></dir><dir name="controllers"><file name="AccountController.php" hash="1ae9f812cf6645a9247f36ddb91b73ef"/><file name="AdminController.php" hash="d585098ce860d3644d28852d9ffe1526"/><file name="CategoryController.php" hash="700eb1ae4819d60b4ccf20ae99f96ecb"/><file name="IndexController.php" hash="bc0a9613fbdc285ba4ce64e337792442"/><file name="PageController.php" hash="046dd6eccb032499afc205097e2bf266"/><file name="ProductController.php" hash="97eecbd93d3ba49490adae969ff45ed6"/><file name="productOrderController.php" hash="d6347c26c70b421ede78637c3b85757c"/></dir><dir name="etc"><file name="config.xml" hash="0856d7dfa31d2607e8e1f434012ead83"/><file name="system.xml" hash="80e9ed6e8e77e6517e87f1c258e51ae5"/></dir><dir name="sql"><dir name="customeractivation_setup"><file name="install-0.1.0.php" hash="daba549afd5282910754038d4bc1c637"/><file name="mysql4-install-0.1.0.php" hash="0b688c4f0c39efb95d4031c632f6b14d"/><file name="mysql4-upgrade-0.2.3-0.2.4.php" hash="d0739de5c91381e11828a033cb496659"/><file name="mysql4-upgrade-0.2.4-0.2.5.php" hash="3be30bef278024b66199c2df6526784d"/><file name="mysql4-upgrade-0.2.7-0.2.8.php" hash="086ef43b26c39e14e7d1211ad444576a"/><file name="mysql4-upgrade-0.2.8-0.2.9.php" hash="857f64d31b13d5c7954591bcad4b45e2"/><file name="mysql4-upgrade-0.2.9-0.3.0.php" hash="86e1cd5ae59f0591e3720f31c41fdf54"/><file name="mysql4-upgrade-0.3.0-0.3.1.php" hash="df03a10a2d5468cd083a800fbfdfe8ee"/><file name="mysql4-upgrade-0.3.1-0.3.2.php" hash="80cf342b3125b4411ffb038446aa25c2"/><file name="mysql4-upgrade-0.3.2-0.3.3.php" hash="7a49fbb49f7515b02385369dae61744e"/><file name="mysql4-upgrade-0.3.3-0.3.4.php" hash="e6830f6ac3625d64209d8ebf9ab4a272"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="customerActivation"><file name="customerActivation.phtml" hash="617232d6030f4d5dc8f115886f576009"/><file name="customerImages.phtml" hash="40df0fb4b7eddfec77faf04f91284117"/><dir name="info"><file name="purchaseorder.phtml" hash="8288341954620536133ce8f388b1864c"/></dir></dir></dir><dir name="layout"><file name="customerActivation.xml" hash="7a6febaadede7863ef1b640fcab762df"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="customerActivation"><dir name="checkout"><dir name="onepage"><dir name="payment"><file name="methods.phtml" hash="771f8c61ca0baa431b0a7aa70b2e1546"/></dir><dir name="shipping_method"><file name="available.phtml" hash="ab11683efa3f497e8c06c7a1176f9d66"/></dir></dir></dir><file name="customerActivation.phtml" hash="83d6ecadd3dfbb95d4cf37ff22261bc1"/><dir name="form"><file name="purchaseorder.phtml" hash="94707f241d7203a08860891c909142dd"/></dir><dir name="info"><file name="purchaseorder.phtml" hash="d3f2a08ee55199680d563929493d0973"/></dir><dir name="onepage"><dir name="shipping_method"><file name="available.phtml" hash="343efe739dab39cd62da8d80c591f8e5"/></dir></dir><file name="quickorderproduct.phtml" hash="ba034c95ebf2cf8258c0815323f22985"/><file name="wholesaleLogin.phtml" hash="16455d9db43ab72c1b385d0ab8e8caee"/><file name="wholesaleRegister.phtml" hash="6b31f2ff96bd041cf21582ffb6744fc5"/></dir></dir><dir name="layout"><file name="customerActivation.xml" hash="fc32c426151f8ffeb9f69bf7321080cd"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Exinent_CustomerActivation.xml" hash="1c70d1597abb1a6401935436754cfc50"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>