Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Checkbox links muli language URL input - ADMIN


OSC-Sevilla

Recommended Posts

I need some help.

 

In the code bellow I am looking for the IDs of the tep_draw_input_field boxes for the URL - If you have multiple languages installed you may see 2 or more URL input boxes - 99% of the time the URL will be the same. Hence it would be handy to have a check box that links the foremost input box with the other so you can simply inpur once and "check the checkbox" to populate the other input fields (saves 10 sec of your life).

 

HELP 1:

What is the input text box id reference?

 

tep_draw_input_field('products_url[' . $languages[$i]['id'] . ']', (isset($products_url[$languages[$i]['id']]) ? stripslashes($products_url[$languages[$i]['id']]) : tep_get_products_url($pInfo->products_id, $languages[$i]['id'])), 'size="70"');

 

 

Help 2:

 

How can we write that into the js? Note ENDDATE/ STARTDATE ARE TEST EXAMPLES

<script>

$(document).ready(function(){

$("input#checker").bind("click",function(o){

if($("input#checker:checked").length){

$("#enddate").val($("#startdate").val());

}else{

$("#enddate").val("");

}

});

}

);

</script>

 

------------------------

 

Here is my code, Note it has some test bits thrown in.

 

<?php

for ($i=0, $n=sizeof($languages); $i<$n; $i++) {

?>

 

 

<tr>

<td class="main"><?php if ($i == 0) echo TEXT_PRODUCTS_URL . '<br /><small>' . TEXT_PRODUCTS_URL_WITHOUT_HTTP . '</small>' . '<br /><input type="checkbox" name="checker" id="checker" />'; ?></td>

<td class="main">

 

 

<?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_input_field('products_url[' . $languages[$i]['id'] . ']', (isset($products_url[$languages[$i]['id']]) ? stripslashes($products_url[$languages[$i]['id']]) : tep_get_products_url($pInfo->products_id, $languages[$i]['id'])), 'size="70"'); ?>

 

-------TEST AREA ------------

<form>

<input type="text" id="startdate" value=""/>

<input type="text" id="enddate" value=""/>Link

</form>

 

-------TEST AREA ------------

 

 

<script>

$(document).ready(function(){

$("input#checker").bind("click",function(o){

if($("input#checker:checked").length){

$("#enddate").val($("#startdate").val());

}else{

$("#enddate").val("");

}

});

}

);

</script>

 

</td>

</tr>

<?php

}

?>

Link to comment
Share on other sites

The id is the first parameter, you can add other parameters to the text box using the third parameters.

If you're using Firefox, get the Firebug addin - you can right click anything on a web page and see the HTML directory.

No the fake pic and the boobs aren't gonna get me to write it all for you lol.

OSC User Definitions

"I can add modules to OSC" = I can search, cut and paste. But not well, or I wouldn't be here.

"I start my posting with 'works like a charm' = I'm letting you down gently, nothing works and I have no idea why

"I finish postings with "plzzzz....hlp" = My installation is buggered and I know I'm going to have to pay someone, but I really, really don't want to.

Link to comment
Share on other sites

the major issue im having is because the additonal language URL input fields are generated automatically if i ID the feild like this:

 

tep_draw_input_field('products_url[' . $languages[$i]['id'] . ']', (isset($products_url[$languages[$i]['id']]) ? stripslashes($products_url[$languages[$i]['id']]) : tep_get_products_url($pInfo->products_id, $languages[$i]['id'])), 'size="70"' id="test");

 

all the additional / generated URL input fields therfore contain the same ID.

 

How do you work arround this????

Link to comment
Share on other sites

GOT IT - JOB DONE.

 

<?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_input_field('products_url[' . $languages[$i]['id'] . ']', (isset($products_url[$languages[$i]['id']]) ? stripslashes($products_url[$languages[$i]['id']]) : tep_get_products_url($pInfo->products_id, $languages[$i]['id'])), 'size="70" id="'.$languages[$i]['id'].'"'); ?>

 

<script>

$(document).ready(function(){

$("input#checker").bind("click",function(o){

if($("input#checker:checked").length){

$("#1").val($("#3").val());

}else{

$("#1").val("");

}

});

}

);

</script>

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...