Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Category Descriptions MS2 1.4


Guest

Recommended Posts

Original Category Descriptions author by Brian Lowe.

 

With my limited osc/php coding knowledge I have just carefully changed a few little things so that it may be compatible with the latest MS2 release.

 

Have it running very well on my MS2 test store.

Please back up your files before installing this mod.

 

Feel free to test it out so that any changes or error may be applied if needed.

Link to comment
Share on other sites

  • Replies 53
  • Created
  • Last Reply

Top Posters In This Topic

I got everything working except when I go to add a category description in the admin I get this error after I hit the "Preview" button

 

Fatal error: Call to undefined function: tep_get_uploaded_file() in /home/cellar/public_html/catalog/admin/categories.php on line 484

Link to comment
Share on other sites

Hmmmm ok let me take a look at this:

 

I believe its new upload instead of the tep_get_uploaded file thing.

 

Let me restall my mod as is and then apply the already changes in my files. Then if its all ok ill upload the new fix.

 

Looks like i didnt add the few changes to the insert file.

 

Brb

Link to comment
Share on other sites

New "new_category.insert" file with the updated "new upload" definition instead of the old "tep_get_uploaded_file" one.

 

Fix the catagory side error to:

 

Locate the following 7 lines (approximately line 97):

       if ($categories_image = new upload('categories_image', DIR_FS_CATALOG_IMAGES)) {

         tep_db_query("update " . TABLE_CATEGORIES . " set categories_image = '" . tep_db_input($categories_image->filename) . "' where categories_id = '" . (int)$categories_id . "'");

       }





REPLACE those 7 lines with the following 11 lines:

         if (ALLOW_CATEGORY_DESCRIPTIONS == 'true') {

           tep_db_query("update " . TABLE_CATEGORIES . " set categories_image = '" . $HTTP_POST_VARS['categories_image'] . "' where categories_id = '" .  tep_db_input($categories_id) . "'");

           $categories_image = '';

     } else {

       if ($categories_image = new upload('categories_image', DIR_FS_CATALOG_IMAGES)) {

         tep_db_query("update " . TABLE_CATEGORIES . " set categories_image = '" . tep_db_input($categories_image->filename) . "' where categories_id = '" . (int)$categories_id . "'");

       }

      }

 

New fixes:

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

 

PS

This is only for the new MS2 (Milstone 2) release and have not tested it with anything else.

 

Please back up your files before installing.

Link to comment
Share on other sites

Ok so if that replaces the tep_get upload then what replaces

 

tep_get_local_path()

 

 

Is this in the change log where to refernce i have been fighting a differnt contrib and trying to get it working with the latest snapshot.

Link to comment
Share on other sites

That is from the old insert file:

$image_directory = tep_get_local_path(DIR_FS_CATALOG_IMAGES);

 

That isnt need anymore cus there is a better way to do this in MS2 which is included in the new 1.5 fix.

 

Try this:

 

Replace this:

// copy image only if modified

     $categories_image = tep_get_uploaded_file('categories_image');

// echo "categories_image['tmp_name'] is <b>" . $categories_image['tmp_name'] . "</b><br>";

// echo "categories_image['name'] is <b>" . $categories_image['name'] . "</b><br>";

     $image_directory = tep_get_local_path(DIR_FS_CATALOG_IMAGES);



     if (is_uploaded_file($categories_image['tmp_name'])) {

       tep_copy_uploaded_file($categories_image, $image_directory);

// echo "is_uploaded_file is true<br>";

       $categories_image_name = $categories_image['name'];

     } else {

       $categories_image_name = $HTTP_POST_VARS['categories_previous_image'];

     }

 

With This:

// copy image only if modified

       $categories_image = new upload('categories_image');

       $categories_image->set_destination(DIR_FS_CATALOG_IMAGES);

       if ($categories_image->parse() && $categories_image->save()) {

         $categories_image_name = $categories_image->filename;

       } else {

       $categories_image_name = $HTTP_POST_VARS['categories_previous_image'];

     }

Link to comment
Share on other sites

Hi ilicious

 

can you update the whole contirbution so that we might not miss any thing

I think i have done this in the new 1.5 fix.

 

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

 

Checked all the changes, applied them to my shop and seems to be running ok.

 

Would like someone to test it out on their MS2 shop so i may track down any errors or anything i may o left out.

Link to comment
Share on other sites

Ok I setup it in last MS2 it seems it is working....

 

but there is one error

 

Without subcategory it shows everything fine in main category page header and descp. However after addded sub category, the main category page header displays....

 

td class="pageHeading"> Las Chicas

 

Subcategories are working fine. Moreover Adding a product to main category also shows Main categories headers and description normal....

 

I look codes for to find what causes the problem however I couldnt find.

Link to comment
Share on other sites

  • 2 weeks later...

Dunno really what it could be other than what was edited in the index.php file.

 

 2) Locate the following line (approximately line 66):

           <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>



    Replace it with the following 9 lines:

           <td class="pageHeading">

            <?php 

              if ( (ALLOW_CATEGORY_DESCRIPTIONS == 'true') && (tep_not_null($category['categories_heading_title'])) ) {

                echo $category['categories_heading_title'];

              } else {

                echo HEADING_TITLE;

              }

            ?>

           </td>

 

