Sanjoy Roy

[MCM, MCP, SCJP] – Senior PHP Programmer

how to upgrade cms ms


define('CUSTOMER_FOLDER', '/var/www/vhosts/');
define('WEB_FOLDER', 'httpdocs/websitedesign');
if (PHP_SAPI != "cli") exit;
if ($argc != 2){
    echo 'this command needs 1 argument'."\n";
    exit;
}
if (!file_exists(CUSTOMER_FOLDER.$argv[1].'/'.WEB_FOLDER.'/version.php')){
    echo CUSTOMER_FOLDER.$argv[1].'/'.WEB_FOLDER.'/version.php'."\n";
    echo 'Check the folder name'."\n";
    exit;
}
$sitename = $argv[1];
$path = CUSTOMER_FOLDER.$sitename.'/';
$owner = 'thehost5';
$group = 'psacln';
chdir('/var/www/vhosts/'.$sitename.'/');
if (!file_exists($path.'backup')){
    mkdir($path.'backup');
} else {
    echo 'backup folder exists'."\n";
}
exec('tar cvzf backup/'.WEB_FOLDER.'.tar.gz '.WEB_FOLDER);
include($path.WEB_FOLDER.'/config.php');
exec('mysqldump -u '.$config['db_username'].' -p'.$config['db_password'].' '.$config['db_name'].' > backup/db.sql');
exec('tar cvzf backup/db.tar.gz backup/db.sql');
unlink($path.'backup/db.sql');
chdir(WEB_FOLDER);
exec('tar xvzf /root/CMS.1-9-4-2.tar.gz');
exec('chown -R '.$owner['name'].'.'.$group['name'].' *');
exec('chown -R '.$owner['name'].'.'.$group['name'].' ../backup');
exec('chmod -R 777 tmp config.php');
exec('chmod -R 777 uploads/ modules/');
Advertisements

how to display products group price B2B CreLoaded Store


$products_group_price = getSpecialPrices($product_info['products_id']);
function getSpecialPrices($products_id){
	$m_value = '';
	$sql = "SELECT `customers_group_price` FROM `products_groups` WHERE `products_id` ='".$products_id."'";
	$m_query = tep_db_query($sql);
	while ($m_rows = tep_db_fetch_array($m_query)) {
		$m_value = $m_rows['customers_group_price'];
	}
	return $m_value;
}

show all categories expanded


$aa = 0;
    $info_box_contents = array();
   // $info_box_contents[] = array('text'  => '' . BOX_HEADING_CATEGORIES4 . '');
  //  new infoBoxHeading($info_box_contents);
  //  $categories_string4 = '';
    if(!$_SESSION['sppc_customer_group_id']) {
      $customer_group_id = 'G';
    } else {
     $customer_group_id = $sppc_customer_group_id;
    }
    $categories_query = tep_db_query("SELECT c.categories_id, cd.categories_name, c.parent_id 
                                        from " . TABLE_CATEGORIES . " c,
                                             " . TABLE_CATEGORIES_DESCRIPTION . " cd 
                                      WHERE c.parent_id = '0' 
                                        and c.categories_id = cd.categories_id 
                                        and cd.language_id='" . $languages_id ."' 
                                      ORDER BY sort_order, cd.categories_name");					  
 
    while ($categories = tep_db_fetch_array($categories_query))  {
		$foo[$categories['categories_id']] = array('name' => $categories['categories_name'],
                                                 'parent' => $categories['parent_id'],
                                                 'level' => 0,
                                                 'path' => $categories['categories_id'],
                                                 'next_id' => false
                                                );
					 if (isset($prev_id)) {
        $foo[$prev_id]['next_id'] = $categories['categories_id'];
      }
      $prev_id = $categories['categories_id'];
      if (!isset($first_element)) {
        $first_element = $categories['categories_id'];      }
	  
	  $categories_query2 = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . $categories['categories_id'] . "' and c.categories_id = cd.categories_id and cd.language_id='" . $languages_id ."' order by sort_order, cd.categories_name");	 
        $category_check = tep_db_num_rows($categories_query2);
        if ($category_check > 0) {
          $new_path = $categories['categories_id'];
          while ($row = tep_db_fetch_array($categories_query2)) {
            $foo[$row['categories_id']] = array('name' => $row['categories_name'],
                                                'parent' => $row['parent_id'],
                                                'level' => $key+1,
                                                'path' => $new_path . '_' . $row['categories_id'],
                                                'next_id' => false
                                               );
            if (isset($prev_id)) {
              $foo[$prev_id]['next_id'] = $row['categories_id'];
            }
            $prev_id = $row['categories_id'];
		  }
		}   
	  
    }  	
	
    tep_show_category4($first_element);

oscommerce – 30 minutes cleanup from cart baskets


