Clear log table & speedup the website speed as well as free up the server space

Magento keep the log file internally to track the visitor, cart, customer, report etc. Once the website get older the logs get larger and that make slow down the website speed and consume the server space

In this article i will guide you how to prevent large log data. That will be beneficial for your website speed and server space

There is two way to achieve the target:
1) Manual process: Go to the database and truncate the below tables time to time:
dataflow_batch_export
dataflow_batch_import
log_customer
log_quote
log_summary
log_summary_type
log_url
log_url_info
log_visitor
log_visitor_info
log_visitor_online
report_viewed_product_index
report_compared_product_index
report_event

2) Clear the log table using cronjobs: This process is safe and easy to implement. Create a php script, using mysql query truncate data from database table.add This php script at cronjob as per as your requirement.
getConnection(‘core_write’);
$query1 = “truncate table dataflow_batch_export”;
$query2 = “truncate table dataflow_batch_import”;
$query3 = “truncate table log_customer”;
$query = “truncate table log_quote”;
$query4 = “truncate table log_summary”;
$query5 = “truncate table log_summary_type”;
$query6 = “truncate table log_url”;
$query7 = “truncate table log_url_info”;
$query8 = “truncate table log_visitor”;
$query9 = “truncate table log_visitor_info”;
$query10 = “truncate table log_visitor_online”;
$query11 = “truncate table report_viewed_product_index”;
$query12 = “truncate table report_compared_product_index”;
$query13 = “truncate table report_event”;

$writeConnection->query($query1);
$writeConnection->query($query2);
$writeConnection->query($query3);
$writeConnection->query($query4);
$writeConnection->query($query5);
$writeConnection->query($query6);
$writeConnection->query($query7);
$writeConnection->query($query8);
$writeConnection->query($query9);
$writeConnection->query($query10);
$writeConnection->query($query11);
$writeConnection->query($query12);
$writeConnection->query($query13);
$writeConnection->query($query13);
?>
Add the php script in cronjob after 15-30 days. so the log file will clear time to time and website speed didn’t get slow down, also it save your server space.

How to Re-index Magento Data via SSH

Re-indexing Magento data is a crucial task to ensure the smooth operation of your eCommerce store. While you can re-index data from the Magento admin panel, this process can sometimes get stuck due to expired sessions, maximum execution time limits, or other issues. The fastest and most reliable way to re-index Magento data is through SSH. This guide will walk you through the process.

Prerequisites

  1. SSH Access: Ensure you have SSH access to your server. If you do not have this access, contact your server administrator.
  2. Magento Installed: This guide assumes that Magento is already installed on your server.

Step-by-Step Guide

1. Log in to Your SSH Account

To start, log in to your SSH account using your preferred terminal or SSH client. If you do not have the login credentials, contact your server administrator.

2. Navigate to the Magento Directory

Once logged in, navigate to the directory where Magento is installed. Replace your_magento_directory with the actual path to your Magento installation.

3. Go to the Shell Directory

Inside the Magento directory, navigate to the shell directory. This is where you will run the re-indexing commands.

4. Run Re-indexing Commands

You can now run the following commands to re-index different parts of your Magento data. Execute each command one by one.

5. Re-index All Data at Once (Optional)

If you prefer to re-index all data in one go, use the following command:

Conclusion

Re-indexing Magento data via SSH is a straightforward process that can save you time and avoid common issues encountered when using the admin panel. By following these steps, you can ensure that your Magento store remains optimized and up-to-date. If you encounter any problems, consult with your server administrator for further assistance.

Session Management In magento1

In this blog i will explain you how to set, retrieve and unset session variable in Magento.
Before start i would like to inform you, By default Magento equipped with three type of session:

  • Core Session
  • Customer Session
  • Checkout Session

Core Session

