How to setup W3 total cache with WooCommerce

W3 Cache Plugin configuration for work with Woocommerce

For Improve website performance we use many cache plugins but its disturbed woo-commerce functionality some time.

Like W3 Cache Plugin stop product page gallery page images slider or checkout page functions for fix these issue we should nee d to configure W3 properly .Following things need to configure.

1 – You must add _wc_session_ to the “Ignored Query Strings” option in W3TC settings.

WP-admin go to Performance > Database Cache and add _wc_session_ to the Ignored query stems: Textarea box

2 – Add mfunc to the list of Ignored Comment Stems:

According wootheme guidelines for WooCommerce Cache Ensure you add ‘mfunc’ to the ‘Ignored comment stems’ option in the Minify settings.

Go to Performance > Minify, add mfunc to the list of Ignored comment stems:

3 – Exclude WooCommerce specific pages from the W3 Total cache

To exclude following WooCommerce pages from Cache

Add cart, checkout, shop, /shop* etc in Performance > Page Cache – Never cache the following pages text-area box.

Contact Form 7 Special Mail Tags

There may be times when you need more information than just the submitter’s input through contact form fields. For example, you may need to know the submitter’s IP address for security reasons. For such purposes, special mail-tags can be very helpful.

Unlike other mail-tags, special mail-tags are independent from form fields or the submitter’s input. You can place these special mail-tags anywhere mail-tags are allowed to be used, such as in the message body or other mail fields.

Special Mail Tags for Submissions


 — This tag is replaced by the submitter’s IP address.


 — This tag is replaced by the submitter’s user agent (browser) information.


 — This tag is replaced by the URL of the page in which the contact form is placed.


 — This tag is replaced by the date of the submission.


 — This tag is replaced by the time of the submission.


 — This tag is replaced by the number of form fields with invalid input.


 — This tag is replaced by a numeric string whose value increments, so this tag can work as the serial number of each submission.

How to Embed a YouTube Video with Autoplay and Sound Muted

This tutorial explains how you can embed a YouTube video that will automatically play when the web page is loaded but with muted audio by Embed code.


This is easy. Go the YouTube video page and note down the ID of the video from the URL. For instance, if the YouTube video link is, the video id is xyz-123. Once you have the ID, all you have to do is replace YOUR_VIDEO_ID in the following code with that string.

We should need to add two query string in embed video url for autoplay and mute.

&mute=1   For sound mute

&autoplay=1   For autoplay


<iframe src=";autoplay=1" frameborder="0" allowfullscreen=""></iframe>

How to increase wp memory limit and PHP Max Input Vars in wordpress

Increasing memory allocated to PHP:


Just add this line into wp-config.php file:

define( 'WP_MEMORY_LIMIT', '64M' );

Add this code into htaccess file:

php_value memory_limit 128M


The most common issue stems from the


PHP directive, which was introduced in PHP 5.3.9. By default, max_input_vars is set to 1000, which can easily be reached with the WordPress menu system, since each menu item sends about 12 variables per item.


The solution is to simply configure the


so that it is large enough to handle the number of variables being sent by WordPress to save your menu.


If you have access to your


, you can just add this directive (or change the value of the existing directive) to includes your max input variables:

max_input_vars = 3000;

If you don’t have access to this file (as with many shared hosts), you may need to contact your host to increase this limit.


Alternatively, you can try placing this in your


. This won’t work on some servers, so your mileage may vary.

php_value max_input_vars 3000

Cordova Command-Line Interface

The Command-Line Interface

This guide shows you how to create applications and deploy them to various native mobile platforms using the cordova command-line interface (CLI). This tool allows you to create new projects, build them on different platforms, and run on real devices or within emulators. The CLI is the main tool to use for the cross-platform workflow (See the Overview for a description of the various workflows.) However, you can also use the CLI to initialize project code, after which you use various platforms’ SDKs and shell tools for continued development.