include_once("includes/configure.php");
$conn = mysql_connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD);
mysql_select_db(DB_DATABASE);
$sql = "SELECT `customers_basket_id`,`customers_id`,`products_id`,`customers_basket_quantity`,`final_price`,`customers_basket_date_added`,`auction_product`,`customers_basket_datetime` FROM   `customers_basket` ORDER BY `customers_basket_id` ASC";
$result = mysql_query($sql);

while ($row = mysql_fetch_assoc($result)) {
	$products_id = $row["products_id"];
	$customers_id = $row["customers_id"];
	$customers_basket_quantity = $row["customers_basket_quantity"];	
	$total_minutes = 0;
	$customers_basket_datetime = $row["customers_basket_datetime"];
	$total_minutes = date_diff($customers_basket_datetime);
	if ($total_minutes >= 30){			
		$sql = "update products set products_quantity = products_quantity + ".$customers_basket_quantity." where products_id = '" .$products_id. "'";
		mysql_query($sql);
		//echo $sql."
"; $sql = "delete from customers_basket where customers_id = '" .$customers_id. "' AND products_id = '" .$products_id. "'"; mysql_query($sql); //echo $sql."
"; $products_parent_id = 0; $products_parent_id = tep_hasParentID($products_id); //echo 'products_parent_id: '.$products_parent_id."
"; if ($products_parent_id>0) { $sql = "update `products` set `products_quantity` = 0, `products_status` = 1 where `products_id` = '".$products_parent_id."'"; mysql_query($sql); //echo $sql."
"; } //echo "
"; } //echo "
"; } mysql_free_result($result); function tep_hasParentID($products_id) { global $conn; $prod_query = mysql_query("SELECT `products_parent_id` FROM `products` WHERE `products_id`='".$products_id."'"); $prods = mysql_fetch_array($prod_query); return $prods['products_parent_id']; } function date_diff($start, $end="NOW"){ $sdate = strtotime($start); $edate = strtotime($end); $time = $edate - $sdate; $phour = ($edate - $sdate) / 3600; $prehour = explode('.',$phour); $premin = $phour-$prehour[0]; $min = explode('.',$premin*60); $presec = '0.'.$min[1]; $sec = $presec*60; $total_mins = 0; if($prehour[0]>0) $total_mins = ($prehour[0] * 60) + $min[0]; else $total_mins = $min[0]; return $total_mins; }

creloaded 6.2 – osCommerce – shopping cart check/uncheck all – remove items from cart


HTML:
<input type="button" value="CHECK ALL" onclick="checkUncheck(true);" />&nbsp;<input type="button" value="UNCHECK ALL" onclick="checkUncheck(false);" />
JS:

function checkUncheck(flag) {
				  for (var i=0;i<document.forms[0].elements.length;i++) {
					var e = document.forms[0].elements[i];
					if ( (e.name != 'cart_delete') && (e.type=='checkbox') && (!e.disabled) ) {
					  if(flag) document.forms[0].elements[i].checked = true; else document.forms[0].elements[i].checked = false;
					}
				  }
				}

Creloaded 6.2 – osCommerce – Cross sell products


$categories = array();
$sql = "SELECT `categories_id` FROM `products_to_categories` WHERE `products_id` = '".$HTTP_GET_VARS['products_id']."'";
$result = tep_db_query($sql);
while ($row = mysql_fetch_assoc($result)) {
    $categories[] = $row["categories_id"];
}

$categories_str = '';
if (sizeof($categories)){
	$categories_str = implode("','", $categories);
}

$products = array();
$sql = "SELECT `products_id` FROM `products_to_categories` WHERE `categories_id` IN ('".$categories_str."')";
$result = tep_db_query($sql);
while ($row = mysql_fetch_assoc($result)) {
    $products[] = $row["products_id"];
}
$products_str = '';
if (sizeof($products)){
	$products_str = implode("','", $products);
}

//echo "'".$products_str."'
"; /*SELECT * FROM `products` w ORDER BY RAND() LIMIT 0 , 6;*/ $sql = "select distinct p.products_id, p.products_image, p.products_price, p.manufacturers_id, pd.products_name, p.products_tax_class_id, p.products_date_added, p.products_image , xp.xsell_id products_price from (" . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id), " . TABLE_PRODUCTS_XSELL . " xp, " . TABLE_PRODUCTS_DESCRIPTION . " pd where xp.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and p.products_id = xp.xsell_id and pd.products_id = xp.xsell_id and pd.language_id = '" . $languages_id . "' and p.products_status = '1' order by rand(), xp.products_id asc limit " . 6; //echo $sql.'
'; $sql = "SELECT * FROM `products` where products_id IN ('".$products_str."') AND `products_price` 0 ORDER BY RAND() LIMIT 0 , 6";

Magento Easy Lightbox

Magento – How to create multiple store?

Magento – Creating a Configurable Product

Magento – How to get a product attribute value?


I have created an extra attribute ‘enquiry_only’ in the back-end, this is how I can retrieve the attribute value in the product info template page:
\public_html\app\design\frontend\base\default\template\catalog\product\

$enquiry_only = Mage::getModel('catalog/product')
                            ->load($_product->getId())
                            ->getAttributeText('enquiry_only');

Alternatively we can use like:

$prod = Mage::getModel('catalog/product')->load($_product->getEntityId());
					$prod = $prod->getData(); 								
					$enquiry_only = 'No';		
					$attribute = Mage::getModel('eav/config')->getAttribute('catalog_product', 'enquiry_only');
					foreach ( $attribute->getSource()->getAllOptions(true, true) as $option){
						if ($option['value'] == $prod['enquiry_only'])
							$enquiry_only = $option['label'];
					}	

osCommerce – Vouchers or coupons when assigned to specific products


Filename: includes/modules/order_total/ot_coupon.php

$c_restrict_to_products 		= $coupon_result['restrict_to_products'];
$logs .= 'c_restrict_to_products: '.$c_restrict_to_products;	   
$c_restrict_to_categories 	= $coupon_result['restrict_to_categories'];
$logs .= 'c_restrict_to_categories: '.$c_restrict_to_categories;

$valid_coupon_product_id_exists = 'false';
if($c_restrict_to_products !=''){		    	  
  $db_product_ids = split("[,]", $c_restrict_to_products);		   
  for ($i=0; $i products); $i++) { 
	$logs .= 'products_id: '.$order->products[$i]['id'];
	if (in_array($order->products[$i]['id'], $db_product_ids)) {
		 $valid_coupon_product_id_exists = 'true';
	}
  }		  			  
}else if($c_restrict_to_categories !=''){
  $db_category_ids = split("[,]", $c_restrict_to_categories);
  for ($i=0; $i products); $i++) { 			
	$category_id = $this->getProductsCategoryID($order->products[$i]['id']);
	$logs .= 'products_id: '.$order->products[$i]['id'];
	$logs .= 'category_id: '.$category_id;
	if (in_array($category_id, $db_category_ids)) {
		 $valid_coupon_product_id_exists = 'true';
	}
  }  		 	  
}
$logs .= 'valid_coupon_product_id_exists: '.$valid_coupon_product_id_exists;
if ($valid_coupon_product_id_exists == 'false') {		    
  tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=ot_coupon&error=' . urlencode('This coupon is not valid for the product(s) you are purchasing.' ), 'SSL'));
}

function getProductsCategoryID($products_id){
$category_id 		= 0;
$p_parent_query		=	tep_db_query("select `products_parent_id` from `products` where products_id = '".$products_id."'");
$p_parent_result	=	tep_db_fetch_array($p_parent_query);
$products_parent_id = 	$p_parent_result['products_parent_id'];

if($products_parent_id == 0){
	$sql = "SELECT `categories_id` FROM `products_to_categories` where products_id = '".$products_id."'";
	$p_parent_queryX = tep_db_query($sql);
	$category_id = $p_parent_queryX['categories_id'];
}else{
	$sql = "SELECT `categories_id` FROM `products_to_categories` where products_id = '".$products_parent_id."'";
	$p_parent_queryY = tep_db_query($sql);	
	$category_id = $p_parent_queryY['categories_id'];
}
return $category_id;
}

Magento – Terms & Condition Popup for Category Page Link


jQuery Library include:
CSS:
css/ui-lightness/jquery-ui-1.8.16.custom.css

JS:
js/jquery-1.6.2.min.js
js/jquery-ui-1.8.16.custom.min.js

Javascript code:

$(document).ready(function(){		
	
	TERMS_CONDT_CNT = 0;
	
	$('.category-box a').click(function() {					
		//$( "#dialog:ui-dialog" ).dialog( "destroy" );	
		console.log(this);
		vlink = this.href;
		console.log(vlink);
		if (TERMS_CONDT_CNT == 0){		
		$( "#dialog-confirm" ).dialog({
			resizable: false,
			height:500,
			width:500,
			modal: true,
			buttons: {
				"Accept": function() {
					TERMS_CONDT_CNT++;
					debugger;
					$( this ).dialog( "close" );
					document.location = vlink;
				},
				"Decline": function() {
					$( this ).dialog( "close" );
					TERMS_CONDT_CNT = 0;
					return false;
				}
			}
		});
		}//if TERMS_CONDT_CNT
		console.log(TERMS_CONDT_CNT);
		if (TERMS_CONDT_CNT == 0) return false; else return true;
		
	});
	});

HTML Code:
<!– popup –>
<div id="dialog-confirm" title="Accept Terms and Conditions: " style="display:none;">
<p style="overflow:auto;">Lorem ipsum dolor sit amet, consectetur adipiscing elit.
</p>
</div>
<!– popup –>
<!– front-end link page –>
<div id="categories">
<div class="col_full">
<div class="listing">

<div class="category-box">
<a href="#trucks.html"><div class="category-image-box">
<img height="97" border="0" src="media/catalog/category/cat-image_1.jpg">
</div>
<div class="category-name">
<p>Trucks</p>
</div></a>
</div>

<div class="category-box">
<div class="category-image-box">
<a href="#/workmate.html"><img height="97" border="0" src="/media/catalog/category/cat-image_25.jpg"></a>
</div>
<div class="category-name">
<p><a href="#/workmate.html"> Workmate</a></p>
</div>
</div>
</div>
<!– front-end link page –>

magento Couldn’t resolve host ‘magento-community’

TNT API Documentation


TNT_v2_iConnections_Tracking

TNT_v2_iConnections_Shipping

TNT_v2_iConnections_Pricing

From Direct Link: http://tntna.com/ec/

http://www.tnt.com/express/en_gb/site/home/shipping_tools/shipping_systems/expressconnect/registration_details.html

Demo Link: https://www.tntexpress.com.au/rtt/demonstration.asp

1. System Overview
The External RTT application provides an interface for TNT customers to retrieve a list of TNT’s available operational services, their cutoff times, estimated delivery dates and prices. This service has been designed for integration into the software or websites of TNT customers. The system overview is presented in figure1, the client application will make an HTTP POST request over SSL and an XML document will be returned.
1.1. Authentication

In order to use the External RTT service users will need to authenticate successfully to the system. This will require users to have a valid account with TNT which has been registered for use with the system. During the registration process users will be assigned a username and password which will be used for authentication. In addition to the username and password authentication the account number passed in the xml request body will be validated.

1.2. Request Format 

The External RTT service will take an application/x-www-form-urlencoded HTTP POST request in the following format. Where the username and password are those provided by TNT during the registration process and the XML Request is an XML string which conforms to the schema listed in section 2 of this document. The xml string should be URL encoded. The request content type should be application/x-www-form-urlencoded NOT text/xml.

URL:
https://www.tntexpress.com.au/Rtt/inputRequest.asp
Post Data:
Username=[username]&Password=[password]&Version=2&XMLRequest=[XMLRequest]

1.3. Response Format

The response will be an XML document conforming to the schema listed in section 3 of this document. The http headers for the response will set the MIME type to “text/xml”. Any errors encountered by the system will be returned in an XML format for consumption by the client application.
Examples of the request and response format are show in section 6 of this document.
1.4. Security
In order maintain the security of your username and password you should not perform request to RTT service from client side scripts (AJAX). Doing so will expose your username and password on the internet. Requests to the service should be performed from server side code using SSL.
The client side requests to the service can also cause cross domain security exceptions in modern browsers depending on how your scripts are coded.
It is suggested that a ‘proxy’ page could be created on your web server (under the same domain) for client side scripts. This page could pass the requests to the RTT service and return the unaltered result back to the client page. This will avoid any cross domain security exceptions and will ensure the security of your username and password which would only be sent from the server side script.

My site is hacked what to do?


If you are running store using creloaded 6.2 try to find the following signatures from your PHP scripts:

base64_decode
ob_start_flush
try_pick_colors
engines110
CoreLibrariesHandler

Mostly they are injected at the top of each files <?php //// ?>
Check the .htaccess file
Remove all uploaded .php script from /images/ directory.
Apply the patch.
https://www.creloaded.com/fdm_file_detail.php?file_id=191 (You need to register and login to creloaded site before you can download)
Change the /admin/ directory name.
Put a .htaccess password to /admin/ directory

How to report to google Publishing Protection Team when site is showing Reported Attack Page! (FireFox)


Browse: http://www.google.com/safebrowsing/report_error/?tpl=mozilla
Enter the URL: http://xyz.com.au
Type the captcha code
In comment area, write:
Dear Phishing Protection Team,
We are recently getting “Reported Attack Page!” on our site: http://xyz.com.au
We have recently cleaned the site and we can browse using Internet Explorer.
Please review our site and remove the publishing error.
Thank you.
Regards,
Company Name
Click on “Submit Report” when done.

How to restart cPanel service from command line – Linux Server?


In order to restart cPanel service from command line one need to execute below mentioned command:
[root@root ~]# /etc/rc.d/init.d/cpanel restart

How to report to google Publishing Protection Team when site is listed as compromised


You have to login to gmail (webmasters tools) to do this, here is the link:
https://www.google.com/webmasters/tools/home?pli=1
Click on Add a Site button and add your site url.
Then browse
https://www.google.com/webmasters/tools/reconsideration
Then write something like:
Dear Publishing Protection Team,
Our site is listed as “compromised.” on our site: http://www.xyz.com.au. The google safebrowsing diagnostic report is “This site is not currently listed as suspicious.”.
We can browse safely without having any suspicious alert.
Please review our site and remove the publishing notification.
Thank you.
Regards,
XYZ Pty Ltd.
Then Press “Request Consideration” button to finish. It usually takes 2 weeks (+) to review and get back to normal.

To Recover Your Parallels Plesk Panel Password on a Linux Server


Using SSH, log in to your server with the User ID and Password that you created when you set up your dedicated hosting account.
At the command line, type su -.
For your password, use the same password that you use with your User ID.
Type cat /etc/psa/.psa.shadow
This file contains your admin Parallels Plesk Panel password.

Where is CPanel Bandwidth Usage

Magento – Where is the mysql configuration file?


C:\wamp\www\www.authsafe.com\public_html\app\etc\local.xml
<config>
<global>
<install>
<date><![CDATA[Wed, 07 Jul 2010 05:17:40 +0000]]></date>
</install>
<crypt>
<key><![CDATA[d9eb10937b98aed1a0b8911c0fbc52fa]]></key>
</crypt>
<disable_local_modules>false</disable_local_modules>
<resources>
<db>
<table_prefix><![CDATA[]]></table_prefix>
</db>
<default_setup>
<connection>
<host><![CDATA[localhost]]></host>
<username><![CDATA[a39085_user]]></username>
<password><![CDATA[se5y45]]></password>
<dbname><![CDATA[a39085_db]]></dbname>
<active>1</active>
</connection>
</default_setup>
</resources>
<session_save><![CDATA[files]]></session_save>
</global>
<admin>
<routers>
<adminhtml>
<args>
<frontName><![CDATA[admin]]></frontName>
</args>
</adminhtml>
</routers>
</admin>
</config>

Magento – How to Enable or Disable Developer’s “Template Path Hints” using phpmyadmin with admin access?


Template Path Hints:

SELECT *
FROM `a39085_db`.`core_config_data`
WHERE (
`config_id` LIKE ‘dev_debug_template_hints’
OR `scope` LIKE ‘dev_debug_template_hints’
OR `scope_id` LIKE ‘dev_debug_template_hints’
OR `path` LIKE ‘dev_debug_template_hints’
OR `value` LIKE ‘dev_debug_template_hints’
)
LIMIT 0 , 30
UPDATE `a39085_db`.`core_config_data` SET `value` = ‘0’ WHERE `core_config_data`.`config_id` = 467 LIMIT 1

Creloaded Payment Modules sorting


File Name: payment.php
Function Name: function selection() {}
Line: 240
Copy and paste the folowing, also do not forget to change your module names within single quotes:

So, anything else will be order just below:

$include_modules_short =  array();
$include_modules = $this->modules;
for($i=0; $imodules = $include_modules_short;$i++){                                    

	if($include_modules[$i] == 'paypal.php'){

	$include_modules_short[1] = $include_modules[$i];

	}else if($include_modules[$i] == 'transfer.php'){

	$include_modules_short[2] = $include_modules[$i];

	}else if($include_modules[$i] == 'moneyorder.php'){

	$include_modules_short[3] = $include_modules[$i];

	}else if($include_modules[$i] == 'nabapi.php'){

	$include_modules_short[0] = $include_modules[$i];

	}else{

	$include_modules_short[$i] = $include_modules[$i];

	}

} 
$this->modules = $include_modules_short;
ksort($this->modules);			

iBrowser upload problem and fixes


Filename: rfiles.php
Changes line no: 432
$cfg[‘temp’] = ‘/home/rarerobi/public_html/images’;
Comment #510
//@chmod($path . $nthumb, 0755) or die($l->m(‘er_028’));
Comment #512
//echo $l->m(‘er_028’);
Comment #436
//echo $l->m(‘er_028’);
Comment #62
//echo $l->m(‘er_001’) . ‘: ‘ . $l->m(‘er_028’);

Change iBrowser config file:
$cfg[‘base_url’] = ‘http://&#8217; . $_SERVER[‘SERVER_NAME’].’/~rarerobi’;

Change in php_thumb config file
$PHPTHUMB_CONFIG[‘allow_local_http_src’] = true;

Change in phpThumb.php file
add the line:
$_GET[‘src’] = $_SERVER[‘SERVER_NAME’]/~rarerobi’.$_GET[‘src’];

add the condition if($lib[‘value’]==’/images/’) at line 1463 of iBrowser.php file to hide other lists than images.

CMS MS – iframe POST method

Magento – Search Results Page 3 column layout display


Magento – Search Results Page 3 column layout display:

Change this file:
/public_html/app/design/frontend/base/default/layout/catalogsearch.xml
change: <action method="setTemplate"><template>page/2columns-right.phtml</template></action> by
<action method="setTemplate"><template>page/3columns.phtml</template></action>

Magento – Display 3 records per row in advance search result page


File Path: /public_html/app/design/frontend/default/f001/template/catalog/product/list.phtml
Change:

$_columnCount = 3;//$this->getColumnCount();

Magento – Search Results Grid Different From Product Grid Listing


From what I can see, it doesn’t look like the Result.php block loads the short description in the _getProductCollection function. The getShortDescription will work, but you just need to tell the block to load that info so that you can call it. Open up app->core->Mage->CatalogSearch->Block->Result.php. You should see the following function:

protected function _getProductCollection()
    {
        if (is_null($this->_productCollection)) {
            $this->_productCollection = $this->_getQuery()->getResultCollection()
                ->addAttributeToSelect('url_key')
                ->addAttributeToSelect('name')
                ->addAttributeToSelect('price')
                ->addAttributeToSelect('special_price')
                ->addAttributeToSelect('special_from_date')
                ->addAttributeToSelect('special_to_date')
                ->addAttributeToSelect('description')
                ->addAttributeToSelect('image')
                ->addAttributeToSelect('small_image')
                ->addAttributeToSelect('tax_class_id');

            Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($this->_productCollection);
            Mage::getSingleton('catalog/product_visibility')->addVisibleInSearchFilterToCollection($this->_productCollection);
        }

        return $this->_productCollection;
    } 
    

As you can see, the short_description is not part of the select query. You can change ->addAttributeToSelect(’description’) to ->addAttributeToSelect(’short_description’), or you can add ->addAttributeTo Select(’short_description’) entirely. Of course, proper conventions would say that you should ammend the function via the local code pool as to preserve the integrity of your changes across future upgrades, but this’ll give you an idea as to how to get the short_description to show up.

Google Map – Add Markers using ExtJS API


Ext.onReady(function(){

    var mapwin;
    var button = Ext.get('show-btn');

    button.on('click', function(){
        // create the window on the first click and reuse on subsequent clicks
        if(!mapwin){

            mapwin = new Ext.Window({
                layout: 'fit',
                title: 'GMap Window',
                closeAction: 'hide',
				maximizable:true,
				minimizable:true,
                width:1024,
                height:786,
                x: 40,
                y: 60,
                items: {
                    xtype: 'gmappanel',
                    zoomLevel: 14,
                    gmapType: 'map',
                    mapConfOpts: ['enableScrollWheelZoom','enableDoubleClickZoom','enableDragging'],
                    mapControls: ['GSmallMapControl','GMapTypeControl','NonExistantControl'],
                    setCenter: {
                        geoCodeAddr: '1 Church St, Richmond, Victoria, 3121',
                        marker: {title: 'Branch Office'}
                    },
                    markers: [{
                        lat: -37.81748164010962,
                        lng: 144.99946296215057,
                        marker: {title: 'Richmond Police Station'},
                        listeners: {
                            click: function(e){
                                Ext.Msg.alert('Richmond', 'Richmond Police Station');
                            }
                        }
                    },{
                        lat: -37.82184477198719,
                        lng: 144.99804139137268,
                        marker: {title: 'Richmond Church'},
						 listeners: {
                            click: function(e){
                                Ext.Msg.alert('Richmond', 'Richmond Church');
                            }
                        }
                    }]
                }
            });
            
        }
        
        mapwin.show();
        
    });
    
 });

<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″>
<title>GMap Window Example</title>
<link rel=”stylesheet” type=”text/css” href=”../../resources/css/ext-all.css” />

<!– GC –>
<!– LIBS –>
<script type=”text/javascript” src=”../../adapter/ext/ext-base.js”></script>
<!– ENDLIBS –>

<script type=”text/javascript” src=”../../ext-all.js”></script>

<!– GMaps API Key that works for http://www.extjs.com –>
<script src=”http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAA2CKu_qQN-JHtlfQ5L7BLlRRadLUjZPtnrRT4mXZqcP4UUH-2OxREmPm3GpN_NHsHuvuHd-QKI4YoRg&#8221; type=”text/javascript”></script>
<!– GMaps API Key that works for localhost –>
<!–<script src=”http://maps.google.com/maps?file=api&amp;v=2.x&amp;key=ABQIAAAA2CKu_qQN-JHtlfQ5L7BLlRT2yXp_ZAY8_ufC3CFXhHIE1NvwkxQl3I3p2yrGARYK4f4bkjp9NHpm5w&#8221; type=”text/javascript”></script>–>

<script src=”../ux/GMapPanel.js”></script>
<script src=”gmap.js”></script>

<!– Common Styles for the examples –>
<link rel=”stylesheet” type=”text/css” href=”../shared/examples.css” />

<style type=”text/css”>
.x-panel-body p {
margin:10px;
font-size:12px;
}
</style>
</head>
<body>
<script type=”text/javascript” src=”../shared/examples.js”></script><!– EXAMPLES –>

<h1>GMap Window</h1>
<p>This example shows how to create an extension and utilize an external library.</p>
<input type=”button” id=”show-btn” value=”Gimme a Map” /><br /><br />
<p>Note that the js is not minified so it is readable. See <a href=”../ux/GMapPanel.js”>GMapPanel.js</a> and <a href=”gmap.js”>gmap.js</a> for the full source code.</p>

</body>
</html>

Magento – How to Change multiselect list box to select box?


In magento, by default if a select option has more than 2 values, it automatically make the select box to multiselect box.
if you need to change this to remain always select box, here is how to do:

Steps:
Edit the Form.php:
Location: /public_html/app/code/core/Mage/CatalogSearch/Block/Advanced/Form.php
Position: public function getAttributeSelectElement($attribute)
Line no.: 185
What to change: <pre>if (is_array($options) && count($options)>2)</pre>  to <pre>if (is_array($options) && count($options)>100)</pre>

Magento – How to display 3 select boxes in a single row in advance search page (li)?


Steps:
Modify the /public_html/skin/frontend/default/f001/css/custom.css file:
(f001 is your defind template)

At the end add the following: custom.css
————————————————————————–
#rim_diameter_inches_li .multiselect {width:70px;}

#tyre_width_li .multiselect {width:50px;}

#profile_li .input-box .multiselect {width:60px;}

#rim_diameter_inches_li {width: 60px; float: left; }
#tyre_width_li{float: left;background-image: url(../images/search-splitter.gif);
background-repeat: no-repeat;
background-position: right center;}
#tyre_width_li .input-box {width: 70px; }

