Do you know if is there any way to avoid/cancel the confirmation email that receives the client after a purchase in Virtuemart?
I would like to keep the admin email.
I searched for that option in the Virtuemart control panel without any result.
I have Virtuemart 2.0.20b and Joomla 2.5.11
Thank you very much
To cancel the confirmation email I made the following:
In the file components/com_virtuemart/helpers/shopfunctionsf.php I changed this (line 243):
$user= self::sendVmMail($view, $recipient,$noVendorMail);
for this:
if ($viewName=='invoice' AND in_array($vars['orderDetails']['details']['BT']->order_status, array('P','U')))
$user = null;
else
$user= self::sendVmMail($view, $recipient,$noVendorMail);
There is a more complete answer in this url
Related
In WordPress, I have custom registration site for new users. Upon registration, there is an optional checkbox to subscribe to our newsletter. As far as I understand it, it adds the value of the checkbox to the user_meta table (the whole thing has been coded by a company in India, which I woould very much prefer to not involve again, since they delayed their work time and time again and didn't do good work after all).
The corresponding code snippet in my child theme's functions.php looks like this:
<?php echo '<div class="form-row form-row-wide">
<input type="checkbox" name="inter_offers" value="yes"> '; _e('I would like to subscribe to the Kurth Electronic newsletter.','kurth-child'); echo '<br></div>';
return $fields; ?>
add_action('woocommerce_created_customer','adding_extra_reg_fields');
function adding_extra_reg_fields($user_id) {
extract($_POST);
update_user_meta($user_id, 'billing_inter_offers',$inter_offers);
} ?>
(I have left out lines irrelevant to this issue.)
Now, this value is saved internally, but not displayed to me. I would like to show the value in an E-Mail or notification generated by WordPress when the user completes registration, so that we can manually add them to our newsletter list whenever someone chooses to subscribe to the newsletter. The problem is that I only have a limited knowledge of PHP and I don't know where to start.
I should also note that this is not done via the standard WorPress registration form, but by a WooCommerce registration form (I have disabled the standard WordPress registration for security reasons).
I tried using the "Better Notifications" plugin (https://wordpress.org/plugins/bnfw/) for custom notifications whenever a new user completes their registration, but it ignores any php code that I add to the custom notifications body to display the user_meta data.
Any help would be appreciated.
Because the registration is done via woocomerce you may have to look for a notification PlugIN that works with woocomerce, the one you have may just work properly with wordpress core version!
You also could generate a mail via php in the function, so that you get a message with the user mail adress, but i think without php knowledge it is not that easy to use the built in php mailer... (You may need an api there!)
But wouldn't it be better to automatically sign them into your newsletter software? For example for Mailchimp or other systems like that there are quite good wordpress plugins!
You may also be able to include the forms of these PlugIns in your registration form, but without a closer look at this woocomerce registration i can't tell for sure!
I think this will do the trick, it will notify you every time a new user is created and also tell you if they subscribed or not.
function new_customer_registered_send_email_admin($user_login, $user_email) {
ob_start();
do_action('woocommerce_email_header', 'New customer registered');
$email_header = ob_get_clean();
ob_start();
do_action('woocommerce_email_footer');
$email_footer = ob_get_clean();
$user = get_user_by( 'email', $user_email );
$subscribed = get_user_meta( $user->ID, 'billing_inter_offers', true );
woocommerce_mail(
get_bloginfo('admin_email'),
get_bloginfo('name').' - New customer registered',
$email_header.'<p>The user '.esc_html( $user_login ).' created an account ' . ( $subscribed ? ' and subscribed to the newsletter.' : '.' ) . '<br>Email:'.esc_html( $user_email ).'</p>'.$email_footer
);
}
add_action('new_customer_registered', 'new_customer_registered_send_email_admin', 10, 2);
I ended up using the plugin amr users to generate a userlist of all users who had a certain metadata tag set to a certain value (in my case, if they want to recieve a newsletter - the previous developers never bothered to make the data actually readable without extra effort). It is a little clunky to use and not what I originally intended, but it got the job done.
So I'm using the SwipeStripe module as an ecommerce shop, and having issues logging member details as customer details. I'll outline the process and what i've tried so far.
I am currently logged in as a member of my website.
I can view, and add products to my cart.
When I reach the checkout page, it asks me to register my details (become a member).
I have gone through the Customer.php, and OrderForm.php files. What I have discovered is:
Customer::currentUser() is not recognising me as a logged in user.
When I print Member::currentUser() it can see I am a logged in, registered member and I can print the details of that record.
Customer::currentUser() is as follows in the Customer.php file:
static function currentUser() {
$id = Member::currentUserID();
if($id) {
return DataObject::get_one("Customer", "\"Member\".\"ID\" = $id");
}
}
I was wondering if anyone could help me understand why Customer::currentUser() isn't recognising me as a logged in user?
Also, in the OrderForm.php, when I change the validation for the "register as a member" form fields (the function is called 'createFields') to Member::currentUserID() it recognises that I'm logged in and skips that section. It's only when it goes to save my order and customer details to the customer DB table, that it can't retrieve my email address.
I know this is an old post, but I've used this code/method all the way up to SS 3.4.
You will need to update Aram's code to work with SS 3.x.x
https://www.silverstripe.org/community/forums/e-commerce-modules/show/21390
-helenclarko
I am trying to create a paypal payment page, but for some reason when I try to add a custom web profile to the payment the option of checking out as a guest suddenly disappears.
First I am creating the web profile this way:
$flowConfig = new FlowConfig();
$flowConfig
->setLandingPageType("billing")
->setBankTxnPendingUrl("...");
$presentation = new Presentation();
$presentation
->setLogoImage("...")
->setBrandName("...")
->setLocaleCode("...");
$inputFields = new InputFields();
$inputFields
->setNoShipping(1)
->setAddressOverride(0);
$webProfile = new WebProfile();
$webProfile->setName("PROFILE" . uniqid())
->setFlowConfig($flowConfig)
->setPresentation($presentation)
->setInputFields($inputFields);
$request = clone $webProfile;
try {
$createProfileResponse = $webProfile->create($apiContext);
} catch (PayPal\Exception\PayPalConnectionException $ex) {
...
}
$profileId = $createProfileResponse->getId();
Then, I have updated the payment code in this way
$paypalPayment = new PayPalPayment();
$paypalPayment->setIntent("sale");
$paypalPayment->setPayer($payer);
$paypalPayment->setRedirectUrls($redirectUrls);
$paypalPayment->setTransactions(array($transaction));
$paypalPayment->setExperienceProfileId($profileId);
The weird thing is that if I comment the last line I can perform payments as a guest without any issue. If, instead, I leave it this way, I get the customized page but the "Check out as a guest" button is replaced by "Create an account".
Do I really have to choose between having a customized checkout page and the possibility to perform payments without creating paypal accounts? Or am I missing something? I didn't find anything related to this issue in the documentation nor here in stackoverflow, and it seems at least strange!
Thank you
Are you using Express Checkout? It looks like recurring payments without a PayPal account are only compatible with Website Payments Pro accounts.
You can still create recurring payments with EC but they will need a PayPal account to accept them, no guest checkout allowed by the looks of it.
https://www.paypal-community.com/t5/Merchant-services-Archive/How-to-accept-recurring-payments-from-buyers-who-don-t-have-a/td-p/178232
A Magento website I'm maintaining stopped sending order confirmations and/or invoices all of a sudden.
Nothing has been changed in the email settings and they're all complying with common Magento guidelines. I've tried sending a test email through the following php script to make sure it's not caused by any server settings:
<?php
$to = "me#domain.com";
$subject = "Test email";
$message = "This is a test email.";
$from = "testing#anothertest.test";
$headers = "From:" . $from;
if (mail($to, $subject, $message, $headers)) {
echo("Your message has been sent successfully");
} else {
echo("Sorry, your message could not be sent");
}
?>
The test message got delivered flawlessly.
I installed the SMTP Pro Email plugin to see if changing settings there would manage a result; nothing. The plugin offers the ability to send a test email, which again gets delivered without flaw.
Even stranger, clicking the 'Send Email' button in the Magento backend for an order does deliver the email. Signing up for a newsletter does result in a subscription confirmation request email. Clearly, the website can send mails, it just somehow doesn't get triggered to do so for order order confirmations and invoices.
And yes, both
System > Configuration > Sales > Sales Emails > Order > Enabled
and
System > Configuration > Sales > Sales Emails > Invoice > Enabled
are set to Yes and include a BCC address.
Similarly,
System > Configuration > Advanced > System > Mail Sending Settings > Disable Email Communications
is set to No.
I'm running Magento CE 1.6.2 on this site, so it's not the common cron job problem version 1.9 seems to cause for a lot of folk.
I'm racking my brain here, does anybody have a clue?
Still haven't found what causes the problem, but added some code to succes.phtml to force the mail to be sent upon loading that page:
<?php
$order = new Mage_Sales_Model_Order();
$incrementId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
$order->loadByIncrementId($incrementId);
try
{
$order->sendNewOrderEmail();
} catch (Exception $ex) { }
?>
It's not the most elegant solution, but at least the customers get their order confirmation through this workaround.
I am using version 1.8.1. I have been fighting with this same problem for 2 weeks now. The simple solution came by me "enabling" every option in System > Configuration > Advanced. All the new order confirmations get sent out immediately now to the person placing the order.
Background: After installing and configuring the new Magento Cart, I noticed that emails were only going through if I manually sent them through the admin screens. This told me that the server SMTP settings were correct, but I was wondering why a person placing an order would not receive the confirmation email...ever. After much searching and reading I thought that it had to do with one of the other functions of the Magento cart. So I went into the system confuration under the advanced tab (System > Configuration > Advanced) and found that I had disabled certain things like Sendtofrined, Newsletter, etc. Not wanting to waste time at the moment, I simply went through the entire list and enabled everything. Now I have the coupon function, add to wish list function and newsletter stuff that I do not want to see in the cart, but the emails are going through immediately and reliably. I will now attempt to find which function is related to the order confirmation email by process of elimination. But this did the trick for me and I hope it helps someone else out there, without having to add code to the php files.
This is probably a feature which any one might be looking for. I would like to send an email notification to my store's contact email address every time a new review has been added.
I am planning to do this by making a custom module which on its own as soon as the new review is posted should notify the store owner (on its contact email address).
Now the few things I am stuck with is whether this needs to be run on a cron job or is it capable of running on its own as soon as a new review has been posted.
Also what exactly would be the condition which would check for new reviews and send email alerts. This are just things off the top of my head, but if any one has got a better outline on how to do this, is more than welcome to drop in their suggestions.
Thanks in advance
As Dick Laurent suggested you can use an observer to notify you by email when a product review is placed.
Looking to see if there is an event after a review is saved I checked:
app/code/core/Mage/Review/etc/config.xml
and there is already someone using this event:
<events>
<review_save_after>
<observers>
<rss>
<class>rss/observer</class>
<method>reviewSaveAfter</method>
</rss>
</observers>
</review_save_after>
</events>
So this is the event you are looking for: review_save_after
See this Magento wiki link for more information about Customizing Magento using Event/Observer
This works if you only want to get notified when a review is posted. If you want more specific/usefull links you might want to override a Magento class from Mage_Review (the controller or the model to store review id and stuff in session.
If you want to include some details about the posted review you can get it from session:
$session = Mage::getSingleton('core/session');
$data = $session->getFormData(true);
What i understood from your description is "You want to send a mail confirmation, when a new review is posted".
In each review there will be a form post with review data.
Then you can save review data in db and asynchromously send email notification.
To send email , you can setup SMTP server connection (either in config or via code) and just send mail.
It is all you wanted?
Else post in detail what you need..
For a quick and very dirty fix you can add a
mail(to,subject,message) line to
app/code/core/Mage/Review/controllers/ProductController.php
after the line $session->addSuccess($this->__('Your review has been accepted for moderation.'));.
//after $rating = $this->getRequest()->getParam('ratings', array()); add
$ratingmsg='';
foreach($data as $key => $value){
$ratingmsg.='<b>'.$key.':</b> '.$value.'<br/>';
}
//and after $session->addSuccess($this->__('Your review has been accepted for moderation.'));
//add
$mail = Mage::getModel('core/email');
$body='<b>Produit :</b> '.$product->getName().'<br/>'.$ratingmsg.'<br/><br/>Pour valider ce commantaire rendez vous dans <br/>catalogue > commentaires > commentaires en attente';
$mail->setToName('name');
$mail->setToEmail('mail#gmail.com');
$mail->setBody($body);
$mail->setSubject('Un nouveau commentaire sur XX');
$mail->setFromEmail('contact#site.com');
$mail->setFromName("Name");
$mail->setType('html');// YOu can use Html or text as Mail format
try {
$mail->send();
//Mage::getSingleton('core/session')->addSuccess('Your request has been sent');
}
catch (Exception $e) {
Mage::log($e->getMessage(), null, 'mail.log');
}