Jump to content
Sign in to follow this  
wheeloftime

[Contrib] Manufacturers Multilanguage

Recommended Posts

hi there

 

many thanks for the contribution.

 

i have come across one bug. if a manufacturer image has been previously defined and i go into edit manufacturer and save changes, it loses the manufacturer image link from the database field.

 

any fixes would be greatly appreciated :)

Hi there,

 

It is not a problem with the contrib but an overall problem, it will always happen as soon as you change manufacturer info through the admin.

The fix is to revert back to an older part of the admin/manufacturer.php code which I found hidden in a contrib:

 // THIS WAS THE OLD CODE 
/*	  if ($manufacturers_image = new upload('manufacturers_image', DIR_FS_CATALOG_IMAGES)) {
	tep_db_query("update " . TABLE_MANUFACTURERS . " set manufacturers_image = '" . $manufacturers_image->filename . "' where manufacturers_id = '" . tep_db_input($manufacturers_id) . "'");
  } */

// THIS IS CODE TAKEN FROM $Id manufacturers.php, v1.51 2003/01/29

  if (is_uploaded_file($manufacturers_image['tmp_name'])) {
	if (!is_writeable($image_directory)) {
	  if (is_dir($image_directory)) {
		$messageStack->add_session(sprintf(ERROR_DIRECTORY_NOT_WRITEABLE, $image_directory), 'error');
	  } else {
		$messageStack->add_session(sprintf(ERROR_DIRECTORY_DOES_NOT_EXIST, $image_directory), 'error');
	  }
	} else {
	  tep_db_query("update " . TABLE_MANUFACTURERS . " set manufacturers_image = '" . $manufacturers_image['name'] . "' where manufacturers_id = '" . tep_db_input($manufacturers_id) . "'");
	  tep_copy_uploaded_file($manufacturers_image, $image_directory);
	}
  }
// END INSERT

Share this post


Link to post
Share on other sites
Hello i have an error when i want to add a manufacturer, is this:

 

Warning: array_merge() [function.array-merge]: Argument #1 is not an array in C:\AppServ\www\argenshop\admin\manufacturers.php on line 26

Warning: reset() [function.reset]: Passed variable is not an array or object in C:\AppServ\www\argenshop\admin\includes\functions\database.php on line 55

Warning: Variable passed to each() is not an array or object in C:\AppServ\www\argenshop\admin\includes\functions\database.php on line 58

Warning: reset() [function.reset]: Passed variable is not an array or object in C:\AppServ\www\argenshop\admin\includes\functions\database.php on line 62

Warning: Variable passed to each() is not an array or object in C:\AppServ\www\argenshop\admin\includes\functions\database.php on line 63
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') values)' at line 1

insert into manufacturers) values)

[TEP STOP]

 

change in manufacturers.php

 

		  $sql_data_array = array_merge($sql_data_array, $insert_sql_data);

to

		  $sql_data_array = array_merge((array)$sql_data_array, (array)$insert_sql_data);

Share this post


Link to post
Share on other sites

Hi I found some of the problem for this script which is duplcate one products two times at the product listing such as for select the manufacturers, the products will show two lines for each

"select " . $select_column_list . " 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_p

can anybody help me to fix it ?

Share this post


Link to post
Share on other sites

Added the additions to the files very carefully, and edited the Admin pages for the Manufacturers (again) carefully, and all is working in the admin.

 

However, when I select a manufacturer from the drop-down list on the home page I get this message:

 

on URL: index.php?cPath=2_20

or URL: index.php?manufacturers_id=6

 

1054 - Unknown column 'p.products_id' in 'on clause'

select count(p.products_id) as total from products p, products_description pd, manufacturers_info m left join specials s on p.products_id = s.products_id where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '6' AND m.languages_id = '1'

 

I've double-checked the code, I can't see anything wrong. I've installed on a very new clean install, except for the register_globals patch files, STS_template, and the category_description contributions - none of which shouls effect this contrib.

 

Any clues please?

Edited by wondernet

Share this post


Link to post
Share on other sites