#profile_li {
width: 70px;
float: left;
}
#profile_li .input-box {width: 50px;  float: left; }
#rim_diameter_inches_li .input-box {float: left; width: 50px;}
———————————————————————–

The form fields are:
Defind in /public_html/app/design/frontend/base/default/template/catalogsearch/advanced/form.phtml file:
<pre>

<ul id=”advanced-search-list”>
<li id=”tyre_width_li”>
<label for=”tyre_width”>Tyre Size</label>
<div>
<select name=”tyre_width” id=”tyre_width” title=”Width (mm)”><option value=”” selected=”selected”>All</option><option value=”54″>175</option><option value=”53″>185</option><option value=”67″>195</option><option value=”80″>205</option><option value=”79″>215</option><option value=”78″>225</option><option value=”77″>235</option><option value=”76″>245</option><option value=”75″>265</option><option value=”74″>275</option><option value=”73″>287</option><option value=”72″>295</option><option value=”71″>314</option><option value=”70″>315</option></select>                        </div>

</li>
<li id=”profile_li”>
<label for=”profile”></label>
<div>
<select name=”profile” id=”profile” title=”Profile”><option value=”” selected=”selected”>All</option><option value=”26″>35</option><option value=”25″>40</option><option value=”24″>45</option><option value=”23″>55</option><option value=”22″>60</option><option value=”21″>65</option><option value=”20″>70</option><option value=”19″>75</option><option value=”18″>80</option><option value=”17″>NA</option></select>                        </div>

