npn2531 Posted December 21, 2009 Posted December 21, 2009 This is a relatively easy way to dress up your category product listings with a mini description in the product name column. It also allows for adding some HTML to customize how it displays. You can see what it looks like here: http://www.niora.com/anti-aging-acne-care On what it looks like on a new install of OSCommerce here: http://adult-acne-product.com/catalog/index.php?cPath=3_10 1)Create a new field in products_description, I suggest 255 characters long ALTER TABLE `products_description` ADD `products_minidescp` LONGTEXT NOT NULL 2. Paste the following query into catalog/includes/modules/product_listings.php about line 85-90 (assuming a new install). Be sure to place it below the ' }' and above '$cur_row = sizeof($list_box_contents) - 1;' //BOF add a mini-description $pl_id = $listing['products_id']; $minidescp_query = tep_db_query("select products_id, products_minidescp from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" .$pl_id. "'"); $minidescp = tep_db_fetch_array($minidescp_query); $pl_minidescp = '<p>'.$minidescp['products_minidescp'].'</p>'; //EOF add a mini-description 3. A few lines below that add the variable $pl_minidescp at the end of this line: This line: $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a>'; is changed to this: $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a><br/>'.$pl_minidescp; 4. Manually enter your mini-descriptions into products_descriptions.products_minidescp ( A proper user interface in admin/categories.php might look it like a contribution ) Oscommerce site: OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120
Guest Posted December 21, 2009 Posted December 21, 2009 George, I believe the full contribution can be found here : http://addons.oscommerce.com/info/3123 Chris
npn2531 Posted December 21, 2009 Author Posted December 21, 2009 George, I believe the full contribution can be found here : http://addons.oscommerce.com/info/3123 Chris Jeebus, and it's been around since 05. It has the user interface, the hard part. This tip here has the advantage of being nothing more than a short bit of code added to one file and adding one field to one table, but you are going to have to be fine with adding data directly to the database to use this. Oscommerce site: OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120
Guest Posted December 21, 2009 Posted December 21, 2009 Well George, It is a good addition...........unfortunately someone thought of it 4 yrs ago. But, I am sure you will come up with something nobody else has sooner or later. Just joking with you. Tip: Check the add-ons section before starting a new contribution. Chris
npn2531 Posted December 21, 2009 Author Posted December 21, 2009 I had no notion of making a contribution out of this. It always fun to think about making a contribution, but I took one look at admin/categories.php and that notion went quickly by the wayside. Oscommerce site: OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120
spooks Posted December 30, 2009 Posted December 30, 2009 I had no notion of making a contribution out of this. It always fun to think about making a contribution, but I took one look at admin/categories.php and that notion went quickly by the wayside. But categories.php is a nice little file easy to mod!! I kid!!, I admit I cannot understand why it was made as it is, clearly it started out to edit categories, but then does products too, I think the two functions would be better done in seperate files. PS take care when adding queries in the listing, on a large shop or slow server too many queries can become an issue, its better to get the data for all displayed product with one query, instead of one query for every product. Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al.
npn2531 Posted December 31, 2009 Author Posted December 31, 2009 But categories.php is a nice little file easy to mod!! I kid!!, I admit I cannot understand why it was made as it is, clearly it started out to edit categories, but then does products too, I think the two functions would be better done in seperate files. PS take care when adding queries in the listing, on a large shop or slow server too many queries can become an issue, its better to get the data for all displayed product with one query, instead of one query for every product. Yes, I had to unfold the extra long page extension handles on Adobe Golive just to open categories.php. In regards to adding a new query on the listings page, it did feel redundant to add a new query on products_description as variables for the fields of the products_description table are floating around already. But I didn't find a query in or above product_listings.php I felt comfortable adding the new field products_minidescrip to. Oscommerce site: OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120
npn2531 Posted January 7, 2010 Author Posted January 7, 2010 Here is how you eliminate the query in product_listing.php, and make an easy way to add a mini-description even easier (the entire process follows): 1)Create a new field in products_description, I suggest 255 characters long, as before ALTER TABLE `products_description` ADD `products_minidescp` LONGTEXT NOT NULL Then manually add your product descriptions to the database. 2) on about line 153 in index.php change: case 'PRODUCT_LIST_NAME': $select_column_list .= 'pd.products_name, '; break; to this: case 'PRODUCT_LIST_NAME': $select_column_list .= 'pd.products_name, pd.products_minidescp, '; break; (you are adding the phrase ->pd.products_minidescp,) 3) On about line 103 in includes/modules/product_listing.php, change this: $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a>'; to this: $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a><br/>'. $listing['products_minidescp']; (You are adding-><br/>'. $listing['products_minidescp']; <- to the end of the line.) You can see it here: http://www.niora.com/anti-aging-acne-care or here on a new OSCommerce install: http://adult-acne-product.com/catalog/index.php?cPath=3_10 Oscommerce site: OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120
broadstreetbully Posted November 24, 2010 Posted November 24, 2010 Jeebus, and it's been around since 05. It has the user interface, the hard part. This tip here has the advantage of being nothing more than a short bit of code added to one file and adding one field to one table, but you are going to have to be fine with adding data directly to the database to use this. either this addon is out of date or written wrong...there's a piece of code that needs to be added onto another piece of code that is not in the file. I checked in the code editor, dreamweaver and coffee cup just to make certain I'm not losing my mind and it definitely is not there.....plus this has to be one of the longest-taking addons to install, not to mention adding to your database...skip this if you know what's good for you....
npn2531 Posted November 26, 2010 Author Posted November 26, 2010 See comment #8 for the correct way to add the mini description in 2.2RC2a. For 2.3 it is a little different and done like this: 1)Create a new field in products_description, I suggest 255 characters long, as before ALTER TABLE `products_description` ADD `products_minidescp` LONGTEXT NOT NULL Then type in your mini descriptions directly into the database. 2) on about line 121 in index.php change: case 'PRODUCT_LIST_NAME': $select_column_list .= 'pd.products_name, '; break; to this: case 'PRODUCT_LIST_NAME': $select_column_list .= 'pd.products_name, pd.products_minidescp, '; break; 3) finally in includes/modules/product_listing.php, change this: case 'PRODUCT_LIST_NAME': if (isset($HTTP_GET_VARS['manufacturers_id']) && tep_not_null($HTTP_GET_VARS['manufacturers_id'])) { $prod_list_contents .= ' <td><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a></td>'; } else { $prod_list_contents .= ' <td><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a></td>'; } to this: case 'PRODUCT_LIST_NAME': if (isset($HTTP_GET_VARS['manufacturers_id']) && tep_not_null($HTTP_GET_VARS['manufacturers_id'])) { $prod_list_contents .= ' <td><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a><br/>'. $listing['products_minidescp'].'</td>'; } else { $prod_list_contents .= ' <td><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a><br/>'. $listing['products_minidescp'].'</td>'; } Click the demo here to see what this looks like. http://www.niora.com/css-oscommerce.php Oscommerce site: OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120
StreamMan Posted December 26, 2010 Posted December 26, 2010 Hello, Can someone please explane step 1? I'm guessing it as something to to with phpmyAdmin? Thank you very much for the time you spend on explaing this to me.
♥kymation Posted December 26, 2010 Posted December 26, 2010 Step one has a minor error: longtext is 4 million characters, not 255. For a 255 character data field, use this: ALTER TABLE `products_description` ADD `products_minidescp` VARCHAR(255) NOT NULL Yes, you use phpMyAdmin. Just click on the SQL tab and paste that code in, then click Go. Regards Jim See my profile for a list of my addons and ways to get support.
pdcelec Posted January 3, 2011 Posted January 3, 2011 I added it to admin/categories.php, by searching for all occurrences of products_description and adding products_minidescp after it. Then add a new function by copying the tep_get_products_description to tep_get_products_minidescp
npn2531 Posted January 4, 2011 Author Posted January 4, 2011 I added it to admin/categories.php, by searching for all occurrences of products_description and adding products_minidescp after it. Then add a new function by copying the tep_get_products_description to tep_get_products_minidescp That's about the most succinct and clearest instructions I've heard for doing this. Thanks! Oscommerce site: OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120
Guldstrand Posted January 19, 2011 Posted January 19, 2011 Am I missing something here? :blink: I'm running osCommerce 2.3.1, and changed all the files, and added the field in the database. How is it intended that the new field should be used? Do you have to fill in the short description somewhere, or will this be retrieved from the original description? Sorry for any stupid questions. I am who I am, unfortunately.
npn2531 Posted January 19, 2011 Author Posted January 19, 2011 You have to fill out the short description directly into the database. The new field is empty and does not pull info from anywhere. You can do this if you are familiar with how to use phpMyAdmin. However, if you would rather fill in the field from the admin, see post #14 above. Oscommerce site: OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120
Guldstrand Posted January 19, 2011 Posted January 19, 2011 You have to fill out the short description directly into the database. The new field is empty and does not pull info from anywhere. You can do this if you are familiar with how to use phpMyAdmin. However, if you would rather fill in the field from the admin, see post #14 above. Now i understand much better. Many thanks for the explanation and for the quick reply. :D I am who I am, unfortunately.
♥14steve14 Posted February 2, 2011 Posted February 2, 2011 After all thesee posts i have to say this is a step back for oscommerce. What a lot of trouble to go through to get a short description. There is a contribution, that works with 2.3.1 which automatically uses the first 80 characters fron the product descriptions and add that as a short description. No messing with the databse at all, and you only need to add the information once. Simple to use and install. The contribution can be found HERE REMEMBER BACKUP, BACKUP AND BACKUP
Guldstrand Posted February 2, 2011 Posted February 2, 2011 After all thesee posts i have to say this is a step back for oscommerce. What a lot of trouble to go through to get a short description. There is a contribution, that works with 2.3.1 which automatically uses the first 80 characters fron the product descriptions and add that as a short description. No messing with the databse at all, and you only need to add the information once. Simple to use and install. The contribution can be found HERE Good to know! I'll try this instead. I am who I am, unfortunately.
RMD27 Posted February 19, 2011 Posted February 19, 2011 After all thesee posts i have to say this is a step back for oscommerce. What a lot of trouble to go through to get a short description. There is a contribution, that works with 2.3.1 which automatically uses the first 80 characters fron the product descriptions and add that as a short description. No messing with the databse at all, and you only need to add the information once. Simple to use and install. The contribution can be found HERE And if you want to add a short description that is different from the long description? This method on this thread is the way to go?
♥14steve14 Posted February 19, 2011 Posted February 19, 2011 And if you want to add a short description that is different from the long description? This method on this thread is the way to go? So you would sooner have to edit your database for every product description, even those products that you already have in your store, rather than use the first part of your product description that is already in your database. If you think that is the way to go, you go for it. I suppose its down to what you prefer, and i prefer not to have to do things twice for every product in my store. if you add the contribution that was mentioned, oscommerce automatically uses the first 80 characters (this can be altered) of your normal product description and adds a read more link that goes to the main product description. One description two jobs. REMEMBER BACKUP, BACKUP AND BACKUP
RMD27 Posted February 21, 2011 Posted February 21, 2011 So you would sooner have to edit your database for every product description, even those products that you already have in your store, rather than use the first part of your product description that is already in your database. If you think that is the way to go, you go for it. I suppose its down to what you prefer, and i prefer not to have to do things twice for every product in my store. if you add the contribution that was mentioned, oscommerce automatically uses the first 80 characters (this can be altered) of your normal product description and adds a read more link that goes to the main product description. One description two jobs. Hi I know what you mean, killing two birds with one stone so to speak, I was thinking along the lines of the mini description being incorporated into Easy Populate. That is the only way I would choose to manage the mini description. The outline given in this thread makes it seem easy to set up an extra field, but I don't know how easy it would be to incorporate it into Easy Populate.
RMD27 Posted February 22, 2011 Posted February 22, 2011 Hi I know what you mean, killing two birds with one stone so to speak, I was thinking along the lines of the mini description being incorporated into Easy Populate. That is the only way I would choose to manage the mini description. The outline given in this thread makes it seem easy to set up an extra field, but I don't know how easy it would be to incorporate it into Easy Populate. If anyone is interested I figured out that EP gives you the instructions on how to incorporate a new field like the one detailed in this thread, into its upload download function http://www.oscommerce.com/forums/topic/371245-this-product-will-be-in-stock-on-format/page__gopid__1567600#entry1567600
tapa Posted March 5, 2012 Posted March 5, 2012 For adding fields: Add More Fields -> http://addons.oscommerce.com/info/8073 Then easy edit "minidescription" in Administration->Catalog->Categories/Products .... Works with Easy Populate.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.