Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Cant get language_id to work


iankil

Recommended Posts

Hello, im having a high fever and trying to get some thing done, but now i have been staring at the screen for hours without understanding why this is not working. I want to pull out some product descriptions to the "whats new box" but i cant get it to work. If i erase the language part it works? i have tryed 500 different combos but it wont work...

 

$sql = 'SELECT `products_description` FROM `products_description` WHERE products_id ='.($random_product['products_id']).' and language_id='.((int)$languages_id);

$description_query = tep_db_query($sql);

$description = mysql_fetch_array($description_query, MYSQL_ASSOC);

$description['products_description'] = substr($description['products_description'], 0, 45);

$desc_len = strlen($description['products_description']);

$newText['desc'] = $description['products_description'] ;

 

And then im trying display $newText['desc']

 

This works on the 2.2 version.but not in 2.3. I have resently updated my wamp server with a new php version so its probably that.

 

what im i missing? It might be a outdated peace of code but i have been using it for a long time before, Please help a sick man :'(

 

/Janne

My contributions

Mindsparx admin for 2.2

Mindsparx admin for 2.3

Mindsparx admin for 3.0

Mindsparx specials 2.2

Starproduct pimped for 2.2

Starproduct pimped for 2.3

Mindsparx template osc Sport 2.2

Mindsparx template Horizon 2.3

+ a few more...

Link to comment
Share on other sites

weird as it looks to be fine, even the sql is formatted correctly i dont have the random products function so just replaced it with a number and tried it and it worked.

 

you could try echo $sql; bellow the statement to see its formatted correctly.

 

i have noticed you do not need to use the brackets twice on ((int)$languages_id)

 

(int)$languages_id will work fine, perhaps a problem with your version of php ? try it and see.

Link to comment
Share on other sites

Thanks for testing the code, The double brackets was one of my 500 tests and i forgot it there :D

 

When im echo out the $sql i get SELECT `products_description` FROM `products_description` WHERE products_id =23 and language_id=0 so it looks fine exept that it cant find the language id... very strange or very simple... i´ll make some more coffee and try to figure this out. Btw im having php version 5.3.0.

 

Thanks for helping

/Janne

My contributions

Mindsparx admin for 2.2

Mindsparx admin for 2.3

Mindsparx admin for 3.0

Mindsparx specials 2.2

Starproduct pimped for 2.2

Starproduct pimped for 2.3

Mindsparx template osc Sport 2.2

Mindsparx template Horizon 2.3

+ a few more...

Link to comment
Share on other sites

Thanks for testing the code, The double brackets was one of my 500 tests and i forgot it there :D

 

When im echo out the $sql i get SELECT `products_description` FROM `products_description` WHERE products_id =23 and language_id=0 so it looks fine exept that it cant find the language id... very strange or very simple... i´ll make some more coffee and try to figure this out. Btw im having php version 5.3.0.

 

Thanks for helping

/Janne

In order to use the $languages_id, you need to put it in the global.

Find

     global $currencies, $oscTemplate;

Change to

     global $currencies, $oscTemplate, $languages_id;

Link to comment
Share on other sites

Fantastic, thank you very much

/janne

My contributions

Mindsparx admin for 2.2

Mindsparx admin for 2.3

Mindsparx admin for 3.0

Mindsparx specials 2.2

Starproduct pimped for 2.2

Starproduct pimped for 2.3

Mindsparx template osc Sport 2.2

Mindsparx template Horizon 2.3

+ a few more...

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...