Magento customer group ID - magento

I have made some changes to Magento order email templates and code so that customers in retail and wholesale customer groups receive differently formatted email confirmations. i.e. One group receives an email showing VAT/TAX the other does not.
This works fine except for orders paid with Paypal. With a paypal order my logic for detecting the group ID is failing. Can anyone shed any light as to why this might be happening? Is the response coming back from paypal somehow not associated with the customers group? If so can I perform a check after a successful paypal ipn response to ensure the system keeps the customer in the right group.
I am retrieving the customer group from the customer/session perhaps I should be getting it directly from the database?
Any assistance would be much appreciated!

Thanks to Anton for pointing me in the right direction. After a paypal payment group ID in the session is set to 0 - not logged in!
Makes much more sense when working on events and code after an order is placed to get customer info from the saved order, so in my case the following returned the correct Group ID for me to use in order confirmation email code etc.
$_order = $this->getOrder();
// get group id from order
$groupId = $_order->getCustomerGroupId();

Related

Magento Orders without status

When I checkout using payment method "Back Transfer Payment" and even another one I installed called "Credit Card by Phone", the orders are created without a status.
I tried to find where it gets the status and sets it but I couldn't find it.
Can you help me?
order state is: payment_review
order status is: NULL
and I have a status assigned for the state payment_review
Thanks
You should check the status and state in the database (in sales_flat_order table).
After you got the status and state, you can check in System -> Order statuses if you have correspondant statuses.
Please come back with the information and we may help more.
Thanks
Okay the problem is with the extension
http://www.magentocommerce.com/magento-connect/official-skrill-moneybookers-quick-checkout-enterprise-module.html
I don't know why but when this one is disabled it just works.
When it's enabled both modules of Bank Transfer and Credit Card by Phone don't save any status when creating the order.

Delayed payment after placing order

After placing order customer gets email with information about this order what includes payment method. If customer doesn't pay the order on the page where did he place it, the order still exists in customers acoount as pending or processing (due to payment method).
Where or what should I look to make link for payment for unpaid orders?
Or should they just "reorder" it?

Magento Product Reviews only by customer who purchased the product

I searched everywhere, but could not find the solution for this. I want to not allow others except the buyers of that product to add review for that particular product, in Magento. Please can anybody help with this.
Initally make the option "Allow Guests to Write Reivews" to "No". Now, you can make this by taking the order collection of a particular product by getProductOrderCollectionById(). From that order collection we can get the list of the customers who purchased it.
In the other hand, you can get the ID of the logged-In customer. If the Order collection list contains the logged In customer ID, then you can allow them to display the review form.

Creating an order processing system from magento?

I want to create a small order processing website, but in time I want the application to be able to extend to an e-commerce solution as well. So I decided to go with magento.
But I am not sure, if magento can be stripped down to only an order processing system. By order processing I want:
Guests should be able select products
Should be able to add products to cart
But at last, instead of processing the order by payment system, the order should be forwarded to email of administrators, who will contact them individually.
How to configure Magento this way??
Here is a full tutorial with all the files you will need, ready to download:
http://www.excellencemagentoblog.com/magento-onestep-checkout-remove-payment-method-step
This does mark orders with the code 'free', however, you words are our servants and not our masters and you could change the word free to 'telesale' (or whatever):
...the basic idea of removing any step from checkout is to see a set a
default value for that step, so that magento order processing runs
smoothly. So when removing the payment method step, i have set the
payment method “Zero Subtotal Checkout” with code “free” as the
default payment method.
If I got you well, you just want to avoid the CC processing,
In this case you can disable in Magento all payment systems except the 'Money/Check' one.
Guests should be able select products
Should be able to add products to cart
But at last, instead of processing the order by payment system, the order should be forwarded to email of administrators, who will
contact them individually.
Magento offers you catalog/cart system by default ( mail is mandatory during order )
Magento offers you cart system by default
You can disable all payment system except 'Money/Check' one. (this will let user confirm their order without any check on the payment).
Then you can contact all user checking the new orders in the backend ( user/guest email will be displayed along with the order display ) ...
Settings
Add email notification for any new orders:
Log in into admin area
Go to System->Configuration
In Sales section, click on Sales Emails
Select the first section Orders.
Enter your admin e-mail in the field “Send Order Email Copy To”.
Now You will receive a new mail every new order.
Manage Payment Methods:
Log in into admin area
Go to System->Configuration
In Sales section, click on Payment Methods
Disable all except Check / Money Orders
Now your customer could order without any payment detail.
I think Magento should suit you, in case the 'Money/Check' payment system is not good for you, you will need to create a new module and add a new payment system.
I hope this helps you answer your doubt
So, as I can understand, you want to finish customers work on the cart step. For example, by clicking Create an Order except Checkout.
Yes, you can use cart2quote or something like this.
The main idea is to save quote with quote items (from the session) after clicking Create an Order button. For example, you can get Quote and serialize it, get Quote items and also serealize them. When it is needed to show them to admin (in email or in admin section) - deserialize all info and display it. This will not be very easy, but is possible. May be it is better to customize some ready solution.

To find customer's first login

Magento 1.6.
Within the login processing code, is it possible to find out when the user/customer has logged in for the very first time?
If your Magento is configured not to use double-opt-in (email confirmation) for customer registrations, then you can use what #PauGNU already posted:
$created_at = $customer->getCreatedAt();
But when it comes to double-opt-in, Magento creates the customer account immediately, i.e. setting created_at to the current system time, but does not activate it (so that customer cannot login before confirming) and only sends a confirmation mail.
This means an unkown delay (minutes, days, weeks, whatever) between created_at and the very first login, so created_at wouldn't be of use anymore.
Actually, Magento has a place, where customer login times are being tracked by default: the table field log_customer.login_at, accessible by Mage_Log_Model_Customer, for example.
But, if you plan to use it:
by default the class has no method to get the very first login. You'd need to develop that yourself.
if "Log Cleaning" is active (to keep the database smaller), you'll gonna lose the saved login times.
In that case, I'd prefer identifying the most proper event, hooking into it and saving only the very first login time per customer to a separate table.
Given that the first login is always when the customer registers itself in the web, you only need to check out the field «created_at» on the customer_entity table.
If you load a customer, it's really easy to get that data:
$created_at = $customer->getCreatedAt();

Resources