Before running any command-line tools, you need to install SDKs for each platform you wish to target. (See the Platform Guides for more details.)
To add support or rebuild a project for any platform, you need to run the command-line interface from the same machine that supports the platform’s SDK. The CLI supports the following combinations:

  • iOS (Mac)
  • Amazon Fire OS (Mac, Linux, Windows)
  • Android (Mac, Linux)
  • BlackBerry 10 (Mac, Linux, Windows)
  • Windows Phone 7 (Windows)
  • Windows Phone 8 (Windows)
  • Windows 8 (Windows)
  • Firefox OS (Mac, Linux, Windows)

On the Mac, the command-line is available via the Terminal application. On the PC, it’s available as Command Prompt under Accessories.
The more likely it is that you run the CLI from different machines, the more it makes sense to maintain a remote source code repository, whose assets you pull down to local working directories.
To install the cordova command-line tool, follow these steps:

1. Download and install Node.js. Following installation, you should be able to invoke node or npm on your command line.
2. Install the cordova utility. In Unix, prefixing the additional sudo command may be necessary to install development utilities in otherwise restricted directories:

Read more »

how to get skin url, get media url, get base url, get store url in magento

Magento Mage Core, Admin Static Blocks, or Phtml edits are usually includes getting url path such images, javascript, base url, media and store url. There are different ways to retrieve mentioned URL paths depending on where section you’re editing.

To Retrieve URL path in STATIC BLOCK


{{skin url=’images/sampleimage.jpg’}}

To get Media URL

{{media url=’/sampleimage.jpg’}}

To get Store URL

{{store url=’mypage.html’}}

To get Base URL

{{base url=’yourstore/mypage.html’}}

TO Retrieve URL path in PHTML

Note: In editing PHTML don’t forget to enclode the following code with PHP tag
Not secure Skin URL:


Secure Skin URL


Get Current URL

$current_url = Mage::helper(‘core/url’)->getCurrentUrl();

Get Home URL

$home_url = Mage::helper(‘core/url’)->getHomeUrl();

Get Magento Media Url


Get Magento Media Url


Get Magento Skin Url


Get Magento Store Url


Get Magento Js Url


Retrieve current product, category and CMS page in Magento

Here are the quick snippet scripts for pulling out the current product, category and cms page from inside script or template files in Magento.

Get Current category

$_category = Mage::registry(‘current_category’);

Get Current Product

$_product = Mage::registry(‘current_product’);

Get Gurrent CMS Page

$_cmspage = Mage::registry(‘cms_page’)

How to get url of a category or product in magento .phtml file

For category url by category ID:

 <?php echo Mage::getModel("catalog/category")->load(5)->getUrl() ?>

To load products of a specific category:

$cat_id = 8; // set desired category id$category = Mage::getModel('catalog/category')->load($cat_id);$products = $category->getProductCollection()->addCategoryFilter($category)->addAttributeToSelect('*');?>
<?php foreach ( $products as $_product ): ?>
    <a href="<?php echo $_product->getProductUrl() ?>"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135, 135); ?>" width="135" height="135" title="<?php echo $_product->getName() ?>" alt="<?php echo $_product->getName() ?>" /></a>
<?php endforeach; ?>

Laravel Building HTML

Building HTML



When displaying user input in your Views, it is important to convert all characters which have significance in HTML to their “entity” representation.
For example, the < symbol should be converted to its entity representation. Converting HTML characters to their entity representation helps protect your application from cross-site scripting: Converting a string to its entity representation:

1. echo HTML::entities(‘‘);

Using the “e” global helper:

1. echo e(‘‘);

Scripts And Style Sheets

Generating a reference to a JavaScript file:

echo HTML::script(‘js/scrollTo.js’);

Generating a reference to a CSS file:

echo HTML::style(‘css/common.css’);

Generating a reference to a CSS file using a given media type:

echo HTML::style(‘css/common.css’, array(‘media’ => ‘print’));

Further Reading:


Generating a link from a URI:

1. echo HTML::link(‘user/profile’, ‘User Profile’);

Generating a link that should use HTTPS:

1. echo HTML::link_to_secure(‘user/profile’, ‘User Profile’);

