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'}}
Tuesday, 26 May 2015
Create custom category attribute in magento
$setup->addAttribute('catalog_category', 'category_color', array(
'group' => 'General',
'input' => 'select', //type of attribute here
'type' => 'varchar',
'label' => 'Show On Home',
'option' => array ('value' => array('optionone'=>array(0=>'No'),'optiontwo'=>array(0=>'Yes'))),
'backend' => 'eav/entity_attribute_backend_array',
'visible' => 1,
'required' => 0,
'user_defined' => 1,
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
));
$installer->endSetup();
How to Get Product details Using Product Id in Magento
$obj = Mage::getModel('catalog/product');
$_product = $obj->load($product_id); // Enter your Product Id in $product_id
// get Product's name
echo $_product->getName();
//get product's short description
echo $_product->getShortDescription();
//get Product's Long Description
echo $_product->getDescription();
//get Product's Regular Price
echo $_product->getPrice();
//get Product's Special price
echo $_product->getSpecialPrice();
//get Product's Url
echo $_product->getProductUrl();
//get Product's image Url
echo $_product->getImageUrl();
Monday, 9 March 2015
How to create and manage categories in Magento
In order to create a new category for your products, go to your Magento admin area > Catalog > Manage Categories. On the left you will see the available categories (if any) and above them you will see two options - Add Root Category and Add Subcategory. Since we have the Magento data installed, we have several categories. Let's create a new subcategory of the root category by clicking Root Catalog and then Add Subcategory.
You should fill in its Name and Description, add an image, fill in some Meta data for search engines, set it as Active so that it appears on your front page and include it in the Navigation Menu.
The last option is URL key, which, if set, will be used in the links to this category. This is useful for SEO purposes - when sites are indexed, it is considered a plus to have as many relative keywords as possible in the URL. If the category is called "PC", you may want to set this field to "personal-computers" to include two additional keywords in the link.
These are the General Information settings for the category. From the 3 other tabs available you can also manage:
- Display Settings - here you can set category Display Mode, its CMS block, whether it is Anchor (i.e. whether or not it should inherit the products in its subcategories) and the product listing sorting options;
- Custom Design - from this tab you can select the design for this category, as well as its layout;
- Category Products - this tab allows you to add existing products to the category
When you are done with your new category, click Save to create it.
How to add a category image in Magento
Adding a Magento category image is simple. From the Magento admin area > Catalog > Manage Categories select the category which you want to add an image to. Then click the General Information tab and click Browse next to the Image field.
Locate the image you want to set for this category on your computer and then click Save Category to save it. The image will appear as a small thumbnail next to the Image field. You can also upload a thumbnail image for the category.
How to list all available categories in Magento
If you want to get a list of all available Magento categories, go to your Magento admin area > Catalog > Manage Categories. From the Categories menu on the left click Expand All and your whole category tree will be displayed.
7 Common Mistakes While Building Online Ecommerce Stores
Are you running a digital online store or planning to go for eCommerce Store Development? If that is the case, then you must be aware of these dumb mistakes which can ruin your profit-making and popular eCommerce store. The number of online stores is rising, but with these soaring numbers we all see a lot of sites making similar fundamental errors. These errors cause poor user experience, eventually decreasing the number of booming sales going through your online shop.
Moreover, none of the online store is flawless, particularly when it first goes on a live mode. No matter even if you pick an apparently the best or comprehensive eCommerce solution, challenges are bound to be faced. Still, the set of common "Mistakes" that most of the companies' merchandizing goods and services online frequently do, are listed down.
Avoid Below Pitfalls While Building Online eCommerce Stores.
Lack of Research
Do not ever forget, that commencing any new business needs a lot of research. Whether it's a retail store or an online store – a meticulous research should be carried out to gain details about the behavior, habits and preferences of your target audience. Always keep in mind the in eCommerce technology is never a problem; it's the selling which is BACK-BREAKER. However, poor or no research might lead to disappointment and anxiety when nothing sells from your store. So better research well!
Selecting Wrong eCommerce Shopping Cart
Think and research properly before you choose any eCommerce Shopping Cart, don't just select the first cart that you think would be sufficient. It is advisable to consider everything from the functionality needs, feature requirements, budget, integration requirements and requirement of Customizability to design/theme needs. Do not worry; you can get a holistic support from an experienced Ecommerce Developer, who can also personalize your needs.
Fake Product Descriptions
The elaborated product description is a common cardinal "SIN" online store owners make. It is very important to provide correct and comprehensive product description without copying the manufacturers' description for the product.
No Easy Access to Contact Page
Contact pages should be made easy to find. Consumers will not get confidence to buy products from your website, unless they are sure that they can contact someone with questions or in the case something goes wrong. You might Look Spam if you do not evidently mention your office number or e-mail. Thus, contact page should be easily accessible with all the necessary contact details.
Poorly Loading Sites
Several eCommerce shopping carts take a lot of time before visitors are even able to see them. This Problem occurs generally due to Bad Design or since the owner makes use of a slow server. It is also an important factor for the search engines, so build your eShop double-quick.
Unintuitive Site Navigation
If your online store is not having easy and smooth navigational functionalities, the visitor is surely going to Leave Quickly. Therefore, you have to certainly have a clear-cut navigation menu which can be directive using least number of clicks.
Poor Product Images/Photo
For the people shopping online it is their tactile ability to examine the product that they are using to buy things online, due to this reason your eCommerce shop must have great product images. You must portray multiple angular images, classified into various options such as Zoom, Color, Appearance etc.
Lengthy Checkout Process
Holding your customers for asking irrelevant information and pathetic checkout design can result in high abandonment rates leading to Low Conversion Rates. So, do not keep any such field which isn't necessary for the checkout process. Keep it as simple as possible for the customers to check out and do not muddle up the process for them.
No Online Mobile Store
It would be the biggest mistake of your, if you have no mobile eCommerce site to support your online eStore. As per the latest statistics people are doing their research and shopping via their mobile devices. In reality, 57 % of buyers will not suggest a business with a sickly designed mobile site. And likewise 40 % of consumers will go to your competitor's online store after an ill mobile experience. So, if you want people to shop more and more from you, "Do not ignore mCommerce!"
Hope, you would eliminates these blunders while choosing to create an eCommerce Shopping Cart or make amendments in your existing eShop. Plus, amongst all the eCommerce Platform, Magento is the best with all the cutting-edge features and functionalities, which any eStore would require to make rapid sales.
Wednesday, 25 February 2015
Magento Installation Guide........
Step 2 Next, you must upload the installation package on your hosting account through your cPanel -> File Manager or using an FTP client.
In case you want the Magento installation to be primary for your domain (i.e. to run from http://yoursite.com), you need to extract the content of the installation package in the public_html folder. On the other hand, if you want it to be in a subfolder like http://yoursite.com/store/ you need to extract the content to public_html/store/.
Once you upload the package, you can extract it through your cPanel -> File Manager.
Step 3 Create a MySQL database and assign a user to it through cPanel -> MySQL Databases. Remember the database details, since you will need them during the script installation.
Step 4 Go through the Magento installation process
In our example we will install Magento in the public_html/store folder. Once the package is uploaded and extracted and you have a MySQL database, navigate to http://yoursite.com/store:
Click on the check box next to "I agree to the above terms and conditions" and click on the Continue button.
Now, choose the preferred Time Zone, Locale and Currency and press the Continue button.
Next, enter the database details: Database Name, User Name and User Password. You can leave the other options intact. Make sure that you place a check on the "Skip Base URL validation before next step" option. Then, click the Continue button to proceed.
At this point you should enter the personal information and the admin login details which you want to use. You can leave the Encryption Key field empty and the script will generate one for you. Once more, click the Continue button.
Finally, Write down your encryption key; it will be used by Magento to encrypt passwords, credit cards and other confidential information.
Tuesday, 24 February 2015
Problem with simple configurable product module in Magento1.9
Problem with simple configurable product module (organic internet) and Magento1.9 with selecting associated products, update attribute values and associated product images with zoom.
Install the simple configurable product option of organic internet.
Then go to configurable product detail page. You can see, when you select any associate product you can see only the price is changing not the image and not the attribute section and even not name also.
These things occurred because of in magento 1.9 there is default theme rwd and it doesn't have class or html tags which is written in js file of scp name "scp_product_extension.js" to replace content after associated product selection.
For changing attributes values in tab view. You need to go to your theme's "view.phtml" page. Where you can find the below code at "app/design/frontend/rwd/default/template/catalog/product/view.phtml"
Here you need to add one class for tab-specification. Let suppose I added class name "tab-specification" at <div class="tab-content">
See the screen shot
You can find it at "skin/frontend/base/default/js".
You have to change this code with below given code
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...