Sometimes if we have to write some joins sql query in magento we cand write those joins as :
public function joins()
{
$table = $this->getMainTable();
$table2 = $this->getTable('customer/entity');
...
In magento if we are required to work on SQL and Database with the query to find the max and count of the fields in database then we can perform it as :
public function countUs(){
$table = $this->getMainTable();
$wh...
Hi Friends,
In this blog we'll take a look at the use of partial views in asp.net MVC. So what may be the scenarios of using a partial view in code and why is this "partial"?. Let's dive in.
What will you do if you n...
JCanvas: As we know that canvas is used to draw graphics with the help of javascript. In this there are certain properties to draw a line, circle, box, etc but canvas does not support event handlers.
JCanvas is a javascript library which is...
There are many factors based on the quality for the web applications. Few of them are mentioned below --
1- Reliability
2- Security
3- Usability
4- Maintainability
Reliability:- Meaning of reliability is that...
Can we execute a program without using main?
Answer is yes, we can run a program without using main with the help of static block. Lets see about static block first.
Static Block:
It is block which can be used to give initial values to t...
Hello Friend,
If you are looking to add products in Magento, there are six different "Product Type" under this. Please find out the difference as below::
1) Simple Product :: If you are looking to add a simple product without any ...
If we need to display the preview of the image on upload, we can write a simple javascript function to perform the same this can be done as :
<!DOCTYPE html>
<html>
<body>
<script>
function img(x) {
doc...
Padding and the margin.
There is always been a confusion between the two for the new learner.
But when you know the difference between them they can help a lot in designing.
Both of them provide the same white space between the element t...
1. Make Sure What Error message is used. Like are they directly from brain tree or manged by the developer .
2. What format of amount with currency is accepted.
3. Collection of appropriate test data used.
4. Integrated Payment Gateway u...
The following directives are used to bind application data to attributes of HTML DOM elements:
1.ng-disabled Directive:-
This directive is used to disable any attribute (button,checkbox,etc).
Add ng-disabled...
If you want to create dynamic editable rows in a table using html and javascript, below example will helps you.
In the below code first I have created a button and then created table in which I have added 2 columns, as the output is ...
Media query is css technique that is being introduce in css3.
It is used to set the css and display the page properly when seen on the different screen size.
It uses $media rule to include a block of the css only if a certain condidtion is ...
Suppose you have a list containing objects. You can export it to the excel file.
You will require the following jars for this:
xmlbeans-2.3.0.jar
poi-3.9-20121203.jar
poi-ooxml-3.9-20121203.jar
poi-ooxml-schemas-3.9-20121203....
Making the google maps is not so difficult. Just to follow some code and google apis.We can make any location google map by using the code below. We have taken the example of dehradun location in India for making this google map.
<html>...
$,ajax() allows to make an ajax call.
This method provide more control than any other method.
In the ex below all the parameters and comment related to each parameter describe the purpose of each one.
var ajaxUrl = "Json.htm";
...
getJson is the method that is used to call the json data by ajax call.
We can only pass the parameter using the get method.
ex of json call function and the data displayed.
var jsonUrl = "Json.htm";
$("#btnJson").click(function () {
...
In Magento sometimes we are required to write advanced operations in model and collection, to execute complex sql queries.
The model and collection architecture in magento is like, a magento model class it extends Mage_Core_Model_Abs...
ROW_NUMBER()
This function is used to assign a unique id to each row returned by the sql query fired.
RANK()
This function is similar to ROW_NUMBER() with the only difference it leaves a gap between the groups i.e this fun...
Hello Readers, In this blog tutorial i will explain how to add custom comment field box to each product in view shopping cart page.
Follow the below steps to create magento comment field in cart & save field data into DB
1. Add new head...
Variable Arguments (Varargs) in Java
Variable Arguments (Varargs) was introduced in JDK 5.
Varargs as the name suggest allows a function to be called with different number of arguments as per the requirement.
The syntax of Varargs:
...
Program:
You can print your message in C with using a semicolon. Let see how?
e.g. Let us print the message Welcome in C.
There is three ways:
1. Using switch:
#include<stdio.h>
void main(){
switch(p...
Waypoints API helps to find directions in Google. So how to pass multiple latitudes and longitudes in Waypoints API. This is the way pass a single lat long we would pass it as below
waypoints:
[{
location:new google.maps.LatLng(42...
How to customize Map Marker:
This blog will help you understand how to customize the markers in google map. Specify the icon option on MarkerOptions to change the marker’s icon. The icon option can be either a string (the URL to the mark...
How to integrate Google Street View in Javascript?
This blog will help you to know how to integrate google street view using javascript. Firstly create index.html and paste the following lines of code:
<!DOCTYPE html>
<html>
...
Hi guys, I want to tell you the use of NOLOCK with simple example but before this lets discuss some terms
Lock:-
When multiple users or applications access the non-shareable resource at the same time, Locking allows to access the ...
Myths/Facts of Security Testing
Let's talk on an intriguing points on Myths and facts of security testing:
Myth #1 We needn't need a security approach as we have a little business
Fact : Everyone and each organi...
Deleting documents:
Suppose, you have collection with the name of demo and you have indexed your file in the server in this collection but you want to delete all the documents or some of them, then it is possible by two ways:
Deletion by So...
Hi Friends
Whenever we register a user in our registration form we need to check for existence of current email/user name or any unique identification property. You certainly don't want two users to be registered with same email ...
In Magento store some times we are required to display best selling products on store’s home page or some other places. To do so we will perform the same as :
first of all we have to create a file in the path app/cod...
In Magento store some times we are required to display most Viewed Products on store’s home page or some other places. To do so we will perform the same as :
first of all we have to create a file in the path app/code...
Integration of security processes with the SDLC:
It is constantly agreed, that cost will be more, if we put off security testing after software implementation stage or after deployment. In this way, it is important to inclu...
From Xcode6 and later .pch file is not created automatically. One has to create it manually.
Following are the steps to add/create a pch file in your xcode project:
Create a new file using: cmd+N
• &nbs...
Prepared Statement is the feature which allows us to write a set of sql statement in which some fields values are unspecified. The unspecified field are labeled with the question mark as "?".
for example :
INSERT INTO...
If you want show all transaction state for the payment.Then you have to follow the following code in your .js file.
odoo.define('pos_mercury.pos_mercury', function (require) {
"use strict";
var Class = require('web.Class'...
What is Security?
Security is set of measures to ensure an application against unexpected activities/actions that make it to stop functioning or being misused/exploited. Unexpected activities can be either intentional o...
We can make a button behave like a toggling button by making a directive in AngularJS. It is very simple. You just need to bind the attribute and then check the condition.
First create a simple HTML :-
<html>
<head>
...
Truncate and drop both are similar to each other as they are used to delete the complete data of a table.
The difference between them is this truncate only delete the data of the table where as the table structure is there but when we drop the...
It is used for conjunction with the select statement to eliminate the all the duplicate record and fetch only the unique record.
There are many situation that we found duplicate data on the database and better to get unique ones.
SELECT D...
We use $location service or $window to redirect to a new URL. $location exposes the URL to the browsers address bar and makes it available to the application. It reflects the changes either side ,i.e. synchronizes the changes and maintains it bet...
If you want get multiple statement_lines.Then you have to follow the following code in your .py file.
import logging
import sets
from openerp import models, fields, api
_logger = logging.getLogger(__name__)
class barc...
If you want to move an override of the ir.actions.report_xml.create() method. Then you have to follow the following code in your .py file.
# -*- coding: utf-8 -*-
import time
import math
from openerp.osv import expression
from opener...
There are 6 types of user role defined in Wordpress by default. These user type/roles make insure that the user can only use only few WordPress website features only. It minimize the chances of any accidents happening that could potentially...
If you want transfer stock in Product module you have to follow the following code in your .py file.
class stock_immediate_transfer(models.TransientModel):
_inherit = 'stock.immediate.transfer'
@api.multi
def process(self):
s...
We always face debug issue in javascript and the time when we want to know which function actually create problem we set debug in all the function in sequence of calling. Since Javascript is not a very structured language it can sometimes be hard...
The LIMIT clause in MySQL helps to get multi pages results or pagination through SQL Databases. This LIMIT clause is very useful on large tables its because returning the large numbers of records through MYSQL will be difficult to read and analyz...
It is used with the like operator to compare the values of the type similar.
It support two wildcards type
1. The percent sign (%)- It match to one or more character.
2. The underscore (_)- It match to one character.
The per...
Alias is basically renaming a table temporarily for a sql statement.
The rename is done only for a particular statement is temporory.
ex
The syntax of table alias is as follows
SELECT column1, column2....
FROM table_name AS alias_n...
A subquery is a query within a query embedded within where clause
It is used to return the data that will be used in the main query as a condition to the data that is retrieved.
SELECT, INSERT, UPDATE, and DELETE statements along with the o...
SQL data type is an attribute that tell us the type of the object.
SQL server has 6 type of datatype
Exact numeric data type
1. bigint- Range start from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
2. int- Range start from ...