Category Archive for "Magento"

Clean logs files database Magento

Clean logs files database Magento How to clean logs files database magento? Magento is an e-commerce platform which is most secure e-commerce open-source platform. So it has lot of security implementation into files or database as well. That’s why it always produces of lot of temporary date in files as well as into database. After some time you can see that your website as well as your database is getting heavy on daily basis. So it affects the performance of…

Like to share it
Read More

How to group Security Headers for web application using htaccess?

How to group group Security for web application using htaccess? Group Security Headers htaccess X-XSS-Protection sets the configuration for the cross-site scripting filters built into most browsers. The best configuration is “X-XSS-Protection: 1; mode=block”. X-Frame-Options tells the browser whether you want to allow your site to be framed or not. By preventing a browser from framing your site you can defend against attacks like clickjacking. X-Content-Type-Options stops a browser from trying to MIME-sniff the content type and forces it to stick with…

Like to share it
Read More

Remove decimal value from price of product in magento

Remove decimal value product price Magento Price of product is : 135.00USD => 135USD How to remove decimal value from product price in magento? In order to remove decimal digits in price of product magento, we need to custom some code :Go to this file : app/code/core/Mage/Directory/Model/Currency.php Open app/code/core/Mage/Directory/Model/Currency.php Find the following code on line no 195 :- Find this code: public function format($price, $options=array(), $includeContainer = true, $addBrackets = false) { return $this->formatPrecision($price, 2, $options, $includeContainer, $addBrackets); } and…

Like to share it
Read More

How to hide product attributes with no value in Magento

As a working consultant on Magento Project I come across that different product type to have different product attributes. This means that every product will have more than 20 options and sometimes all option don’t apply to certain products. For instance a projector and laptop have different kind of product attributes like “Front Camera” in laptop is necessary to show as an product attribute, but into project it should not. Because the store uses the same attribute sets for each…

Like to share it
Read More

Change default sort order ASC to DESC for product listing in Magento

By default Magento shows products in category pages by ascending order. That’s why latest added product show at last in the Category. If we need to show latest added product at first in Category for this we should change default product order from ascending to descending. By changing direction we will able to show products as descending by its Name, Price and Position. For change order from Ascending to Descending: For this we need to update a little bit into…

Like to share it
Read More

Get last order of an customer magento

Here is the example code by which you can get last order details into mangento of using email id. $_customer = Mage::getModel('customer/customer'); $_customer->loadByEmail('demo@demo.com'); $orders = Mage::getResourceModel('sales/order_collection') ->addFieldToSelect('*') ->addFieldToFilter('customer_id', $_customer->getId()) ->addAttributeToSort('created_at', 'DESC') ->setPageSize(1); <strong>ID</strong> echo $orders->getFirstItem()->getId(); Shashi Dhar KumarShashi Dhar Kumar Experience in Web/software development including client server and implementation using PHP, XML, MySQL and SQL Server. Experience of working on Apache, Linux projects, Javascript, Ajax, Putty, FTP, Remote Connection, XML parsing, Mod-Rewriting, Payment Gateways and shipping modules, Trouble shooting and…

Like to share it
Read More

Remove links from myaccount in magento

The easiest way to remove any link from the My Account panel in Magento is to first copy: app/design/frontend/base/default/template/customer/account/navigation.phtml to app/design/frontend/enterprise/YOURSITE/template/customer/account/navigation.phtml Open the file and fine this line, it should be around line 34: Right below it add this: <?php $_count = count($_links); /* Add or Remove Account Left Navigation Links Here -*/ unset($_links['tags']); /* My Tags */ unset($_links['invitations']); /* My Invitations */ unset($_links['enterprise_customerbalance']); /* Store Credit */ unset($_links['OAuth Customer Tokens']); /* My Applications */ unset($_links['enterprise_reward']); /* Reward Points */…

Like to share it
Read More

Magento redirect customer after registration

Go to customer accountcontroller find _welcomeCustomer method. file location must be like app/code/core/Mage/Customer/controllers/AccountController.php Search for protected function _successProcessRegistration(Mage_Customer_Model_Customer $customer) function at accountcontroller.php file and change following: $url = $this->_getUrl(‘*/*/index’, array(‘_secure’ => true)); to $url = Mage::getUrl(‘thank-you’, array(‘_secure’=>true)); OR Search for $successUrl = $this->_getUrl(‘*/*/index’, array(‘_secure’ => true)); replace this code with your URL $successUrl = $this->_getUrl(‘thank-you’, array(‘_secure’ => true)); And don’t forget to create Thank You Page with URL Key as thank-you or you can change with your desired url, but…

Like to share it
Read More

Declaration of Zend_Pdf_FileParserDataSource_File::__construct() must be compatible with Zend_Pdf_FileParserDataSource::__construct()

In one of my Magento projects, on development environment everything was working fine but when the site was live “Invoice” print in magento admin[Admin>>Sales>>Orders>>Invoice>>Open Invoice>>Click print button] was giving Fatal error: Declaration of Zend_Pdf_FileParserDataSource_File::__construct() must be compatible with Zend_Pdf_FileParserDataSource::__construct(). We though that we might have missed some file when moving to live site but ultimately we found that code base was same. After doing some research we found that it was an environment issue. On development environment we were running…

Like to share it
Read More

How to get minimum and maximum price of Bundled Product in Magento?

I have problem to show the EMI price for particular product in bundled product in Magento. So I have tried to go through the google and found some interesting forum post to get the bundle product’s price. <?php $product_id = YOUR_PRODUCT_ID; $bundled_product = new Mage_Catalog_Model_Product(); $bundled_product->load($product_id); $selectionCollection = $bundled_product->getTypeInstance(true)->getSelectionsCollection( $bundled_product->getTypeInstance(true)->getOptionsIds($bundled_product), $bundled_product ); $bundled_items = array(); foreach($selectionCollection as $option) { $bundled_prices[]=$option->getPrice(); } sort($bundled_prices); $minimum_price=$bundled_prices[0]; $maximum_price_tmp=array_slice($bundled_prices, -1, 1, false); $maximum_price=$maximum_price_tmp[0]; echo “Minimum Price:” . $minimum_price; echo “Maximum Price:” . $maximum_price; ?> Shashi…

Like to share it
Read More