Jump to content
Sign in to follow this  
defender39

Featured 1.5

Recommended Posts

I installed the last version and some files that were either not used or have somehow been broken from 1.3. So here is an extremely easy Featured replacement for you front page only. It also has an sql install that will give you admin control to turn it on or off. You can also designate the amount of products you wish to display from admin. Very easy and quick install. Simple to read instructions thanks to a previous contributor who gets named in the file.

 

http://www.oscommerce.com/community/contributions,651

 

any questions feel free to post them here for me to see

Share this post


Link to post
Share on other sites

Nice one!!

 

I was hoping that someone could improve on my version (1.4) by adding in more admin functionality.

Share this post


Link to post
Share on other sites

just installed . . . and . . .

 

I get this message:

Fatal error: Cannot instantiate non-existent class: contentboxheading in /customers/nisse.se/nisse.se/httpd.www/catalog/admin/includes/languages/Svenska/featured.php on line 42

 

Line 42 contains this:

$num ++; if ($num == 1) { new contentBoxHeading($info_box_contents); }

 

 

Please HELP!!!

/Lars

Share this post


Link to post
Share on other sites

I just cleared the first entri did . .wich generated an error . .so no I can go into admin and then click on the featured products link.

 

. .i still got a problem . .and that is when I I've added the product . .I get the message:

 

Warning: Cannot add header information - headers already sent by (output started at /customers/nisse.se/nisse.se/httpd.www/catalog/admin/includes/languages/Svenska/featured.php:16) in /customers/nisse.se/nisse.se/httpd.www/catalog/admin/includes/functions/general.php on line 18

 

 

and when I now trie to add more products . .I'm back at:

 

Fatal error: Cannot instantiate non-existent class: contentboxheading in /customers/nisse.se/nisse.se/httpd.www/catalog/admin/includes/languages/Svenska/featured.php on line 42

 

 

 

what to do?

 

/L

Edited by lbackmol

Share this post


Link to post
Share on other sites

well in the instructions whenever it asks for a change in /english whatever...you need to also add/edit inside your language folder

 

this contrib like most is based on English

Share this post


Link to post
Share on other sites

it wants this file

catalog/admin/includes/languages/Svenska/featured.php

 

get it from here

catalog/admin/includes/languages/English/featured.php

Share this post


Link to post
Share on other sites

sorry my mistake . . I forgot to mention that this is done and translated. So it must another problem . . .

 

/L

Share this post


Link to post
Share on other sites

I have also just installed and get thie error

Fatal error: Cannot instantiate non-existent class: contentboxheading in /home/vbaxter/public_html/corina/admin/includes/languages/english/featured.php on line 42
I am using english, I also note that in admin a lot of the define titles are showing instead of the word.

 

this was missing

 

add this line to admin/includes/languages/english.php

 

define('BOX_CATALOG_FEATURED', 'Featured');

 

also most of the table titles are missing


No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P


Support The Project
Documentation/Knowledgebase/Discussions
 

Share this post


Link to post
Share on other sites

It appears that the admin/languages/english/featured.php file that was zipped in was incorrect. I changed the file to this to get rid of that instantiate non-existant class error... I might have missed something though

 

<?php
/*
 $Id: customers.php,v 1.12 2002/01/12 18:46:27 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2002 osCommerce

 Released under the GNU General Public License
*/

define('HEADING_TITLE', 'Featured Products');


define('TABLE_HEADING_PRODUCTS', 'Products');
define('TABLE_HEADING_STATUS', 'Status');
define('TABLE_HEADING_ACTION ', 'Action');


define('TEXT_INFO_DATE_ADDED', 'Date Added:');
define('TEXT_INFO_LAST_MODIFIED', 'Last Modified:');
define('TEXT_INFO_EXPIRES_DATE', 'Expires:');
define('TEXT_INFO_STATUS_CHANGE', 'Status Change:');
define('TEXT_DISPLAY_NUMBER_OF_FEATURED', 'Number of Featured:');

