I have changed store email for another store.
Using below code I get a email of default config.
$FromName = Mage::getStoreConfig('trans_email/ident_general/name');
$FromEmail = Mage::getStoreConfig('trans_email/ident_general/email');
I want another email address which i have changed for specific store only.
Is there any way to fetch store email by store id?
Please find the answer below, You need to pass the current store to get an Email Id...
$store = Mage::app()->getStore(); // store info
$FromName = Mage::getStoreConfig('trans_email/ident_general/name',$store);
$FromEmail = Mage::getStoreConfig('trans_email/ident_general/email',$store);
Related
my session driver is set to database,
.env => SESSION_DRIVER=database
I have made a model for session and I access to a session of another user by user_id like this :
use App\Models\Session;
$payload = Session::where('user_id', $request->user_id)->pluck('payload');
$payload = unserialize(base64_decode($payload));
if (!isset($payload['cart'])) {
dd($payload['cart']);
}
now I want to session()->forget('cart') of that specific user not the current user, but the payload field is decode by base64 and serialized.
how to do that?
thanks
I tried a few things and by changing the id it works :
// Get the store from laravel (encrypted or not)
$store = session()->getDrivers()['database'];
// Change the id
$store->setId($id);
// Start the session
$store->start();
// Remove the item
$store->pull('cart');
// Save the session in database
$store->save();
i don't think it's something that laravel support, so this might break in the future
Yes I found it.
the problem is to displacement of serialize() and base64_encode() after unset($payload['cart']) like this:
use App\Models\Session;
$session = Session::where('user_id', $request->user_id)->first();
$payload = unserialize(base64_decode($session->payload));
if (!isset($payload['cart'])){
unset($payload['cart']);
}
$session->payload = base64_encode(serialize($payload));
$session->save();
I'm using the paypal API with Laravel, everything works fine. I just need to find the way to get the user email address and name.
$payment = Payment::get($payment_id, $this->_api_context);
$execution = new PaymentExecution();
$execution->setPayerId( $request->query('PayerID') );
$result = $payment->execute($execution, $this->_api_context);
if ($result->getState() == 'approved') {
// I should get the info about the payer here
}
The v1/payments PayPal-PHP-SDK is deprecated, you should not use it for any new integration.
The current supported SDK is the v2/checkout/orders Checkout-PHP-SDK, which you should use instead.
You can try the srmklive package "v3" if you like, otherwise integrate directly.
You should be able to create two routes, one for 'Create Order' and one for 'Capture Order', documented here. These routes should return only JSON data (no HTML or text). Pair those two routes with the following approval flow: https://developer.paypal.com/demo/checkout/#/pattern/server
The capture order response may have details about the payer and payment, if not use can do a 'Get' API call on the order ID for this information. Store it in your database before returning the JSON to the client code.
I Need to create an email template. Also I need to load that customer template into another .phtml file and edit before send the email. After editing only I need to send the email. Can anyone please help me how to do this?
I searched and tried for this, but I only found articles related to send email without editing the existing email template.
example: http://www.caritorsolutions.com/blog/158-send-email-from-custom-module-in-magento
You can create an email template when going to System > Transactional Emails. The name you put in is the unique identifier for that template.
<?php
$templateName = 'template_name_you_put_in_in_the_backend';
$to = 'johndoe#example.com';
$customerName = 'John Doe';
// Load our template by template_id
$emailTemplate = Mage::getModel('core/email_template')->loadDefault($templateId);
$vars = array(
'customer_name' => $customerName
// Other vars that can be used in the mplate
);
// Store sends it
$senderName = Mage::getStoreConfig(Mage_Core_Model_Store::XML_PATH_STORE_STORE_NAME);
$senderEmail = Mage::getStoreConfig('trans_email/ident_general/email');
$emailTemplate->setSenderName($senderName);
$emailTemplate->setSenderEmail($senderEmail);
//Send the email!
$emailTemplate->send($to, $customerName, $emailTemplateVariables);
You can of course edit this file through System > Transactional Emails. If this isn't what you mean, can you clarify what you mean by 'editing the existing email template' ?
i'm trying to get address from checkout page for a registered customer. on the checkout page I have a form that a user has to fill in with address info. Now the trick is to get that address displayed on the account dashboard.
I did try to get the address on the quote on .phtml here is my code
$quote = Mage::getSingleton('checkout/session')->getQuote();
$quote_billing = $quote->getBillingAddress();
echo $quote_billing
Is there any other possible way to get and address from a session
Try:
$customer = Mage::getSingleton('customer/session')->getCustomer();
foreach ($customer->getAddresses() as $address) {
Zend_Debug::dump($address->getData());
}
You could also do what you did and just do getData() on the $quote_billing. That should provide you with the data that you need to pull.
i am trying to create a order and assign a shipping no for that order when a order is placed. But i see that when i have an invoice created and a shipment added , magento sets the order status to 'complete' automatically. I tried to change the status manually but it wouldn work.
$order = Mage::getModel('sales/order');
$order->loadByIncrementId($orderId);
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true);
$order->save();
Could some one suggest me how to over come this?
Also, how i add a custom carrier ? The default ones are DHL, FedEx , UPS.. I want to add one similar to them. This is how i am doing it:
$carrier = "dhl";
$title = "DHL";
$trackNumber = '538099';
if (1) {
$itemsQty = $order->getItemsCollection()->count();
$shipment =Mage::getModel('sales/service_order',$order)->prepareShipment($itemsQty);
$shipment = new Mage_Sales_Model_Order_Shipment_Api();
$shipmentId = $shipment->create($orderId);
$shipment->addTrack($shipmentId,$carrier,$title,$trackNumber);
}
For the carrier and title, if i give a custom name, i get a error invalid carrier in a report. How do i go about this? Thanks.
You could use the addStatusToHistory function. This is also used for adding comments.
$order->addStatusToHistory('processing', 'Order is being processed', false);
param 1 (string): The new status
param 2 (string): Your Comment
param 3 (boolean): If you want to send the customer an email notification.