Blog

All articles written here are the lists.

Home Blog

Blog

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); ID echo $orders->getFirstItem()->getId();

How to use WooCommerce’s default price at any custom template

To use WooCommerce’s price in your custom theme template open the template file and use the following code and see the magic. Example <?php global $post, $product; ?> <span itemprop=”price” class=”price”><?php echo $product->get_price_html(); ?></span> For default price template file of...

How to use hooks (actions and filters) in wordpress and woocommerce

What are hooks? Hooks are helpful in WordPress which allow you to manipulate code without editing core files. It is used extensively used throughout WordPress and WooCommerce by developers. Two types of hook: actions and filters. Action Hooks allow you...

How to optimize files and images of website?

Optimizing Websites: Optimizing your website’s files is very important for better utilization of server resources. Even a high end server can fail to deliver the speed and performance that you look for, if the website is not optimized. Following are...

Steps To Follow When Updating WordPress

The WordPress upgrade system is improved itself from last version. However, there are some steps you can take care to ensure that your upgrades doesn’t affect anything. First and foremost, upgrades and updates should be done during your off hours...

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: Just...

WordPress comment form validation

Copy and paste below and see the validation in working: <style type=”text/css”> .error { font-size: 12px; padding: 0 0 5px 0; color: #FF0000; } input.error, textarea.error { background: #FFD2D2; color:#000000; } </style> <?php function comment_validation_init() { if(is_single() && comments_open() )...

WordPress comment form customization

Copy and Paste following into your functions.php file and see the customized form <?php function po_custom_comment_fields($fields) { //define global variable global $post; //remove defaults fields here $fields[‘url’] = ”; //begin custom fields $fields[‘firstname’] = ” . ‘<p class=”comment-form-firstname”><label for=”firstname”>’ ....

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...

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...