Showing posts with label Magento Coding. Show all posts
Showing posts with label Magento Coding. Show all posts

February 11, 2015

Importing Products with the Import Export with Magento 1.5 CE

This tutorial is regarding how to use the "Import Export" feature that has been introduced with Magento 1.5 and above in community edition.

I will demonstrate how to import simple product data via CSV files and CSV product related variants.

CSV format is as follows:

Have to put column names in the first table row

Make sure to keep - Field separator: comma

Make sure to keep - Text separator: double quotation marks (optional)

Make sure to keep character coding set to - Character set: UTF-8

Sample importing product format of CSV file.
We have used comma for separating column only for demonstration. Use CSV file as attached.

Column Names :
store, websites, _attribute_set, _type, sku, price, weight, name, image, thumbnail, small_image, short_description, description, status, visibility, tax_class_id, qty, is_in_stock

Values :
admin, base, Default, simple, sandy_product, 100, 0.5, sandy_product, /image1.jpg, /image1_thumb.jpg, /image1_small.jpg, sandy_product, sandy_product, 1, 4, 2, 100, 1





April 25, 2014

Magento : Currently running Store info (getStore() info)

// To fetch the current store information 
$_storeInfo = Mage::app()->getStore(); 

Zend_Debug::dump($_storeInfo ->debug());
You can do debugging for all the collections. This will help you a lot in all the case.
 
// To fetch the current store id 
$_storeId = Mage::app()->getStore()->getStoreId(); 

// To fetch the current store code 
$_storeCode = Mage::app()->getStore()->getCode(); 

// To fetch the current store's group id 
$_storeGroupId = Mage::app()->getStore()->getGroupId(); 

// To fetch the current store's name 
$_storeName = Mage::app()->getStore()->getName(); 

// To fetch the current store's sort order 
$_storeOrder = Mage::app()->getStore()->getSortOrder(); 

// To fetch the current store's status 
$_storeStatus = Mage::app()->getStore()->getIsActive(); 

// To fetch the current store's locale 
$_storeCode = Mage::app()->getStore()->getLocaleCode(); 

// To fetch the current website id 
$_websiteId = Mage::app()->getStore()->getWebsiteId(); 

// To fetch the current store's home url 
$_storeHomeUrl = Mage::app()->getStore()->getHomeUrl();

January 09, 2014

Session Variables in Magento


Following are main of the session variables. 

1. First one is about getting information regardng core session data for magento.
Core Session :- Mage::getSingleton(‘core/session’) 

2. Customer session is for getting details associated with the customer data that is currently in session.
You can play with customer session data in shopping cart in the case of one page check out or another kind of. 
Customer Session :- Mage::getSingleton(‘customer/session’);

3 .Admin session gives you information regarding admin session related with admin modules and permisssions.
You have to back up your source code before using this session. This is very important. 
Admin Session :- Mage::getSingleton(‘adminhtml/session’) 

4. Shopping cart session determines that you can get info about various products in shopping cart and customer data. 
Shopping Cart Session :- Mage::getSingleton(‘checkout/session’)->getQuote() 

User defined session variables: 
How to set a session variable in Magento : 
$data = 'Hello heaven welcomes you.'; 
 Mage::getSingleton('core/session')->setMyData($data); 
OR 
Mage::getSingleton('core/session')->setData('my_data', $data); 

How to get a session variable in Magento: 
$string_data = Mage::getSingleton('core/session')->getMyData(); 
OR
$string_data = Mage::getSingleton('core/session')->getData('my_data'); 

var_dump($string_data );