Author: naveenos
-
WordPress: How to get role name of a user by id
This code will print the role name of the user whose id is store in $user_id variable. Tweet This Post
-
Magento: How to get value of custom created category attribute at front side?
According to magento characteristics, we can get the custom created product attributes at front side in easy way by $_product->getCustomCreateAttribute() But when we create an attribute for an category then magento does not show by $_main_category->getCustomCreateAttribute() Magento only show the attribute value at front side which created by system or Magento. So for this we…
-
Magento : add two column value in collection
many times we need to do operation on two column values and show in the admin panel. for this we have to follow these steps: 1. Add column in your Grid.php file: 2. Now create a folder in the AdminHtml folder with name ‘Renderer’ 3. Create a new php file with name ‘Qty.php’ 4. Write…
-
WordPress: How to use Ajax at front side without using admin-ajax.php
Mostly all wordpress developers write the code to create widgets in admin side. and he use following code: var ajaxurl =”; var data = { action: ‘action_function_name’ }; // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php jQuery.post(ajaxurl, data, function(response) { alert(response); }); But when he wants to use…
-
WordPress: Retrieve all roles list
Many times we need to show all roles in a dropdown for our widget and we try to find in database but we are unable to get correct value.. so here I am providing a good solution to get all list of roles: Tweet This Post
-
Magento: How to retrieve products with a specific attribute?
Mostly all Models in the Magento have a corresponding Collection object that can be used to fetch multiple instances of a Model. To instantiate a Product collection, do the following $collection = Mage::getModel(‘catalog/product’)->getCollection(); Products are a Magento EAV style Model, so you’ll need to add on any additional attributes that you want to return. $collection…
-
Add and Remove HTML elements dynamically with Javascript
Today I have work in magento and work was save multiple dates in an attribute witout entering multiple values in one field. and need to provide multiple text box ( with date icon to select date )where user can select date and submit the form. On the submit time I have to fill all text…
-
Drag and Drop div area with pure javascript – Step 3
My last two posts told to create javascript and html file. This post will tell you last step to drag and drop div are with pure javascript ( without jQuery ). Add below css code to head tags in the index.html file: and create a folder with name images and put your images in this…
-
Drag and Drop div area with pure javascript – Step 2
After reading my previous post Drag and Drop div area with pure javascript – Step 1, you have created javascript file draganddrop.js. Means you can add this javascript file to html page. so create a file index.html file and put below content in the head tag : And put below code inside the body tag:…
-
Drag and Drop div area with pure javascript – Step 1
Today I have to work on drag and drop functionality and I found that on mostly sites it provides using Jquery but I have to develop with pure javascript. so I found best code for it. and this was the solution : First create a file draganddrop.js and put below code in this file: var…
-
show the div area in middle on screen using jquery
If you want to show any div area in the middle on click any link or button then follow these steps: 1. First download and add JQuery js in your file. 2. now create a function If you want to show any div area in the middle on click any link or button then follow…
-
get the table name with prefix in magento
This is most useful when you don’t know that what will be table prefix on server side. This situation may be generate when you are developing project at local system and you know table prefix and you have no access on server side so you are not able to know what table prefix used during…
-
Print magento Sql at run time
Any developer wants to check what sql is executing during page load. so he can check and identify the getting errors: To print the sql go to folder : app\code\core\Mage\Catalog\Model\ and open file Layer.php search the function : and replace : to and save and run front page again… you will see all Sqls are…
-
Remove side space in string
Javascript Trim Functions Use the code below to make trim a method of all Strings. These are useful to place in a global Javascript file included by all your pages. String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g,””); } String.prototype.ltrim = function() { return this.replace(/^\s+/,””); } String.prototype.rtrim = function() { return this.replace(/\s+$/,””); } // example of using…
-
Retrieving all URL paths in Magento
Magento comes with built in function for retrieving URL paths. Function is called getBaseUrl() and its located under Mage class. However, function is not documented as it should be. Documentation only states that function retrieves $type parametar which is by default equal to “base”. Here is the list of all the available parameters I found.…