Magento get order shipping method title - magento

Hi can anybody tell me how can i get after successfully order is placed shipping method title?
Here is what i have
$iOrderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
$oOrder = Mage::getModel('sales/order')->loadByIncrementId($iOrderId);
echo $oOrder->getShippingMethod();
but how can i get this shipping method title?

$oOrder->getShippingDescription();

$order = Mage::getModel('sales/order')->loadByIncrementId($iOrderId);
$order->getShippingDescription();
Or
$shipping = $order->getShippingAddress()->getShippingMethod();
echo $shipping->getData('title');

This worked for me when looking for the custom title:
Mage::getModel('sales/order')->loadByIncrementId($orderId)->getTracksCollection()->getFirstItem()->getTitle();

$order->getShippingDescription(); // returns Shipping Method Title

Related

if attribute is xyz, show (pre-defined) text in product view

I need to show a pre-defined text in product view for some special products. These products all have a special value for an attribute.
I need a solution to show tgis text, when the attribute has this special value.
Another solution could be to show this text if a checkbox (an attribute?) is checked.
Can anyone help me?
Thanks for reading!
This is the code you need.
$product_id = Mage::registry('current_product')->getId();
$store_id = Mage::app()->getStore()->getId();
$attribute = Mage::getResourceModel('catalog/product')->getAttributeRawValue($product_id, 'attribute_code', $store_id);
if ($attribute == "needed value")
{
echo "my pre defined text";
}
you can get the attribute value ,
just echo $_product->getRefillProduct() ; // attribute id is refill_product
fore more detail click on http://www.sharpdotinc.com/mdost/2009/04/06/magento-getting-product-attributes-values-and-labels/

Getting Order Number from Order Id in Magento?

I am using following code to get the Order Number from Order ID.
$orderId=64; //Order Id will be supplied dynamically
$order = Mage::getModel('sales/order')->load($orderId);
echo "Order Number is: ".$order['increment_id'];
I am getting the correct order number using this code like 100000067.
I wanted to know Is this the correct approach to use.
Please guide.
Thanks
This should work for you.
$orderId = 64;
$order = Mage::getModel('sales/order')->load($orderId);
echo $order->getIncrementId();
Cheers!

having trouble getting the subtotal from the cart in magento?

I am trying to get the subtotal from the cart using the code
<?php echo Mage::helper('checkout/cart')->getQuote()->getSubtotal(); ?>
It only works when i clean the cache, i don't know why. how to get the subtotal in a correct way? . Any help will be greatly appreciated.
Thank you in advance
$session= Mage::getSingleton('checkout/session');
$getotal = Mage::helper('checkout')->getQuote()->getGrandTotal();
//Total object
$totals = Mage::getSingleton('checkout/session')->getQuote()->getTotals();
//Subtotal value
$subtotal = $totals["subtotal"]->getValue();
Use the above mentioned code you will surely get subtotal at the end.:-)

magento vat number pdf invoice

can anyone help me in placing the vat/tax number on the pdf invoice in Magento?
I tried this code but it didn't work:
$taxvat = $order->getData('customer_taxvat');
$page->drawText('Tax/Vat: '.$taxvat, 35, 567);
You can retrieve this by doing;
$order->getCustomerTaxvat()
If this value is empty you could try this;
$customer = Mage::getModel('customer/customer')->load($order->getData('customer_id'));
$taxVat = $customer->getData('taxvat');

Magento Product Insert Function

I need to add a custom option to all products as they get saved. For that I need to find the function that inserts the products into the database, which I'm not able to find.
Please, any help would be appreciated.
thanx
$client = new SoapClient('http://www.magentolocal.it/api/?wsdl');
$session = $client->login('productloader', '1234567890');
$sku = "123456";
$attrs['name'] = "Template #1";
$attrs['description'] = "This is the first template.";
$attrs['short_description'] = "This is the short description of the template";
$attrs['websites'] = array('1');
$attrs['price'] = "11.53";
$attrs['categories'] = array('35');
$attrs['images'] = array()
$result = $client->call($session, 'catalog_product.create', array('simple', '63', $sku, $attrs));
echo $result;
$client->endSession($session);
Magento's EAV system is pretty strung out among several files, so you won't find a single function that accomplishes what you want. If you did go looking for it, and changed it, you would also be changing the same save method that mostly every other object in Magento uses, which is probably not what you want.
To do what you want, try setting up an observer/listener on the events that catalog products use when saving, namely catalog_product_save_before or catalog_product_save_after. That way, you don't have to hack the framework.
Hope that helps!
Thanks,
Joe
How about http://www.magentocommerce.com/wiki/doc/webservices-api/api/catalog_product#catalog_product.create?

Resources