Page 1 of 1

[SOLVED] Add different picture for different languages

Posted: Wed Dec 11, 2013 12:11 am
by David Sanchez
Hello Fellows!
This is my first post, so first of all, thanks to all for everything, this page/product is great, made by all of you and I will like to help on the possibilities I can.

Okay, after my short introduction, here is my question.

I noticed that around the project there are a lot of tables where in one of them (e.g option_value) keeps the information of the image for the option, but in the other table (e.g. option_value_description) we have the multilingual information for the options. My question is the following, Im trying to create something able to add different pictures depending on the language.

My first, (and i think most obvious idea) is to add the information of the image on the second table (what actually makes sens, since has all the description of the option).

So, I started learning (by myself, REALLY HARD, since im quite slow and bad hihihi ), and I basically achieve everything, BUT there is just an small problem.
What do i mean with i achieve everything? Well, basically I have the code to add, update, put the second picture, displayed it, blablabla.

THE PROBLEM??? Im missing one step. The step is if I decide to upload a picture, then this information is no longer saved on the DATABASE. Im kind of becomming crazy, I tried and read everything, but without much success.

Actually, I can even put an input type in HTML to introduce manually the path to the picture, but we will lose the filemanager functionality already implemented:

Code: Select all

<input type="text" name="option_value[<?php echo $option_value_row; ?>][option_value_description][<?php echo $language['language_id']; ?>][name]" value="<?php echo isset($option_value['option_value_description'][$language['language_id']]) ? $option_value['option_value_description'][$language['language_id']]['image'] : ''; ?>" />

Im sorry, I think this is the proper place, but sorry in advance if im wrong. I dont want someone to code for me, I just want to understand, how can I integrate the filemanager and put (and give the info) to the DB. This also could be helpfull for others :)

Big thanks in advance

Re: Add different picture for different languages

Posted: Wed Dec 11, 2013 1:45 am
by butte
If this concerns an actual extension for product options, then you should ask the extension author. When you upload images, send them via ftp into /image/data/ (where originals sit) NOT into /image/cache/data (where OC makes thumbnails).

Re: Add different picture for different languages

Posted: Wed Dec 11, 2013 8:21 pm
by David Sanchez
Hello Butte, and thanks for you fast replay. I couldnt answer you from the job.

No, its not for an specific module. I just want to extend the basic (but great) functionality of OC. So, I think here is the place to post =).

No, maybe I didnt explain properly myself. Is nothing about uploading the pictures or not. Is just about storing the PATH to the picture properly to de database to the proper field.

So for example, I set this:

Code: Select all

<td class="left"><div class="image"><img src="<?php echo $option_value['option_value_description'][$language['language_id']]['image']; ?>" alt="" id="thumb<?php echo $option_value_row; ?>" />

<input type="hidden" name="option_value[<?php echo $option_value_row; ?>][image]" value="<?php echo $option_value['option_value_description'][$language['language_id']]['image']; ?>" id="image<?php echo $option_value_row; ?>"  />

<br />

<a onclick="image_upload('image<?php echo $option_value_row; ?>', 'thumb<?php echo $option_value_row; ?>');"><?php echo $text_browse; ?></a>&nbsp;&nbsp;|&nbsp;&nbsp;<a onclick="$('#thumb<?php echo $option_value_row; ?>').attr('src', '<?php echo $no_image; ?>'); $('#image<?php echo $option_value_row; ?>').attr('value', '');"><?php echo $text_clear; ?></a></div></td<td class="right"><input type="text" name="option_value[<?php echo $option_value_row; ?>][sort_order]" value="<?php echo $option_value['sort_order']; ?>" size="1" /></td>

<td class="left"><a onclick="$('#option-value-row<?php echo $option_value_row; ?>').remove();" class="button"><?php echo $button_remove; ?></a></td>
But the problem, in the moment I press the button Browse, and select a picture (btw, i can upload perfectly), it will display the picture on the rectangle, BUT WHEN I PRESS SAVE THE OPTION, IT WILL NOT SAVE this info into de DB.

I repeat, im sure I have the functions to write the value inside de DB, but Its on this step when I loose the info.

¿Ideas? Thanks again :D

Re: Add different picture for different languages

Posted: Thu Dec 12, 2013 2:12 am
by butte
Then it is not seeking Extension Support but comprises a Feature Request . . .

Re: Add different picture for different languages

Posted: Wed Dec 18, 2013 2:19 am
by David Sanchez
Sorry sorry, my bad.

We can close this topic or change it to the proper place.

I finally solved the problem! :)

Re: Add different picture for different languages

Posted: Wed Dec 18, 2013 2:14 pm
by butte
Moderators move whatever they feel needs moving, don't worry about it. What did you do to solve it? Then go ahead and edit your opening title Solved.

Re: Add different picture for different languages

Posted: Thu Dec 19, 2013 9:51 pm
by David Sanchez
Hello!

Well, actually there was a problem where I didnt expected. Im not very good in PHP, basically I never learnt, and I thought that to pass the value to the database had to be through the tag id, instead of the tag name.

Once I found out this, was solve.

I had this question since I wanted to create an extension for opencart that can be found here http://www.opencart.com/index.php?route ... n_id=15049 or here http://www.alzoco.com/BannerMultiLanguage.

I suggest anyone who wants to learn to have a look at it :), I'll appreciate any comment or rating >D.

Cheers guys!

Re: [SOLVED] Add different picture for different languages

Posted: Fri Dec 20, 2013 12:48 am
by butte
Good! People will find it and try it, for what it does and because it is free. Be aware that how tags and searches are handled varies among versions, and the sort of difference you discovered will pop up from time to time, so for other version compatibilities you would to need to discover and change those. You're off to a good start. Congratulations.