Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Description in Product Listing MS2 v.2.3


Guest

Recommended Posts

Original author: Paul Crovella <[email protected]>

 

Have added a modified version of this mod with replaced files from MS2 with the hack marked in the files.

 

Tried the best i could to make a nice and easy to follow install.txt

 

Added the optional new products of the current month addition.

 

Works perfectly on my shop and some testers would be cool to verify this contribution works ok in MS2.

 

http://www.oscommerce.com/community/contributions,1375

 

PS

Trying to get the short description in the new products (whats new list) would have to alter how it currently looks.

If i can do it ill release that too.

Link to comment
Share on other sites

  • Replies 84
  • Created
  • Last Reply

Top Posters In This Topic

I tried installing your older contribution for ms1, and I can't seem to get it to work?

 

the descriptions still don't show up:

 

http://www.plaksmacker.com/catalog/default...lt.php?cPath=35

 

Any ideas why this would happen?

Assault

If you want to find it you'll have to google "Assault T-Shirts" because posting my damn url in my signature is against the forum rules.

T-Shirts with an edge

Powered by OSCommerce + about 20 different custom addons and some Wordpress

Link to comment
Share on other sites

I tried installing your older contribution for ms1, and I can't seem to get it to work?

 

the descriptions still don't show up:

 

http://www.plaksmacker.com/catalog/default...lt.php?cPath=35

 

Any ideas why this would happen?

 

This mod of this thread is for the MS2 version only.

 

If you are using this "Description in Product Listing Hack MS2 v.2.3" then i dont think it will work with MS1.

 

If your using the Description in Product Listing Mod based on the 9/1 snapshot then i guess you on the right.

 

Biggest problem i often hear is in the catalog/includes/modules/product_listing.php

Can be tricky installing the mod here. So if you have the MS1 mod ide double check everything.

 

Also dont forget to add this to /catalog/includes/functions/general.php

 

////

// Return a product's description

// TABLES: products description

