I set Payreto Payment method in my magento web site. Then i can All checkout process done but not get Checkout E-Mail Admin or User.
So, Please Help me.
Open app/code/community/Payreto/controllers/ResponseController.php
and go to
private function _getPostResponseActionUrl(Mage_Sales_Model_Order $order) { and find Mage::getModel('sales/quote')->load($order->getQuoteId())->setIsActive(true)->save(); and Put
if ($order->getCanSendNewEmailFlag()) {
try {
$order->sendNewOrderEmail();
} catch (Exception $e) {
Mage::logException($e);
}
}
So Working Email Admin and User Both.
Related
I have a little problem with placing order button on magento. For some reasons when I complete a order and click "Place Order" it doesn't redirect the page in a success page (or even elsewhere) it just stays in the checkout page with all the products still inside (image http://i.stack.imgur.com/74I3X.png this is what happen when I click the place order button)
I don't really know where to modify the redirect to another page.
This is the code for the /Checkout/controllers/onepagecontroller.php
/**
* Order success action
*/
public function successAction()
{
$session = $this->getOnepage()->getCheckout();
if (!$session->getLastSuccessQuoteId()) {
$this->_redirect('checkout/cart');
return;
}
$lastQuoteId = $session->getLastQuoteId();
$lastOrderId = $session->getLastOrderId();
$lastRecurringProfiles = $session->getLastRecurringProfileIds();
if (!$lastQuoteId || (!$lastOrderId && empty($lastRecurringProfiles))) {
$this->_redirect('checkout/cart');
return;
}
$session->clear();
$this->loadLayout();
$this->_initLayoutMessages('checkout/session');
Mage::dispatchEvent('checkout_onepage_controller_success_action', array('order_ids' => array($lastOrderId)));
$this->renderLayout();
}
Please make sure that you have php-mbscript enabled in your server.
Magento 1.9.x version requires this needs to be turned on if it is disabled
For more information you can read following post
https://magento.stackexchange.com/questions/62744/place-order-button-doesnt-go-to-success-confirmation-page-1-9-1-0
[SOLVED] There was a problem with the file in /public_html/app/code/core/Mage/core/email/template.php (there was a character that stopped the page)
Thank you all guys.
I am using magento 1.7.Can anyone help/advise on this??
Also using EPDQ Barclaycard module.
Everything seems ok with capturing payments, however when I go to checkout fill in all the details up to Payment Information select card type and hit continue, then place order a new order email has been sent but it hasnt been paid for yet!
Is there anyway that this can be prevented till payment has been captured via Barclaycard?
Have I missed something?
Thanks in advance
Magento sends email order confirmations as soon as the order is placed. If you are redirecting the user to a payment gateway after the order has been placed but not paid for you will need to modify your payment module to use magento's payment redirect setup to get it to ignore the confirmation email (See Mage_Checkout_Model_Type_Onepage class saveOrder() method).
You should see some code like;
/**
* a flag to set that there will be redirect to third party after confirmation
* eg: paypal standard ipn
*/
$redirectUrl = $this->getQuote()->getPayment()->getOrderPlaceRedirectUrl();
/**
* we only want to send to customer about new order when there is no redirect to third party
*/
if (!$redirectUrl && $order->getCanSendNewEmailFlag()) {
try {
$order->sendNewOrderEmail();
} catch (Exception $e) {
Mage::logException($e);
}
}
So this gives you a few options. Extend your payment module so that it sets the order place redirect url, but this might mess up your payment module depending on how it was coded or you could extend the above class into your own module (do not mod the core), override the saveOrder() method and check the payment method in the if statement shown above a bit like;
if (!$redirectUrl && $order->getPayment()->getMethod() != 'your_payment_method' && $order->getCanSendNewEmailFlag()) {
try {
$order->sendNewOrderEmail();
} catch (Exception $e) {
Mage::logException($e);
}
}
You would then to handle IPN notification to get it to send the email when a successful payment IPN is received, I would suggest you take a look at the PayPal Standard module that ships with Magento for some pointers as this is exactly how it works. I am surprised the EPDQ module you have does not work like this already, might be worth contacting them and highlighting the issue.
I'm working on the automation of the shipping method, it seems to be working fine, but problem is:
Every 2nd order there is same error "Please specify a shipping method"
Can it be session error? Should variables be send over get-post or retrieved from Magento in other way?
Here is a code:
<?php
$customer = Mage::getSingleton('customer/session')->getCustomer();
$customer->setWebsiteId(Mage::app()->getWebsite()->getId());
echo $customAddress = Mage::getModel('customer/address')->load($customer->getDefaultBilling());
$quote = Mage::getSingleton('checkout/session')->getQuote()->setBillingAddress(Mage::getSingleton('sales/quote_address')->importCustomerAddress($customAddress));
$cart = Mage::getSingleton('checkout/cart');
$storeId = Mage::app()->getStore()->getId();
$checkout = Mage::getSingleton('checkout/type_onepage');
$checkout->initCheckout();
$checkout->saveCheckoutMethod('register');
$checkout->saveShippingMethod('matrixrate_matrixrate_35');
$checkout->savePayment(array('method'=>'pay'));
Mage::getSingleton('checkout/type_onepage')->getQuote()->getShippingAddress()->setShippingMethod('matrixrate_matrixrate_35');
try {
if ($checkout->saveOrder()) {echo "SUCCESSSSS!!!";}}
catch (Exception $ex) {
echo $ex->getMessage();
}
/* Clear the cart */
$cart->truncate();
$cart->save();
$cart->getItems()->clear()->save();
Mage::getSingleton('checkout/session')->clear();
It's using custom payment gateway called Pay and I'm using matrixrate extension for shipping, althought there is same eror on flatrate_flatrate so I don'd consider it as extension issue.
Thanks!!!
Adam
Issue: Cart items still displaying after order splitting
1.Save quote collection in shipping method step..
$quote->collectTotals()->save();
2.Add the below steps in the last section of the order split.
$quote->setIsActive(false);
$quote->save();
PROBLEM IS SOLVED.
Looks like there has been issue with sessions/time, server didn't process everything at once.
I had to add on cart-total page:
$checkout->getQuote()->getShippingAddress()->setShippingMethod('matrixrate_matrixrate_35');
$checkout->saveShippingMethod('matrixrate_matrixrate_35');
To make sure that shipping is set, also:
session is cleared at success page manually.
There has been a bug with total quote amount, so I just redesigned script to count it properly.
Many Thanks for help!!
Adam
I am using Magento 1.7.0.2. Whilst on the product page, if a customer attempts to add a quantity greater than we have in stock they receive a message stating ".. the requested quantity is not available".
Is there any way for magento to either email or log when this occurs? I.e. I receive an automatic email stating a customer has attempted to add X number of item X? This would allow me to identify lost sales due to us not having enough stock of a particular item?
Has anyone come across anything like this before or is this even possible?
Thank you in advance
Mike Prentice
yes this is possible
You have to code for this.
I came across this problem one time and what i have do like this below.
I have make one observer event to check if customer is requesting quantity more then available if so i sent email to admin.
What you can do is create one observer for chekout_cart_add_before event in this event you can put your logic.
Or otherwise you can use magento feature Backorders you can find this in inventory tab,if you enable this then customer can order even requested quantity > available quantity, customer can see one message in cart page about backorder.
There is no standart functionality to notify about low quantity products by email.
But there is RSS notification http://www.magentocommerce.com/wiki/modules_reference/english/mage_adminhtml/system_config/edit/cataloginventory
Extend this functionality to match your needs.
You could write some script which would parse RSS, and send email etc.
EDIT
Here is some extension you may like http://www.magentocommerce.com/magento-connect/low-stock-email-notification.html
But is is not free.
Here's how I've done it so that it sends a google analytics tracking event whenever a customer tries to order more than the available stock level.
First copy: app/code/core/Mage/CatalogInventory/Model/Stock/Item.php
To: app/code/local/Mage/CatalogInventory/Model/Stock/Item.php
so that you're not modifying a core file.
In app/code/local/Mage/CatalogInventory/Model/Stock/Item.php add this function
public function notifyOutOfStock($productId){
$session = Mage::getSingleton('checkout/session');
//Initialise as empty array, or use existing session data
$outOfStockItems = array();
if ($session->getOutOfStock()){
$outOfStockItems = $session->getOutOfStock();
}
try {
$product = Mage::getModel('catalog/product')->load($productId);
$sku = $product->getSKu();
if($sku){
//Add the current sku to our out of stock items (if not already there)
if(! isset($outOfStockItems[$sku]) ) {
$outOfStockItems[$sku] = 0;
}
}
} catch (Exception $e){
//Log your error
}
Mage::getSingleton('checkout/session')->setOutOfStock($outOfStockItems);
}
In that same file is another function called checkQuoteItemQty.
Inside that function you need to call your new function using $this->notifyOutOfStock($this->getProductId()); right after it sets each of the error messages and before the return statement.
So:
public function checkQuoteItemQty($qty, $summaryQty, $origQty = 0)
{
....
if ($this->getMinSaleQty() && ($qty) < $this->getMinSaleQty()) {
$result->setHasError(true)
->setMessage(
$_helper->__('The minimum quantity allowed for purchase is %s.', $this->getMinSaleQty() * 1)
)
->setQuoteMessage($_helper->__('Some of the products cannot be ordered in requested quantity.'))
->setQuoteMessageIndex('qty');
//** Call to new function **
$this->notifyOutOfStock($this->getProductId());
return $result;
}
.....
->setQuoteMessageIndex('qty');
//** Call to new function **
$this->notifyOutOfStock($this->getProductId());
return $result;
.....
What this does is add your product sku to an array in the checkout session.
This means you will have access to that info in the template file right after your page loads displaying the "Insufficient stock" notification.
So in one of your template files you can add some code to render the necessary JavaScript.
I've chosen header.phtml since it loads on every page. (Users can add quantities of items to the cart in the cart page as well as the product view page).
app/design/frontend/CUSTOMNAME/default/template/page/html/header.phtml
Somewhere down the bottom of the code add this:
<!-- GA tracking for out of stock items -->
<script>
try {
<?php
$session = Mage::getSingleton('checkout/session');
if ($session->getOutOfStock()){
$outOfStockItems = $session->getOutOfStock();
foreach($outOfStockItems as $sku=>$value) {
if($value==0){
//Render the GA tracking code
echo "_gaq.push(['_trackEvent', 'AddToCart', 'ProductQtyNotAvailable', '".$sku."']); \r\n";
//Set it to 1 so we know not to track it again this session
$outOfStockItems[$sku] = 1;
}
}
//Update the main session
Mage::getSingleton('checkout/session')->setOutOfStock($outOfStockItems);
}
?>
}
catch(err) {
//console.log(err.message);
}
</script>
Can confirm this works well and in my opinion is better than an email or RSS feed as you can analyse it along with the rest of your analytics.
I am working on shopping cart application in which there is an integration of PayPal and Google Checkout. All the code is working fine, but how do I know if the payment is done by Google or PayPal?
The response page for both Google Checkout and PayPal is the same.
After getting response I'm adding all the information to my database and removing items from the session, and then getting redirected to myindex page....
You could set a session variable or some sort of flag when executing the specific code for PayPal or Google.
Example:
payment() {
$vendor = selectedPayementVendor();
if($vendor == 'Google') {
$_SESSION['paymentVendor'] = 'google';
} elseif($vendor == 'PayPal') {
$_SESSION['paymentVendor'] = 'paypal';
} elseif ...
}