Scriptbaker Blog
Bringing you the latest technology trends, engineering guides, industry thinking, and practical tutorials from the Scriptbaker team.
JQuery Multi fileupload
File Upload widget with multiple file selection, drag&drop support, progress bars and preview images for jQuery. Supports cross-domain, chunked and resumabl
Magento 1: Export manufacturers CSV by specific store view
This post will guide you on how you can export the manufacturer list (Magento 1.9) to CSV file. In this script, I am filtering the list by store view. Let’
Magento 1: Export catalog categories for a specific store view
In this post you will learn how you can export Magento 1.9 categories for a specific store view as CSV. For example, you have Arabic store view with ID 7, and y
Search Magento products by product labels
Project Overview: Task was to develop a Product Labels Magento extension. Where admin can create product labels by uploading an image, enter label title and att
How to separate front and admin panel in yii-framework
In my previous post I demonstrated you how to render different layout for different user role, now lets move a step forward and see how to create separate front
How to save multiple related models in Yii [Complete Solution]
Scenario: You are in a situation where you have two related tables a Parent and a child table. You need to create a user experience in which user presses Save b
How to make Yii checkBoxList selected
Many people find it hard to make the Yii checkBoxList selected on update view, but believe me in fact its very easy and straight forward. This post will help yo
How to Conditionally remove Magento header/footer?
<p>Are you looking for a solution to conditionally remove Magento header footer but don’t know where to start? Right in this post I will show you how to create custom layout handles and utilize them to conditionally remove header/footer blocks.</p>
Adding Custom Fields to WordPress User Profile and Add New User page
Adding custom profile fields in WordPress made easy through action hooks. .Most of the solutions available on internet tell you about adding custom fields on &#
Script Logic Plugin
Introduction Script Logic is a WordPress plugin that lets you control on which pages scripts and style sheets load using WP’s conditional tags. This plug
Multi Image Upload
Multi Image Upload adds a meta box to upload multiple images for posts and pages. You can enable it for custom post types also. Download: http://wordpress.org/p
JQuery tooltip
Here is a nice jQuery tool tip. How to use: 1- Download the file 1.1- Rename the file tipsy-zip.doc to tipsy.zip 1.2- Extract the zip folder or download it from
Get list of records from SugarCRM module using REST API
Its very common problem for many people to fetch data from SugarCRM application and feed it to some other application. Using REST API we can easily fetch list o
My 3 days trip to Swat, Malam Jabba and Kalam (20th Mar to 23rd Mar)
Pakistan is a land of natural beauty and has been blessed with the abundance of awe-inspiring outdoor areas. From the unspoiled golden beaches,across the desola
Lamudi.pk is The Fastest growing real estate startup in Pakistan
There are several online real estate portals running in Pakistan, a couple of them have captured the market and leading the industry. In such a scenario it’s ha
Install WordPress plugins, themes & upgrades without providing FTP access?
You must have experienced that WordPress asks for FTP credentials if you initiate upgrade or install plugins. And sometimes developers don’t have FTP access and
Get selected value of radioButtonList using jQuery in Yii
Sometimes you want to get selected value of radioButtonList using jQuery in your Yii powered application and it feels difficult due to Yii’s field naming
Creating Magento order programmatically and charging saved credit card.
Creating order is the basic functionality of Magento but its the trickiest one at the same time for developers. Yes, its true because its not straight forward l
Magento 2.0 : Fatal error: Uncaught exception 'Magento\Framework\Exception\LocalizedException' with message 'Can't create directory
You may encounter below fatal error While installing Magento 2.0 Fatal error: Uncaught exception ‘Magento\Framework\Exception\LocalizedException’ wi
How to install Laravel on Ubuntu
How to install Laravel on Ubuntu | Scriptbaker
How to parse Salesforce tables and put data in SugarCRM?
In previous post you learnt how to create REST API to fetch data from SugarCRM application, in this tutorial you will learn to migrate data from Salesforce to S
Magento: Render static block in a phtml file
Suppose you have created a static block from Magento administration panel (CMS -> Static Blocks) and you want to render its content in some phtml file. [source
How to render custom phtml in Magento admin tabs block?
It’s possible to add custom tabs on any page of Magento administration panel. Normally tabs are generated by Form Blocks, this is fine if you want to crea
How to make certain field readonly or disabled based on some other field’s value using SugarCRM Dependencies
Let’s suppose you want to make Mobile field readonly based on Title field’s value in Contacts Module. SugarCRM Dependencies: You can achieve above with SugarCRM
How to create custom form in WordPress and handle submission?
There are cool plugins available that create forms without any programming effort but still many times we need to create custom forms in our WordPress website.
How to change logo of SugarCRM application
After completing installation of SugarCRM community edition, one of the first things you may want to change is the application logo. SugarCRM provides the optio
Get custom attribute value in Magento
So you have created some custom attributes for your Magento products and now you want to fetch their values. Magento provides a function getAttributeText that t
Common mistakes in WordPress Theme Development
This post will let you know about common mistakes in WordPress theme development and also tell you how to avoid them. Template Tags: WordPress template tags are
Add custom Javascript in Magento admin form
In previous post we learnt how to render custom html in tabs block. Now lets add custom JavaScript in Magento admin form. Magento is flexible enough to insert y
Ajax based Yii login form
Ajax helps us creating fancy forms, Ajax based forms boost user experience. Yii framework provides ajax validation but at the end form is submitted without ajax
Yii 1.1: Behaviors & Events
Behaviors & Events provide endless possibilities and unbelievable flexibility, but as current Yii documentation does not give more than a few examples, it m
Switch Yii layout based on user role
You can assign different layouts to different users using following filter class 1. Add LayoutFilter.php to your protected/components/ folder [code language=
Add remove Wordpress dashboard widgets
WordPress comes with a bunch of widgets loaded on its dashboard. The default WordPress dashboard may seems cluttered to some users because many widgets may be i
mouseover with delay (using hoverIntent plugin)
hoverIntent is a plug-in that attempts to determine the user’s intent… like a crystal ball, only with mouse movement! It works like (and was derived
Trigger Google conversion on some event
Normally Google conversion code is added in header or footer of the “Thank you for your purchase” pages. A conversion is logged when someone lands o
Random string generator
Random string are often used in web application to assign records a unique random key. Here is very useful random string generator function that allows you gene
Add Home link in Magento top navigation menu
By default there is no Home link in Magento top navigation menu but you can easily add it yourself. 1- Copy following 2 files design/frontend/base/template/pag
nl2br equivalent JavaScript function
PHP provides a useful function nl2br that inserts HTML line breaks before all newlines \n in a string. Many times we want to utilize this functionality in JavaS
Table 'DATEBASE_NAME.AuthAssignment' doesn't exist
<p>If you have used Rights module for RBAC in your Yii application and you deploy it on Linux based server, you may encounter this error.</p>
WordPress search filters based on custom fields
WordPress custom fields are good for adding meta data to posts. These custom fields are not just for displaying data but can be used to sort and filter posts. Y
Keeping your Yii Models Lean - Use Behaviors
Active Record models are fantastic for consolidating “black box” logic and keeping your models self-aware of their business logic, but what do you d
Configure Authorize.net in Magento
Magento has various built-in payment methods, one of them is Authorize.net. To enable and configure Authorize.net as your payment processor, you should have API
Yii password, repeat password fields
Yii framework has awesome input validation mechanism, one of the many validation rules is “compare” rule. You can utilize it for creating confirmati
Yii Rights: Get all assigned roles of a user
[sourcecode language=”php”] $command = Yii::app()->db->createCommand("SELECT * FROM `authassignment` WHERE userid={$user_id}"); $res
Magento: Add radio/checkbox custom column in Admin Grid
Magento grids are very useful for displaying/filtering and sorting data. Their flexibility is endless, you can customize them in any way. One may want to add a
MySQL calculate hours since row created
[code lang=”sql”] SELECT DATEDIFF(now() , created_at)*24 AS hours_passed FROM table_name; [/code]
How to reindex tables with MySQL
[code lang=”sql”] ALTER TABLE wp_posts CHANGE ID ID int(11) UNSIGNED NOT NULL; — Removes auto-inrement from ID DROP INDEX `PRIMARY` ON wp_pos
Magento Admin: 404 Error Page not found.
Let’s suppose you are logged in to Magento admin panel and you are installing a new extension that adds some new sections to Magento Configurations. You a
Get Magento root category id
[code language=”php”] public function getRootCategoryId() { $categories = Mage::getModel(‘catalog/category’)->getCollection()
Set Magento website template, skin and layout programmatically
[code language=”php”] $groups[‘theme’][‘fields’][‘template’][‘value’] = ‘template_name’;
Set Magento store's base_link_url programmatically
[code language=”php”] $installer->setConfigData(‘web/unsecure/base_link_url’,'{{unsecure_base_url}}mystore/’,’stores̵
Magento get store by storecode
[code language=”php”] function _getStoreByCode($storeCode) { $stores = array_keys(Mage::app()->getStores()); foreach ($stores as $id)
Post to your Facebook wall using Javascript SDK
Step1: [code language=”html”] <div id="fb_div"> <h3>Post to your Facebook wall:</h3> <br /> <textarea i
Get Magento Website meta data and configurations data
Following functions will help you to get Magento meta data like “Default Title”, “Default Description” To get Default Title: [code langu
How to change Magento Base URL
1- Logon to Admin panel 2- Navigate to [code language=”html”] System >> Configuration >> Web >> Unsecure >> Base URL [/code]
Disabled Yii logs and stack trace messages
Open up the index.php from root folder and comment out following 2 lines [code language=”php”] defined(‘YII_DEBUG’) or define(‘YII
Allow admin to change user role
1. Add following code to _form.php [code language=”php”] Yii::app()->getModule(‘rights’); if (Yii::app()->user->isSuperuser) {
keyup function with delay
This code will execute a function after the user has stopped typing for a time of 1000ms. Hence the function will not be called on each keyup event. Grea
Change WordPress login screen logo
[code language=”php”] function my_custom_login_logo() { echo ‘h1 a { background-image:url(‘ . get_bloginfo(‘template_directory
Add custom menu item for WP subscribers panel
[code language=”php”] if (is_admin()) { add_action(‘admin_menu’, ‘my_menu’); } function my_menu() { add_menu_page(&#
Remove index.php from URL in YII
1- Open root/protected/config/main.php and uncomment the UrlManager 2- Create .htaccess file and place it on the root of your site. Contents of .htaccess s
jQuery UI Multiselect by Michael
First off, you can visit the demo to see the widget in action. The script depends on jQuery 1.3 and jQuery UI 1.7 and is style-able using Themeroller. It works
jQuery Alert Dialogs by Bill Beckelman
Screenshots Live Demo | Download
Style file upload field
You can turn file upload field to a very sexy looking file upload by using this handy script Demo: Needed JQuery files : 1. jquery.min.js 2. jquery.filestyle.
Integrate Filemanager to FCKeditor in YII
Before starting the tutorial you may also like to view the fully functional demo, or you may download the example and start working on it. Please note that this
Disable Browser's Back button
function disableBackButton() { window . history . forward(); } setTimeout(
debug WP Queries and boost performance
Hi, I found a very useful plugin for WP Query debugging. I proudly share this resource with you, because I believe it will be very useful to people who want to