Core sessions are bone of Magento, you can use it anywhere any place in the code.
Set core session: Mage::getSingelton(‘core/session’)->set();
This will set the value (value_of_session) in session variable name (your_session_name).
EX:
$myValue =’test’;
Mage::getSingleton(‘core/session’)->setMyValue($myValue);
In the above example i have set the value “test” in variable myValue, and set myValue in session. Now the session “MyValue” set with value “test”.
Retrieve core session value: Mage::getSingelton(‘core/session’)->get();,
This will return the session variable value which you set in “your_session_name”.
Unset core session:Mage::getSingleton(‘core/session’)->uns();, This will delete session value which you set in ““.

Same with the customer and checkout session:
Mage::getSingleton(‘customer/session’)
Mage::getSingleton(‘checkout/session’)

Magento : Get Base Url , Skin Url , Media Url , Js Url , Store Url and Current Url

Get Url in phtml files

  • Get Base Url : Mage::getBaseUrl();
  • Get Skin Url : Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);
  • Unsecure Skin Url : $this->getSkinUrl(‘images/imagename.jpg’);
  • Secure Skin Url : $this->getSkinUrl(‘images/imagename.gif’, array(‘_secure’=>true));
  • Get Media Url : Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
  • Get Js Url : Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS);
  • Get Store Url : Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
  • Get Current Url Mage::helper(‘core/url’)->getCurrentUrl();

Get Url in cms pages or static blocks

  • Get Base Url : {{store url=””}}
  • Get Skin Url : {{skin url=’images/imagename.jpg’}}
  • Get Media Url : {{media url=’/imagename.jpg’}}
  • Get Store Url : {{store url=’mypage.html’}}

Carshoez

Tire & Wheel sale website. CarShoez makes it easy to buy tires online. One thing we know about consumers is that they want free shipping, so we offer just that on all orders! We also know that consumers want the best deals on tires they can find, which is why CarShoez is your best choice for discount tires. Our goal is to provide you with the cheapest tires online. We don’t sell just cheap tires, but high quality, cheap tires for cars, trucks and more! Though our prices are low, you won’t have to worry about quality because we carry tires from only the leading brands in the industry including Michelin® Tires, BFGoodrich Tires, Uniroyal® Tires, Pirelli Tires, Yokohama Tires and Toyo Tires. View our online tire catalogs to find your tire choice! You can also check out what out what sales and deals we currently have going on! As you browse our online store, if you don’t find what you need, please send us an email or visit us in Fort Lauderdale, FL and we will get you the products you need. you can check it from Carshoez

Developer Name

[et_pb_section admin_label=”section”][et_pb_row admin_label=”row”][et_pb_column type=”4_4″][et_pb_text admin_label=”Developer Name” background_layout=”light” text_orientation=”left” text_font_size=”14″ use_border_color=”off” border_color=”#ffffff” border_style=”solid”]

t-s-1

I love to Develop

I love to introduce myself as a hardcore Web Developer.

Developer Name

Development Manager

[/et_pb_text][/et_pb_column][/et_pb_row][/et_pb_section]

Design Manager

[et_pb_section admin_label=”section”][et_pb_row admin_label=”row”][et_pb_column type=”4_4″][et_pb_text admin_label=”Text” background_layout=”light” text_orientation=”left” text_font_size=”14″ use_border_color=”off” border_color=”#ffffff” border_style=”solid”]

t-s-1

Its Awesome Work

I love to introduce myself as a hardcore Web Designer.

Designer Name

Design Manager

[/et_pb_text][/et_pb_column][/et_pb_row][/et_pb_section]

CEO NAME

[et_pb_section admin_label=”section”][et_pb_row admin_label=”row”][et_pb_column type=”4_4″][et_pb_text admin_label=”Text” background_layout=”light” text_orientation=”left” text_font_size=”14″ use_border_color=”off” border_color=”#ffffff” border_style=”solid”]

t-s-1

Hello World

I love to introduce myself as a hardcore Web Designer.

CEO NAME

founder & ceo

[/et_pb_text][/et_pb_column][/et_pb_row][/et_pb_section]