Magento: One Page Checkout Order Review

During Magento One Page Checkout, i used to display order details(subtotal,tax,shipping,grand total ) at Payment Information section. Use checkout session, to retrieve order data.

//Order Totals
$orderDetails = Mage::getSingleton('checkout/session')->getQuote()->getTotals(); //Total object
$subtotal = $orderDetails["subtotal"]->getValue(); //Subtotal value
$shippingAmount = Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getShippingAmount() //Shipping Amount
$taxAmount =Mage::helper('checkout')->getQuote()->getShippingAddress()->getData('tax_amount') //Tax Amount
if(isset($orderDetails['discount']) && $orderDetails['discount']->getValue()) {
 $discount = $orderDetails['discount']->getValue(); //Discount value if applied
}
$grandtotal = $orderDetails["grand_total"]->getValue(); //Grand Total
Advertisements

Magento: Add Column at Sales Orders Grid

Order Mode

Magento admin orders custom field. For example, add custom field into grid as Order Type (Virtual Order Or Shipping Order).

File Path: app/code/core/Mage/Adminhtml/Block/Sales/Order/Grid.php

protected function _prepareCollection()
{
$collection = Mage::getResourceModel($this->_getCollectionClass());

//New Lines
$resource = Mage::getSingleton('core/resource');
$orderReference = $resource->getTableName('sales/order');
$collection->getSelect()->join(array('so' => $orderReference),'main_table.entity_id = so.entity_id',array(''))
->columns('(CASE WHEN so.is_virtual = 1 THEN "Virtual Order" ELSE "Shipping Order" END) AS order_mode');
//END

$this->setCollection($collection);
return parent::_prepareCollection();
}
protected function _prepareColumns()
{
//Place code where you need to show field
$this->addColumn('status_type', array(
'header' => Mage::helper('sales')->__('Order Mode'),
'index' => 'order_mode',
'type' => 'text',
'width' => '70px',
'filter' => false,
'sortable' => false,
));
}

While searching sales orders list, you are getting error as “Integrity constraint violation: 1052 Column ‘increment_id’ in where clause is ambiguous”. To resolve those errors add “filter_index” at required add column function. Use below code for increment id error, do same for “created_at”,”grand_total”,..

$this->addColumn('real_order_id', array(
    'header'=> Mage::helper('sales')->__('Order #'),
    'width' => '80px',
    'type'  => 'text',
    'index' => 'increment_id',
    'filter_index'=>'main_table.increment_id',
));

JQuery | $(…).flexslider is not a function

$(…).flexslider is not a function, this issue mainly occurs after upgrading the jquery version or Multiple initialization of jquery. Try below points will help you to sort out the issue.

  • if your jquery version  is greater than jquery-1.8.3.js, call the script at bottom of page before closing </body> tag or if version equal or less than 1.8.3 place the script top of page.
  • Check whether you not initialize the jquery more than once.

CSS | Text Over Image using CSS

Below HTML code guide you to insert text (Hot Fried Prawns) over the image.

<!DOCTYPE html>
<html>
<head>
<title> CSS – Insert Text Over Image using CSS</title>
<link href=”https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css&#8221; rel=”stylesheet” integrity=”sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u” crossorigin=”anonymous”>
<link href=”https://fonts.googleapis.com/css?family=Miriam+Libre&#8221; rel=”stylesheet”>
<style type=”text/css”>
.banner-textimg-section {
text-align: right;
}
.banner-textimg-section > .banner-text {
padding-top: 10em;
padding-right: 5em;
position: absolute;
display: inline-block;
text-align: right;
width: 100%;
}
.banner-textimg-section > .banner-text{
transform: translateX(-100%);
-moz-transform: translateX(-100%);
-ms-transform: translateX(-40%);
-webkit-transform: translateX(-100%);
-o-transform: translateX(-100%);
}
.banner-img {
width: 100%;
}
.home-button-section.default-button-link {
font-family: ‘Miriam Libre’, sans-serif;
text-decoration: none;
color: #F44336;
background: #ffffff;
padding: 6px 20px 2px 20px;
text-transform: none;
font-weight: 600;
font-size: 2.5em;
display: inline-block;
vertical-align: middle;
}
</style>
</head>
<body>

Magento: Change Theme Using Controller

We can change the theme using magento controller by adding below code before $this->loadLayout(); , $this->renderLayout(); . Theme update reflects only on the specific controller.

public function indexAction()
{
/* Begin - Design Package */
Mage::getSingleton('core/design_package')
                    ->setPackageName($package) // $package = base, default, {{custom_package}}, ...
                    ->setTheme($theme); //  $theme = iphone, default, {{custom_theme}}, ...
/* End */ $this->loadLayout(); $this->renderLayout(); }