Version Notes
Kartparadigm Store Credit
Download this release
Release Info
Developer | Kartparadigm |
Extension | Kartparadigm_StoreCredit |
Version | 1.0.1.2 |
Comparing to | |
See all releases |
Code changes from version 1.0.1.1 to 1.0.1.2
- app/code/community/Kartparadigm/StoreCredit/Model/Observer.php +3 -1
- app/code/community/Kartparadigm/StoreCredit/controllers/Adminhtml/CustomerController.php +1 -1
- app/code/community/Kartparadigm/StoreCredit/controllers/Adminhtml/CustomerController.php~ +387 -0
- app/code/community/Kartparadigm/StoreCredit/controllers/IndexController.php +1 -1
- package.xml +4 -4
app/code/community/Kartparadigm/StoreCredit/Model/Observer.php
CHANGED
@@ -320,7 +320,9 @@ if (Mage::helper('kartparadigm_storecredit')->getRefundDeductConfig())
|
|
320 |
|
321 |
}
|
322 |
//end
|
323 |
-
|
|
|
|
|
324 |
{
|
325 |
|
326 |
$val = array();
|
320 |
|
321 |
}
|
322 |
//end
|
323 |
+
$status = array();
|
324 |
+
$status = Mage::getSingleton('adminhtml/session')->getTotal();
|
325 |
+
if($status['status'] == 1)
|
326 |
{
|
327 |
|
328 |
$val = array();
|
app/code/community/Kartparadigm/StoreCredit/controllers/Adminhtml/CustomerController.php
CHANGED
@@ -362,7 +362,7 @@ $customerData = Mage::getModel('customer/customer')->load($id)->getData();
|
|
362 |
$emailTemplateVariables['var1'] = $customerData['firstname'];
|
363 |
$emailTemplateVariables['var4'] = $arr1['total_credits'];
|
364 |
$emailTemplateVariables['var5'] = $message;
|
365 |
-
$emailTemplateVariables['var8'] =
|
366 |
|
367 |
$emailTemplate->getProcessedTemplate($emailTemplateVariables);
|
368 |
//Mage::log($name);
|
362 |
$emailTemplateVariables['var1'] = $customerData['firstname'];
|
363 |
$emailTemplateVariables['var4'] = $arr1['total_credits'];
|
364 |
$emailTemplateVariables['var5'] = $message;
|
365 |
+
$emailTemplateVariables['var8'] = $this->getBaseUrl();
|
366 |
|
367 |
$emailTemplate->getProcessedTemplate($emailTemplateVariables);
|
368 |
//Mage::log($name);
|
app/code/community/Kartparadigm/StoreCredit/controllers/Adminhtml/CustomerController.php~
ADDED
@@ -0,0 +1,387 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require_once 'Mage/Adminhtml/controllers/CustomerController.php';
|
3 |
+
class Kartparadigm_StoreCredit_Adminhtml_CustomerController extends Mage_Adminhtml_CustomerController
|
4 |
+
{
|
5 |
+
public function saveAction()
|
6 |
+
{
|
7 |
+
$data = $this->getRequest()->getPost();
|
8 |
+
//Mage::log($data['credit_value']);
|
9 |
+
|
10 |
+
if ($data) {
|
11 |
+
|
12 |
+
//Inset the credits added by admin
|
13 |
+
|
14 |
+
$date = new Zend_Date(Mage::getModel('core/date')->timestamp());
|
15 |
+
$date=$date->toString('Y-M-d H:m:s');
|
16 |
+
$col = Mage::getModel('kartparadigm_storecredit/creditinfo')->getCollection()->addFieldToFilter('c_id',$data['customer_id'])->addFieldToFilter('website1',$data['website1'])->getLastItem();
|
17 |
+
$tdata = array();
|
18 |
+
$tdata['c_id'] = $data['customer_id'];
|
19 |
+
$tdata['action_credits'] = $data['credit_value'];
|
20 |
+
|
21 |
+
|
22 |
+
// Action Of The Admin
|
23 |
+
if($col->getTotalCredits() == '')
|
24 |
+
$tdata['action'] = "Created";
|
25 |
+
else
|
26 |
+
$tdata['action'] = "Updated";
|
27 |
+
//
|
28 |
+
$tdata['website1'] = $data['website1'];
|
29 |
+
if($data['notification'] == 'on')
|
30 |
+
$tdata['customer_notification_status'] = "Notified";
|
31 |
+
else
|
32 |
+
$tdata['customer_notification_status'] = "No";
|
33 |
+
$tdata['state'] = "completed";
|
34 |
+
$tdata['custom_msg'] = "By admin : admin (".$data['description'].")";
|
35 |
+
$tdata['action_date'] = $date;
|
36 |
+
$tdata['store_view'] = $data['storeview1'];
|
37 |
+
|
38 |
+
$tdata['total_credits'] = $col->getTotalCredits() + ($data['credit_value']);
|
39 |
+
if($tdata['total_credits'] <= 0)
|
40 |
+
{
|
41 |
+
$tdata['action_credits'] = -$col->getTotalCredits();
|
42 |
+
$tdata['total_credits'] = 0;
|
43 |
+
|
44 |
+
}
|
45 |
+
|
46 |
+
Mage::log($col->getTotalCredits());
|
47 |
+
|
48 |
+
if(isset($data['credit_value']) && ($data['credit_value'] != 0) && ($col->getTotalCredits() > 0 || ($col->getTotalCredits() == '' && $data['credit_value'] > 0) || $tdata['total_credits'] > 0))
|
49 |
+
{
|
50 |
+
|
51 |
+
|
52 |
+
$model = Mage::getModel('kartparadigm_storecredit/creditinfo')->setData($tdata);
|
53 |
+
try{
|
54 |
+
|
55 |
+
$model->save();
|
56 |
+
if($data['notification'] === 'on'){
|
57 |
+
|
58 |
+
$templateName = Mage::getStoreConfig('mycustom_section/mycustom_group1/caritor_email_template');
|
59 |
+
|
60 |
+
//Mage::log($templateName."sreehari");
|
61 |
+
// for sending mail to admin after order placed
|
62 |
+
$emailTemplate = Mage::getModel('core/email_template')
|
63 |
+
->loadDefault('caritor_email_template');
|
64 |
+
$name = Mage::getStoreConfig('mycustom_section/mycustom_group1/sender_email_identity');
|
65 |
+
$group = "ident_".$name;
|
66 |
+
|
67 |
+
$email = Mage::getStoreConfig('trans_email/'.$group.'/email');
|
68 |
+
|
69 |
+
|
70 |
+
$emailTemplateVariables = array();
|
71 |
+
$emailTemplateVariables['var1'] = $data['account']['firstname'];
|
72 |
+
$emailTemplateVariables['var2'] = $tdata['action_credits'];
|
73 |
+
$emailTemplateVariables['var3'] = $data['storeview1'];
|
74 |
+
$emailTemplateVariables['var4'] = $tdata['total_credits'];
|
75 |
+
$emailTemplateVariables['var5'] = $tdata['action'];
|
76 |
+
$emailTemplateVariables['var6'] = $tdata['action_date'];
|
77 |
+
$emailTemplateVariables['var7'] = $data['description'];
|
78 |
+
$emailTemplateVariables['var8'] = $this->getUrl('customer/account/login/');
|
79 |
+
|
80 |
+
$emailTemplate->getProcessedTemplate($emailTemplateVariables);
|
81 |
+
Mage::log($name);
|
82 |
+
|
83 |
+
$emailTemplate->setSenderName($name);
|
84 |
+
$emailTemplate->setSenderEmail($email);
|
85 |
+
$emailTemplate->setReplyTo($email);
|
86 |
+
try {
|
87 |
+
$emailTemplate->send($data['account']['email'], $data['account']['firstname'], $emailTemplateVariables);
|
88 |
+
} catch (Exception $e) {
|
89 |
+
echo $e->getMessage();
|
90 |
+
}
|
91 |
+
|
92 |
+
//
|
93 |
+
}
|
94 |
+
|
95 |
+
}catch(Exception $e)
|
96 |
+
{
|
97 |
+
|
98 |
+
echo $e->getMessage();
|
99 |
+
}
|
100 |
+
}
|
101 |
+
|
102 |
+
|
103 |
+
//
|
104 |
+
|
105 |
+
$redirectBack = $this->getRequest()->getParam('back', false);
|
106 |
+
$this->_initCustomer('customer_id');
|
107 |
+
|
108 |
+
/** @var $customer Mage_Customer_Model_Customer */
|
109 |
+
$customer = Mage::registry('current_customer');
|
110 |
+
|
111 |
+
/** @var $customerForm Mage_Customer_Model_Form */
|
112 |
+
$customerForm = Mage::getModel('customer/form');
|
113 |
+
$customerForm->setEntity($customer)
|
114 |
+
->setFormCode('adminhtml_customer')
|
115 |
+
->ignoreInvisible(false)
|
116 |
+
;
|
117 |
+
|
118 |
+
$formData = $customerForm->extractData($this->getRequest(), 'account');
|
119 |
+
|
120 |
+
// Handle 'disable auto_group_change' attribute
|
121 |
+
if (isset($formData['disable_auto_group_change'])) {
|
122 |
+
$formData['disable_auto_group_change'] = empty($formData['disable_auto_group_change']) ? '0' : '1';
|
123 |
+
}
|
124 |
+
|
125 |
+
$errors = $customerForm->validateData($formData);
|
126 |
+
if ($errors !== true) {
|
127 |
+
foreach ($errors as $error) {
|
128 |
+
$this->_getSession()->addError($error);
|
129 |
+
}
|
130 |
+
$this->_getSession()->setCustomerData($data);
|
131 |
+
$this->getResponse()->setRedirect($this->getUrl('*/customer/edit', array('id' => $customer->getId())));
|
132 |
+
return;
|
133 |
+
}
|
134 |
+
|
135 |
+
$customerForm->compactData($formData);
|
136 |
+
|
137 |
+
// Unset template data
|
138 |
+
if (isset($data['address']['_template_'])) {
|
139 |
+
unset($data['address']['_template_']);
|
140 |
+
}
|
141 |
+
|
142 |
+
$modifiedAddresses = array();
|
143 |
+
if (!empty($data['address'])) {
|
144 |
+
/** @var $addressForm Mage_Customer_Model_Form */
|
145 |
+
$addressForm = Mage::getModel('customer/form');
|
146 |
+
$addressForm->setFormCode('adminhtml_customer_address')->ignoreInvisible(false);
|
147 |
+
|
148 |
+
foreach (array_keys($data['address']) as $index) {
|
149 |
+
$address = $customer->getAddressItemById($index);
|
150 |
+
if (!$address) {
|
151 |
+
$address = Mage::getModel('customer/address');
|
152 |
+
}
|
153 |
+
|
154 |
+
$requestScope = sprintf('address/%s', $index);
|
155 |
+
$formData = $addressForm->setEntity($address)
|
156 |
+
->extractData($this->getRequest(), $requestScope);
|
157 |
+
|
158 |
+
// Set default billing and shipping flags to address
|
159 |
+
$isDefaultBilling = isset($data['account']['default_billing'])
|
160 |
+
&& $data['account']['default_billing'] == $index;
|
161 |
+
$address->setIsDefaultBilling($isDefaultBilling);
|
162 |
+
$isDefaultShipping = isset($data['account']['default_shipping'])
|
163 |
+
&& $data['account']['default_shipping'] == $index;
|
164 |
+
$address->setIsDefaultShipping($isDefaultShipping);
|
165 |
+
|
166 |
+
$errors = $addressForm->validateData($formData);
|
167 |
+
if ($errors !== true) {
|
168 |
+
foreach ($errors as $error) {
|
169 |
+
$this->_getSession()->addError($error);
|
170 |
+
}
|
171 |
+
$this->_getSession()->setCustomerData($data);
|
172 |
+
$this->getResponse()->setRedirect($this->getUrl('*/customer/edit', array(
|
173 |
+
'id' => $customer->getId())
|
174 |
+
));
|
175 |
+
return;
|
176 |
+
}
|
177 |
+
|
178 |
+
$addressForm->compactData($formData);
|
179 |
+
|
180 |
+
// Set post_index for detect default billing and shipping addresses
|
181 |
+
$address->setPostIndex($index);
|
182 |
+
|
183 |
+
if ($address->getId()) {
|
184 |
+
$modifiedAddresses[] = $address->getId();
|
185 |
+
} else {
|
186 |
+
$customer->addAddress($address);
|
187 |
+
}
|
188 |
+
}
|
189 |
+
}
|
190 |
+
|
191 |
+
// Default billing and shipping
|
192 |
+
if (isset($data['account']['default_billing'])) {
|
193 |
+
$customer->setData('default_billing', $data['account']['default_billing']);
|
194 |
+
}
|
195 |
+
if (isset($data['account']['default_shipping'])) {
|
196 |
+
$customer->setData('default_shipping', $data['account']['default_shipping']);
|
197 |
+
}
|
198 |
+
if (isset($data['account']['confirmation'])) {
|
199 |
+
$customer->setData('confirmation', $data['account']['confirmation']);
|
200 |
+
}
|
201 |
+
|
202 |
+
// Mark not modified customer addresses for delete
|
203 |
+
foreach ($customer->getAddressesCollection() as $customerAddress) {
|
204 |
+
if ($customerAddress->getId() && !in_array($customerAddress->getId(), $modifiedAddresses)) {
|
205 |
+
$customerAddress->setData('_deleted', true);
|
206 |
+
}
|
207 |
+
}
|
208 |
+
|
209 |
+
if (Mage::getSingleton('admin/session')->isAllowed('customer/newsletter')
|
210 |
+
&& !$customer->getConfirmation()
|
211 |
+
) {
|
212 |
+
$customer->setIsSubscribed(isset($data['subscription']));
|
213 |
+
}
|
214 |
+
|
215 |
+
if (isset($data['account']['sendemail_store_id'])) {
|
216 |
+
$customer->setSendemailStoreId($data['account']['sendemail_store_id']);
|
217 |
+
}
|
218 |
+
|
219 |
+
$isNewCustomer = $customer->isObjectNew();
|
220 |
+
try {
|
221 |
+
$sendPassToEmail = false;
|
222 |
+
// Force new customer confirmation
|
223 |
+
if ($isNewCustomer) {
|
224 |
+
$customer->setPassword($data['account']['password']);
|
225 |
+
$customer->setForceConfirmed(true);
|
226 |
+
if ($customer->getPassword() == 'auto') {
|
227 |
+
$sendPassToEmail = true;
|
228 |
+
$customer->setPassword($customer->generatePassword());
|
229 |
+
}
|
230 |
+
}
|
231 |
+
|
232 |
+
Mage::dispatchEvent('adminhtml_customer_prepare_save', array(
|
233 |
+
'customer' => $customer,
|
234 |
+
'request' => $this->getRequest()
|
235 |
+
));
|
236 |
+
|
237 |
+
$customer->save();
|
238 |
+
|
239 |
+
// Send welcome email
|
240 |
+
if ($customer->getWebsiteId() && (isset($data['account']['sendemail']) || $sendPassToEmail)) {
|
241 |
+
$storeId = $customer->getSendemailStoreId();
|
242 |
+
if ($isNewCustomer) {
|
243 |
+
$customer->sendNewAccountEmail('registered', '', $storeId);
|
244 |
+
} elseif ((!$customer->getConfirmation())) {
|
245 |
+
// Confirm not confirmed customer
|
246 |
+
$customer->sendNewAccountEmail('confirmed', '', $storeId);
|
247 |
+
}
|
248 |
+
}
|
249 |
+
|
250 |
+
if (!empty($data['account']['new_password'])) {
|
251 |
+
$newPassword = $data['account']['new_password'];
|
252 |
+
if ($newPassword == 'auto') {
|
253 |
+
$newPassword = $customer->generatePassword();
|
254 |
+
}
|
255 |
+
$customer->changePassword($newPassword);
|
256 |
+
$customer->sendPasswordReminderEmail();
|
257 |
+
}
|
258 |
+
|
259 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
260 |
+
Mage::helper('adminhtml')->__('The customer has been saved.')
|
261 |
+
);
|
262 |
+
Mage::dispatchEvent('adminhtml_customer_save_after', array(
|
263 |
+
'customer' => $customer,
|
264 |
+
'request' => $this->getRequest()
|
265 |
+
));
|
266 |
+
|
267 |
+
if ($redirectBack) {
|
268 |
+
$this->_redirect('*/*/edit', array(
|
269 |
+
'id' => $customer->getId(),
|
270 |
+
'_current' => true
|
271 |
+
));
|
272 |
+
return;
|
273 |
+
}
|
274 |
+
} catch (Mage_Core_Exception $e) {
|
275 |
+
$this->_getSession()->addError($e->getMessage());
|
276 |
+
$this->_getSession()->setCustomerData($data);
|
277 |
+
$this->getResponse()->setRedirect($this->getUrl('*/customer/edit', array('id' => $customer->getId())));
|
278 |
+
} catch (Exception $e) {
|
279 |
+
$this->_getSession()->addException($e,
|
280 |
+
Mage::helper('adminhtml')->__('An error occurred while saving the customer.'));
|
281 |
+
$this->_getSession()->setCustomerData($data);
|
282 |
+
$this->getResponse()->setRedirect($this->getUrl('*/customer/edit', array('id'=>$customer->getId())));
|
283 |
+
return;
|
284 |
+
}
|
285 |
+
}
|
286 |
+
$this->getResponse()->setRedirect($this->getUrl('*/customer'));
|
287 |
+
}
|
288 |
+
/*------------------------------Send credits Form to multiple customers------------------------------------ */
|
289 |
+
|
290 |
+
public function sendCreditsAction()
|
291 |
+
{
|
292 |
+
$customersIds = $this->getRequest()->getParam('customer');
|
293 |
+
$registry = Mage::getModel('customer/customer');
|
294 |
+
|
295 |
+
if ($customersIds) {
|
296 |
+
$emails = array();
|
297 |
+
$i = 0;
|
298 |
+
foreach($customersIds as $id2)
|
299 |
+
{
|
300 |
+
$registry->load((int) $id2);
|
301 |
+
$emails[] = array(
|
302 |
+
'label' => $registry->getEmail(),
|
303 |
+
'value' => $id2
|
304 |
+
);
|
305 |
+
}
|
306 |
+
//Mage::register('registry_data', $emails);
|
307 |
+
Mage::getSingleton('adminhtml/session')->setFormData($emails);
|
308 |
+
$this->loadLayout();
|
309 |
+
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
310 |
+
$this->renderLayout();
|
311 |
+
}
|
312 |
+
|
313 |
+
}
|
314 |
+
/*------------------------------------------sending credits to multiple customers-------------------------------- */
|
315 |
+
|
316 |
+
public function sendAction()
|
317 |
+
{
|
318 |
+
Mage::log(count($this->getRequest()->getParams()));
|
319 |
+
$count = count($this->getRequest()->getParams());
|
320 |
+
$customersIds = $this->getRequest()->getParam('email');
|
321 |
+
|
322 |
+
$credits = $this->getRequest()->getParam('credits');
|
323 |
+
|
324 |
+
$message = $this->getRequest()->getParam('message');
|
325 |
+
$storeview = $this->getRequest()->getParam('store_view');
|
326 |
+
|
327 |
+
if($this->getRequest()->getParam('notify'))
|
328 |
+
Mage::log("hhhhh");
|
329 |
+
$currentTimestamp = Mage::getModel('core/date')->timestamp(time());
|
330 |
+
$nowdate = date('Y-m-d H:m:s', $currentTimestamp);
|
331 |
+
foreach($customersIds as $id){
|
332 |
+
|
333 |
+
$collection = Mage::getModel('kartparadigm_storecredit/creditinfo')->getCollection()->addFieldToFilter('c_id',$id)->addFieldToFilter('website1','Main Website')->getLastItem();
|
334 |
+
|
335 |
+
$arr1['c_id'] = $id;
|
336 |
+
$arr1['website1'] = "Main Website";
|
337 |
+
$arr1['action_credits'] = $credits;
|
338 |
+
$arr1['total_credits'] = $collection->getTotalCredits() + $credits;
|
339 |
+
$arr1['action'] = "Updated";
|
340 |
+
$arr1['state'] = 0;
|
341 |
+
$arr1['store_view'] = $storeview;
|
342 |
+
$arr1['action_date'] = $nowdate;
|
343 |
+
$arr1['custom_msg'] = "Send By Admin: admin( ".$message." )";
|
344 |
+
$arr1['customer_notification_status'] = 'No';
|
345 |
+
|
346 |
+
$table1 = Mage::getModel('kartparadigm_storecredit/creditinfo');
|
347 |
+
$table1->setData($arr1);
|
348 |
+
|
349 |
+
try{
|
350 |
+
$table1->save();
|
351 |
+
if($count == 7){
|
352 |
+
$emailTemplate = Mage::getModel('core/email_template')
|
353 |
+
->loadDefault('caritor_email_template');
|
354 |
+
$name = Mage::getStoreConfig('mycustom_section/mycustom_group1/sender_email_identity');
|
355 |
+
$group = "ident_".$name;
|
356 |
+
|
357 |
+
$email = Mage::getStoreConfig('trans_email/'.$group.'/email');
|
358 |
+
|
359 |
+
$customerData = Mage::getModel('customer/customer')->load($id)->getData();
|
360 |
+
|
361 |
+
$emailTemplateVariables = array();
|
362 |
+
$emailTemplateVariables['var1'] = $customerData['firstname'];
|
363 |
+
$emailTemplateVariables['var4'] = $arr1['total_credits'];
|
364 |
+
$emailTemplateVariables['var5'] = $message;
|
365 |
+
$emailTemplateVariables['var8'] = $this->getBaseUrl();
|
366 |
+
|
367 |
+
$emailTemplate->getProcessedTemplate($emailTemplateVariables);
|
368 |
+
//Mage::log($name);
|
369 |
+
|
370 |
+
$emailTemplate->setSenderName($name);
|
371 |
+
$emailTemplate->setSenderEmail($email);
|
372 |
+
$emailTemplate->setReplyTo($email);
|
373 |
+
try {
|
374 |
+
$emailTemplate->send($customerData['email'], $customerData['firstname'], $emailTemplateVariables);
|
375 |
+
} catch (Exception $e) {
|
376 |
+
echo $e->getMessage();
|
377 |
+
}
|
378 |
+
}//end if for sending credits email update
|
379 |
+
}catch(Exception $e){
|
380 |
+
Mage::log($e);
|
381 |
+
}
|
382 |
+
|
383 |
+
}
|
384 |
+
$this->_redirect('*/credits/customer');
|
385 |
+
}
|
386 |
+
|
387 |
+
}
|
app/code/community/Kartparadigm/StoreCredit/controllers/IndexController.php
CHANGED
@@ -187,7 +187,7 @@ $email = Mage::getStoreConfig('trans_email/'.$group.'/email');
|
|
187 |
$emailTemplateVariables['var3'] = $data['sname'];
|
188 |
$emailTemplateVariables['var4'] = $nowdate;
|
189 |
$emailTemplateVariables['var5'] = $data['message'];
|
190 |
-
$emailTemplateVariables['var8'] =
|
191 |
|
192 |
$emailTemplate->getProcessedTemplate($emailTemplateVariables);
|
193 |
//Mage::log($name);
|
187 |
$emailTemplateVariables['var3'] = $data['sname'];
|
188 |
$emailTemplateVariables['var4'] = $nowdate;
|
189 |
$emailTemplateVariables['var5'] = $data['message'];
|
190 |
+
$emailTemplateVariables['var8'] = Mage::getBaseUrl();
|
191 |
|
192 |
$emailTemplate->getProcessedTemplate($emailTemplateVariables);
|
193 |
//Mage::log($name);
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Kartparadigm_StoreCredit</name>
|
4 |
-
<version>1.0.1.
|
5 |
<stability>stable</stability>
|
6 |
<license>OSL</license>
|
7 |
<channel>community</channel>
|
@@ -10,9 +10,9 @@
|
|
10 |
<description>Efficiently maintain customer credits in all store views.</description>
|
11 |
<notes>Kartparadigm Store Credit</notes>
|
12 |
<authors><author><name>Kartparadigm</name><user>kartparadigm</user><email>kartparadigm@gmail.com</email></author></authors>
|
13 |
-
<date>2015-04-
|
14 |
-
<time>05:
|
15 |
-
<contents><target name="magecommunity"><dir name="Kartparadigm"><dir name="StoreCredit"><dir name="Block"><dir name="Adminhtml"><dir name="Customer"><dir name="Edit"><dir name="Tab"><dir name="Credits"><file name="
|
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>Kartparadigm_StoreCredit</name>
|
4 |
+
<version>1.0.1.2</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>OSL</license>
|
7 |
<channel>community</channel>
|
10 |
<description>Efficiently maintain customer credits in all store views.</description>
|
11 |
<notes>Kartparadigm Store Credit</notes>
|
12 |
<authors><author><name>Kartparadigm</name><user>kartparadigm</user><email>kartparadigm@gmail.com</email></author></authors>
|
13 |
+
<date>2015-04-21</date>
|
14 |
+
<time>05:30:57</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Kartparadigm"><dir name="StoreCredit"><dir name="Block"><dir name="Adminhtml"><dir name="Customer"><dir name="Edit"><dir name="Tab"><dir name="Credits"><file name="List1.php" hash="44228eee4508701546e2e4f794431b14"/><file name="List.php" hash="243615c727cebfe59d273da8b85b5db0"/></dir><file name="Credits.php" hash="8af8e7e7ae5634de6b7dc6dda9349269"/></dir></dir><file name="Grid.php" hash="335c1bee870644f106315be703e4c0d0"/></dir><dir name="Promo"><dir name="Catalog"><dir name="Edit"><dir name="Tab"><file name="Actions.php" hash="36fe787ce9fd4c5d6283c35c741add92"/></dir></dir></dir></dir><dir name="Registries"><dir name="Edit"><file name="Form.php" hash="a2a4f87d29506b1bfd7adf9e420a3e8d"/></dir><file name="Edit.php" hash="2328aeadf074d5e7740947b8bfc54a84"/><file name="Grid.php" hash="99fd3e2d4528bd98aeda18783c2653c0"/></dir><dir name="Registries1"><dir name="Edit"><file name="Form.php" hash="78c893545865890297ac7f4d406d9afd"/></dir><file name="Edit.php" hash="b38d2e821374c9babdbe4c8de1dd71f0"/><file name="Grid.php" hash="74af81c3af7fe14a52fc03b9d06c5c38"/></dir><file name="Registries1.php" hash="5f821c5722e3e2ec2c635f13efae5270"/><file name="Registries.php" hash="77e441d9f86462eea31cd1ab3abbc24e"/></dir><file name="Collection.php" hash="06203b41373cbb51433aaff716e54a45"/><file name="Credit.php" hash="c207b8719fa5aba99fe0f49110b71e12"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="CreditsController.php" hash="e817f4fcad453b723f2c906c6420ce8b"/><file name="CustomerController.php" hash="9ebe74d47ed0bf5a00893411c2ff391e"/><file name="CustomerController.php~" hash="9ebe74d47ed0bf5a00893411c2ff391e"/><dir name="Promo"><file name="CatalogController.php" hash="aac0c07d33396bc86c5adcfc234838d7"/></dir><dir name="Sales"><dir name="Order"><file name="CreditmemoController.php" hash="4e971e6c64d0763a570e315ccd0d980c"/></dir></dir></dir><dir name="Checkout"><file name="OnepageController.php" hash="2a9734b2099905ba8f0fd1ac79b614c6"/></dir><file name="IndexController.php" hash="47069d8dad760a91f02a500fbeb010b4"/></dir><dir name="etc"><file name="adminhtml.xml" hash="1a78218db0c18efcf81ed04ba8b655c2"/><file name="config.xml" hash="39065261bc245ba54799940bea51d5e0"/><file name="system.xml" hash="4b4ef37096e12405ea23e9a7de8efa10"/></dir><dir name="Helper"><file name="Data.php" hash="d8bfacd9796c4947eeee1f28878ab8e4"/></dir><dir name="Model"><file name="Creditinfo.php" hash="a96ee7fd6d660ff6de22dbbdbc90a7ae"/><dir name="Mysql4"><dir name="Creditinfo"><file name="Collection.php" hash="6f62213e7f4f62d0f90ffaeb6ff61f03"/></dir><file name="Creditinfo.php" hash="85e01354a1e6973e74dd8fdf11af4eb8"/><dir name="Sendcreditstofriend"><file name="Collection.php" hash="93b7db3ec026d02fc205c8fc5e23630e"/></dir><file name="Sendcreditstofriend.php" hash="32be8731fb112f18d70e06e2b388ebd3"/></dir><file name="Observer.php" hash="fd8d149808d31ed61c1ca373973c1be3"/><dir name="Resource"><file name="Rule.php" hash="b6471332cf41e96cc6e60e57505bd0f5"/><file name="Setup.php" hash="7f5ed91bf4d6ab4bc2dd3496fdf37d1c"/><file name="Transaction.php" hash="1b8c9d66ba8457b166f8aca5f9e341ed"/></dir><file name="Sendcreditstofriend.php" hash="711f4fbee2493698486fbc162e1fda6e"/><file name="Source.php" hash="8f51c351a0c8d70ac2308f5b7f39a1aa"/></dir><dir name="sql"><dir name="kartparadigm_storecredit_setup"><file name="install-0.1.0.php" hash="0e60f75abadb436a7fbc9682245773ab"/><file name="upgrade-0.1.0-0.2.0.php" hash="9e9d855251ffa1ef256e4821a5e903c9"/><file name="upgrade-0.2.0-0.3.0.php" hash="4bafbe8bba6b4d6e824487220d1b49fb"/><file name="upgrade-0.3.0-0.4.0.php" hash="1f7b1d85ca78d5d42afb5f9c064b9acd"/><file name="upgrade-0.4.0-0.5.0.php" hash="4a3ba65764d6ae5bbde2bd48dba46bdc"/><file name="upgrade-0.5.0-0.6.0.php" hash="d60d6c4631750a02202220552c73d373"/><file name="upgrade-0.6.0-0.7.0.php" hash="37acfd4ef86bc0a7d7f7deaa393fdfbb"/><file name="upgrade-0.7.0-0.8.0.php" hash="3f23d2d79ea4b93b1012194677e55da0"/><file name="upgrade-0.8.0-0.9.0.php" hash="ae7b43bf8747d56bede623e52c824597"/></dir></dir></dir></dir><dir name="Mage"><dir name="Adminhtml"><dir name="Block"><dir name="Sales"><file name="Totals.php" hash="9d15eca76b896d950a59234c82d3786f"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="credit.xml" hash="128baf9ae30f2a2e01cd1779a9356229"/></dir><dir name="template"><dir name="kartparadigm"><dir name="storecredit"><file name="credit.phtml" hash="67a2b79a158a9b7190b1b6c6e970d7c9"/><dir name="customer"><file name="main.phtml" hash="db60ca5b83d64d2e180e84b86b48b126"/></dir><file name="payment.phtml" hash="d8c9566e168e25d371ed718e122394f9"/><file name="storecreditview.phtml" hash="81b3e839f3321b9b46ef70d80839c6a6"/><file name="transaction.phtml" hash="f2852bdefed025ee6ef326ffd990b932"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="credit.xml" hash="bdfdd8dbf648bf7846c9b4eab07a68a9"/></dir><dir name="template"><dir name="kartparadigm"><file name="mycredits.phtml" hash="8f3daee8faac9b6262eed78c33af08b1"/><file name="mytransactions.phtml" hash="f104dcf3016d7d414b139f81aa8e9517"/><file name="payment.phtml" hash="bab542921a9690d9afd006d541ac82b0"/><file name="product.phtml" hash="640ee05cb6c5ad478b3f6fffcac82764"/><file name="sendcreditsform.phtml" hash="db4cb8365272bd3e02f1976f8a542841"/><file name="totalcredits.phtml" hash="601bd8258fd0c06adcc16910db6a5037"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Kartparadigm_StoreCredit.xml" hash="886b0f62af9d0dcdd64eabf698d9fdb9"/></dir></target><target name="magelocale"><dir name="en_US"><dir name="template"><dir name="email"><file name="caritor_email_template1.html" hash="4aa55abbeb482a6b156eadcfeda159e4"/><file name="caritor_email_template.html" hash="88f3d40c0d0eeba73a34a63577ade965"/></dir></dir></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|