2

We have a coupon-less discount for customers placing their first order. For various reasons these customers fail the checkout from time to time and we need to put their failed order through for them, in the admin.

We have a discount with coupon code that we can put in for them, however, there is the risk that this discount code gets widely known for some reason or other. Therefore we would like this particular coupon code to work for admin orders only.

Currently, I don't have any ideas or workarounds on how to make a coupon 'admin only'. Any ideas?

  • maybe create a special user group that gets the discount amount and add your salespeople to that customer 'group' – pzirkind May 20 '13 at 17:32
3

You could just use Mage::app()->getStore()->isAdmin() within the logic where the coupon validity is checked.

You could do it in

Checkout/controllers/CartController.php     couponPostAction()
SalesRule/Model/Validator.php               _canProcessRule()

The latter would probably be preferred, you could just extend the class and add a conditional statement and return false.

Then add an attribute to the coupon model for whether it can be used in the frontend or not.

Eg.

protected function _canProcessRule($rule, $address) 
{

  ...

  if ( Mage::app()->getStore()->isAdmin() && $rule->hasAdminOnly() ) {
    return false;
  }

The above is just pseudo(ish) code, correct to suit your needs.

  • What do you mean by add an attribute to the coupon model? – Yogita May 22 '19 at 5:17

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.