define('TEXT_FEATURED_PRODUCT ', 'Featured Product:');
define('TEXT_FEATURED_EXPIRES_DATE', 'Expires:');

?>

 

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

Movie Review, Book reviews, opinion http://www.mechanic-al.org/Ed

Share this post


Link to post
Share on other sites

damn...

again..I worked all night till 5am and of course I make some dumb error...when I get home tonight I will look at my files and zip and try to correct the errors and reupload..at least the sql file works

Share this post


Link to post
Share on other sites

Ok, I have Featured Products installed. No Errors at all. Beautiful contrib. ty!

 

Request:

Can someone help me or PM me the code changes to add a BUY NOW button to each product?, or make the changes in the code and post it here ?

I am sure many would like to add this.

 

Any help is appreciated.

Edited by ScooterProShop.com

Scooterboy

Share this post


Link to post
Share on other sites

Try this

} else {
? ? ?$info_box_contents[$row][$col] = array('align' => 'center',
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'params' => 'class="smallText" width="33%" valign="top"',
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $featured_products['products_image'], $featured_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . $featured_products['products_name'] . '</a><br>' . $currencies->display_price($featured_products['products_price'], tep_get_tax_rate($featured_products['products_tax_class_id'])) . '<br><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $new_products['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a>');
? ?} ? ?

I have shown the code from the else statement however this is the addin

<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $new_products['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a>'

Edited by 241

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P


Support The Project
Documentation/Knowledgebase/Discussions
 

Share this post


Link to post
Share on other sites

What file do I add the code to and where ?

 

Got the file: /includes/modules/featured.php

 

Now where do I add it ?

Edited by ScooterProShop.com

Scooterboy

Share this post


Link to post
Share on other sites

catalog/includes/modules/featured.php :D

 

where from the else statement or if using just the code for the button then from where you want the button ;)

 

Would you like a line :P

Edited by 241

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P


Support The Project
Documentation/Knowledgebase/Discussions
 

Share this post


Link to post
Share on other sites

OK I am looking for the code to replace or where to add it.

 

A line # would be great ... I would like to add it just below the image, like you have it on your test site.

Edited by ScooterProShop.com

Scooterboy

Share this post


Link to post
Share on other sites

Hi there,

I love this contrib, and had great fun installing it.

However I noticed that the sql statements would not pull out all the featured products from within a category having deep nested sub categories. So I amended the code; I think I changed the parent_id clause to this:

c.categories_id IN (".implode(',',$cat_array).")

And just before declaring the raw sql statement including the above, I put:

function get_all_subcategories($currentParID) {
global $cat_array;
$haschildren = 0; //default
$categories_query = tep_db_query("select c.categories_id, c.parent_id from " . TABLE_CATEGORIES . " c where c.parent_id = '" . $currentParID . "' order by sort_order");
$cat_array[] = $currentParID;
while ($categories = tep_db_fetch_array($categories_query))  {
$haschildren=tep_has_category_subcategories($categories['categories_id']);
 if ($haschildren) {
  get_all_subcategories($categories['categories_id']);
 } else {
  $cat_array[] = $categories['categories_id'];
 }
}
}
$cat_array = array();
get_all_subcategories($featured_products_category_id);

Where the above get_all_subcategories function will return an array list of all associated child sub categories pertaining to the current subcategory.

 

I also added in the admin selction the option whether or not to include the specials in the features box.

 

It was my first hack of having to join tables etc, so I haven't posted the entire code of modules/featured.php


"Any fool can know. The point is to understand." -- Albert Einstein

Share this post


Link to post
Share on other sites

OK make catalog/includes/modules/featured.php line #52 this

 

'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $featured_products['products_image'], $featured_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . $featured_products['products_name'] . '</a><br>' . $currencies->display_price($featured_products['products_price'], tep_get_tax_rate($featured_products['products_tax_class_id'])) . '<br><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $new_products['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a>');

Edited by 241

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P


Support The Project
Documentation/Knowledgebase/Discussions
 

Share this post


Link to post
Share on other sites

A BUG! LOL!

The Buy Now button appears but, when clicked it just goes to shopping_cart.php ?!?! Doesnt add onything to cart.

 

The Buy Now button also won't display on products "On sale" or called "Specials"

 

Can you fix that? Or is that a show stopper?

Edited by ScooterProShop.com

Scooterboy

Share this post


Link to post
Share on other sites

Try changing $new_products['products_id'] to $featured_products['products_id'] in the above code.


"Any fool can know. The point is to understand." -- Albert Einstein

Share this post


Link to post
Share on other sites

Excellent work!

 

That fixed the BUY NOW issue. It now goes to the product information page the same as if they click on the image.

 

I suppose it would be nice to have the BUY NOW act as an ADD TO CART button but that may be a bit complicated. No?

 

The issue with the "Specials" products still do not display the BUY NOW button.

Is that an easy fix? I do like to give customers a break on pricing, but this is an all or nothing type of modification.

 

I will post the entire code for featured.php as soon as this issue is resolved.

That way perhaps the author can either add it to the contrib, or be an option for those like me that want to add it.

Edited by ScooterProShop.com

Scooterboy

Share this post


Link to post
Share on other sites

the code I gave was to place a buy now button as you requested this could link to the cart and for specials copy the code for the buy now to the line for specials, I didnot do this as I did not require the specials


No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P


Support The Project
Documentation/Knowledgebase/Discussions
 

Share this post


Link to post
Share on other sites

Ok .. if I can even find where that line is .. I will do that. (low priority I suppose)

 

I would like to fix this BUY NOW code to act as a "Add to Cart"

- That just makes more sense to me since a customer can click on the image to get to the product page.

This Buyer that I am targeting wants to buy it NOW and doesnt need any more information! - lol

 

Ok here is what I tried.

 

Line 51 /includes/modules/featured.php

 

Changing:

'action=buy_now&products_id='

To:

'action=add_product&products_id='

 

Gets me to the cart, but the product doesnt get added.

 

I am trying at least ! - What do I need to add to that code to make it include the product ?

Edited by ScooterProShop.com

Scooterboy

Share this post


Link to post
Share on other sites

ok update is catalog/includes/modules/featured.php change the code from line #45 to line #53

 

 $info_box_contents[$row][$col] = array('align' => 'center',
                                          'params' => 'class="smallText" width="33%" valign="top"',
                                          'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $featured_products['products_image'], $featured_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . $featured_products['products_name'] . '</a><br><s>' . $currencies->display_price($featured_products['products_price'], tep_get_tax_rate($featured_products['products_tax_class_id'])) . '</s><br><span class="productSpecialPrice">' . 
                                          $currencies->display_price($featured_products['specials_new_products_price'], tep_get_tax_rate($featured_products['products_tax_class_id'])) . '</span>' . '<br><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=add_product&buy_now&products_id=' . $featured_products['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a>');
   } else {
     $info_box_contents[$row][$col] = array('align' => 'center',
                                          'params' => 'class="smallText" width="33%" valign="top"',
                                          'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $featured_products['products_image'], $featured_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . $featured_products['products_name'] . '</a><br>' . $currencies->display_price($featured_products['products_price'], tep_get_tax_rate($featured_products['products_tax_class_id'])) . '<br><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=add_product&buy_now&products_id=' . $featured_products['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a>');
   }


No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P


Support The Project
Documentation/Knowledgebase/Discussions
 

Share this post


Link to post
Share on other sites

Nope ... no change at all.

I see the code changes in the source .. but it does nothing different than the first code I tried. (above)

 

It goes to cart, but doesnt add the product to it.

 

Take a look at my WWW link ... the code is in place now.

Edited by ScooterProShop.com

Scooterboy

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
Sign in to follow this  

×