Dennisra Posted September 29, 2017 Share Posted September 29, 2017 I would like to display the store specials on the center column of the main page much like the new products are. Can anyone suggest a simply or the best add-on to accomplish this. I have looked but none of the add-ons seem to fit the bill. I may be missing something however. Thank you for your help. osCommerce Online Merchant v2.3.4 Responsive PHP version: 5.6.31 (Zend: 2.6.0) MySQL 5.6.37-log Quote Link to comment Share on other sites More sharing options...
frankl Posted September 29, 2017 Share Posted September 29, 2017 It would be simple to copy the new products module but have it show specials instead. Have a go, if you get stuck I can help. Dennisra 1 Quote osCommerce user since 2003! Link to comment Share on other sites More sharing options...
Dennisra Posted September 30, 2017 Author Share Posted September 30, 2017 I found this. Tried for a couple hours but it does not work for me. Any tips that might help. Posted September 2, 2014 by GLWalker Here's a super easy special module that follows the same layout as the new products module. Im going to post the code here and let you put it together! It is so similar to the new products module, some may swear I just copied it and just changes 3 things! Maybe I did, maybe I didn't, maybe I used copy and paste, maybe I typed it all out. You will NEVER know. Step 1) Navigate to your catalog/includes/modules/ directory. Create a new .php file and name it specials.php Step 2) Open the new file and paste this inside: <?php /* $Id$ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2014 osCommerce Released under the GNU General Public License */ if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) { $special_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, pd.products_name, products_price, if(s.status, s.specials_new_products_price, p.products_price) as products_special_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS); } else { $special_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name, products_price, if(s.status, s.specials_new_products_price, p.products_price) as products_special_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS); } $num_special_products = tep_db_num_rows($special_products_query); if ($num_special_products > 0) { $special_prods_content = NULL; while ($special_products = tep_db_fetch_array($special_products_query)) { $special_prods_content .= '<div class="col-sm-6 col-md-4">'; $special_prods_content .= ' <div class="thumbnail">'; $special_prods_content .= ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $special_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $special_products['products_image'], $special_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>'; $special_prods_content .= ' <div class="caption">'; $special_prods_content .= ' <p class="text-center"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $special_products['products_id']) . '">' . $special_products['products_name'] . '</a></p>'; $special_prods_content .= ' <hr>'; $special_prods_content .= ' <p class="text-center text-danger"><del class="text-muted">' . $currencies->display_price($special_products['products_price'], tep_get_tax_rate($special_products['products_tax_class_id'])) . '</del><br>' . $currencies->display_price($special_products['products_special_price'], tep_get_tax_rate($special_products['products_tax_class_id'])) . '</p>'; $special_prods_content .= ' <div class="text-center">'; $special_prods_content .= ' <div class="btn-group">'; $special_prods_content .= ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'products_id=' . $special_products['products_id']) . '" class="btn btn-default" role="button">' . SMALL_IMAGE_BUTTON_VIEW . '</a>'; $special_prods_content .= ' <a href="' . tep_href_link($PHP_SELF, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $special_products['products_id']) . '" class="btn btn-success" role="button">' . SMALL_IMAGE_BUTTON_BUY . '</a>'; $special_prods_content .= ' </div>'; $special_prods_content .= ' </div>'; $special_prods_content .= ' </div>'; $special_prods_content .= ' </div>'; $special_prods_content .= '</div>'; } ?> <h3><?php echo sprintf(TABLE_HEADING_SPECIAL_PRODUCTS, strftime('%B')); ?></h3> <div class="row"> <?php echo $special_prods_content; ?> </div> <?php } ?> Step 3) Open catalog/index.php Find in 2 areas: <?php include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); ?> Depending what order you want to show the specials paste this in before or after the above: <?php include(DIR_WS_MODULES . 'specials.php'); ?> Step 4) Open catalog/includes/languages/* / index.php Add this line where ever you feel like: define('TABLE_HEADING_SPECIAL_PRODUCTS', '%s Specials!'); Done! Usage: If you want to limit the products that show, inside includes/modules/specials.php change MAX_DISPLAY_NEW_PRODUCTS to any number desired. Quote Link to comment Share on other sites More sharing options...
frankl Posted September 30, 2017 Share Posted September 30, 2017 (edited) What errors are you getting? Best to let me know how old your version of osCommerce Online Merchant v2.3.4 Responsive is. Edited September 30, 2017 by frankl Quote osCommerce user since 2003! Link to comment Share on other sites More sharing options...
Dennisra Posted September 30, 2017 Author Share Posted September 30, 2017 No error. Just no content on index page. New about July 2016. Quote Link to comment Share on other sites More sharing options...
Omar_one Posted September 30, 2017 Share Posted September 30, 2017 (edited) @Dennisra add this <?php include(DIR_WS_MODULES . 'specials.php'); ?> after <?php echo $oscTemplate->getContent('index'); ?> and if you got error like this 1327 - Undeclared variable: MAX_DISPLAY_NEW_PRODUCTS thats mean on the page you request, the variable MAX_DISPLAY_NEW_PRODUCTS is not defined. It should be present in the configuration table. INSERT INTO `configuration` (`configuration_id`, `configuration_title`, `configuration_key`, `configuration_value`, `configuration_description`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`) VALUES (9999, 'New Products Module', 'MAX_DISPLAY_NEW_PRODUCTS', '9', 'Maximum number of specials products to display in a category', 3, 5, NULL, '2017-09-30 07:18:08', NULL, NULL); Edited September 30, 2017 by Omar_one Quote Get the latest Responsive osCommerce CE (community edition) here . Link to comment Share on other sites More sharing options...
Omar_one Posted September 30, 2017 Share Posted September 30, 2017 @demnia in your specials.php your are using MAX_DISPLAY_NEW_PRODUCTS so thats mean that you will use configuration whats belong to new products for specials products Omar Quote Get the latest Responsive osCommerce CE (community edition) here . Link to comment Share on other sites More sharing options...
Omar_one Posted September 30, 2017 Share Posted September 30, 2017 (edited) After disable the New Products Module Edited September 30, 2017 by Omar_one Quote Get the latest Responsive osCommerce CE (community edition) here . Link to comment Share on other sites More sharing options...
burt Posted September 30, 2017 Share Posted September 30, 2017 You can't use 3 years old blog post exactly...codebase has changed so much since then...and the index page is now modular...so your specials thing needs to be a module. Take the idea of that blog post, but not the code. You need to make a module. A module consists of (usually) three files; the module itself the modules template file the modules language file So, take the new products module as a base...and by trial and error learn some code from it. It's important that all shopowners know enough code to be dangerous... /includes/modules/content/index/cm_i_new_products.php /includes/modules/content/index/templates/new_products.php /includes/languages/english/modules/content/index/cm_i_new_products.php You need to copy each. Rename each. Open each, change each appropriately. Save, upload, install. Forget. Dennisra and douglaswalker 2 Quote Link to comment Share on other sites More sharing options...
Omar_one Posted September 30, 2017 Share Posted September 30, 2017 @burt a few months ago I tried to make it as module and it was shown well but there was no price its show 0 I will see is I still have the files and post it here if some one can fix it Omar Dennisra 1 Quote Get the latest Responsive osCommerce CE (community edition) here . Link to comment Share on other sites More sharing options...
Omar_one Posted September 30, 2017 Share Posted September 30, 2017 @burt @Dennisra @frankl I didn't find the old files so I create new one Special Products Content Module(BS) and it working well Omar burt and Dennisra 2 Quote Get the latest Responsive osCommerce CE (community edition) here . Link to comment Share on other sites More sharing options...
Dennisra Posted October 1, 2017 Author Share Posted October 1, 2017 Excellent Omar_one. It works like a charm!! One question: Should there be a file "specials.php in //includes/modules as I get this error on each category display page: Warning: include(includes/modules/specials.php): failed to open stream: No such file or directory in /usr/local/www/index.php on line 214Warning: include(): Failed opening 'includes/modules/specials.php' for inclusion (include_path='.:/usr/local/share/pear') in /usr/local/www/index.php on line 214 Thank you again! Quote Link to comment Share on other sites More sharing options...
Omar_one Posted October 1, 2017 Share Posted October 1, 2017 @Dennisra the specials.php file no need for it anymore. Do you still have this code in the index.php. <?php include(DIR_WS_MODULES . 'specials.php'); ?> If it is there remove it from there .. Omar Dennisra 1 Quote Get the latest Responsive osCommerce CE (community edition) here . Link to comment Share on other sites More sharing options...
Dennisra Posted October 1, 2017 Author Share Posted October 1, 2017 YOmar: Yes, it was still there. I removed it and all is well. Thank you very much. I appreciate your help! Dennis Quote Link to comment Share on other sites More sharing options...
Omar_one Posted October 1, 2017 Share Posted October 1, 2017 (edited) @Dennisra You are welcome Edited October 1, 2017 by Omar_one Quote Get the latest Responsive osCommerce CE (community edition) here . Link to comment Share on other sites More sharing options...
Dennisra Posted October 4, 2017 Author Share Posted October 4, 2017 This is really a good add-on. If you have specials a must have: https://apps.oscommerce.com/JNkw9 Quote Link to comment Share on other sites More sharing options...
Omar_one Posted October 4, 2017 Share Posted October 4, 2017 I am sure it will keep sales up during slower seasons Omar Quote Get the latest Responsive osCommerce CE (community edition) here . Link to comment Share on other sites More sharing options...
Omar_one Posted October 8, 2017 Share Posted October 8, 2017 @Dennisra New update - Add Ribbon to Special products box - Change the Special products price font color. Omar Quote Get the latest Responsive osCommerce CE (community edition) here . Link to comment Share on other sites More sharing options...
Omar_one Posted October 8, 2017 Share Posted October 8, 2017 @Dennisra New update just clean the code Special Products Content Module(BS) Omar Dennisra 1 Quote Get the latest Responsive osCommerce CE (community edition) here . Link to comment Share on other sites More sharing options...
Dennisra Posted October 8, 2017 Author Share Posted October 8, 2017 I just installed this (update) and it works great!! I had to put the css code at the top of the file user.css to get it to work in Chrome but other than that no problem. Looks good in Firefox, IE and Chrome. Nice addition. Thank you very much!! Dennis Quote Link to comment Share on other sites More sharing options...
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.