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

1
[_remote_ip]

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

1
[_user_agent]

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

1
[_url]

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

1
[_date]

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

1
[_time]

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

1
[_invalid_fields]

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

1
[_serial_number]

 — 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 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:

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

Add this code into htaccess file:

1
php_value memory_limit 128M

max_input_vars

The most common issue stems from the

1
max_input_vars

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.

Solution

The solution is to simply configure the

1
max_input_vars

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

php.ini

If you have access to your

1
php.ini

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

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

.htaccess

Alternatively, you can try placing this in your

1
.htaccess

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

1
php_value max_input_vars 3000

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

To get SKIN URL

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

Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);

Get Magento Media Url

Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);

Get Magento Skin Url

Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);

Get Magento Store Url

Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);

Get Magento Js Url

Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS);

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:

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

To load products of a specific category:

1
2
3
4
5
 <?php                      
$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; ?>

Host your Podcasts on Google Drive for Free

If you are looking to publish your own audio or video podcasts, you’ll need space on a public web server to host the MP3 or MP4 files of your podcast. When a user subscribes to your podcast feed in iTunes, or another podcatcher app, the podcast files will be downloaded from this server to the user’s computer (or mobile phone).

Where do you host the podcast files? If you have signed up for a web hosting account, you can use the rented space to host the podcast files else you may consider using Google Drive – it is free, you can host both audio and video podcast files and there are no known bandwidth restrictions.

Free Podcast Hosting on Google Drive

Here’s how you can use your Google Drive to host your podcast in two minutes.
We will first create a Podcast folder in Google Drive to store the podcast files and then make this folder public so anyone can download the episodes stored in this Google Drive folder. Any video file that you upload to this folder in Drive will have a public URL that you can use in your Podcast XML feed.

Click here and authorize the script to access to your Google Drive. The script will create a new public folder in your Google Drive for hosting the files.
Go to
drive.google.com in your desktop browser and upload one or more podcast files in the new Podcasts folder that you created in Step #1.
Once the files have been uploaded, open that folder link in your browser (
see example) and you should see a list of all the uploaded podcast files.
Right-click any podcast file (see the above screenshot) to copy the file’s URL which you can then paste in your podcast RSS feed –
see example).

The podcasts will be served from googledrive.com.

Other than the actual podcast episodes, you may also upload art work, logos and other image files that may be required for submitting your Podcast into the iTunes store.

A Simple Way to Protect Images from ‘Casual Copying’

If you don’t want other people to download images from your website, don’t put them online because – the way the web works – it is almost impossible to prevent someone from copying or saving your images.

However there’s one little trick that may discourage the less-technical people from casually copying, or even hot-linking, to your web images. To give you an example, try saving the following image to your computer using the standard “save as” option.

The “save picture” option under right-click is still available for the above image but instead of downloading the actual photograph, all it would save is a blank image. Also, the URL for the image (under Properties) would appear as some junk characters (it’s called a data URI) and thus would deter the non-techies from hotlinking to that image.
Here’s how you may implement something similar for your own images:
The standard embed code for an image looks something like this:

1
<img src="photograph.jpg" alt="" width="500" height="250" />

What you need to do is change the value of the src attribute to point to a blank image and then add a new style attribute to render the actual image. Also make sure that the value of the height and the width parameters are exactly the same as the actual image.

1
<img style="background-image: url('photograph.jpg');" src="data:image/gif;base64, R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" alt="" width="500" height="250" />

This is like overlaying a completely transparent screen over your photograph and anyone trying to save the image will end up downloading that screen instead of the image.

Obviously, there are simple workarounds to get around the above method. For instance, a copy of the full image will still be available in your browser’s cache. You may look at the HTML source or may even save the image using screen capture but again, these techniques may not always be known to the non-technical users of your website.

How to change magento admin password through phpmyadmin ?

It seems like the password must be typed and not copy/paste at least on the install part. good to know ;o)

The default login is : admin The default password is : 123123
If you are having troubles and want to reset it to a different password, just run at your sql database:

1
SELECT * FROM admin_user;

Then, find the username you want to modify in the listing provided – ‘admin’ in this example. Then, to update the password, type:

1
 UPDATE admin_user SET password=CONCAT(MD5('qXpassword'), ':qX') WHERE username='admin';

‘qX’ would be changed to whatever you want it to be and same goes for ‘password’
You can also do this in phpMyAdmin, find the admin_user field and choose MD5 when updating password.
If you want to add a new admin user, you must not only create a new entry in the table ‘admin_user’, but you also have to insert an entry in the table ‘admin_role’ which has to be associated with the user by the field ‘user_id’.

How to Reduce and clean the options table of wp session entries

Every visitor will have a temporary session stored on the options table. The session tokens are very small, it is a server side cookie store. The sessions automatically purge after 30 minutes of inactivity.

But when its not not purge automatically then it create a problem and your database size increase too much that effected your site speed.

So we should need to delete these entries manually or create a plugin for that i will show you how can be delete these through phpmyadmin command or by a plugin.

By Mysql command:

1
2
3
DELETE
FROM `wp_options`
WHERE option_name LIKE '_wp_session%'

You should create a plugin that will schedule an event that occurs daily:

1
2
register_activation_hook(__FILE__, 'my_activation');
add_action('my_daily_event', 'do_this_daily');

function my_activation() {
wp_schedule_event(time(), ‘daily’, ‘my_daily_event’);
}

function do_this_daily() {
$wpdb->query(
“DELETE FROM $wpdb->options
WHERE option_name LIKE ‘_wp_session%’

)
}