Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Featured Products v1.5.6


desk2web

Recommended Posts

I'm having a few problems working out which code to edit out in the last step of the installation:

 

Step 13:
For this step some customizing may need to be done.  The following code includes the seperate pricing contribution.  You may also want to add things like a different model number field, cost, or other description... 

edit /catalog/admin/includes/functions/html_output.php and at the very bottom right before the ?> add:

//draw products multiselect box
 function tep_draw_products_mselect($name, $parameters = '', $selected_vals) {
global $currencies, $languages_id;

if ($exclude == '') {
  $exclude = array();
}

$select_string = '<select name="' . $name . '"';
if ($parameters) $select_string .= ' ' . $parameters;
$select_string .= ' multiple>';

// BOF - Separate_Pricing_Per_Customer_v3.5
  $all_groups=array();
  $customers_groups_query = tep_db_query("select distinct customers_group_name, customers_group_id from " . TABLE_CUSTOMERS . " order by customers_group_id ");
  while ($existing_groups =  tep_db_fetch_array($customers_groups_query)) {
	  $all_groups[$existing_groups['customers_group_id']]=$existing_groups['customers_group_name'];
  }
$products_query = tep_db_query("select p.products_id, pd.products_name, p.products_price, p.products_code from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by products_code");
while ($products = tep_db_fetch_array($products_query)) {
// BOF - Separate_Pricing_Per_Customer_v3.5
// Next lines were original code
//	  if (!in_array($products['products_id'], $exclude)) {
//		$select_string .= '<option value="' . $products['products_id'] . '">' . $products['products_name'] . ' (' . $currencies->format($products['products_price']) . ')</option>';
//	  }

	 $price_query=tep_db_query("select customers_group_price, customers_group_id from " . TABLE_PRODUCTS_GROUPS . " where products_id = " . $products['products_id']);
	 $product_prices=array();
	 while($prices_array=tep_db_fetch_array($price_query)){
		 $product_prices[$prices_array['customers_group_id']]=$prices_array['customers_group_price'];
	 }
	 reset($all_groups);
	 $price_string="";
	 $sde=0;
	 while(list($sdek,$sdev)=each($all_groups)){
		 //if (!in_array((int)$products['products_id'].":".(int)$sdek, $exclude)) {
			 if($sde)
				$price_string.=", ";
			 $price_string.=$sdev.": ".$currencies->format(isset($product_prices[$sdek]) ? $product_prices[$sdek]:$products['products_price']);
			 $sde=1;
		 }
	 //}
 if (!in_array($products['products_id'], $selected_vals)) {
	 $select_string .= '<option value="' . $products['products_id'] . '">' . $products['products_model'] . ' ' . $products['products_name'] . ' (' . $price_string . ')</option>\n';
  } else {
  $select_string .= '<option value="' . $products['products_id'] . '" SELECTED>' . $products['products_model'] . ' ' . $products['products_name'] . ' (' . $price_string . ')</option>\n';
}
// EOF - Separate_Pricing_Per_Customer_v3.5
}

$select_string .= '</select>';

return $select_string;
 }

//draw products multiselect delete box
 function tep_draw_products_delete_mselect($name, $parameters = '', $selected_vals) {
global $currencies, $languages_id;

if ($exclude == '') {
  $exclude = array();
}

$select_string = '<select name="' . $name . '"';
if ($parameters) $select_string .= ' ' . $parameters;
$select_string .= ' multiple>';

$products_query = tep_db_query("select p.products_id, pd.products_name, s.featured_id, s.featured_date_added, s.featured_last_modified, s.expires_date, s.date_status_change, s.status from " . TABLE_PRODUCTS . " p, " . TABLE_FEATURED . " s, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and p.products_id = s.products_id order by pd.products_name");
while ($products = tep_db_fetch_array($products_query)) {
$select_string .= '<option value="' . $products['featured_id'] . '">' . $products['products_model'] . ' ' . $products['products_name'].'</option>\n';
}

$select_string .= '</select>';

return $select_string;
}

 

I've had a go at editing the code, and have succeeded to a small degree in that I now see:

 

49FAKL_823.jpg

which is a start I guess!

 

  //draw products multiselect box
 function tep_draw_products_mselect($name, $parameters = '', $selected_vals) {
global $currencies, $languages_id;

if ($exclude == '') {
  $exclude = array();
}

$select_string = '<select name="' . $name . '"';
if ($parameters) $select_string .= ' ' . $parameters;
$select_string .= ' multiple>';

// BOF - Separate_Pricing_Per_Customer_v3.5
 // $all_groups=array();
 // $customers_groups_query = tep_db_query("select distinct customers_group_name, customers_group_id from " . TABLE_CUSTOMERS . " order by customers_group_id ");
 // while ($existing_groups =  tep_db_fetch_array($customers_groups_query)) {
   //   $all_groups[$existing_groups['customers_group_id']]=$existing_groups['customers_group_name'];
 // }
  // $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_price, p.products_code from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by products_code");
  // while ($products = tep_db_fetch_array($products_query)) {
// BOF - Separate_Pricing_Per_Customer_v3.5
// Next lines were original code
 if (!in_array($products['products_id'], $exclude)) {
	$select_string .= '<option value="' . $products['products_id'] . '">' . $products['products_name'] . ' (' . $currencies->format($products['products_price']) . ')</option>';
  }

   // this is crap  $price_query=tep_db_query("select customers_group_price, customers_group_id from " . TABLE_PRODUCTS_GROUPS . " where products_id = " . $products['products_id']);
   //  $product_prices=array();
   //  while($prices_array=tep_db_fetch_array($price_query)){
   //	  $product_prices[$prices_array['customers_group_id']]=$prices_array['customers_group_price'];
   //  }
   //  reset($all_groups);
   //  $price_string="";
   //  $sde=0;
   //  while(list($sdek,$sdev)=each($all_groups)){
		 if (!in_array((int)$products['products_id'].":".(int)$sdek, $exclude)) {
   //		  if($sde)
   //			 $price_string.=", ";
   //		  $price_string.=$sdev.": ".$currencies->format(isset($product_prices[$sdek]) ? $product_prices[$sdek]:$products['products_price']);
   //		  $sde=1;
   //	  }
	 }
  //  if (!in_array($products['products_id'], $selected_vals)) {
  //	  $select_string .= '<option value="' . $products['products_id'] . '">' . $products['products_model'] . ' ' . $products['products_name'] . ' (' . $price_string . ')</option>\n';
  //   } else {
//  $select_string .= '<option value="' . $products['products_id'] . '" SELECTED>' . $products['products_model'] . ' ' . $products['products_name'] . ' (' . $price_string . ')</option>\n';
//}
// EOF - Separate_Pricing_Per_Customer_v3.5
}

$select_string .= '</select>';

return $select_string;
// }

//draw products multiselect delete box
 function tep_draw_products_delete_mselect($name, $parameters = '', $selected_vals) {
global $currencies, $languages_id;

if ($exclude == '') {
  $exclude = array();
}

$select_string = '<select name="' . $name . '"';
if ($parameters) $select_string .= ' ' . $parameters;
$select_string .= ' multiple>';

$products_query = tep_db_query("select p.products_id, pd.products_name, s.featured_id, s.featured_date_added, s.featured_last_modified, s.expires_date, s.date_status_change, s.status from " . TABLE_PRODUCTS . " p, " . TABLE_FEATURED . " s, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and p.products_id = s.products_id order by pd.products_name");
while ($products = tep_db_fetch_array($products_query)) {
$select_string .= '<option value="' . $products['featured_id'] . '">' . $products['products_model'] . ' ' . $products['products_name'].'</option>\n';
}

$select_string .= '</select>';

return $select_string;
}

?>

Allan Young

Link to comment
Share on other sites

Whilst I have your attention, I am keen to have an image behind each item in the featured list, specifically:

49FAKL_822.jpg

or if a similar effect can be achieved by CSS then that would be great

 

Anyone any ideas please. Thanks in advance.

Allan Young

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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...