Wednesday, 18 November 2015
Multiple image uploading using single input in CodeIgniter
Tuesday, 10 November 2015
Get currency symbol or currency code
Get currency symbol or currency code
Store currency code eg. USD
$currency_code = Mage::app()->getStore()->getCurrentCurrencyCode();
store currency symbol eg. $
$currency_symbol = Mage::app()->getLocale()->currency( $currency_code )->getSymbol();
store currency name eg. US Dollar
$currency_name = Mage::app()->getLocale()->currency( $currency_code)->getName();
Try this
$currencyCode = '';
$currency = $order->getOrderCurrency(); //$order object
if (is_object($currency)) {
$currencyCode = $currency->getCurrencyCode(); }
$currencySymbol = Mage::app()->getLocale()->currency($currencyCode)->getSymbol();
var_dump($currencySymbol);
Try this also
$CurrencyCode = Mage::getModel('core/config_data')
->getCollection()
->addFieldToFilter('path','currency/options/allow')
->addFieldToFilter('scope_id',
$currencies_array = explode(',',$CurrencyCode[0]['value']);
if($currencies_array[0] == '')
{
$currencies_array[]= Mage::app()->getStore($site_id)->getCurrentCurrencyCode();
}
print_r($currencies_array);
Thursday, 5 November 2015
Get sub-categories of a specific parent category
get sub categories of specific category
<?php
$children = Mage::getModel('catalog/category')->getCategories(10);
foreach ($children as $category) {
echo $category->getName();
}
?>
------------------------------------------------------------------------------
get child category of every current category
<?php
$layer = Mage::getSingleton('catalog/layer');
$_category = $layer->getCurrentCategory();
$currentCategoryId= $_category->getId();
$children = Mage::getModel('catalog/category')->getCategories($currentCategoryId);
foreach ($children as $category)
{
echo $category->getName(); // will return category name
echo $category->getRequestPath(); // will return category URL
}
?>
------------------------------------------------------------------------------
<?php
$parentCategoryId = 107;
$cat = Mage::getModel('catalog/category')->load($parentCategoryId);
$subcats = $cat->getChildren();
// Get 1 Level sub category of Parent category
foreach(explode(',',$subcats) as $subCatid)
{
$_category = Mage::getModel('catalog/category')->load($subCatid);
if($_category->getIsActive()) {
echo '<ul><a href="'.$_category->getURL().'"
title="View the products for the "'.$_category->getName().'" category">'.$_category->getName().'</a>';
echo '</ul>';
}
}
?>
------------------------------------------------------------------------------
<?php
$children = Mage::getModel('catalog/category')->load('10')->getChildrenCategories();
foreach ($children as $category):
$category = Mage::getModel('catalog/category')->load($category->getId());
echo '<li><a href="' . $category->getUrl() . '">' . $category->getName() . '</a></li>';
endforeach;
?>
-------------------------------------------------------------------------------
<?php
$root = Mage::getModel('catalog/category')->load(13);
$subCat = explode(',',$root->getChildren());
$collection = $root
->getCollection()
->addAttributeToSelect("*")
->addFieldToFilter("entity_id", array("in", $subCat) );
foreach($collection as $catname){
echo $catname->getName();
}
?>
Edit links inside My Account page via xml files
Edit links inside My Account page via xml files
The Magento account page is the screen shown to the user after login.In this page there is a menu with various items.
Depending on the website, not all the items presents in the menu are useful, some of them could confuse the customer.
By default the items presents in the menu are:
- Account Dashboard
- Account Information
- Address Book
- My Orders
- Billing Agreements
- Recurring Profiles
- My Product Reviews
- My Tags
- My Wishlist
- My Downloadable Products
- Newsletter Subscriptions
WARNING: the Magento layout edits are saved in the CMS cache, remember to refresh the Magento cache after every edit (or disable the cache temporally).
1. 2. 3. Account Dashboard, Account Information, Address Book
These three menu items could be found inside the file"/app/design/frontend/*/*/layout/customer.xml"
For removing the item Account Dashboard you have to comment out this line of code
<action method="addLink" translate="label" module="customer"><name>account</name><path>customer/account/</path><label>Account Dashboard</label></action>
For removing the item Account Information you have to comment out this line of code
<action method="addLink" translate="label" module="customer"><name>account_edit</name><path>customer/account/edit/</path><label>Account Information</label></action>
For removing the item Address Book you have to comment out this line of code
<action method="addLink" translate="label" module="customer"><name>address_book</name><path>customer/address/</path><label>Address Book</label></action>
4. My Orders
This menu item could be found inside the file"/app/design/frontend/*/*/layout/sales.xml"
For removing this you have to comment out this line of code
<action method="addLink" translate="label" module="sales"><name>orders</name><path>sales/order/history/</path><label>My Orders</label></action>
5. Billing Agreements
This menu item could be found inside the file"/app/design/frontend/*/*/layout/sales/billing_agreement.xml"
For removing this you have to comment out this line of code
<action method="addLink" translate="label"><name>billing_agreements</name><path>sales/billing_agreement/</path><label>Billing Agreements</label></action>
6. Recurring Profiles
This menu item could be found inside the file"/app/design/frontend/*/*/layout/sales/recurring_profile.xml"
For removing this you have to comment out this line of code
<action method="addLink" translate="label"><name>recurring_profiles</name><path>sales/recurring_profile/</path><label>Recurring Profiles</label></action>
7. My Product Reviews
This menu item could be found inside the file"/app/design/frontend/*/*/layout/review.xml"
For removing this you have to comment out this line of code
<action method="addLink" translate="label" module="review"><name>reviews</name><path>review/customer</path><label>My Product Reviews</label></action>
8. My Tags
This menu item could be found inside the file"/app/design/frontend/*/*/layout/tag.xml"
For removing this you have to comment out this line of code
<action method="addLink" translate="label" module="tag"><name>tags</name><path>tag/customer/</path><label>My Tags</label></action>
9. My Wishlist
This menu item could be found inside the file"/app/design/frontend/*/*/layout/wishlist.xml"
For removing this you have to comment out this line of code
<action method="addLink" translate="label" module="wishlist" ifconfig="wishlist/general/active"><name>wishlist</name><path>wishlist/</path><label>My Wishlist</label></action>
10. My Downloadable Products
This menu item could be found inside the file"/app/design/frontend/*/*/layout/downloadable.xml"
For removing this you have to comment out this line of code
<action method="addLink" translate="label" module="downloadable"><name>downloadable_products</name><path>downloadable/customer/products</path><label>My Downloadable Products</label></action>
10. Newsletter Subscriptions
This menu item could be found inside the file"/app/design/frontend/*/*/layout/newsletter.xml"
For removing this you have to comment out this line of code
<action method="addLink" translate="label" module="newsletter"><name>newsletter</name><path>newsletter/manage/</path><label>Newsletter Subscriptions</label></action>
A little tip before the end
If some functions aren't used at all in your website, more than hiding only a menu item, it's better to directly disable this function. As example if you're sure that the function Tag will not be used, you could disalbe it going on System -> Configuration -> Advanced and disabling the Mage_Tag module.MAGENTO GET PRODUCT DETAILS
Useful Url options for static blocks, cms pageS and magento phtml files
getLayout()->createBlock('cms/block')->setBlockId(‘BlockIdHere')->toHtml(); ?>
1. Get Base Url :
Mage::getBaseUrl();
2. Get Skin Url :
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);
(a) Unsecure Skin Url :
$this->getSkinUrl('images/imagename.jpg');
(b) Secure Skin Url :
$this->getSkinUrl('images/imagename.gif', array('_secure'=>true));
3. Get Media Url :
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
4. Get Js Url :
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS);
5. Get Store Url :
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
6. Get Current Url
Mage::helper('core/url')->getCurrentUrl();
Get Url in cms pages or static blocks
1. Get Base Url :
{{store url=""}}
2. Get Skin Url :
{{skin url='images/imagename.jpg'}}
3. Get Media Url :
{{media url='/imagename.jpg'}}
4. Get Store Url :
{{store url='mypage.html'}}
about new GraphQL freature in Magento2
GraphQL: GraphQL is a data query language developed internally by Facebook in 2012 before being publicly released in 2015. Magento impleme...
-
Problem with simple configurable product module (organic internet) and Magento1.9 with selecting associated products, update attribute va...
-
- What is PHP? Ans. PHP is a recursive acronym for "PHP: Hypertext Preprocessor". PHP is a server side scripting lang...