</li>
<li id=”rim_diameter_inches_li”>
<label for=”rim_diameter_inches”></label>
<div>
<select name=”rim_diameter_inches” id=”rim_diameter_inches” title=”RIM diameter inches”><option value=”” selected=”selected”>All</option><option value=”36″>14</option><option value=”35″>14C</option><option value=”88″>15</option><option value=”87″>16</option><option value=”86″>16C</option><option value=”85″>17</option><option value=”84″>18</option><option value=”83″>19</option><option value=”82″>20</option><option value=”81″>22.5</option></select>                        </div>

</li>
<div style=”clear: both; padding-left: 170px;”><b>WIDTH</b>&nbsp;(mm)&nbsp;/&nbsp;<b>PROFILE</b>&nbsp;<b>RIM</b> (diameter inches)
</div>                                    <li id=”size_li”>
<label for=”size”>Size</label>
<div>

<input name=”size” id=”size” value=”” title=”Size” type=”text”>
</div>

</li>
<li id=”speed_li”>
<label for=”speed”>Speed</label>
<div>
<input name=”speed” id=”speed” value=”” title=”Speed” type=”text”>
</div>

</li>
<li id=”brand_li”>
<label for=”brand”>Brand</label>
<div>
<input name=”brand” id=”brand” value=”” title=”Brand” type=”text”>
</div>

