“Invalid entity model” error while exporting csv file for products and Customers in Magento

Displayed “Invalid entity model” error, While Exporting  Products and Customers in Magento!

Its due to permission issue. Some time this error display in windows server.

Solution:

Open abstract class /app/code/core/Mage/ImportExport/Model/Export/Adapter/Abstract.php and replace line number 60(Line number will change some time)

//$destination = tempnam(sys_get_temp_dir(), 'importexport_');
//Change above like as like BELOW: 
$destination = tempnam(Mage::getBaseDir() . '/var/tmp/' , 'importexport_'); 

NOTE: Also, make sure “root/var/tmp/” folder have full permission.

How to add more tabs on product-collateral of product view page

Step1: Add the code in catalog.xml file

path:app/design/frontend/yourtheme/default/layout/

<catalog_product_view>
   <block type="catalog/product_view_description" name="product.faq" as="faq" template="catalog/product/view/faq.phtml">
	<action method="addToParentGroup"><group>detailed_info</group></action>
	<action method="setTitle" translate="value"><value>Frequently Asked Questions(Tab Dispaly Value)</value></action>
    </block>
</catalog_product_view>

Note: name =”product.your_template_name” template=”catalog/product/view/new_template_file” create the new template file in this path and saved

Step2: Created the New Attribute Template file example:faq.phtml

<?php  $faq = $this->getProduct()->getFrequentlyQuestions(); ?>
 
<?php if ($faq): ?>
    <h2><?php echo $this->__('Frequently Asked Questions') ?></h2>
    <div class="std">
        <?php echo $this->helper('catalog/output')->productAttribute($this->getProduct(), $faq, 'faq') ?>
    </div>
<?php endif; ?>

Note: getFrequentlyQuestions() = get’attributeID'()

Magento Invoice PDF Style and Content Alteration

Step1: Move the Below Base Folder are move your local folder

app\code\local\Mage\Sales\Model\Order\Pdf

Include the Fonts and Style:

protected function _setFontItalic($object, $size = 7)
    {
        $font = Zend_Pdf_Font::fontWithPath(Mage::getBaseDir() . '/lib/LinLibertineFont/roboto.italic.ttf');
        $object->setFont($font, $size);
        return $font;
    }

Font Function Call:

$this->_setFontItaltalic($page, 24);

Include the new Text Content:

$page->drawText(Mage::helper('sales')->__('FOR YOUR ORDER.'), 165, $this->y, 'UTF-8');

Draw the Line:

$page->drawLine(25, $this->y, 570, $this->y);

Draw the Box Style:

$page->drawRectangle(25, $top, 275, ($top - 25));

Create a New Page for PDF:

public function newPage(array $settings = array())
    {
        /* Add new table head */
        $page = $this->_getPdf()->newPage(Zend_Pdf_Page::SIZE_A4);
        $this->_getPdf()->pages[] = $page;
        $this->y = 800;
        if (!empty($settings['table_header'])) {
            $this->_drawHeader($page);
        }
        return $page;
    }

 

Note : 

$this->y(y-axis)

this variable is used to align the content in vertical postion

Magento Migration One Domain to Another Domain

Step1: Change the ‘secure’ and ‘unsecure’ url in your database ‘core_config_data’ table’

Using Below query or Change manually:

UPDATE core_config_data SET value="http://newhost.com/" WHERE path="web/unsecure/base_url";
UPDATE core_config_data SET value="https://newhost.com/" WHERE path="web/secure/base_url";

 

Step2: Change the ‘local.xml’ file database configuration file path: yourdomain\app\etc

Note: Don’t Backup the local.xml file same folder,remove the older files in that folder.

Step3: Clear the cache and session folder

File path: yourdomain\var\cache, yourdomain\var\session

Step4: Change the .htaccess file configure

Notes:

1.Check the ‘Old Domain’ urls in your Full Database and Files and replace with ‘Live Url’.

2.Take your Old Database Backup with out old caches

3.Magento 1.9 version need the php5 and above version not php7

 

 

 

Getting the Totals of the Cart

 

Step1: Getting the SubTotal of the Cart:

<?php Mage::getSingleton('checkout/session')->getQuote()->getSubtotal(); ?>

 

Step2: Getting the GrandTotal of the Cart:

<?php 
     $totals = Mage::getSingleton('checkout/session')->getQuote()->getTotals(); //Total object			
     $grandtotal = round($totals["grand_total"]->getValue());//Grandtotal value 
     echo $formattedPrice = Mage::helper('core')->currency($grandtotal , true, false);
?>