Magento how to prevent data changes in observer [closed] - magento

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 9 years ago.
Improve this question
I need to prevent some customers to change their addresses.
I found system event 'customer_address_save_(before|after)'.
Is it possible to cancel writing to database from own observer (based on some customer's conditions)? Or can I do it by rewriting system customer classes (i.e. beforeSave method)?
In short the question is how to prevent data changes in own module.
Thanks.

You can try in your observer (event - customer_address_save_before) :
/** #var $customerAddress Mage_Customer_Model_Address */
$customerAddress = $observer->getCustomerAddress();
$origData = $customerAddress->getOrigData();
$newData = $customerAddress->getData();
Enjoy.

Related

Call to undefined function App\Http\Controllers\exec() [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 months ago.
Improve this question
Please help me. The website works fine in the local host, but it is having error in the C panel. How to solve?
the path is:
app/config/app.php
you can use Process Component of Symfony that is already in Laravel
http://symfony.com/doc/current/components/process.html
use Symfony\Component\Process\Process;
use Symfony\Component\Process\Exception\ProcessFailedException;
inside your elcdetails use
$macAddr = new Process('getmac');
$macAddr->run();
// executes after the command finishes
if (!$macAddr->isSuccessful()) {
throw new ProcessFailedException($macAddr;
}
//or whatever you want to do with the output.
echo $macAddr->getOutput();
note that, if you are trying to get the client mac address, short answer is you cannot.
From your image, I'm supposing you defined the public function exec() function somewhere above or below in your controller. You cannot reference to it that way since its a method in your controller class.
So change it to this instead. $macAddr = $this->exec('getmac');

Check User/mailbox have Public Folders Root Permission/Permission Level using Redemption [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
How can I check that a user can access Public Folder(Have Public Folders Root Permission/Permission Level) or not, Using Redemption ?
I am using following method to access Public Folders. I want to abort this process if user have not Public Folders access rights.
set Session = CreateObject("Redemption.RDOSession")
Session.Logon("Profile","Password", covOptional, covOptional, covOptional, covOptional)
set Stores = Session.GetStores()set Store = Stores.FindExchangePublicFoldersStore()
set Folder = Store.GetDefaultFolder(olPublicFoldersAllPublicFolders)
set folders = Folder.GetFolders()
Thanks

ASP.NET BOILERPLATE: javascript to call application service [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 4 years ago.
Improve this question
ASP.NET BOILERPLATE: I have a table Asset for which I have created AssetApplicationService with base class CRUDAsync; I have wired up AssetController, & appropriate DTO's, I am able to retrieve data and show on the list as similar to user list.
when I click on Create New Asset,I am able to bring the modal dailog as well until now it is all good, I have copied the user\index.js and tailored to call my asset application service from javascript...this is where i am struck
var _assetService = abp.services.app.asset; //line1
var _$modal = $('#AssetCreateModal');
var _$form = _$modal.find('form');
line 1 returns me undefined when I debug through alert(_assetService), not sure why...where as abp.services.app.user, role works fine.
AssetApplicationService must be implemented by IApplicationService.
public interface IAssetApplicationService : IApplicationService
{
}
public class AssetApplicationService : IAssetApplicationService
{
}
Note: I've replied your previous question. Please mark the answer as solution if that worked for you.

How to tweak FOSUserBundle for an AJAX-only use? [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 7 years ago.
Improve this question
I'm using Symfony on my backend, accessed only by a JS frontend with AJAX requests.
The issue I'm having is that the return codes sent by the FOSUserBundle does not coincide with what I'm expecting for 'user management' actions.
For instance, when for instance a user tries to register on the frontend :
What I get:
Registration success --> Redirection to '.../confirmed'
Registration failure --> 200 (re-displaying the form page)
What I would like to have:
Registration success --> 202 Added
Registration failure --> 500 or else
Do you know how to archieve that, especially given that, in FOSUserBundle, there are no events to hook on to for failures?
You can modify the file RegistrationController.php in the path /vendor/friendsofsymfony/user-bundle/Controller/
In this file, you will find a method called registerAction. Simply add the following code in your form validation part.
if ($form->isValid()) {
$event = new FormEvent($form, $request);
$dispatcher->dispatch(FOSUserEvents::REGISTRATION_SUCCESS, $event);
$userManager->updateUser($user);
if (null === $response = $event->getResponse()) {
$url = $this->generateUrl('fos_user_registration_confirmed');
$response = new RedirectResponse($url);
}
$dispatcher->dispatch(FOSUserEvents::REGISTRATION_COMPLETED, new FilterUserResponseEvent($user, $request, $response));
return $response;
}
else
{
return new JsonResponse(array('status' => 'failure'), 500);
}
Keep in mind this is a simple case of invalid form validation that I have provided. You can do other type of modifications in this part.
After a few analysis, I decided to rewrite entirely what I needed from scratch, since it was a very small subset of FOSUserBundle.
This solves the problem, allowing to return specific responses with the desired HTTP codes, at any stage of the processes.

Loading views in conrtroller using CodeIgniter [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I am new to CodeIgniter. Can anybody explain to me how to load a view in a controller?
This is my controller:
<?php
class Example extends CI_controller
{
function display($p,$p1)
{
echo $p1,$P;
//here i want to load my view
}
}
?>
you can place fallowing code wherever you want to load the view
$this->load->view('viewname');
you can also pass the data to view as fallows
$data['key'] = 'this is data";\
$this->load->view('viewname',$data);
and also you did not mention $ symbol before 'p'

Resources