1

I'm trying to establish whether it is possible to differentiate between orders placed in the frontend (by the customer) and the backend (by an administrator).

I read this post on SO:

Differentiating Backend vs. Frontend Purchases in Magento

Which mainly highlights the fact that you used to be able to check the store_id field, but this does not hold true for the latest versions of Magento.

The other thing which it mentions is that when looking at an order via the backend, if it was indeed placed by a customer, you will see a field titled Placed from IP, which is missing if it was placed by an administrator.

I can't seem to find anything related to IP addresses via the sales_flat_order table.

Any ideas?

6

There is a field remote_ip on the table sales_flat_order, that appears to be null from the admin and the ip of the customer from the front end.

It was added in Magento 1.6 so if you are using version 1.7 you should be safe here.

It is set in app/code/core/Mage/Checkout/Model/Session.php on the quote and copied across.

<sales_convert_quote>
    <remote_ip>
        <to_order>*</to_order>
    </remote_ip>
</sales_convert_quote>
  • Ah, can't believe I missed that! Exactly what I was looking for. I was searching for something along the lines of 'ip address' – Moose Mar 30 '14 at 12:37
2

This worked for me:

if (Mage::app()->getStore()->isAdmin()) {
    // your code here
}

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.