Blog

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]