Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Addon} Modular Front Page


kymation

Recommended Posts

The left and right columns are not part of this Addon. Search the Addons section for banner boxes; I believe there is at least one.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Thanks kymation for all your help. I have managed to create an additional featured module named featured_two but have 2 issues.

 

1. When selecting Install Module i seem to get the following error:

 

Warning: include_once(includes/functions/modules/front_page/featured_two.php) [function.include-once]: failed to open stream: No such file or directory in C:\xampp\htdocs\oscommercenew\catalog\includes\modules\front_page\featured_two.php on line 39

Warning: include_once() [function.include]: Failed opening 'includes/functions/modules/front_page/featured_two.php' for inclusion (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\oscommercenew\catalog\includes\modules\front_page\featured_two.php on line 39

 

When i change this value to featured.php then i am able to install the module but cannot see any products but can see the title. Any ideas where i have gone wrong?

 

Thanks once again.

Link to comment
Share on other sites

You are right, that particular value should not be changed. Leave the function name as 'featured.php'. Then uninstall and reinstall your module.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

kymation, thanks for your response. I have unintalled and reinstalled the module but now when editing the module (Featured Products Two) I dont get the options of the featured products #1, featured products #2 etc... any ideas? sorry for troubling btw..

 

the following is the amended code that i have within modules:

 

<?php
/*
 $Id: featured_two.php v1.1.5 20110108 Kymation $
 Most of the execute() code is from the stock osCommerce New Products module

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

 Copyright (c) 2010 osCommerce

 Released under the GNU General Public License
*/

 class featured_two {
   var $code = 'featured_two';
   var $group = 'front_page';
   var $title;
   var $description;
   var $sort_order;
   var $enabled = false;
   var $count;
   // Set the number in the following line to the number of featured_two products desired.
   var $featured_products = 10;

   function featured_two() {
     global $PHP_SELF;

     $this->title = MODULE_FRONT_PAGE_FEATURED_TWO_TITLE;
     $this->description = MODULE_FRONT_PAGE_FEATURED_TWO_DESCRIPTION;

     if (defined('MODULE_FRONT_PAGE_FEATURED_TWO_STATUS')) {
       $this->sort_order = MODULE_FRONT_PAGE_FEATURED_TWO_SORT_ORDER;
       $this->enabled = (MODULE_FRONT_PAGE_FEATURED_TWO_STATUS == 'True');
       $this->count = MODULE_FRONT_PAGE_FEATURED_TWO_MAX_DISPLAY + 1;
     }

     // Include the function that is used to add products in the Admin
     if ($PHP_SELF == 'modules.php') {
       include_once (DIR_WS_FUNCTIONS . 'modules/front_page/featured.php');
     }
   }

   function execute() {
     global $oscTemplate, $languages_id, $currencies, $PHP_SELF, $cPath;

     if ($PHP_SELF == 'index.php' && $cPath == '') {
       // Set the text to display on the front page
       $featured_two__content = '<!-- Featured Products BOF -->' . "\n";
       if (MODULE_FRONT_PAGE_FEATURED_TWO_FRONT_TITLE != '') {
         $featured_two__content .= '  <h2>' . MODULE_FRONT_PAGE_FEATURED_TWO_FRONT_TITLE . '</h2>' . "\n";
       }
       $featured_two__content .= '  <div class="contentText">' . "\n";
       $featured_two__content .= '    <table border="0" width="100%" cellspacing="0" cellpadding="2">' . "\n";

       $col = 0;
       for ($id = 1; $id <= $this->featured_two_products; $id++) {
         $products_id = @ constant('MODULE_FRONT_PAGE_FEATURED_TWO_PRODUCT_' . $id);
         if ($products_id > 0) {
           $featured_two_products_query_raw = "
                       select
                         p.products_id,
                         pd.products_name,
                         p.products_price,
                         p.products_tax_class_id,
                         p.products_image,
                         s.specials_new_products_price,
                         s.status
                       from
                         " . TABLE_PRODUCTS . " p
                         join " . TABLE_PRODUCTS_DESCRIPTION . " pd
                           on pd.products_id = p.products_id
                         left join " . TABLE_SPECIALS . " s
                           on s.products_id = p.products_id
                       where
                         p.products_id = '" . $products_id . "'
                         and pd.language_id = '" . ( int ) $languages_id . "'
                     ";
           // print 'Featured Query: ' . $featured_two_products_query_raw . '<br />';
           $featured_two_products_query = tep_db_query($featured_two_products_query_raw);
           $featured_two_products = tep_db_fetch_array($featured_two_products_query);

           // Format the price for the correct currency
           if ($featured_two_products['status'] == 1) {
             $products_price = '<del>' . $currencies->display_price($featured_two_products['products_price'], tep_get_tax_rate($featured_two_products['products_tax_class_id'])) . '</del><br />';
             $products_price .= '<span class="productSpecialPrice">' . $currencies->display_price($featured_two_products['specials_new_products_price'], tep_get_tax_rate($featured_two_products['products_tax_class_id'])) . '</span>';
           } else {
             $products_price = $currencies->display_price($featured_two_products['products_price'], tep_get_tax_rate($featured_two_products['products_tax_class_id']));
           }

           if ($col == 0) {
             $featured_two__content .= '    <tr>' . "\n";
           }

           $width = (floor(100 / MODULE_FRONT_PAGE_FEATURED_TWO_COLUMNS));

           $featured_two__content .= '        <td width="' . $width . '%" align="center" valign="top">' . "\n";
           $featured_two__content .= '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_two_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $featured_two_products['products_image'], $featured_two_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br /><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_two_products['products_id']) . '">' . $featured_two_products['products_name'] . '</a><br />' . $products_price;
           $featured_two__content .= '</td>' . "\n";

           $col++;

           if ($col > (MODULE_FRONT_PAGE_FEATURED_TWO_COLUMNS - 1)) {
             $featured_two__content .= '    </tr>' . "\n";
             $col = 0;
           }
         }
       } // for( $id=1;

       $featured_two__content .= '    </table>' . "\n";
       ;
       $featured_two__content .= '  </div>' . "\n";
       $featured_two__content .= '<!-- New Products EOF -->' . "\n";

       $oscTemplate->addBlock($featured_two__content, $this->group);
     }
   } // function execute

   function isEnabled() {
     return $this->enabled;
   }

   function check() {
     return defined('MODULE_FRONT_PAGE_FEATURED_TWO_STATUS');
   }

   function install() {
     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_FRONT_PAGE_FEATURED_TWO_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");
     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Featured Products', 'MODULE_FRONT_PAGE_FEATURED_TWO_STATUS', 'True', 'Do you want to show the Featured box on the front page?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Title', 'MODULE_FRONT_PAGE_FEATURED_TWO_FRONT_TITLE', 'Featured Products', 'Title to show on the front page.', '6', '2', now())");
     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Max Featured Products', 'MODULE_FRONT_PAGE_FEATURED_TWO_MAX_DISPLAY', '6', 'How many featured_two products do you want to show?', '6', '3', now())");
     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Number of Columns', 'MODULE_FRONT_PAGE_FEATURED_TWO_COLUMNS', '3', 'Number of columns of products to show', '6', '4', now())");
     for ($id = 1; $id <= $this->featured_two_products; $id++) {
       tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Featured Product #" . $id . "', 'MODULE_FRONT_PAGE_FEATURED_TWO_PRODUCT_" . $id . "', '', 'Select featured_two product #" . $id . " to show', '6', '99', 'tep_cfg_pull_down_products(', now())");
     }
   }

   function remove() {
     tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
   }

   function keys() {
     $keys = array ();
     $keys[] = 'MODULE_FRONT_PAGE_FEATURED_TWO_STATUS';
     $keys[] = 'MODULE_FRONT_PAGE_FEATURED_TWO_SORT_ORDER';
     $keys[] = 'MODULE_FRONT_PAGE_FEATURED_TWO_FRONT_TITLE';
     $keys[] = 'MODULE_FRONT_PAGE_FEATURED_TWO_MAX_DISPLAY';
     $keys[] = 'MODULE_FRONT_PAGE_FEATURED_TWO_COLUMNS';

     for ($id = 1; $id <= $this->featured_two_products; $id++) {
       $keys[] = 'MODULE_FRONT_PAGE_FEATURED_TWO_PRODUCT_' . $id;
     }

     return $keys;
   }
 }

?>

Link to comment
Share on other sites

You may have messed up your database with previous installs. Search the configuration table for keys starting with MODULE_FRONT_PAGE_FEATURED_ and delete any duplicates.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

kymation, thanks for your response. I have checked the database and there are no duplicate keys within the configuration table. I have reinstalled both modules and reinstalled but 2nd still doesnt work. I'll try saving it down from the 1st version... thanks for your help btw, really appreciate it.

Link to comment
Share on other sites

Super Great Addon one of the best and easiest to install and use!

 

I do have 1 small problem with Text Main:

 

If I add simple text it will allow you to go back and edit the text.

 

If I add text with HTML the module will not let me go back and re exit the text. Gives this error message

Parse error: syntax error, unexpected T_STRING in /hermes/bosweb/web013/b138/nf.kg4ena/public_html/home/admin/modules.php(237) : eval()'d code on line 1

 

If I uninstall module and reinstall the module re-add the text and save it is ok. Other wise It is the best module ever.

 

Bob

Link to comment
Share on other sites

This is the same behavior as the stock TEXT_MAIN. You need to escape all single quotes/apostrophes by adding a backslash in front of them.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

  • 4 weeks later...

I have a fresh download and when I go to sign in and click "Install Module", I get an "Fatal error: Cannot redeclare class banner_rotator in /home/content/t/m/c/tmcjim/html/catalog/includes/modules/front_page/banner_rotator.php on line 13". What do I need to do?

Link to comment
Share on other sites

This usually means that you have uploaded a module file to the language directory. You need to put the files in the correct locations.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

This usually means that you have uploaded a module file to the language directory. You need to put the files in the correct locations.

 

Regards

Jim

Jim,

I took a look and the files look correct.

Would "2.2.4 Modified Files" "catalog/index.php (One edit near the bottom of the file)" have anything to do with it? I do not understand if this was something I had to modify?

Link to comment
Share on other sites

Yes, you need to modify your catalog/index.php or use the one supplied if yours is still stock. That has nothing to do with the error.

 

Do you have more than one language installed? If so, did you copy the English language files to the other language(s)? A missing language file is unlikely to be the problem, but it's possible. If that's not the case, then it has to be a module file in the wrong place.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

kymation, i finally managed to add more than one featured section so thanks for all your help. I just went through the original files and went through the steps of replacing the values (match case) and it worked! Appreciate all your help.

 

Had one more question, was wondering if it is possible to make some adjustments to the scroller i.e. add product name, add a line between products. Any suggestions on how i can do this would be really helpful.

 

Thanks

Link to comment
Share on other sites

To add a line between products, you could probably add a border to the right of each image in the CSS. Adding the product name would take modifications to the CSS, the scroller Javascript, and some PHP to retrieve the names. Not a simple task.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Hi

 

I have just installed this great addon, but getting the error below

 

any ideas for me ?

 

 

Fatal error: Call to undefined function tep_cfg_pull_down_products() in /home/jasonaus/public_html/shop/admin/modules.php(232) : eval()'d code on line 1

 

Warning: include_once(includes/functions/modules/front_page/featured.php) [function.include-once]: failed to open stream: No such file or directory in /home/jasonaus/public_html/shop/includes/modules/front_page/scroller.php on line 38

 

Warning: include_once() [function.include]: Failed opening 'includes/functions/modules/front_page/featured.php' for inclusion (include_path='.:/usr/local/php5/lib/php') in /home/jasonaus/public_html/shop/includes/modules/front_page/scroller.php on line 38

Link to comment
Share on other sites

The error message says that includes/functions/modules/front_page/featured.php is missing.

 

Regards

Jim

Hi

I checked through the install instructions, and could not find that reference, but i copied the files up to that folder anyway, and still got the same error,

 

I'll do it when i get back in and upload a screenshot

Link to comment
Share on other sites

The error message says that includes/functions/modules/front_page/featured.php is missing.

 

Regards

Jim

Hi

I checked through the install instructions, and could not find that reference, but i copied the files up to that folder anyway, and still got the same error,

 

I'll do it when i get back in and upload a screenshot

Link to comment
Share on other sites

See the User's Manual Appendix, section A.1. The stylesheet is marked /* Banner height */ where you need to make the changes (two places.)

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

See the User's Manual Appendix, section A.1. The stylesheet is marked /* Banner height */ where you need to make the changes (two places.)

 

Regards

Jim

 

Thanks Jim, i'll take a look and let you know whether I've managed to adjust the height.

 

Regards,

Yousef

Link to comment
Share on other sites

See the User's Manual Appendix, section A.1. The stylesheet is marked /* Banner height */ where you need to make the changes (two places.)

 

Regards

Jim

 

Thank you very much for your help. Very useful manual guide, height was adjusted within seconds.

 

Regards,

Yousef

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...