</li>
<li id=”pattern_li”>

<label for=”pattern”>Pattern</label>
<div>
<input name=”pattern” id=”pattern” value=”” title=”Pattern” type=”text”>
</div>

</li>
<li id=”price_li”>
<label for=”price”>Price</label>
<div>

<input name=”price[from]” value=”” id=”price” title=”Price” type=”text”>
<span>-</span>
<input name=”price[to]” value=”” id=”price_to” title=”Price” type=”text”>
<small>(AUD)</small>
</div>
</li>
</ul>

</pre>

BrowserLab – Preview web pages across multiple browsers and operating systems


Accurately pinpoint compatibility issues and compare web pages at a glance to easily identify differences and potential problems. Preview full screenshots with multiple view options and customizable test settings.

With the integration of Dreamweaver CS5 or Firebug, you can also give BrowserLab permission to preview web pages that are behind a firewall.

Magento – How to order the fields in catalog advance search page.


Steps:
1. Alter the table:`eav_attribute`, use the following command:
ALTER TABLE `eav_attribute` ADD `sort_by` INT( 4 ) NOT NULL DEFAULT ‘500’
2. Edit the /public_html/app/code/core/Mage/CatalogSearch/Model/Advanced.php file:
Function Name: public function getAttributes()
Line no. #98
Change: ->setOrder(‘main_table.attribute_id’, ‘asc’) by ->setOrder(‘main_table.sort_by’, ‘asc’)
3. Done. Reload the ..index.php/catalogsearch/advanced/ page.

