Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

jcisar

Featured Product Support v1.5.4

Recommended Posts

Hi, I'm using this contribution to display featured products of a particular catagory on the homepage. I managed to get it to work by just setting

 

$featured_products_category_id = 3;

 

3 being the important catagory. I also commented out the next 3 lines since I already know the name of the catagory.

 

Now in the Administration, the drop down list displays every product. Is there a way to program it to filter it by catagory number? So that only catagory 3 will be displayed and such?

 

I'm not quite familiar with that.

 

Thanks in advance!

Share this post


Link to post
Share on other sites
After my installation I get an SQL error message almost similar to Andyshep:

 

1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

select value from currencies WHERE currencies_id =

[TEP STOP]

 

Is it an upgrade issue too? :(

 

When i had my problem i found the solution in the contiributions .

READ THE TEXT!

 

For those of you who cant be *rsed to find it :-"

The featured products contribution suffers from the same MS2 bug (bug report 1316) as new products ie "Even on a clean install new products will only show up in the new products category if they are one Category level or less in. Anything beyond that they do not show up." Here's the fix for the featured products contribution:

 

In "catalog/includes/modules/featured.php"

 

after line #34:

 

$info_box_contents[] = array('align' => 'left', 'text' => sprintf(TABLE_HEADING_FEATURED_PRODUCTS_CATEGORY, $cat_name));

 

insert the following:

 

$subcategories_array = array();

tep_get_subcategories($subcategories_array, $featured_products_category_id);

$featured_products_category_id_list = tep_array_values_to_string($subcategories_array);

if ($featured_products_category_id_list == '') {

$featured_products_category_id_list .= $featured_products_category_id;

} else {

$featured_products_category_id_list .= ',' . $featured_products_category_id;

}

 

You now need to change original line #35 (after the additional lines of code above it will now be around line #43):

 

$featured_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, s.status as specstat, s.specials_new_products_price, p.products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c left join " . TABLE_FEATURED . " f on p.products_id = f.products_id where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . $featured_products_category_id . "' and p.products_status = '1' and f.status = '1' order by rand() DESC limit " . MAX_DISPLAY_FEATURED_PRODUCTS);

 

 

so that it becomes:

 

$featured_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, s.status as specstat, s.specials_new_products_price, p.products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c left join " . TABLE_FEATURED . " f on p.products_id = f.products_id where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id in (" . $featured_products_category_id_list . ") and p.products_status = '1' and f.status = '1' order by rand() DESC limit " . MAX_DISPLAY_FEATURED_PRODUCTS);

 

 

Finally, if you haven't previously installed the 'new products bug fix', bug report ID 1316, then you will also need to add the following function to 'catalog/include/functions/general.php':

 

function tep_array_values_to_string($array, $separator = ',') {

$get_string = '';

if (sizeof($array) > 0) {

while (list($key, $value) = each($array)) {

$get_string .= $value . $separator;

}

$remove_chars = strlen($separator);

$get_string = substr($get_string, 0, -$remove_chars);

}

return $get_string;

}

Share this post


Link to post
Share on other sites

I have a question:

 

I installed SPPC 4.1.4 and Featured Products 1.5.6.

 

Seems to work ok up to a point. It will display Featured Items that I have selected in each category, but when you get to the deepest category, it displays the same product for as many products in that category.

 

Any ideas?

Share this post


Link to post
Share on other sites
Guest
Any ideas on how to fix this? I've totally removed my store, reinstalled fresh copy of osc ms2 2.2 and reinstalled featured products. I get this error EVERY time! Has anyone heard of this before?

 

 

I am getting this as well in using version 1.56

Any help would be greatly appreciated.

Share this post


Link to post
Share on other sites
Guest
I am getting this as well in using version 1.56

Any help would be greatly appreciated.

 

 

I should probably be clearer. I am getting this error when trying to add a feature product:

 

Product: 1054 - Unknown column 'customers_group_name' in 'field list'

 

select distinct customers_group_name, customers_group_id from customers order by customers_group_id

 

[TEP STOP]

 

 

Any help would be greatly appreciated.

Share this post


Link to post
Share on other sites
I should probably be clearer. I am getting this error when trying to add a feature product:

Product: 1054 - Unknown column 'customers_group_name' in 'field list'

[...]

 

Nice. Just added the contrib - got the same problem :(

Thanks in advance for any help!!

Share this post


Link to post
Share on other sites
Nice. Just added the contrib - got the same problem :(

Thanks in advance for any help!!

 

first make sure your using the latest oscommerce with the nov updates.

 

second if your are using the latest oscommerce it looks like you have not update your database correctly

 

the 'customers_group_name' field has not been added to the database

Edited by andyshep

Share this post


Link to post
Share on other sites

I downloaded my osc like 5 days ago! (oscommerce-2.2ms2-051113)

And yes, there is no attribute called like that in the db! Which sql should add this one, please? The sql script from the featured products contrib doesn't.

Share this post


Link to post
Share on other sites

(Sorry for double posting! Edit=disabled!?)

 

Something just came to my mind... What's this customers_group_name attribute for? Does anyone know that?

EDIT: Ah no, forget that. But I would still appreciate any help on that! :)

Edited by philippo

Share this post


Link to post
Share on other sites

Alright: triple posting (can anyone explain to me, why this ... edit-button disappears after a while????)

 

The problem is step 13 in the readme.txt of the contrib. In the html_output.php you're supposed to 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;
 }

