[RESOLU] Contribution Control New Products - Aide installation |
Bienvenue invité ( Connexion | Inscription )
[RESOLU] Contribution Control New Products - Aide installation |
1 Apr 2012, 22:57
Message
#1
|
|
Ceinture orange OSC Groupe : Membres Messages : 215 Inscrit : 25-February 08 Lieu : FRANCE Membre no 20931 |
Bonjour,
Je souhaiterais installer la contribution ci-dessous: http://www.oscommerce.com/community/contributions,3030 Elle permet, comme son nom l'indique, de controler la boxe nouveaux produits qui se situe en page d'acceuil des sites Osc. L'installation est relativement simple mais il y a quelques points qui ne sont pas clairs et j'aurais besoin de quelques éclaircissements. Dans le package on peut trouver plusieurs fichiers qui sont semble t-il pour ceux n'ayant jamais fais de modifications sur leur site Osc ce qui n'est pas mon cas. J'en suis donc venu à la conclusion qu'il fallait que je fasse les modifications à la main dans chaque fichiers seulement je trouve que le readme n'est pas clair. Il y a un fichier .sql il faut donc l'éxecuter via phpmyadmin mais dans le readme l'auteur dis de sauter cette étape si j'ai bien compris ??? Citation SKIP! Step 1 if you use the Contol_New_Products-sql.sql Then you can define EXPIRE_NEW_PRODUCTS in your admin shop in configuration/Control New Products [New products in..] De plus ensuite il semble expliquer encore une nouvelle méthode d'installation à la fin du readme ???? Bref je suis un perdu et je ne sais pas si il faut que je fasse la requête SQL ou non avec le fichier .sql ??? Si quelqu'un pouvait m'éclaircir les idées et me dire quelles sont les parties du readme qu'il faut que je fasse ou non. Je vous copie colle le readme ci-dessous: Merci à tous Code Thanks to zipper for the sql code that made life better and making a forum suggestion into a
contribution! This upgrade is based on his SQL code for calculating a cutoff date, but this contribution update uses the original new-products.php and completes the other half of the project, which is controlling what is shown in the New Products info box and the new products cutoff date when someone clicks on the new products info box. Also, there should not be any changes here that will not be compaitble with any other modifications you may have made to these files, since I am using the original osCommerce files, and have only made minor changes, maintaining the integrety of the original coding. After doing the modifications listed below, set EXPIRE_NEW_PRODUCTS to how many days you would like to keep your "new items" on the new item list. If you have no new items to list during the period you specify, the new items bars will not show, and the new items info box will not display. PLEASE BACK UP YOUR FILES BEFORE MAKING ANY CHANGES! I have included the updated catalog/includes/modules/new_products.php and catalog/products_new.php for those that have NOT modified either file, or wish to use a file-compare utility such as Beyond Compare to make changes. If you copy these files, don't forget to do Manual Installation, step 1, changes to catalog/includes/application_top.php. SKIP! Step 1 if you use the Contol_New_Products-sql.sql Then you can define EXPIRE_NEW_PRODUCTS in your admin shop in configuration/Control New Products [New products in..] Manual installation: #################################################### #Step 1: In catalog/includes/application_top.php # #################################################### add this: // how long before new products expire days define('EXPIRE_NEW_PRODUCTS', '60'); just before: // initialize the message stack for output messages require(DIR_WS_CLASSES . 'message_stack.php'); $messageStack = new messageStack; ############################################ #Step 2: catalog/products_new.php # ############################################ about line 53, look for: <?php $products_new_array = array(); $products_new_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added DESC, pd.products_name"; relpace the entire section with: <!-- New Product Expire //--> <?php $days = EXPIRE_NEW_PRODUCTS; $products_new_array = array(); $products_new_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_date_available, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_date_added > SUBDATE( now( ) , INTERVAL " . $days . " DAY ) and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added DESC, pd.products_name"; ?> <!-- New Product Expire_eof //--> <?php ########################################################## #Step 3: catalog/includes/modules/new_products.php # ########################################################## ***1. approx line 13 look for:**** <!-- new_products //--> <?php $info_box_contents = array(); $info_box_contents[] = array('text' => sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B'))); new contentBoxHeading($info_box_contents); if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) { $new_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where products_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS); } else { $new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as 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 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' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS); } ***Replace the *entire* section with: **** <!-- new_products //--> <!-- New Product Expire //--> <?php $days = EXPIRE_NEW_PRODUCTS; if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) { $check_products_query = tep_db_query("select count(products_id) as count from " . TABLE_PRODUCTS . " where products_status = '1' and products_date_added > SUBDATE( now( ) , INTERVAL " . $days . " DAY )"); } else { $check_products_query = tep_db_query("select count(p.products_id) as count from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . 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 = '" . $new_products_category_id . "' and p.products_status = '1' and products_date_added > SUBDATE( now( ) , INTERVAL " . $days . " DAY ) limit " . MAX_DISPLAY_NEW_PRODUCTS); } $check_new_products = tep_db_fetch_array($check_products_query); if ($check_new_products['count'] < "1") { echo "<br><!-- new_products_disabled //--><br>"; } else { ?> <!-- New Product Expire_eof //--> <?php $info_box_contents = array(); // $info_box_contents[] = array('text' => sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B'))); $info_box_contents[] = array('text' => sprintf(TABLE_HEADING_EXPIRE_NEW_PRODUCTS, strftime('%B'))); new contentBoxHeading($info_box_contents); if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) { ?> <!-- New Product Expire //--> <?php $new_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_date_added > SUBDATE( now( ) , INTERVAL " . $days . " DAY ) and p.products_status = '1' and products_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS); } else { $new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as 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 where p.products_date_added > SUBDATE( now( ) , INTERVAL " . $days . " DAY ) and p.products_status = '1' and 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' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS); } ?> <!-- New Product Expire_eof //--> <?php ***2. approox. line 42, look for: new contentBox($info_box_contents); right after this line, add: } #################################################### #Step 4: catalog/includes/boxes/whats_new.php # #################################################### about line 13, find if ($random_product = tep_random_select("select products_id, products_image, products_tax_class_id, products_price from " . TABLE_PRODUCTS . " where products_status = '1' order by products_date_added desc limit " . MAX_RANDOM_SELECT_NEW)) { and replace with: $days = EXPIRE_NEW_PRODUCTS; if ($random_product = tep_random_select("select products_id, products_image, products_tax_class_id, products_date_available, products_price from " . TABLE_PRODUCTS . " where products_date_added > SUBDATE( now( ) , INTERVAL " . $days . " DAY ) and products_status = '1' order by products_date_added desc limit " . MAX_RANDOM_SELECT_NEW)) { #################################################### #Step 5: catalog/includes/languages/danish.php # #################################################### add this: // Contol New Products define('TABLE_HEADING_EXPIRE_NEW_PRODUCTS', 'Nye produkter tilføjet de sidste ' . EXPIRE_NEW_PRODUCTS . ' dage.'); just before: ?> #################################################### #Step 5: catalog/includes/languages/english.php # #################################################### add this: // Contol New Products define('TABLE_HEADING_EXPIRE_NEW_PRODUCTS', 'New Products added within the last ' . EXPIRE_NEW_PRODUCTS . ' days.'); just before: ?> ******* Done. Enjoy. And, of course, you DID back up your files before making this modifications, DIDN'T YOU!! Any problems, email me at gsnell@ameriwebs.com. I'll do my best to help, BUT, as the contributions board so aptly states, use all contributions at your own risk! #################################################################### Control New Products module for 2.2-MS2 ----------------------------- By default, OsCommerce shows the latest added items as new items both on the startpage and on the category pages. The box says ex. "New products in May" wich might be the case if you added those items in May. But the default version of OsC does not handle when to remove these items from the "New products in.." box. If you are not frequently adding new items to your shop, this looks pretty dull after a while, since the same products lay there all the time. This Mod lets lets you choose for how long newly added items should be shown in the "New products in.." box on the frontpage. Default is 30 days, but it can be changed to that ever you like. See comments in new_products.php for more info. Installation of the script is very straightforward, but remember to BACKUP the relevant files before you change anything. Enjoy! Zipper - Sweden zipper@smartsite.nu Installation ------------------------------ Very simple, just make a backup copy of the file /catalog/includes/modules/new_products.php Copy the file new_products.php in this .zip file to /catalog/includes/modules/ Change the options available in your new new_products.php You are done! Changing the number of days and other alternatives. ------------------------------ See comments in new_products.php Ce message a été modifié par croco - 6 Apr 2012, 10:47. -------------------- OSCommerce Ms2 contrib : Easy Graphical Borders v1.1 FDP_panier 3.6.2 (Merci Bonbec) Quantity for Product Attributes Mod Header Tags SEO ATOS Sogenactif Ban Ip Multiorders specials enhanced v1.2.1 fr ImageS stock, affichage de l'état du stock via une image Reclamaposte |
|
Version bas débit | Nous sommes le : 28th March 2024 - 12:53 |
Ce site est déclaré auprès de la commision Nationale de l'Informatique et des Libertés (déclaration n°: 1043896) |