Magento Quick Links


Change Logo:
skin/frontend/default/default/images/
01. logo.gif
02. logo_email.gif

Main Templates:
/public_html/app/design/frontend/base/default/template/page

Side boxes:
/public_html/app/design/frontend/base/default/template/callouts

Majento Product Details Page:
/public_html/app/design/frontend/base/default/template/catalog/product/view.phtml

header:
/public_html/app/design/frontend/base/default/template/page/html/header.phtml
/public_html/app/design/frontend/default/f001/template/page/html

Search box:
/public_html/app/design/frontend/base/default/template/catalogsearch

Footer:
/public_html/app/design/frontend/base/default/template/page/html/header.phtml
in static blocks

remove footer links
/public_html/app/design/frontend/base/default/layout/catalog.xml
/public_html/app/design/frontend/base/default/layout/contacts.xml
/public_html/app/design/frontend/base/default/layout/catalogsearch.xml

Featured:
/public_html/app/design/frontend/default/default/template/inchoo

Compare Products:
/public_html/app/design/frontend/base/default/template/catalog/product/compare

Newsletter Box:
/public_html/app/design/frontend/base/default/template/newsletter

Installed Modules:
/public_html/app/design/frontend/default/default/template

Free themes:
http://www.patternhead.com/found-freebies/21-free-magento-themes-for-your-e-commerce-store