But as you can see, the author has included another contrib, and if you don't use this one as well, the featured products contrib won't work.

With my lack of php knowledge, i can't solve this problem, sorry!

Everything what's needed is a multiselect products "method" (method? yes, whatever), as far as I see.

Share this post


Link to post
Share on other sites

Alright, 4th posting in a row now... :D

 

I got it!

Just use this:

//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 .= '>';

$products_query = tep_db_query("select p.products_id, pd.products_name, p.products_price 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_name");
while ($products = tep_db_fetch_array($products_query)) {
  if (!in_array($products['products_id'], $exclude)) {
	$select_string .= '<option value="' . $products['products_id'] . '">' . $products['products_name'] . ' (' . $currencies->format($products['products_price']) . ')</option>';
  }
}

$select_string .= '</select>';

return $select_string;
 }

Share this post


Link to post
Share on other sites

I have Featured Products 1.5.5 installed (using admin/featured.php from 1.5.6), and all is working... except that only 1 featured product is showing. In configuration, it is set to show 6 products, and there are two products set in the catalog/featured area in the admin panel. Neither date is expired, and this is the only time I've ever experienced this problem. My only thought is that the featured products are to display in an area that is set to a width of 500. Is this causing the problem? Either way, any help would be appreciated!

Share this post


Link to post
Share on other sites

does anyone know how to add a Buy Now Button?

also how can I stop the product from moving when the page refreshes?

 

cheers

Danny

Share this post


Link to post
Share on other sites
Guest

Can someone point me in the right direction to fix this error?

 

i get this in the admin when i try to add a featured product

 

Product:

Fatal error: Call to undefined function tep_draw_products_mselect() in /home/website/public_html/admin/featured.php on line 147

Share this post


Link to post
Share on other sites
Can someone point me in the right direction to fix this error?

 

i get this in the admin when i try to add a featured product

 

Product:

Fatal error: Call to undefined function tep_draw_products_mselect() in /home/website/public_html/admin/featured.php on line 147

 

 

Which version do you have installed? I installed 1.5.5, and then installed admin/featured.php from 1.5.6 and it solved that problem.

Share this post


Link to post
Share on other sites
Alright, 4th posting in a row now... :D

 

I got it!

Just use this:

 

Thank you philippo! I had same problem as you. Cheers mate!


luke

Share this post


Link to post
Share on other sites

Can anyone point me in the right direction of how to get items to display on the main page of my website. Ideally would like to have a featured products banner at the top and then the images under it.

Edited by shiftlocked

Things still to do before going "live" in no real order...

Change "buy now buttons" css styles

Change "lets see what we have here" into something meaningfull

Main logo of the website

Sort out currency to make site UK only (at present)

Remove "xx requests since" stuff

Update mainpage :D

Move shopping cart status into header

Add in stock status to product listing page

Define styles for product listing standardisation

Change CSS background for Headings

Increase Category size headings

Used mods so far:- basic_design_pack1mk7 | Google XML sitemap w admin | Paypal IPN v 1.2 | Feedmachine | pricematch_1_3_1 | Dynamic Sitemap 1.6 | Whos online Enhancement | Easypopulate 2.72

 

Each one that I solve I;ll be putting a post on the forum in a "completed shop" thread that Im writing up

Share this post


Link to post
Share on other sites

I am wondering if there is a way to create a placeholder tag for STS. I'd like to be able to add a box for my featured products and control where it goes on my template page.

 

Thanks!

Jason

Share this post


Link to post
Share on other sites

I am wondering if there is a way to create a placeholder tag for STS. I'd like to be able to add a box for my featured products and control where it goes on my template page.

 

Thanks!

Jason

Share this post


Link to post
Share on other sites
Guest

Thanks a lot, this looks very useful.

 

Is there any way to have it display in column_right.php? When I add the

include(DIR_WS_MODULES . FILENAME_FEATURED);

, it shows up in the wrong sort of box.

 

I've tried converting it to a file in the boxes directory, but the script just seems to cut off everything else (and the page displays half loaded). No errors seem to pop up anywhere.

 

Any help would be fantastic.

Share this post


Link to post
Share on other sites

I just installed this and have been working with it for over two hours. :blink:

 

When I go to my website, the featured products box is not there. It's on my admin panel, and I can add new featured products, but none are showing up on my site and there's not even a box for featured products and my new products box came back.

 

Can someone help??

Share this post


Link to post
Share on other sites

Hi

 

I packed all fixed and versions since "Featured Products v1.5.5" of C?dric R of date 17 Jun 2005

 

and create COMPLETE PACK, the version: Featured Products 1.5.8

 

But this version IS ONLY FOR OSCOMMERCE INSTALLATION WITHOUT SPCC CONTRIBUTION

 

 

Include:

 

- ALL the before versions and fixes since version "Featured Products v1.5.5" of C?dric R of date 17 Jun 2005.

 

All credits are for they.

 

( this version is for store without SPPC installed ( used instead the version of 24 May 2006), specials valin form (12 May 2006) and depper categories (7 Apr 2006) )

 

- Fixed: dont duplicate New Products module when desactive this featured module

 

- Featured infobox for columns

 

- Add install instructions in spanish

 

- screenshots

 

* See changelog.txt file for a detailed info of all changes.

 

 

 

FOR SPPC USERS: if you have installed SPPC contributions then have to do the installation of version "Featured Products v1.5.6 by guardianms of 24 May 2006

 

FOR "Specials valid from" users (http://www.oscommerce.com/community/contributions,2520/ by Felix Schwarz) then do the modification of this version 1.5.8 and then fixed of version: Specials valid from - Calendar Fix dwdonline 12 May 2006, in file catalog/admin/featured.php

 

FOR deeper categories installed do the modification of this version 1.5.8 and the fix of version: mysql5 fix deeper categories by saho of 7 Apr 2006, in file catalog/includes/modules/featured.php

 

 

and can see live demo at URL:

http://www.oscommerce-demo.com/demo01/

(Note: this demo include graphical modification of modules not include in this contribution)

Edited by nicko107

Share this post


Link to post
Share on other sites
Thanks a lot, this looks very useful.

 

Is there any way to have it display in column_right.php? When I add the

include(DIR_WS_MODULES . FILENAME_FEATURED);

, it shows up in the wrong sort of box.

 

I've tried converting it to a file in the boxes directory, but the script just seems to cut off everything else (and the page displays half loaded). No errors seem to pop up anywhere.

 

Any help would be fantastic.

 

 

Hi

 

Try to used the infobox of version:

 

Featured Product Infobox with Infobox Admin by cschnell of date 31 May 2006

 

That version have a infobox for column for display one featured products.

Share this post


Link to post
Share on other sites

Is it possible to show the product description? On my site I only see product name, and price, but it dont display part of the product description.

 

I tried many options to add it, but I cant figure it out.

Share this post


Link to post
Share on other sites
Is it possible to show the product description? On my site I only see product name, and price, but it dont display part of the product description.

 

I tried many options to add it, but I cant figure it out.

 

 

Hi

 

Open file

 

catalog/includes/modules/featured.php

 

1- find:

 

$featured_products['products_name'] = tep_get_products_name($featured_products['products_id']);

 

ADD after:

 

	$sql = 'SELECT `products_description` FROM `products_description` WHERE products_id ='.$featured_products['products_id'].' && language_id='.(int)$languages_id;
$description_query = tep_db_query($sql);
$description = mysql_fetch_array($description_query, MYSQL_ASSOC);		
$description['products_description'] = substr($description['products_description'], 0, 80);
$desc_len = strlen($description['products_description']);
$description['products_description'][$desc_len-1] = '.';
$description['products_description'][$desc_len-2] = '.';
$description['products_description'][$desc_len-3] = '.';
$description['products_description'] = ereg_replace("(Array)", "", $description['products_description']);

 

 

80 is the number of character of the short description, you can change it

 

 

2- In the same file FIND:

 

. '</a><br><s>' .

 

REPLACE with:

 

. '</a><br>' . strip_tags($description['products_description']) . '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']). '">' . DESCR_READ_MORE . '</a><br>  <a href="' . tep_href_link(FILENAME_DEFAULT, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $featured_products['products_id']) . '">' . tep_image_button('cart_buy.gif', IMAGE_BUTTON_BUY_NOW) . '</a> <s>' .

 

 

3- In the same file FIND:

 

. '</a><br>' .

 

REPLACE with:

 

. '</a><br>' . strip_tags($description['products_description']) . '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']). '">' . DESCR_READ_MORE . '</a><br>  <a href="' . tep_href_link(FILENAME_DEFAULT, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $featured_products['products_id']) . '">' . tep_image_button('cart_buy.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ' .

 

 

 

4- open file:

 

catalog/includes/languages/english.php

 

and ADD this:

 

//Short description in products modules Start
define('DESCR_READ_MORE', '<FONT color=blue>more info+.</FONT>'); // ... read more.
//Short description in products modules End

 

This add a short description, button buy now and a "more info+" link to product description

 

 

nicko107

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×