function tep_get_products_description($product_id) {

global $languages_id;

 

$product_query = tep_db_query("select products_description from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . $product_id . "' and language_id = '" . $languages_id . "'");

$product_description = tep_db_fetch_array($product_query);

 

return $product_description['products_description'];

}

Link to comment
Share on other sites

Sorry for posting in this forum, I have ms1, and I'm using the ms1 contrib. I'll double check and post back somewhere else.

Assault

If you want to find it you'll have to google "Assault T-Shirts" because posting my damn url in my signature is against the forum rules.

T-Shirts with an edge

Powered by OSCommerce + about 20 different custom addons and some Wordpress

Link to comment
Share on other sites

New update avalable:

 

http://www.oscommerce.com/community/contributions,1375

 

Forgot to add a function definition in /catalog/includes/functions/general.php

 

You must also add:

 

// ################### Products Description Hack begins ##############

//

// grabs a length from a string, but goes back to the last space if it cut into

// the middle of a string.  If the string is longer than that, cut, then add '...'

// to the end of the string, if the $more == 1

function osc_trunc_string($str="",$len=150,$more=1)

{

 if ($str=="") return $str;

 if (is_array($str)) return $str;

 $str = trim($str);

 // if it's les than the size given, then return it

 if (strlen($str) <= $len) return $str;

 // else get that size of text

 $str = substr($str,0,$len);

 // backtrack to the end of a word

 if ($str != "") {

	 // check to see if there are any spaces left

	 if (!substr_count($str," ")) {

   if ($more) $str .= "...";

   return $str;

	 }

	 // backtrack

	 while(strlen($str) && ($str[strlen($str)-1] != " ")) {

   $str = substr($str,0,-1);

	 }

	 $str = substr($str,0,-1);

	 if ($more) $str .= "...";

 }

 return $str;

}

// ########### Products Description Hack ends #############

 

If you get any errors look in /catalog/includes/functions/general.example.php to see how its inserted.

Link to comment
Share on other sites

  • 2 weeks later...

Hey Illicious. Can you help me? I have tried so many times to install this contribution but have never got it to work. I have used beyond compare to change the files but end up with this error message.

 

1064 - You have an error in your SQL syntax near '.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(' at line 1



select pd.products_name, m.manufacturers_name, p.products_quantity, p.products_model, pd.products_description p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from products_description pd, products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id, products_to_categories p2c left join specials s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '1' and p2c.categories_id = '31' order by pd.products_name limit 0, 20



[TEP STOP]

 

Can you help?

Link to comment
Share on other sites

Hey Illicious. Can you help me? I have tried so many times to install this contribution but have never got it to work. I have used beyond compare to change the files but end up with this error message.

 

1064 - You have an error in your SQL syntax near '.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(' at line 1



select pd.products_name, m.manufacturers_name, p.products_quantity, p.products_model, pd.products_description p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from products_description pd, products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id, products_to_categories p2c left join specials s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '1' and p2c.categories_id = '31' order by pd.products_name limit 0, 20



[TEP STOP]

 

Can you help?

Link to comment
Share on other sites

Try installing the contribution without replaceing the files.

 

If you are using Milestone 2, added the SQL info to your database and followed the install.txt i dont see why you would get them errors. Ill need some more info on where the error may be.

 

Try installing it again starting from the admin side and after each files edit/install see if theres still any errors.

 

You should be able to pin down where they coming from.

Link to comment
Share on other sites

the trunc'd descriptions show up fine on the advanced search (with the exception of some cosmetic mishaps), but then for the product listing page I get that same error 1064 when clicking on a category. I'm using 22ms2 with the latest mod.

 

HELP!

 

ERROR BELOW***

 

1064 - You have an error in your SQL syntax near ' p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, ' at line 1

 

select p.products_weight, p.products_image, pd.products_name, pd.products_description, , p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from products_description pd, products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id, products_to_categories p2c left join specials s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '1' and p2c.categories_id = '24' order by pd.products_name limit 0, 20

Link to comment
Share on other sites

thanks for the heads up on the error above. Where would I go to fix the query itself? I'm new to this...thanks in advance. i noticed the other guy that posted the error on the previous page had the opposite, he had no comma between the two field names and I had two. How did this happen anyways?

Link to comment
Share on other sites

I kinda need to fix this soon as it seems that I get the error with ANY product listing page, even the backups that I made so now I can't display any product listings through clicking to it from categories.

 

TIA Kepa

Link to comment
Share on other sites

I am using the Basic template structure http://www.oscommerce.com/community/contributions,1263 and the installation seems to be compatible except for the catalog/advanced_search_result.php. I have no idea where to put the code because the page is completely different.

<?php

/*

 $Id: advanced_search_result.php,v 1.72 2003/06/23 06:50:11 project3000 Exp $



 osCommerce, Open Source E-Commerce Solutions

 http://www.oscommerce.com



 Copyright (c) 2003 osCommerce



 Released under the GNU General Public License

*/



 require('includes/application_top.php');



 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_ADVANCED_SEARCH);



 $error = false;



 if ( (isset($HTTP_GET_VARS['keywords']) && empty($HTTP_GET_VARS['keywords'])) &&

      (isset($HTTP_GET_VARS['dfrom']) && (empty($HTTP_GET_VARS['dfrom']) || ($HTTP_GET_VARS['dfrom'] == DOB_FORMAT_STRING))) &&

      (isset($HTTP_GET_VARS['dto']) && (empty($HTTP_GET_VARS['dto']) || ($HTTP_GET_VARS['dto'] == DOB_FORMAT_STRING))) &&

      (isset($HTTP_GET_VARS['pfrom']) && !is_numeric($HTTP_GET_VARS['pfrom'])) &&

      (isset($HTTP_GET_VARS['pto']) && !is_numeric($HTTP_GET_VARS['pto'])) ) {

   $error = true;



   $messageStack->add_session('search', ERROR_AT_LEAST_ONE_INPUT);

 } else {

   $dfrom = '';

   $dto = '';

   $pfrom = '';

   $pto = '';

   $keywords = '';



   if (isset($HTTP_GET_VARS['dfrom'])) {

     $dfrom = (($HTTP_GET_VARS['dfrom'] == DOB_FORMAT_STRING) ? '' : $HTTP_GET_VARS['dfrom']);

   }



   if (isset($HTTP_GET_VARS['dto'])) {

     $dto = (($HTTP_GET_VARS['dto'] == DOB_FORMAT_STRING) ? '' : $HTTP_GET_VARS['dto']);

   }



   if (isset($HTTP_GET_VARS['pfrom'])) {

     $pfrom = $HTTP_GET_VARS['pfrom'];

   }



   if (isset($HTTP_GET_VARS['pto'])) {

     $pto = $HTTP_GET_VARS['pto'];

   }



   if (isset($HTTP_GET_VARS['keywords'])) {

     $keywords = $HTTP_GET_VARS['keywords'];

   }



   $date_check_error = false;

   if (tep_not_null($dfrom)) {

     if (!tep_checkdate($dfrom, DOB_FORMAT_STRING, $dfrom_array)) {

       $error = true;

       $date_check_error = true;



       $messageStack->add_session('search', ERROR_INVALID_FROM_DATE);

     }

   }



   if (tep_not_null($dto)) {

     if (!tep_checkdate($dto, DOB_FORMAT_STRING, $dto_array)) {

       $error = true;

       $date_check_error = true;



       $messageStack->add_session('search', ERROR_INVALID_TO_DATE);

     }

   }



   if (($date_check_error == false) && tep_not_null($dfrom) && tep_not_null($dto)) {

     if (mktime(0, 0, 0, $dfrom_array[1], $dfrom_array[2], $dfrom_array[0]) > mktime(0, 0, 0, $dto_array[1], $dto_array[2], $dto_array[0])) {

       $error = true;



       $messageStack->add_session('search', ERROR_TO_DATE_LESS_THAN_FROM_DATE);

     }

   }



   $price_check_error = false;

   if (tep_not_null($pfrom)) {

     if (!settype($pfrom, 'double')) {

       $error = true;

       $price_check_error = true;



       $messageStack->add_session('search', ERROR_PRICE_FROM_MUST_BE_NUM);

     }

   }



   if (tep_not_null($pto)) {

     if (!settype($pto, 'double')) {

       $error = true;

       $price_check_error = true;



       $messageStack->add_session('search', ERROR_PRICE_TO_MUST_BE_NUM);

     }

   }



   if (($price_check_error == false) && is_float($pfrom) && is_float($pto)) {

     if ($pfrom >= $pto) {

       $error = true;



       $messageStack->add_session('search', ERROR_PRICE_TO_LESS_THAN_PRICE_FROM);

     }

   }



   if (tep_not_null($keywords)) {

     if (!tep_parse_search_string($keywords, $search_keywords)) {

       $error = true;



       $messageStack->add_session('search', ERROR_INVALID_KEYWORDS);

     }

   }

 }



 if (empty($dfrom) && empty($dto) && empty($pfrom) && empty($pto) && empty($keywords)) {

   $error = true;



   $messageStack->add_session('search', ERROR_AT_LEAST_ONE_INPUT);

 }



 if ($error == true) {

   tep_redirect(tep_href_link(FILENAME_ADVANCED_SEARCH, tep_get_all_get_params(), 'NONSSL', true, false));

 }



 $breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_ADVANCED_SEARCH));

 $breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, tep_get_all_get_params(), 'NONSSL', true, false));



 $content = CONTENT_ADVANCED_SEARCH_RESULT;



 require(DIR_WS_TEMPLATES . TEMPLATENAME_MAIN_PAGE);



 require(DIR_WS_INCLUDES . 'application_bottom.php');

?>

 

Any idea where to add you bits or am I screwed?

 

// Products Description Hack begins

                      'PRODUCT_LIST_DESCRIPTION' => PRODUCT_LIST_DESCRIPTION, 

                      // Products Description Hack ends

 // Products Description Hack begins

     case 'PRODUCT_LIST_DESCRIPTION':  

       $select_column_list .= 'pd.products_description, ';

       break;

     // Products Description Hack ends

 // Products Description Hack begins

     case 'PRODUCT_LIST_DESCRIPTION':

       $order_str .= "pd.products_description " . ($sort_order == 'd' ? "desc" : "");

       break;

     // Products Description Hack ends

Link to comment
Share on other sites

It was in there somewhere and I just copied and pasted that section from the original index.php. It must have gotten corrupted somewehre. It's working fine now...

 

How did you manage to fix this? I have gone nearly crossed trying to find the error. I have the identical problem as you posted as oposed to my first post.

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