Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

How to do this PHP, MySQL

Featured Replies

I have a datafeed management script written in PHP / MySQL on X template (smarty, which was written in 2000 :o ) and basically trying to do some modifications without squat knowledge of PHP really.

 

The script has 'popular products' function which from what i can see displays products by popularity from a column called 'prodPopularity' in the table affilist_products1, basically i want to replicate this but sort the products by 'rating' but this column is in another table called affilist_comments!

 

this is the popular products, can anyone tell me what needs changing to accomplish this?

 

Thanks in advance ;)

 

<?php
/*
if (eregi(".inc.php",$HTTP_SERVER_VARS['PHP_SELF']) || eregi(".inc.php",$_SERVER['PHP_SELF'])) {
echo "<html>\r\n<head>\r\n<title>Forbidden 403</title>\r\n</head>\r\n<body><h3>Forbidden 403</h3>\r\nThe document you are requesting is forbidden.\r\n</body>\r\n</html>";
exit;
}

// get listing options		
$getListOptions = mysql_query("SELECT value FROM affiliSt_config WHERE name = 'prodListings'");
$listOptions = mysql_fetch_assoc($getListOptions);
$prodOptions = explode(":", $listOptions['value']);

// popular products listing
$getPopular = mysql_query("SELECT prodImageSmall, prodImageURL, prodName, merchantProdID, dbProdID, prodDB, prodPrice, prodCurrency, prodPopularity FROM affiliSt_products1 ORDER BY prodPopularity DESC LIMIT 0, 10");
$popularList = mysql_fetch_assoc($getPopular);

$box_content = new XTemplate ("skins/".$configSkin['value']."/styleTemplates/popularprod.tpl");

do {

	// get titles
	$getTitles = mysql_query("SELECT value FROM affiliSt_config WHERE name = 'feedMemory".$popularList['prodDB']."'");
	$allTitles = mysql_fetch_assoc($getTitles);
	$listTitles = explode("-:-", $allTitles['value']);

	// thumb image
	if ($popularList['prodImageSmall'] == NULL) {
	$thumbImage = $popularList['prodImageURL'];
	} else {
	$thumbImage = $popularList['prodImageSmall'];
	}

	$popResult = ucwords(strtolower($popularList['prodName']));

				// use merchant product ids
				if ($navOpt[12] == 1) {
				$theprodID = $popularList['merchantProdID'];
				} else {
				$theprodID = $popularList['dbProdID'];
				}
				if ($navOpt[7] == 1) {
				// html perma
				$box_content->assign("LINKDATA",$installDir['value'].'product/'.$popularList['prodDB'].'/'.$theprodID.'/'.urltxt($popularList['prodName']).'.html');
				$box_content->assign("IMAGELINK",$installDir['value'].'img/'.$popularList['prodDB'].'/'.$popularList['dbProdID'].'.jpg');
				} else {
				// php link
				$box_content->assign("LINKDATA",$installDir['value'].'index.php?case=product&proddb='.$popularList['prodDB'].'&pid='.$theprodID);
				$box_content->assign("IMAGELINK",$thumbImage);
				}
				if ($prodOptions[6] == 1 && $popularList['prodPrice'] != '') {
					if ($prodOptions[12] == 1) {
					$theTitle = $listTitles[27];
					} else {
					$theTitle = '';
					}
					if ($popularList['prodPrice'] == 0.00) {
					$box_content->assign("PRICE",'<span class="popProdPrice">'.$theTitle.'N/A</span><br />');
					} else {
					$box_content->assign("PRICE",'<span class="popProdPrice">'.$theTitle.$popularList['prodCurrency'].$popularList['prodPrice'].'</span><br />');
					}
				} else {
				$box_content->assign("PRICE",'');
				}

				$box_content->assign("DATA",substr($popResult, 0, 30).'');
				$box_content->assign("POPIMAGE",$popularList['dbProdID']);
				$box_content->parse("popularprod.li");

	} while ($popularList = mysql_fetch_assoc($getPopular));




$box_content->assign("DATA", "Popular Products");

$box_content->assign("SKIN",$configSkin['value']);
$box_content->parse("popularprod");
$box_content = $box_content->text("popularprod");
?>

 

thanks!

  • 2 weeks later...

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.