Jump to content

Show "new customer" status on orders


Recommended Posts

Hi guys,

 

Sorry if this has already been brought up, but I can't seem to find it.

 

I want to include what I'd call a tag in my email template for when we receive a new order (template new_order under mailalerts) to show whether or not it's the customer's first order.

 

I know this info is kicking around in the database somewhere as it's shown on the "orders" page in the back office ("new client" column).

 

Is there something I can do in the email template similar to the way you can use {firstname} {lastname} etc?

 

I'm assuming this isn't a built-in thing and I'm going to have to modify a php file somewhere.

 

Thanks in advance!

Link to comment
Share on other sites

Hi, you can try to modifiy the mailalerts file (or create a module that use actionValidateOrder hook).

 

in this function that sends the mail :

 

you can add :


$new_customer = 1;
$customer_orders = Order::getCustomerOrders((int)$this->context->customer->id);
if (count($customer_orders) > 1)
    $new_customer = 0;

then in the data array sent to the email template, you can add a line:

 

'{new_customer}' => $new_customer ? '<span>new customer</span>' : '',

 

 

 

 

 

 

Edited by fred-vinapresta (see edit history)
  • Like 1
Link to comment
Share on other sites

  • 8 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...