This tutorial will show how to assign or remove a category from a product in Magento 1. I have used the standalone script, but you can use this in any module. Assign a category to product $productId = 2000; $categoryId = 200; Mage::getSingleton(‘catalog/category_api’)->assignProduct($categoryId,$productId);Remove a category to product $productId = 2000; $categoryId = 200; Mage::getSingleton(‘catalog/category_api’)->removeProduct($categoryId,$productId);
Magento
Create customer attribute in Magento 1
This tutorial will guide you through the steps to create a custom customer attribute in Magento 1. My use case was to save a mobile application token against the user for further authentication.
Magento extensions, the opportunity has just kicked in for Omnichannel retailing
Have you heard about Omnichannel retailing? I am sure you have! In fact these buzzwords are the same which fall in the news again and again, but the lack of knowledge becomes the sole reason to dismiss them. Omnichannel retailing is the new customer demand of a business that is pretty much in talks these…Continue Reading
Magento 1: How to get the Order Id from Shipping Tracking Id
How to get the Order Id from Shipping Tracking Id. This code would work only if the shipment has created.
How To Start An E-commerce Store Using Magento
Gone are the days when Brick and Mortar used to be the only way of doing business. Now, more than ever, an ecommerce stores has become the way to go and almost everyone can now create an online store to market and sell their products and services. Though, the real question is: How to start…Continue Reading
Magento 1: Direct MySQL query for create, read, update and delete
In a previous article we have shown how to use direct MySQL raw queries in Magento 1. We have used read and write adapters to execute normal MySQL queries in Magento controllers, models and helpers. In this tutorial we are using built in Magento functions to create, read, update and delete records from database. Before…Continue Reading
How to Create a Module in Magento 2
Today’s tutorial are showing how to create a module in Magento 2. When you work in Magento you have to create a custom module at some point. Magento 2 has been around for 2 years now. More people are attracted to Magento’s powerful features and developing more Magento websites in the eCommerce industry. Magento considered…Continue Reading
How do I call a static block inside phtml magento
A static block in phtml file of Magento, sometimes we need to do this kind of functionality. For instance whenever you want to add one banner image on right side of callout block. banner_image_block_id is the identifier you have created with static block in magento
Magento – Get Current Store Details
To get the current store details you can use following code. Gets the current store’s id Gets the current store’s code Gets the current website’s id Gets the current store’sGroup id Gets the current store’s status Gets the current store’s locale Gets the current store’s home url Gets the current store’s name Gets the current…Continue Reading
A Guide to Secure Magento Website from Hacker
Getting started with Magento eCommerce platform doesn’t mean your site is safe and secure. Despite the fact that Magento is the most robust content management system for eCommerce websites, you can’t take its security lightly. You need to take serious measures to combat the security and hacking issues for your web store. In fact, the…Continue Reading
Get Magento attribute names instead of ID numbers
The following will help you to get attribute names instead of ID numbers when handling product attributes
Magento Get Customer Details
Getting customer details, there is handy function out there in Magento to achieve this. When working with Magento it’s very common that you need this information. So we are discussing how to get customer details in Magento. Follow the below steps Get customer Id from session in Magento Using the $customerId we can load the…Continue Reading
Change of Magento contacts page URL
Magento’s default contact us form page URL is a little bit awkward as its says http://yourdomain.om/contacts. We can change this easily by creating a small module.
How to get categories for a product in Magento
How to get categories for a product in Magento, use the below snippet code anywhere in the magneto.
How to override the Magento 1 controller
How to override Magento controller, must be a good practice whenever we want to add/update a new functionality to current Magento controller functions. Why overriding controllers? Controller is the entry point for any incoming request in Magento. To handle this Magento declares numerous functions in the Controller file mainly called actions. Suppose you want to…Continue Reading
Get all children categories given a category id in Magento
If you want to get the children categories recursively, you can use: Get all children categories given a category id in Magento. This will retrieve all sub – sub categories recursively.
Top Magento Hosting Providers
Building a Magento website is easy when comparing to figure out a good Magento hosting solution for the website. There are plenty of Magento hosting recommendations in the internet, but most of them are really confusing and sometimes misleading. Usually Magento developer companies suggest for the server, depending on the load and features of the website….Continue Reading
Magento Newsletter Tutorial
Magento Newsletter Tutorial When running an e-commerce store it is necessary to send out promotional emails and campaigns. Apparently, Magento having built in newsletter functionality and it’s easy to use. It allows site administrators to create and send email campaigns from admin panel. Before going to Magento newsletter page, we just need to set Magento email…Continue Reading
Redirecting to External URLs in Magento controllers
If you need to redirect to external URLs in Magento you have to use There are similar method uses in Magento to redirect to another Magento internal path. $path would be an internal module/controller/action/param1/param1value page
MAGENTO SEO – HOW TO DISABLE THE CATEGORIES PATH IN URL?
To do this, go to System => Configuration => Catalog => Catalog => Search Engine Optimization and set “Use categories path for product URL’s” to “no”.
Direct SQL queries in Magento
This tutorial mainly demonstrates direct SQL queries in Magento. Magento data models are giving great flexibility for the data processing. We don’t need to touch the complex SQL statements because of this feature. This often gives really quick development speed and accuracy more over a bulletproof approach. But several situations it much needed to execute…Continue Reading
How to use custom cache data in Magento
Using caching in Magento website is an essential part of development. Magento is well known for eating up the server resources. The below code snippet helps when someone deals with heavy data in Magento website.
Creating Magento simple products programmatically
Products are the basic thing in the e-commerce shop and Magento has good features to create it from the backend. But certain situations we have to create it via programmatically. For example a bulk upload from a API, or another store etc. How to create Magento simple products programmatically We can use API for this,…Continue Reading
Search by only product name in Mini Search In Magento
Magento has a good search functionality. By default when someone searches it search through all the description and short descriptions. So sometimes at first look this results appears to be strange. We need Search by only product name in Mini Search In Magento But the reason Magento pick this up because these keywords might be present…Continue Reading
Get a parent category and all sub-sub–sub categories in Magento
Getting all sub(recursively) categories in Magento, not an easy task. I’ve seen so many of them looping through the category model and creating overhead to the server. It’s mainly because the each model creates and SQL query. Good performance Single Query Solution: Let $parentCategory be your Main Category, then this collection will load all subcategories,…Continue Reading
How to get data from Magento System Configuration
Magento stores all the configuration values in the database, but it has a particular format to retrieve the data. Getting data from system configuration table is easy. sectionName, groupName and fieldName are present in etc/system.xml file of your module. It will automatically fetch config value of currently viewed store as you have the option to enable…Continue Reading
Get order currency code from order
When we need to get currency code from order object use the below code 1) currency code from order object 2) With currency symbol
How to clear the Magento cache?
When making certain changes to Magento, it is necessary to clear the cache in order to reflect the changes to reflect. There are three ways to clear the cache in Magento: Through the Magento Admin Panel website.Log in to your Admin Panel account Go to the System -> Cache Management section Click on the Flush…Continue Reading
Magento: Convert Price from Current Currency to Base Currency
It’s quick way to convert currency from one currency to another in Magento and vice-versa. It is useful when you are using multiple currencies in a shop. From below code, you can convert from currency to another chosen currency. Changing currency from one to another
how to get category name of current product in magento
Getting the category name for the current product in Magento it’s easy to find out with below codes.