Notify admin via email when order is placed in magento - magento

Is there a way to Notify admin via email when order is placed in magento? I feel like this is a silly question but I'm placing test orders currently and I'm not getting any email notification.
Will the order also get an email notification by default or does the admin have to click the "invoice button" each time an order comes in?

In the magento backend goto
System > Configuration
Left Naviagation > Sales > Sales Emails this option will let you configure mail sending settings where you can ask magento to send you mail whenever an order is placed.
Alternatively, you can create a plugin with an observer which listens to the event of the order being placed and you can write your mail sending code in the observer.

Once configured...
Are you sure that email is being sent?
<?php
$to = "recipient#example.com";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
if (mail($to, $subject, $body)) {
echo("sent!");
} else {
echo("failed");
}
?>
also check your /var/log/maillog for messages.

Go to System -> Configuration -> Select Store email addresses and change the Sales representative's email address.
Then go to Left Naviagation > Sales > Sales Emails and ensure that it is set for Sales representative.
Also just check that you've done this on the main site.

Related

Magento 2.4.5: Unable to get Stripe Payment information in my observer class

With the upgrade to Magento 2.4.5 from 2.4.2, the old code in an observer class in the custom module to get information about Stripe Payment isn't working any more. It looks like Magento event sales_order_place_after isn't able to help with retrieving payment information. I tried several other events including sales_order_load_after sales_order_save_before sales_order_save_after sales_order_delete_before sales_order_delete_after checkout_submit_all_after. Below is the code snippet that calls a function by passing a Stripe payment object and an array containing order details. $stripePayment->getCard() returns null although Magento admin shows all payment information.
switch ($_payment_info->getMethod()) {
case "stripe_payments":
// We need to set the current_order in registry, as StripeIntegration script info.php uses this registry.
// Instantiate the StripeIntegration Info class after setting the registry.
$this->registry->register('current_order', $order);
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$stripePayment = $objectManager->get('StripeIntegration\Payments\Block\Adminhtml\Payment\Info');
// Now, we can make the calls to retrieve the Stripe details for the Credit card.
$this->get_credit_card_payment_info($order_info, $stripePayment->getCard());
$order_info["cc_name"] = $order->getBillingAddress()->getName();
$order_info["cc_veri"] = $order->getPayment()->getTransactionId();
break;
The comments in it will help you understand that I'm using registry to store the order object for the Stripe module to use in its class. This has been working fine for the past three years until the latest Magento upgrade.

Using codeigniter 4, cannot send link in gmail

$message = "Hi ".$name.", <br>Your account is created successfully. Please click the below link to activate your account
<br><br><a href=".base_url()."/register/activate/".$uniid."Activate now </a>";
I already recieved the email but the href function is excluded. it only display
"Hi myname,
Your account is created successfully. Please click the below link to activate your account";
it dont display the link
You have syntax errors in your code.
Missing > in anchor tag".$uniid."Activate now
Wrong href dicleration href=".base_url()."/register/activate/".$uniid."
wrap inner conditions with '.
Use below code
$message = "Hi {$name}, <br>Your account is created successfully. Please click the below link to activate your account
<br><br><a href='/register/activate/{$uniid}'>Activate now </a>";

Hello World Magento Plugin

I'm new to magento & am trying to get a simple plugin working.
When a user adds a product to the basket I'd like magento to display a dialog box with some text in it.
Can anyone provide a link to a guide to this or something similar?
I'm using magento2
Thanks
EDIT:
Thanks for that,
I found a tutorial and this is what I have atm, the plugin looks to be enabled as far as I can see.
What I'm trying to get to working is a message to display when a user adds a product to the cart.
Currently the text on the add to cart button changes to 'Adding..' and hangs. How can I debug this?
Thanks for that,
I found a tutorial and this is what I have atm, the plugin looks to be enabled as far as I can see.
What I'm trying to get to working is a message to display when a user adds a product to the cart.
Currently the text on the add to cart button changes to 'Adding..' and hangs. How can I debug this or fix this?
<?php
namespace Acme\AddToCartMessage\Plugin;
use Magento\Checkout\Model\Cart\CartInterface;
use Magento\Framework\Message\ManagerInterface as MessageManager;
class AddToCartMessage{
private $messageManager;
public fucntion __construct(MessageManager $messageManager){
$this->messageManager = $messageManager;
}
public afterAddProduct(\Magento\Checkout\Model\Cart\CartInterface $cart, $result){
$this->messageManager->addNoticeMessage('Testing');
return result;
}
}
There are actually a couple ways to achieve what you're trying to do. The cleanest way would be to utilize event observers. Here's a link to their documentation - Magento 2 - Events and Observers.
A quick overview:
Create an etc/frontend/events.xml file.
Create an observer for the checkout_cart_add_product_complete event.
Inject the \Magento\Framework\Message\ManagerInterface into your observer class.
public function __construct (
\Magento\Framework\Message\ManagerInterface $messageManager
) {
$this->_messageManager = $messageManager;
}
The message manager will display a notification after the item has been added. To show a popup, you should look into M2's JS components - JavaScript Developer Guide.

MsgBox on server side

I am trying to display a popup message on my web app. When i run my app normally on my local pc, i get the pop up message boxes appear. However when i publish the app they dont.
here's how it will work:
a button is pressed, it will pick up a file from a directory, then it will check another directory to see if the file the exists...if the file exists then a pop up is needed to inform "File already exists. do you want to continue?" if the user clicks yes it carried on with the code, if they click no then the process is ended.
do anyone have any idea how to do this?
my code so far:
If System.IO.File.Exists(acceptedExistsuNKNOWN) And System.IO.File.Exists(rejectedExistsUNKNOWN) Then
'IF BOTH EXIST
If MsgBox(acceptedExistsuNKNOWN & " & " & rejectedExistsUNKNOWN & "files already exists, do you want to rerun the process?", MsgBoxStyle.YesNo, "Files Exists") = MsgBoxResult.Yes Then
(continur
else
System.Diagnostics.Process.GetCurrentProcess.Kill()...
many thanks
The problem with your idea is that someone would need to sit logged in to the server to interact with the modal popup boxes; that is, if this was even possible, since it would need to be that person on the server who does the action on the page in order to be the recipient of the popup, so it's not like other users can issue a popup to him.
What you do on the server side executes on the server side.
I think you really want ti to show on the client side, but want the logic to make it happen on the server side. It doesn't work this way. Instead, what you might do is output something n the response that indicates a client-side popup should be shown. For instance, you could have a hidden field on the page and set a value, then use JavaScript to show an alert if that value meets your criteria.
Think about what you are asking. If a dialog pops on the server side, the user will not be able to see it (they are on the client side). Moreover, the code will be at a standstill until someone dismisses that dialog, which the user cant see. Only individuals with access to the server will be able to see this. Do you intend to have someone watching the server 24/7? Instead, you probably want to alert the user. This can be done my returning a response from the server code to the client code to display a dialog. The simplest method would be to throw an error and redirect the user to a new page to display an error. If you want something more fluid, you can use updated panels and the AjaxControlToolkit's modal pop up extender. Another way would be to use ClientScript, like this:
try
{
//check for files here
}
catch (Exception ex)
{
string script = "<script>alert('" + ex.Message + "');</script>";
if (!Page.IsStartupScriptRegistered("myErrorScript"))
{
Page.ClientScript.RegisterStartupScript("myErrorScript", script);
}
}

Jomsocial multi profile user approval notification

I am using jomsocial multi profile for user registration . Some profile needs administration approval to complete registration process .
But the problem is administrator is no getting any notification to approve new user registration .
How can I solve this problem?
I am using Joomla! 2.5.2 Stable and jomsocial 2.4.3
Log in to the backend of Joomla as administrator then click on the menu.
Go to Users > User Manager, then click on the admin user that you wish to receive the notifications for, and set the "Receive System emails" to Yes. Here is a picture to help you http://screencast.com/t/p1LgQFVt
IF this helped you, please consider supporting the proposal for a Joomla StackOverflow by clicking follow here >>> http://area51.stackexchange.com/proposals/34294/joomla-answers
changed line 911 of /components/com_community/controllers/register.php
from
if( $type == 'registration_complete' && (C_JOOMLA_15 || (!$requireApproval && !C_JOOMLA_15)))
to
if( $type == 'registration_complete' && (C_JOOMLA_15 || ($requireApproval && !C_JOOMLA_15)))
and it is working now

Resources