Jump to content

Help me !


Guest Mai Hai

Recommended Posts

Guest Mai Hai

Hi all,

Currently I am studying CubeCart should not have much experience. Some

questions in discussion with [email protected]. I want to ask if I want to

add an entry in the function randomProduct is no more?

For example: I want to add more images to randomly display more here Random

Product Box? (randomProduct.inc.php)

---------------------------------------Code here---------------------------------------

<?php

/*

+--------------------------------------------------------------------------

| CubeCart 4

| ========================================

| CubeCart is a registered trade mark of Devellion Limited

| Copyright Devellion Limited 2009. All rights reserved.

| Devellion Limited,

| 13 Ducketts Wharf,

| South Street,

| Bishops Stortford,

| HERTFORDSHIRE. CM23 3AR

| UNITED KINGDOM

| http://www.devellion.com

| UK Private Limited Company No. 5323904

| ========================================

| Web: http://www.cubecart.com

| Email: [email protected]

| License Type: CubeCart is NOT Open Source Software and Limitations Apply

| License Info: http://www.cubecart.com/v4-software-license

+--------------------------------------------------------------------------

| randomProduct.inc.php

| ========================================

| Random Product Box

+--------------------------------------------------------------------------

*/

if (!defined('CC_INI_SET')) die("Access Denied");

$lang = getLang("includes".CC_DS."boxes".CC_DS."randomProd.inc.php");

$seed = mt_rand(1, 10000);

$whereClause = (isset($_GET['catId'])) ? "AND I.cat_id=".$db->mySQLSafe($_GET['catId'])." AND I.cat_id > 0 AND C.hide != '1'" : "AND I.cat_id > 0";

$sql = sprintf("SELECT I.name, I.image, I.productId FROM %1\$sCubeCart_inventory AS I, %1\$sCubeCart_category AS C WHERE I.cat_id = C.cat_id AND I.disabled != '1' AND C.hide = '0' AND (C.cat_desc != '##HIDDEN##' OR C.cat_desc IS NULL) %2\$s ORDER BY RAND(%3\$d) LIMIT 1", $glob['dbprefix'], $whereClause, $seed);

$randProd = $db->select($sql);

if ($randProd)

{

if (($val = prodAltLang($randProd[0]['productId'])) == true) {

$randProd[0]['name'] = $val['name'];

}

$box_content = new XTemplate ("boxes".CC_DS."randomProd.tpl");

$box_content->assign("LANG_RANDOM_PRODUCT",$lang['randomProd']['featured_prod']);

$box_content->assign("PRODUCT_ID",$randProd[3]['productId']);

$box_content->assign("PRODUCT_NAME",validHTML($randProd[3]['name']));

$thumbRootPath = imgPath($randProd[0]['image'],$thumb=1,$path="root");

$thumbRelPath = imgPath($randProd[0]['image'],$thumb=1,$path="rel");

if (file_exists($thumbRootPath) && !empty($randProd[0]['image'])) {

$box_content->assign("IMG_SRC", $thumbRelPath);

} else {

$box_content->assign("IMG_SRC", "skins/". SKIN_FOLDER . "/styleImages/thumb_nophoto.gif");

}

$box_content->parse("random_prod");

$box_content = $box_content->text("random_prod");

} else {

$box_content = '';

}

?>

----------------------------------------------------------------------------------------------

Thanks a lot !

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...