could it be anything to do with the fact that i have removed languages except for English, and also only have 1 currency (GBP)??

 

If so, I would like to get this working if anyone can see what I need to do (and make a contribution out of it for us all)

Share this post


Link to post
Share on other sites

Ok this kind of sounds like what I need??

 

Basically its a lingerie site...

 

I am using the categories for e.g.

 

designer bras, with sub cats of balcony bra and half cup bra.

 

BUT I am using manufacturers as designers........inside those i need collections, so like a sub category in a manufacturer.

 

e.g. Designer x, when you click that it will list collection 1, collection 2 etc.....acting the same as sub cats.

 

I have tried manufacturer 2 http://addons.oscommerce.com/info/2634 but it doesn't really do what I need.

 

any ideas? thanks in advance

Share this post


Link to post
Share on other sites

Hello,

 

Tried to apply SQL in mod of 23 aug 2007

Go SQL error

 

SQL-query:

 

UPDATE `manufacturers` m,

`manufacturers_info` i SET i.`manufacturers_name` = m.`manufacturers_name` WHERE m.`manufacturers_id` = i.`manufacturers_id` ALTER TABLE `manufacturers` DROP `manufacturers_name` ;

 

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ALTER TABLE `manufacturers` DROP `manufacturers_name`' at line 2

 

I have PHP4.4.7

Please help

Share this post


Link to post
Share on other sites

step 4:

 

4) Replace your (catalog)/admin/manufacturers.php with the one provided with this

contribution. Only do so if you haven't made any other changes to it yet.

If you already made changes to this file then you will have to compare the two and

make the changes by hand.

 

What are these changes??

Share this post


Link to post
Share on other sites

I got two languages. Dutch and English. After the installing. I can choose manufacturers in front of the default language. But when I choose the other language. The manufacturers box has disappeared.

 

Can someone upload the manufacturers menu of different languages in the backoffice? I like to see how this menu looks like.

Share this post


Link to post
Share on other sites
Hello,

 

Tried to apply SQL in mod of 23 aug 2007

Go SQL error

 

SQL-query:

 

UPDATE `manufacturers` m,

`manufacturers_info` i SET i.`manufacturers_name` = m.`manufacturers_name` WHERE m.`manufacturers_id` = i.`manufacturers_id` ALTER TABLE `manufacturers` DROP `manufacturers_name` ;

 

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ALTER TABLE `manufacturers` DROP `manufacturers_name`' at line 2

 

I have PHP4.4.7

Please help

 

 

I got the same error.

 

You'd better do this by hand.

Share this post


Link to post
Share on other sites
Hi I found some of the problem for this script which is duplcate one products two times at the product listing such as for select the manufacturers, the products will show two lines for each

"select " . $select_column_list . " 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_p

can anybody help me to fix it ?

 

got the same problem. I cleanup all the database tables and did some new input. I there already a solution for this problem?

Share this post


Link to post
Share on other sites

In the normal way I think the contribution works well for me. but because of 6000 items . I use Easy populate. And that's the problem! This will not works very well for me.

 

Because of the 2 tables manufacturers and manufacturers_info.

 

Does someone got this contribution with easy populate?

Share this post


Link to post
Share on other sites
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ALTER TABLE `manufacturers` DROP `manufacturers_name`' at line 2

 

I got the same error.

 

You'd better do this by hand.

 

What to do? Could you please post the solution if known

Many thanks!

 

Sergei

Share this post


Link to post
Share on other sites
What to do? Could you please post the solution if known

Many thanks!

 

Sergei

 

Go into your database and compare this with version 1.1. It works for me! I mean the sql data.

Edited by Simpel

Share this post


Link to post
Share on other sites

Ok does anyone works with EASY POPULATE?

 

I got it almost done.

 