Generating a link and specifying extra HTML attributes:

1. echo HTML::link(‘user/profile’, ‘User Profile’, array(‘id’ => ‘profile_link’));

Links To Named Routes

Generating a link to a named route:

echo HTML::link_to_route(‘profile’);

Generating a link to a named route with wildcard values:

$url = HTML::link_to_route(‘profile’, ‘User Profile’, array($username));

Further Reading:

  • Named Routes

Links To Controller Actions

Generating a link to a controller action:

1. echo HTML::link_to_action(‘home@index’);

Generating a link to a controller action with wildcard values:

1. echo HTML::link_to_action(‘user@profile’, ‘User Profile’, array($username));

Links To A Different Language

Generating a link to the same page in another language:

1. echo HTML::link_to_language(‘fr’);

Generating a link to your home page another language

1. echo HTML::link_to_language(‘fr’, true);

Mail-To Links

The “mailto” method on the HTML class obfuscates the given e-mail address so it is not sniffed by bots.
Creating a mail-to link:

1. echo HTML::mailto(‘’, ‘E-Mail Me!’);

Creating a mail-to link using the e-mail address as the link text:

1. echo HTML::mailto(‘’);


Generating an HTML image tag:

1. echo HTML::image(‘img/smile.jpg’, $alt_text);

Generating an HTML image tag with extra HTML attributes:

1. echo HTML::image(‘img/smile.jpg’, $alt_text, array(‘id’ => ‘smile’));


Creating lists from an array of items:

1. echo HTML::ol(array(‘Get Peanut Butter’, ‘Get Chocolate’, ‘Feast’));

2. echo HTML::ul(array(‘Ubuntu’, ‘Snow Leopard’, ‘Windows’));

3. echo HTML::dl(array(‘Ubuntu’ => ‘An operating system by Canonical’, ‘Windows’ => ‘An operating system by Microsoft’));

Custom Macros

It’s easy to define your own custom HTML class helpers called “macros”. Here’s how it works. First, simply register the macro with a given name and a Closure:
Registering a HTML macro:

1. HTML::macro(‘my_element’, function()

2. {

3. return ‘


4. });

Now you can call your macro using its name:
Calling a custom HTML macro:

1. echo HTML::my_element();

Solving reindex issues with Product Flat Data in Magento

Check your exception.log file And find :

Product Flat Data index process unknown error:
exception ‘PDOException’ with message ‘SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`DATABASE_NAME`., CONSTRAINT `FK_CAT_PRD_FLAT_2_ENTT_ID_CAT_PRD_ENTT_ENTT_ID` FOREIGN KEY (`entity_id`) REFERENCES `catalog_product_entity` ()’ in /app/magento_oneline/lib/Zend/Db/Statement/Pdo.php:228
Stack trace:
#0 /app/magento_oneline/lib/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array)
#1 /app/magento_oneline/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#2 /app/magento_oneline/lib/Zend/Db/Statement.php(300): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#3 /app/magento_oneline/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)

That error for

1 The key is here:
2 ?
4 That is telling you which table is failing. This exception tells that
5 the referential integrity between:
6 catalog_product_flat_2.entity_id and catalog_product_entity.entity_id is corrupted. This usually means some record(s)
7 contain(s) null in the field catalog_product_entity.entity_id, where they are expected to contain existing entity_ids.

Fixing this

In order to fix this issue, you need to find what the corrupted entries are. This is easy. In this case, you’ll need to create a query to get the empty registers:

SELECT a.entity_id FROM catalog_product_flat_2 AS a LEFT JOIN catalog_product_entity AS b ON a.entity_id = b.entity_id WHERE ISNULL(b.entity_id);
This will display the corrupted entities. You only need to delete them and that’s all.

1 +———–+
2 | entity_id |
3 +———–+
4 | 35427 |
5 | 35428 |
6 +———–+
7 2 rows in set (0.04 sec)
As example:
1DELETE FROM catalog_product_flat_2 where entity_id = ‘35427’;