defender39 Posted January 21, 2004 Posted January 21, 2004 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 Quote
JonoB Posted January 21, 2004 Posted January 21, 2004 Nice one!! I was hoping that someone could improve on my version (1.4) by adding in more admin functionality. Quote
lbackmol Posted January 21, 2004 Posted January 21, 2004 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 Quote
lbackmol Posted January 21, 2004 Posted January 21, 2004 (edited) 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 January 21, 2004 by lbackmol Quote
defender39 Posted January 21, 2004 Author Posted January 21, 2004 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 Quote
defender39 Posted January 21, 2004 Author Posted January 21, 2004 it wants this file catalog/admin/includes/languages/Svenska/featured.php get it from here catalog/admin/includes/languages/English/featured.php Quote
lbackmol Posted January 21, 2004 Posted January 21, 2004 sorry my mistake . . I forgot to mention that this is done and translated. So it must another problem . . . /L Quote
241 Posted January 21, 2004 Posted January 21, 2004 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 Quote 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! Is your Osc dated try Phoenix raising oscommerce from the ashes.
c0rr0ded Posted January 22, 2004 Posted January 22, 2004 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 Quote
defender39 Posted January 22, 2004 Author Posted January 22, 2004 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 Quote
c0rr0ded Posted January 22, 2004 Posted January 22, 2004 no need to be so hard on yourself, it is still a good contib! Quote
ScooterProShop.com Posted January 24, 2004 Posted January 24, 2004 (edited) 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 January 24, 2004 by ScooterProShop.com Quote Scooterboy
241 Posted January 24, 2004 Posted January 24, 2004 (edited) 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 January 24, 2004 by 241 Quote 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! Is your Osc dated try Phoenix raising oscommerce from the ashes.
ScooterProShop.com Posted January 24, 2004 Posted January 24, 2004 (edited) What file do I add the code to and where ? Got the file: /includes/modules/featured.php Now where do I add it ? Edited January 24, 2004 by ScooterProShop.com Quote Scooterboy
241 Posted January 24, 2004 Posted January 24, 2004 (edited) 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 January 24, 2004 by 241 Quote 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! Is your Osc dated try Phoenix raising oscommerce from the ashes.
ScooterProShop.com Posted January 24, 2004 Posted January 24, 2004 (edited) 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 January 24, 2004 by ScooterProShop.com Quote Scooterboy
devosc Posted January 24, 2004 Posted January 24, 2004 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 Quote "Any fool can know. The point is to understand." -- Albert Einstein
241 Posted January 24, 2004 Posted January 24, 2004 (edited) 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 January 24, 2004 by 241 Quote 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! Is your Osc dated try Phoenix raising oscommerce from the ashes.
ScooterProShop.com Posted January 24, 2004 Posted January 24, 2004 (edited) 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 January 24, 2004 by ScooterProShop.com Quote Scooterboy
devosc Posted January 24, 2004 Posted January 24, 2004 Try changing $new_products['products_id'] to $featured_products['products_id'] in the above code. Quote "Any fool can know. The point is to understand." -- Albert Einstein
ScooterProShop.com Posted January 24, 2004 Posted January 24, 2004 (edited) 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 January 24, 2004 by ScooterProShop.com Quote Scooterboy
241 Posted January 24, 2004 Posted January 24, 2004 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 Quote 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! Is your Osc dated try Phoenix raising oscommerce from the ashes.
ScooterProShop.com Posted January 24, 2004 Posted January 24, 2004 (edited) 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 January 24, 2004 by ScooterProShop.com Quote Scooterboy
241 Posted January 24, 2004 Posted January 24, 2004 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>'); } Quote 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! Is your Osc dated try Phoenix raising oscommerce from the ashes.
ScooterProShop.com Posted January 24, 2004 Posted January 24, 2004 (edited) 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 January 24, 2004 by ScooterProShop.com Quote Scooterboy
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.