I changes the :manufactures code (easypopulate.php)into this

    // OK, we need to convert the manufacturer's name into id's for the database
   if ( isset($v_manufacturers_name) && $v_manufacturers_name != '' ){
       $sql = "SELECT man.manufacturers_id
           FROM ".TABLE_MANUFACTURERS." as man
           WHERE
               man.manufacturers_name = '" . $v_manufacturers_name . "'";
       $result = tep_db_query($sql);
       $row =  tep_db_fetch_array($result);
       if ( $row != '' ){
           foreach( $row as $item ){
               $v_manufacturer_id = $item;
           }
       } else {
           // to add, we need to put stuff in manufacturers and manufacturers_table
           $sql = "SELECT MAX( manufacturers_id) max FROM ".TABLE_MANUFACTURERS;
           $result = tep_db_query($sql);
           $row =  tep_db_fetch_array($result);
           $max_mfg_id = $row['max']+1;
           // default the id if there are no manufacturers yet
           if (!is_numeric($max_mfg_id) ){
               $max_mfg_id=1;
           }

           // Uncomment this query if you have an older 2.2 codebase
           /*
           $sql = "INSERT INTO ".TABLE_MANUFACTURERS."(
               manufacturers_id,
               manufacturers_name,
               manufacturers_image
               ) VALUES (
               $max_mfg_id,
               '$v_manufacturers_name',
               '".EP_DEFAULT_IMAGE_MANUFACTURER."'
               )";
           */

           // Comment this query out if you have an older 2.2 codebase
           $sql = "INSERT INTO ".TABLE_MANUFACTURERS."(
               manufacturers_id,
               manufacturers_name,
               manufacturers_image,
               date_added,
               last_modified
               ) VALUES (
               $max_mfg_id,
               '$v_manufacturers_name',
               '".EP_DEFAULT_IMAGE_MANUFACTURER."',
               '".date("Y-m-d H:i:s")."',
               '".date("Y-m-d H:i:s")."'
               )";
           $result = tep_db_query($sql);

           foreach ($languages as $key => $lang){
				  if (EP_DEFAULT_LANGUAGE_ID == $lang['id']) {
           $sql = "INSERT INTO ".TABLE_MANUFACTURERS_INFO."(
               manufacturers_id,
               languages_id,
              manufacturers_name,
               date_added,
               last_modified
               ) VALUES (
             $max_mfg_id,
               '".EP_DEFAULT_LANGUAGE_ID."',
             '$v_manufacturers_name',
               '".date("Y-m-d H:i:s")."',
               '".date("Y-m-d H:i:s")."'
               )";
          } else {
						$sql = "INSERT INTO ".TABLE_MANUFACTURERS_INFO."(
									manufacturers_id,
									languages_id,
									manufacturers_name
								) VALUES (
									$max_mfg_id,
									'".$lang['id']."',
									''
								)";
					}

           $result = tep_db_query($sql);
       }
       }
       }


   // if the categories names are set then try to update them

 

 

 

BUT!!

 

 

The manufacturers works fine. But when I choose a category, the manufacturers will be display in every language. I use 2 languages and get the same product 2 times in row. So every language displays also the other one.

 

I think is is something with this contribution and not with easy populate, because everything seems ok into the database.

 

Does anyone got the same problem or got an solution for this little problem?

Edited by Simpel

Share this post


Link to post
Share on other sites
Check the changes needed for the Manu Multi again and especially look at the last part from the install instructions telling:

In your (catalog)/advanced_search_result.php search for

$where_str .= " and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'";

And replace this with

$where_str .= " and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' AND m.languages_id = '" . (int)$languages_id . "'";

When you get a result for every language in your shop you can be sure there is somewhere missing the part where the languages_id is compared with the active language of the shop.

 

 

What should be the trick?

Share this post


Link to post
Share on other sites
What should be the trick?

 

 

TABLE_MANUFACTURERS_INFO . " m on (p.manufacturers_id = m.manufacturers_id AND m.languages_id = " . (int)$languages_id . " ) left join " . TABLE_PRODUCTS_DESCRIPTION .

 

changed in the 3 paragraf of the index.php modification.

Share this post


Link to post
Share on other sites
Go into your database and compare this with version 1.1. It works for me! I mean the sql data.
Go into your database and compare this with version 1.1. It works for me! I mean the sql data.

 

