2

I have made a custom attribute blacklisted in the customer grid. I have created the attribute directly from phpmyadmin.

I will blacklist customers manually.

Now, while placing an order, if, for the customer, blacklisted='Yes', he should not be able to place order. I want to check this attribute using the customer's email id.

How can I achieve this?

| improve this question | | | | |
1

I like this question but I would use a different approach.

Firstly I would create a customer group called blacklisted then use the following code to display or hide content as needed.

$groupId = Mage::getSingleton('customer/session')->getCustomerGroupId();
$group = Mage::getModel('customer/group')->load($groupId);  
if(Mage::getSingleton('customer/session')->isLoggedIn() && $group->getCode()=="blacklisted"):
//Content
endif;
| improve this answer | | | | |
  • Using this approach, how can I bar him from placing any further orders ? – Rajat Agarwal Mar 3 '17 at 5:36
  • You could wrap it around the place order button or even the whole checkout so the page looks totally different to blacklisted customers and then display a warning message. – Mike Tim Turner Mar 3 '17 at 8:11
  • okay. Thank you for the help. Your idea of creating a group is superb :) – Rajat Agarwal Mar 3 '17 at 8:36
1

You have to create an observer method and call it on the event sales_order_place_before.

In this method you can get the customer id from session and load that customer. Now you will get all the attribute value of customer.

If its blacklisted then return false.

You can follow this link to create observer on event.

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.