Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Javascript calendar


roots

Recommended Posts

Hi everyone,

 

I want to integrate the Javascript calendar from the admin module, which appears when you add a new product, in the catalog with the advanced search.

 

So, here is what I want:

When you select the advanced search option, you can give in the data-from and date-to options as search criteria.

Instead of filling in the dates maualy, I want it insert by using the calendar, just like you do at the admin section.

 

Can some one help me how to import that part from admin section to catalog section

:?:

thanks

Link to comment
Share on other sites

This is a very radical way:

make a copy of folder javascript in catalog/admin/includes

 

and place it in catalog/includes

 

then in advanced_search.php

 

right below <body .................... > line 117

put:

<div id="spiffycalendar" class="text"></div>

 

around line 180 after

      <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

     </tr>

     <tr>

       <td>

 

place:

<link rel="stylesheet" type="text/css" href="includes/javascript/spiffyCal/spiffyCal_v2_1.css">

<script language="JavaScript" src="includes/javascript/spiffyCal/spiffyCal_v2_1.js"></script>

<script language="javascript">

var date_from = new ctlSpiffyCalendarBox("date_from", "advanced_search", "dfrom", "btnDate1","<?php echo $dfrom; ?>",scBTNMODE_CUSTOMBLUE);

var date_to = new ctlSpiffyCalendarBox("date_to", "advanced_search", "dto", "btnDate2","<?php echo $dto; ?>",scBTNMODE_CUSTOMBLUE);

</script>

 

replace the whole line w/ tep_draw_input_field('dfrom',.... around 220 with:

'    <td class="fieldValue"><script language="javascript">date_from.writeControl(); date_from.dateFormat="dd/MM/yyyy";</script></td>' . "n" .

 

and the whole line w/ tep_draw_input_field('dto',...... around 224 with:

'    <td class="fieldValue"><script language="javascript">date_to.writeControl(); date_to.dateFormat="dd/MM/yyyy"; </script></td>' . "n" .

 

This should do it

 

ivan

Link to comment
Share on other sites

Ivan,

 

I have tried your method... It worked perfectly...

 

Good one...you should submit it as a mod.

 

Do you know how to add extra search options in?

 

Thanks

Craig

Link to comment
Share on other sites

Hi Craig, how are things down under ?

 

Of course my method works !!!!! 8)

I'm sure you can make it working also leaving the javascript folder where it is (under admin), but then you should do some mods inside the .js.

to change the path to the button image "var scImgPath = './includes/javascript/spiffyCal/images/';".

 

I would not crowd the page w/ other search options, it could be confusing, you can already search by name, description, price and so on, although you can use any DB data to build your queries but that depends a lot on the typology of products you sell.

 

Ivan

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...