Thanks Simpel, it helps to import sql data correctly.

Menwhile this contribution gives errors for me on

 

index.php?manufacturers_id=...

1054 - Unknown column 'p.products_id' in 'on clause'

 

and also gives error 1054 - Unknown column 'm.manufacturers_name' in 'field list'

for contribution Coming_Soon_by_Month

 

Sorry, too many problems I can't solve. Removed

Share this post


Link to post
Share on other sites

Don't give up

 

index.php?manufacturers_id=...

1054 - Unknown column 'p.products_id' in 'on clause'

 

Mysql5 compatibility problem, so need to correct sql

 

and also gives error 1054 - Unknown column 'm.manufacturers_name' in 'field list'

for contribution Coming_Soon_by_Month

 

Sql to add extra field not run, so need to check installation completed (could be wrong here, but then first point is only an experienced guess)

Edited by geoffreywalton

Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Share this post


Link to post
Share on other sites

Ok I installed also Manufacturer to order contribution. So you can see the right manufacturer in the shoppingcart/ invoice/ mail etc.

 

The problem is the multilanguage. It seems the manufacturer to order takes the wrong table.

 

FILENAME: includes/functions/general.php LINE end of page

Just before the last ?> at the bottom of the page

 

ADD:

 //manware.nl added manufacturer name to order (name query) 
 function tep_get_manufacturer_name($products_id = '') {
if (isset($products_id)){
	$manufacturer_query = tep_db_query("select m.manufacturers_name from " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS . " p where p.products_id = '" . (int)$products_id . "' and p.manufacturers_id = m.manufacturers_id");
	$manufacturers = tep_db_fetch_array($manufacturer_query);
	return $manufacturers['manufacturers_name'];
}
 }

 

 

I think TABLE_MANUFACTURERS should be TABLE_MANUFACTURERS_INFO . But also the language implementation has to be done. Can anyone help me with this to get this work?

Share this post


Link to post
Share on other sites

Ok hello,

 

I noticed this, a week ago.

 

Do you want to display the Category/Manufacturer Filter?

 

When set ON! in the administration. I got 2 languages instead of the one I choosen.

 

Are there more people who got this problem?

 

Solved: missed the second change of the index.php

Edited by Simpel

Share this post


Link to post
Share on other sites

Great contribution! I've installed it and the funcionality seems to be in working order.

I have the same problem as Simpel though, I get both languages in my shop displayed in the dropdown box.

I must add that I'm also working with the Manufacturer2 contribution, wich means I have 2 manufacturers boxes in my shop.

I'm getting the feeling that the sql query in /boxes/manufacturer.php is the issue here. When I tried to implement it, the box just dissapeared.

I altered it but didn't add the language definition, because it doesn't display the box when I do so. So how do I get that in there?

The query looks like this now

$manufacturers2_query = tep_db_query("select m.manufacturers2_id, mi.manufacturers2_name from " . TABLE_MANUFACTURERS2 . " m, " . TABLE_MANUFACTURERS2_INFO . " mi where m.manufacturers2_id=mi.manufacturers2_id order by mi.manufacturers2_name");

When I add it like so:

$manufacturers2_query = tep_db_query("select m.manufacturers2_id, mi.manufacturers2_name from " . TABLE_MANUFACTURERS2 . " m, " . TABLE_MANUFACTURERS2_INFO . " mi where m.manufacturers2_id=mi.manufacturers2_id AND mi.languages_id=" . (int)$languages_id . " order by mi.manufacturers2_name");

the box dissapears. Any help on this would be highly appreciated.

Share this post


Link to post
Share on other sites

Okay, so it seems that when you merge the manufacturer2.0 and Manufacturer Multilingual contibutions you should not drop the manufacturers2_name in table manufacturers2 as the SQL file for this contribution states. I have the correct language displaying in the box now, BUT it still keeps disapearing on the second click I make in the shop. So when I open my browser and go to the site, it's there, but when I click on a page it's gone. Does this have something to do with the cache for the manufacturers box? Does anyone know what could be the case here?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×