Sanjoy Roy

[MCM, MCP, SCJP] – Senior PHP Programmer

Tag Archives: Creloaded

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";

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);