Josed Posted February 21, 2011 Share Posted February 21, 2011 (edited) This addon add a short description to the products, taken directly from the first 90 characters of the product's description, to display it in the main modules, products listing and page of the catalog: New Products in month.. module, main page and categories with sub-categories products listing of categories (without sub-categories) and manufacturers products listing of search results Products new page and Special page This addon is for the osCommerce version 2.3.1 Link to the addon: http://addons.oscommerce.com/info/7875 The short description is displayed below the product name and include at the end the "..." and a "read more" link. All can be customize in the stylesheet.css file, links colours, font,.. of the Product name, read more link and price. Screenshots: http://crearweb.cyberdream.es/en/ Regards, Jose Edited February 21, 2011 by Josed Quote Link to comment Share on other sites More sharing options...
AdrianOsc Posted February 23, 2011 Share Posted February 23, 2011 Estimado Josed He probado tu contribución y la misma además de funcionar muy bien, es realmente de gran utilidad. Muchas gracias por el aporte. Sucede que en mi caso, la descripción del producto la hago con el CKEditor, el cual además del texto pone las etiquetas de formato y se genera un inconveniente a la hora de tomar los 90 caracteres... Como ejemplo: Toma <p style="text-align: justify;"> <span style="font-family: lucida sans unicode,lucida gran en lugar de: Resumen: Este libro habla fundamentalmente de la interpretación de una carta infan De momento y mientras escribo esto se me ocurre como "solución precaria" cambiar el límite de 90 caracteres al total del campo y luego "limpiarlo" con la función strip_tags de PHP y recién ahí tomar los 90 caracteres... No es muy elegante pero funciona. He visto que hay una función para mysql y poder sacar limpio desde el vamos los 90 caracteres, pero es algo que se debe agregar y realmente no se ni donde ni como. Te dejo mi comentario como una inquietud, para futuras versiones. Saludos, Adrián.- Quote Link to comment Share on other sites More sharing options...
Josed Posted February 23, 2011 Author Share Posted February 23, 2011 Hola, puedes hacer lo siguiente, yo he puesto 190 en el siguiente ejemplo pero puedes adaptarlo a mas o menos caracteres segun necesites: en vez de usar: trim(substring(pd.products_description, 1, 90)) as products_description, usa esto: trim(substring(pd.products_description, 1, 190)) as products_description, y para la parte que muestra la descripción corta, en vez de usar: strip_tags($new_products['products_description']) usa esto: substr(strip_tags($new_products['products_description']), 0, 90) esto lo que hara es lo que indicas, seleccionara mas texto en la consulta de sql y luego mediante php se "recortara" de 190 a 90 caracteres, si vez que en todas las descripciones tienes el mismo numero de etiquetas html, unas 100 en este caso, entonces es facil hacerlo seleccionando 190 en vez de 90, si es mas puedes poner la cantidad que necesites, y esta parte con la modificacin substr(strip_tags($new_products['products_description']), 0, 90) reducira siempre la descripcion corta a 90. Ten en cuenta que este ultimo codigo cambia segun el archivo, en este caso es para el modulo central de Nuevos productos en me.. catalog/includes/modules/new_products.php, que utiliza $new_products, en el paso 4 y 5 de las instrucciones, luego para el listado de productos es $listing, el paso 7 substr(strip_tags($listing['products_description']), 0, 90) para el paso 9 que es el de las paginas de ofertas es $specials; substr(strip_tags($specials['products_description']), 0, 90) y para el paso 10 de la pagina de novedades es $products_new. substr(strip_tags($products_new['products_description']), 0, 90) Lo que tiene esto es que selecciona mas texto en la consulta a la base de datos, en este momento no se si hay posibilidad de hacer esto directamente solo con la consulta sql para que seleccione 90 caracteres sin incluir etiquetas html, pero asi vale tambien. un saludo Lo traduzco al ingles tambien, por si alguien tiene la misma duda. In english: ----------- In the case of use a wysiwyg editor and/or add html tags in the products description this addon will show less characteres in the short description cause the strip_tags strip HTML and PHP tags from the products description a possible solution to this is increse the amount of characters in the sql select (the increment of characters will depend of the usual number of characters created by the html tags you use in the begin of the product description) if it were 100 then change this code from the install instructions: trim(substring(pd.products_description, 1, 90)) as products_description, by this: trim(substring(pd.products_description, 1, 190)) as products_description, (change 190 by other number of characters depending of your needed) and then, this other code of the step 4 and 5: strip_tags($new_products['products_description']) replace it by this: substr(strip_tags($new_products['products_description']), 0, 90) notice that piece of code is different in each file, for the product listing change in $new_products by this $listing, so the change in the install instructions for the step 7 would be: substr(strip_tags($listing['products_description']), 0, 90) for the step 9: substr(strip_tags($specials['products_description']), 0, 90) and for the step 10: substr(strip_tags($products_new['products_description']), 0, 90) This will show the same number of characters for all short descriptions. regards Quote Link to comment Share on other sites More sharing options...
AdrianOsc Posted February 24, 2011 Share Posted February 24, 2011 Estimado Josed Exacto! Es eso lo que hice... Yo puse 250 y quedo perfecto. Ah! En la parte que muestra al descripción no es necesario modificar nada. Pues el strip_tags() se encarga de dejar solo texto sin etiquetas. Muchas garcias. Saludos Adrián Quote Link to comment Share on other sites More sharing options...
pabyford Posted March 9, 2011 Share Posted March 9, 2011 (edited) Sorry, disregard, I didn't read the entire posts above, I assumed it was in Spanish only. Edited March 9, 2011 by pabyford Quote Link to comment Share on other sites More sharing options...
Tolcar Posted April 7, 2011 Share Posted April 7, 2011 Hola Josed Gracias por "Simple Products Short Description for 2.3.x" Lo he instalado y funciona perfecto, Me gustaria saber si es posible que en la descripcion del listado de los productos se pudiera activar de alguna manera el editor "ckeditor" para poder incluir un link a cada producto, en mi caso camciones en MP3, de manera que el link abriera un player y tocara la cancion sin tener que entrar en el producto "read more" para escuchar. Hay alguna manera simple de hacer esto?? Mucha Gracias ------------------ English ------------------------ Hi Josed Thank you for "Simple Products Short Description for 2.3.x" I have installed it and works great, I’d like to ask you, is it possible to have html active in the Short Description of the product listing? I’m using "ckeditor" to make the descriptions and to include a Mp3 player that would play a track when you click in the product or “Read more...” link. But the idea is to have an active link with each product so you can preview the music in the product listing without having to click the read more... to preview the tracks. Is here any simple way of doing this? Thanks Quote Link to comment Share on other sites More sharing options...
lazygun Posted September 1, 2011 Share Posted September 1, 2011 Hi, I have installed this addon and most of it works fine. However, it seems the new css items in stylesheet.css are getting ignored in my shop. Therefore the title of an article is not distinguishable from the description. I am running OSC2.3.1 with a couple of addons like "CKEditor", "Prices for logged in users only v5" and some of the security improvements. I also have created a custom jquery theme. Any idea where to look? Kind regards LazyGun Quote Link to comment Share on other sites More sharing options...
sexyglamour Posted December 5, 2011 Share Posted December 5, 2011 Hola Josed, he puesto a funcionar la contribución y es fantastica, ya que oscommerce peca de poco texto, pero donde más me interesa que es en la index, no me aparece ya que tengo la contribución front page y tener mayor control sobre la presentación de la tienda. Agradecería una ayuda para las modificaciones oportunas en el includes/modules/front_page/featured.php Imagino que no os es desconocido. Gracias de antemano. Juan. Quote Link to comment Share on other sites More sharing options...
hellboy084 Posted December 31, 2011 Share Posted December 31, 2011 Hola Josed, Excelente tu addon, es justo lo que estaba buscando, pero quiziera hacerte una consulta como puedo hacer para que la descripcion aparezca con todos los atributos html, ya que el texto me aparece todo seguido. Feliz Año Nuevo!!! Quote Link to comment Share on other sites More sharing options...
MishaB Posted January 12, 2012 Share Posted January 12, 2012 Hi Jose, many thanks for the great Add-On. In theory it works very good for me (especially at the New Product of the month site) However, not on the product listing page itself, because I also modified my shop to show the product listing in columns (this Add-On: http://addons.oscommerce.com/info/7696) Actually this is pretty similar to the design of the new product of the month site, so what piece of code do I need to change? I guess for somebody with coding experience like you, this is a piece of cake, but I am absolutely new to this and can just do copy /paste ... ;-) Hope somebody can help me ...? Many thanks, Misha Quote Link to comment Share on other sites More sharing options...
MishaB Posted January 14, 2012 Share Posted January 14, 2012 (edited) Hi Jose, many thanks for the great Add-On. In theory it works very good for me (especially at the New Product of the month site) However, not on the product listing page itself, because I also modified my shop to show the product listing in columns (this Add-On: http://addons.oscommerce.com/info/7696) Actually this is pretty similar to the design of the new product of the month site, so what piece of code do I need to change? I guess for somebody with coding experience like you, this is a piece of cake, but I am absolutely new to this and can just do copy /paste ... ;-) Hope somebody can help me ...? Many thanks, Misha Nevermind. Fixed it myself. Just changed a little bit here and there in the product_listing.php. Thanks! Edited January 14, 2012 by MishaB Quote Link to comment Share on other sites More sharing options...
Guest Posted March 2, 2012 Share Posted March 2, 2012 Hola Josed. Primero agradecerte por tu add, me ha sido de mucha ayuda. Ahora, mi consulta puntual es: He instalado en el add Optional Related products. http://addons.oscommerce.com/info/8057/v,23 No se como instalar tu add en el modulo que tiene el siguiente codigo <?php /* $Id: optional_related_products.php, ver 1.0 02/05/2007 Exp $ Copyright (c) 2007 Anita Cross (http://www.callofthewildphoto.com/) Part of Contribution: Optional Related Products Ver 4.0 Based on code from Optional Relate Products, ver 2.0 05/01/2005 Copyright (c) 2004-2005 Daniel Bahna ([email protected]) osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Released under the GNU General Public License */ $orderBy = 'ORDER BY '; $orderBy .= (RELATED_PRODUCTS_RANDOMIZE)?'rand()':'pop_order_id, pop_id'; $orderBy .= (RELATED_PRODUCTS_MAX_DISP)?' limit ' . RELATED_PRODUCTS_MAX_DISP:''; $attributes = " SELECT pop_products_id_slave, products_name, products_model, products_price, products_quantity, products_tax_class_id, products_image FROM " . TABLE_PRODUCTS_RELATED_PRODUCTS . ", " . TABLE_PRODUCTS_DESCRIPTION . " pa, ". TABLE_PRODUCTS . " pb WHERE pop_products_id_slave = pa.products_id AND pa.products_id = pb.products_id AND language_id = '" . (int)$languages_id . "' AND pop_products_id_master = '".$HTTP_GET_VARS['products_id']."' AND products_status='1' " . $orderBy; $attribute_query = tep_db_query($attributes); if (mysql_num_rows($attribute_query)>0) { $count = 0; ?> <tr> <td> <table class="productlisting-related" border="0" cellspacing="0" cellpadding="2" width="100%"> <tr> <td align="" class="productListing-related-heading"> <?php echo TEXT_RELATED_PRODUCTS ?> </td> </tr><tr> <td align="center" class="productListing-related-geral"> <table border="0" cellspacing="3" cellpadding="2" width="100%" align="center"> <tr> <?php while ($attributes_values = tep_db_fetch_array($attribute_query)) { $products_name_slave = ($attributes_values['products_name']); $products_model_slave = ($attributes_values['products_model']); $products_qty_slave = ($attributes_values['products_quantity']); $products_id_slave = ($attributes_values['pop_products_id_slave']); if ($new_price = tep_get_products_special_price($products_id_slave)) { $products_price_slave = $currencies->display_price($new_price, tep_get_tax_rate($attributes_values['products_tax_class_id'])); } else { $products_price_slave = $currencies->display_price($attributes_values['products_price'], tep_get_tax_rate($attributes_values['products_tax_class_id'])); } echo '<td class="productListing-related-data" valign="top" align="center">' . "\n"; // show thumb image if Enabled if (RELATED_PRODUCTS_SHOW_THUMBS == 'True') { echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_id_slave) . '">' . "\n" . tep_image(DIR_WS_IMAGES . $attributes_values['products_image'], $attributes_values['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"').'</a><br><br><br>' . "\n"; } $caption = ''; if (RELATED_PRODUCTS_SHOW_NAME == 'True') { $caption .= '<p>' . $products_name_slave; if (RELATED_PRODUCTS_SHOW_MODEL == 'True') { $caption .= sprintf(RELATED_PRODUCTS_MODEL_COMBO, $products_model_slave); } $caption .= '</p>' . "\n"; } elseif (RELATED_PRODUCTS_SHOW_MODEL == 'True') { $caption .= '<p>' . $products_model_slave . '</p>' . "\n"; } if (RELATED_PRODUCTS_SHOW_PRICE == 'True') { $caption .= '<p>' . sprintf(RELATED_PRODUCTS_PRICE_TEXT, $products_price_slave) . '</p>' . "\n"; } if (RELATED_PRODUCTS_SHOW_QUANTITY == 'True') { $caption .= '<p>' . sprintf(RELATED_PRODUCTS_QUANTITY_TEXT, $products_qty_slave) . '</p>' . "\n"; } echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_id_slave) . '">' . $caption . '</a>' . "\n"; if (RELATED_PRODUCTS_SHOW_BUY_NOW== 'True') { echo '<div class="boton-related"><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=rp_buy_now&rp_products_id=' . $products_id_slave) . '">' . tep_image_button('button_rp_buy_now.png', IMAGE_BUTTON_RP_BUY_NOW) . '</a></div>'; } echo '</td>' . "\n"; $count++; if ((RELATED_PRODUCTS_USE_ROWS == 'True') && ($count%RELATED_PRODUCTS_PER_ROW == 0)) { echo '</tr><tr>' . "\n"; } } ?> </tr></table> </td> </tr></table> </td> </tr> <?php } ?> Gracias de ante mano. Saludos, Quote Link to comment Share on other sites More sharing options...
Guest Posted March 4, 2012 Share Posted March 4, 2012 alguna idea? Quote Link to comment Share on other sites More sharing options...
paddyK Posted March 19, 2012 Share Posted March 19, 2012 Hello i installed the addon simple product short description for 2.3.x. I can not find where i went wrong. when i go to my live site. www.alaaniclothing.com i only get this message. (Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/shebafas/public_html/includes/modules/new_products.php on line 33) Please help i can't find whats wrong Paddyk Quote Link to comment Share on other sites More sharing options...
Guest Posted March 20, 2012 Share Posted March 20, 2012 Paddyk, very nice your site. Quote Link to comment Share on other sites More sharing options...
♥14steve14 Posted June 29, 2012 Share Posted June 29, 2012 I have just installed this addon and am receiving the following error when i turn error reporting to error_reporting(E_ALL & ~E_STRICT); PHP Warning: strip_tags() expects parameter 1 to be string, array given in includes/modules/product_listing.php on line 115 Part of line 115 is . strip_tags($description['products_description']) . Whilst i appreciate that this works with the error suppressed, surely i should not be getting the error in the first place.Does anyone have an answer hoew to remove this error without diabling error reporting. Quote REMEMBER BACKUP, BACKUP AND BACKUP Link to comment Share on other sites More sharing options...
multimixer Posted June 29, 2012 Share Posted June 29, 2012 PHP Warning: strip_tags() expects parameter 1 to be string, array given in includes/modules/product_listing.php on line 115 Solutions and explanation here Quote My community profile | Template system for osCommerce - New: Responsive | Feedback channel Link to comment Share on other sites More sharing options...
♥14steve14 Posted June 29, 2012 Share Posted June 29, 2012 Cheers George just noticed that and posted a reply just after. Quote REMEMBER BACKUP, BACKUP AND BACKUP Link to comment Share on other sites More sharing options...
madbusu Posted March 8, 2013 Share Posted March 8, 2013 wow love it ty very much for this , it's just what i need (w00t) Quote Link to comment Share on other sites More sharing options...
Fusion616 Posted April 29, 2014 Share Posted April 29, 2014 Hi .. I'm loving this addon. In the product_listing.php I have been able to display the product name with the manufacturer name underneath that. I would like to do the same on the New Product results as well but haven't been able to work that bit out yet. Obviously it requires the manufacturers id to be established and for that to be used to read the relevant database table but I'm still pretty new to PHP and not totally sure how to acheive this. Is there an easy way to make this happen? TIA Quote Link to comment Share on other sites More sharing options...
Fusion616 Posted April 29, 2014 Share Posted April 29, 2014 No worries ... someone pointed me to a contribution for v2.2 and I have sussed out the changes required to make it work in v2.3.3.4 :) 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.
Note: Your post will require moderator approval before it will be visible.