and

 

 5) A few lines later (approximately line 241) there is a line that reads:

           <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>



   REPLACE it with the following 9 lines:

           <td class="pageHeading">

            <?php 

              if ( (ALLOW_CATEGORY_DESCRIPTIONS == 'true') && (tep_not_null($category['categories_heading_title'])) ) {

                echo $category['categories_heading_title'];

              } else {

                echo HEADING_TITLE;

              }

            ?>

           </td>

 

Make sure your not missing a "<" in

 <td class="pageHeading">

also make sure your html above and below begins and ends evenly and isnt broken.

Link to comment
Share on other sites

I posted this question in the general forum, but after further discussion I believe I am having the problem as a result of installing this mod. I was wondering if anyine who has installed this mod has had this problem.

 

When I add new category images in the admin I get broken images. When I go back under the category images box it gives a path /tmp/phpZ5ff0J. In other words the category images and only the catgory images are trying to be stored in that directory which does not exist. Product images upload fine.

 

and I have checked all of the permissions and they are fine, so thats not it. Any help would be greatly appreciated

Link to comment
Share on other sites

I have tried setting up this contrib but I cannot load the sql file into php admin. I end up with this error

 

MySQL said: You have an error in your SQL syntax near 'true', 'false'), ', now())' at line 2

 

Is there anyway I can manually fix this?

Link to comment
Share on other sites

If you have phpMyAdmin try adding this through the

"Run SQL query/queries on database yourdatabase" window instead of uploading the sql file:

 

INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Allow Category Descriptions', 'ALLOW_CATEGORY_DESCRIPTIONS', 'true', 'Allow use of full text descriptions for categories', '1', '19', 'tep_cfg_select_option(array('true', 'false'), ', now());



ALTER TABLE categories_description ADD categories_heading_title varchar(64) AFTER categories_name;

ALTER TABLE categories_description ADD categories_description text AFTER categories_heading_title;

Link to comment
Share on other sites

  • 5 weeks later...

hello all.

unfortunately the html generated by the module is not fine enough for some browsers,

and I'd like to use netscape 4.77 for administrative functions for some reasons.

I've looked around in the html, and made the following changes,

all in the lines which now come in the new_category_insert - file.

 

now it works with netscape 4.77.

 

new_category_insert :

 

line 33 :

addes a "<td>" after the "<tr>" for better html

now reads :

<tr><td><?php echo tep_draw_form('new_category', FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $HTTP_GET_VARS['cID'] . '&action=new_category_preview', 'post', 'enctype="multipart/form-data"'); ?></td>

lines 79,80 :

<tr>

<tr>

one of them deleted.



around line 100 :       </form></tr>

I added a </table> here



three lines before end of file (around 215)

</form></tr>

I also added a </table> here

 

cu all, karlheinz meier[/code]

Link to comment
Share on other sites

hi to all

 

i have a big problem .. when i insert an images for the directory ... i can't see it. In preview i can see the images but in the db don't exit ...

can Anyone help me plz?

 

Thk workin

Edited by workin
Link to comment
Share on other sites

  • 3 weeks later...

Does this mod support multiple languages? I have fields in the admin area to add the category name, category heading title, category description in English, German and Spanish, but it seems this information never makes it into the catalog_descriptions table in the mySQL database, only the product descriptions for the english version are visible in the cart. Did I miss something during the install of this mod???

 

Do I need to edit the categories.php file in admin/includes/languages for each language, besides the default language used by the cart?

 

Thank you in advance for any help with this mod. You can see the problem at:

 

Tea Herb Farm

Link to comment
Share on other sites

Hi,

I'm getting

Warning: Cannot modify header information - headers already sent by (output started at /home/jood/public_html/shop2/catalog/admin/includes/languages/english/categories.php:101) in /home/jood/public_html/shop2/catalog/admin/includes/functions/general.php on line 18
after adding a category description, the description appears fine and nothing else seems broekn (from what I can see) just this.

Does anyone know what I might've done wrong?

 

Thanks in advance,

 

Toe Knee

Link to comment
Share on other sites

I'm trying to install this contribution on my new soter using osCommerce MS2. The readme file says:

 

<quote>

4) Locate the following line (approximately line 199):

// We build the manufacturers Dropdown

About 33 lines further down from it are two lines that read:

?>

<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">

 

Insert the following 3 lines BEFORE the line that reads "?>":

 

// Get the category name and description

$category_query = tep_db_query("select cd.categories_name, cd.categories_heading_title, cd.categories_description, c.categories_image from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = '" . $current_category_id . "' and cd.categories_id = '" . $current_category_id . "' and cd.language_id = '" . $languages_id . "'");

$category = tep_db_fetch_array($category_query);

</quote>

 

I can't find the line that says "We build the manufacturer's dropdown" in my index.php file. Can anyone help me locate where this code should go? I found three instances of this:

?>

<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">

 

One was around line 60-something, one was in the 300s, and the third was around 241 (after installing all of the other code in the readme file). I inserted this code around 241 - is this correct? The code right above is:

 

<quote>

case 'PRODUCT_LIST_WEIGHT':

$listing_sql .= "p.products_weight " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";

break;

case 'PRODUCT_LIST_PRICE':

$listing_sql .= "final_price " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";

break;

}

}

</quote>

 

Any help with this would be appreciated.

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