MODULES: /public_html/app/design/frontend/default/default/template

Slider : Simple Banners
magento-community/Banners
http://www.magentocommerce.com/magento-connect/Free+Magento+Extensions/extension/3382/banners

{{block type=”banners/banners” name=”banners” template=”banners/banners.phtml”}}

app\design\frontend\default\default\template\banners
app\design\frontend\default\default\layout\banners.xml

Side Blocks:
magento-community/AsiaConnect_FreeCMS

sidebar-right-top
sidebar-right-bottom
sidebar-left-top
sidebar-left-bottom
content-top
menu-top
menu-bottom
page-bottom

Featured:
magento-community/Inchoo_FeaturedProducts

index.php/featured-products/ (store link)

{{block type=”featuredproducts/listing” template=”inchoo/block_featured_products.phtml”}}

NEW Products:
{{block type=”catalog/product_new” name=”home.catalog.product.new” alias=”product_homepage” template=”catalog/product/new.phtml”}}

/public_html/app/design/frontend/default/f001/template/catalog/product
/public_html/app/design/frontend/base/default/template/catalog/product
/public_html/app/code/core/Mage/Catalog/Block/Product/new.php

Best Seller:
magento-community/Luxe_Bestsellers

{{block type=”bestsellers/list” name=”home.bestsellers.list” alias=”product_homepage” template=”catalog/product/list.phtml”}}

Default: {{block type=”bestsellers/list” name=”home.bestsellers.list” alias=”product_homepage” template=”catalog/product/list.phtml””}}
Path: /public_html/app/design/frontend/base/default/template/catalog/product/list.phtml

Popular:
magento-community/Luxe_MostViewed”}}

{{block type=”mostviewed/list” name=”home.mostviewed.list” alias=”product_homepage” template=”catalog/product/list.phtml”}}

Include static block:

{{block type=”cms/block” block_id=”home-page-promo”}}
<?php echo $this->getLayout()->createBlock(‘cms/block’)->setBlockId(‘footer_links’)->toHtml() ?>

%d bloggers like this: