snubbr.com

What are the charges to get your e-commerce website verisign secured?

Get a Verisign SSL certificate for 30 days FREE. Click here to use coupon...

Get a free trial of Verisign SSL certificates. Click here for this special deal...
Got a question, hope someone can answer... What are the charges to get your e-commerce website verisign secured? Looking forward for any answer. Another question... Hi There,.

I may be missing something, however, I know you can get many scripts in various languages that randomise what images are shown when a page loads..

However I am after one that will do so within the header of an oscommerce store, that also carries different links with each image..

I have 3 graphical links within my header that promote various aspects of thre store, however as these are in the header they are the same regardless what page you are on or how many links you follow, so I want to randomise the images shown, with each image having it's own link.......

I know it's can be done as standard by something as easy as Javascript but is there something that can be used within an oscommerce store?..

Comments (118)

I would like to know the answer too. Anyone here know what is the answer to that question. I'll do some poking around and get back to you if I discover an decent answer. You should email the people at Verisign as they probably can answer it..

Comment #1

Maybe more than you want..

Load as many images and categories as you want..

Randomizes, picks 4, and associates a category with each (won't use the same image or category more than once)..

<?php.

// load the images in the array here.

$img = array("image1.gif", "image2.gif", "image3.gif", "image4.gif", "image5.gif", "image6.gif", "image7.gif", "image8.gif");.

// load the categories to be used here.

$lnk = array("cPath=1", "cPath=2", "cPath=3", "cPath=4", "cPath=5", "cPath=6", "cPath=7", "cPath=8");.

// randomize the arrays.

Shuffle($img);.

Shuffle($lnk);.

// pick 1st image and category.

$img1 = array_pop($img);.

$lnk1 = array_pop($lnk);.

Echo '<a href="'tep_href_link(FILENAME_DEFAULT,$lnk1)'">'tep_image(DIR_WS_IMAGES$img1)'</a>';.

// pick 2nd image and category.

$img2 = array_pop($img);.

$lnk2 = array_pop($lnk);.

Echo '<a href="'tep_href_link(FILENAME_DEFAULT,$lnk2)'">'tep_image(DIR_WS_IMAGES$img2)'</a>';.

// pick 3rd image and category.

$img3 = array_pop($img);.

$lnk3 = array_pop($lnk);.

Echo '<a href="'tep_href_link(FILENAME_DEFAULT,$lnk3)'">'tep_image(DIR_WS_IMAGES$img3)'</a>';.

// pick 4th image and category.

$img4 = array_pop($img);.

$lnk4 = array_pop($lnk);.

Echo '<a href="'tep_href_link(FILENAME_DEFAULT,$lnk4)'">'tep_image(DIR_WS_IMAGES$img4)'</a>';.

?>..

Comment #2

Ok this looks promising, not being fluent at all in php just a couple of Q's.

1) How do I determine where these images are shown?.

2) Can I simply drop 2 of the images and just have the 3 rotating?.

3) Does Cpath 1 always coinside with images 1 etc?.

Cheers..

Comment #3

1) You're gonna have to post your code if you can't figure that out from what I posted.

2) I thought we were talking about 4 images?.

3) Not if you don't want it that way..

What we have here is a failure to communicate.....

Comment #4

Hi,.

In my second post I stated that I was willing to reduce from the 4 rotating images, and now have decided that would be best, sorry for the miscommunication..

I will post the code below, for reference the images I want to have rotated are m16 & m17.

<?php.

/*.

$Id: header.php,v 1.42 2003/06/10 18:20:38 hpdl Exp $.

OsCommerce, Open Source E-Commerce Solutions.

Http://www.oscommerce.com.

Copyright (c) 2003 osCommerce.

Released under the GNU General Public License.

*/.

// check if the 'install' directory exists, and warn of it's existence.

If (WARN_INSTALL_EXISTENCE == 'true') {.

If (file_exists(dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME'])'/install')) {.

$messageStack->add('header', WARNING_INSTALL_DIRECTORY_EXISTS, 'warning');.

}.

}.

// check if the configure.php file is writeable.

If (WARN_CONFIG_WRITEABLE == 'true') {.

If ( (file_exists(dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME'])'/includes/configure.php')) && (is_writeable(dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME'])'/includes/configure.php')) ) {.

$messageStack->add('header', WARNING_CONFIG_FILE_WRITEABLE, 'warning');.

}.

}.

// check if the session folder is writeable.

If (WARN_SESSION_DIRECTORY_NOT_WRITEABLE == 'true') {.

If (STORE_SESSIONS == '') {.

If (!is_dir(tep_session_save_path())) {.

$messageStack->add('header', WARNING_SESSION_DIRECTORY_NON_EXISTENT, 'warning');.

} elseif (!is_writeable(tep_session_save_path())) {.

$messageStack->add('header', WARNING_SESSION_DIRECTORY_NOT_WRITEABLE, 'warning');.

}.

}.

}.

// check session.auto_start is disabled.

If ( (function_exists('ini_get')) && (WARN_SESSION_AUTO_START == 'true') ) {.

If (ini_get('session.auto_start') == '1') {.

$messageStack->add('header', WARNING_SESSION_AUTO_START, 'warning');.

}.

}.

If ( (WARN_DOWNLOAD_DIRECTORY_NOT_READABLE == 'true') && (DOWNLOAD_ENABLED == 'true') ) {.

If (!is_dir(DIR_FS_DOWNLOAD)) {.

$messageStack->add('header', WARNING_DOWNLOAD_DIRECTORY_NON_EXISTENT, 'warning');.

}.

}.

If ($messageStack->size('header') > 0) {.

Echo $messageStack->output('header');.

}.

?>.

<!.

<? // MANUFACTURERS.

$manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name from "TABLE_MANUFACTURERS" order by manufacturers_name");.

If ($number_of_rows = tep_db_num_rows($manufacturers_query)) {.

Echo '<table cellspacing=0 cellpadding=0 width=177 align=center> '..

Tep_draw_form('manufacturers', tep_href_link(FILENAME_DEFAULT, '', 'NONSSL', false), 'get').

.' <tr><td colspan=2><b>Search by manufacturers:</b></td></tr>.

<tr><td height=2 colspan=2></td></tr>.

<tr><td colspan=2>.

';.

$manufacturers_array = array();.

While ($manufacturers = tep_db_fetch_array($manufacturers_query)) {.

$manufacturers_name = ((strlen($manufacturers['manufacturers_name']) > MAX_DISPLAY_MANUFACTURER_NAME_LEN) ? substr($manufacturers['manufacturers_name'], 0, MAX_DISPLAY_MANUFACTURER_NAME_LEN)'..' : $manufacturers['manufacturers_name']);.

$manufacturers_array[] = array('id' => $manufacturers['manufacturers_id'],.

'text' => $manufacturers_name);.

}.

Echo tep_draw_pull_down_menu('manufacturers_id', $manufacturers_array, (isset($HTTP_GET_VARS['manufacturers_id']) ? $HTTP_GET_VARS['manufacturers_id'] : ''), 'onChange="this.form.submit();" size="'MAX_MANUFACTURERS_LIST'" class=se1')tep_hide_session_id();.

Echo ' </td>.

</form>.

</table>.

';.

}.

?>.

>.

<table cellspacing=0 cellpadding=0 width=747 align=center>.

<tr><td valign=top>.

<table cellspacing=0 cellpadding=0>.

<tr><td width=248><a href=<?=tep_href_link('index.php')?>><img src=images/m01.gif width=248 height=88 border=0></a></td>.

<td width=499 valign=top>.

<table cellspacing=0 cellpadding=0 width=499>.

<tr><td bgcolor=#F4F0ED height=45></td></tr>.

<tr><td bgcolor=#EFE8E2 height=43>.

<table cellspacing=0 cellpadding=0>.

<form>.

<tr><td width=97 align=right class=ch1>Currencies:</td>.

<td width=136> &nbsp;.

<? // CURRENCIES.

Echo tep_draw_form('currencies', tep_href_link(basename($PHP_SELF), '', $request_type, false), 'get');.

Reset($currencies->currencies);.

$currencies_array = array();.

While (list($key, $value) = each($currencies->currencies)) {.

$currencies_array[] = array('id' => $key, 'text' => $value['title']);.

}.

$hidden_get_variables = '';.

Reset($HTTP_GET_VARS);.

While (list($key, $value) = each($HTTP_GET_VARS)) {.

If ( ($key != 'currency') && ($key != tep_session_name()) && ($key != 'x') && ($key != 'y') ) {.

$hidden_get_variables .= tep_draw_hidden_field($key, $value);.

}.

}.

Echo tep_draw_pull_down_menu('currency', $currencies_array, $currency, 'onChange="this.form.submit(); "class=se style="width:106px; font-size: 9px" ')$hidden_get_variablestep_hide_session_id();.

Echo '</form>';.

?>.

</td>.

<td bgcolor=#D5C9BE width=1 height=30></td>.

<td width=18></td>.

<td><a href=<?=tep_href_link('shopping_cart.php')?>><img src=images/m02.gif width=15 height=17 border=0></a></td>.

<td> &nbsp; <span class=ch1>Shopping Cart</span> <span class=ch2>now in your cart</span> <a class=ml1 href=<?=tep_href_link('shopping_cart.php')?>><?=$cart->count_contents()?> items</a></td>.

</tr>.

</form>.

</table>.

</td></tr>.

</table>.

</td>.

</tr>.

</table>.

</td></tr>.

<tr><td valign=top>.

<table cellspacing=0 cellpadding=0>.

<tr><td width=248 valign=top>.

<table cellspacing=0 cellpadding=0>.

<tr><td><img src=images/m04.gif width=248 height=17></td></tr>.

<tr><td><a href=<?=tep_href_link('index.php')?>><img src=images/b01.gif width=248 height=30 border=0></a></td></tr>.

<tr><td><a href=<?=tep_href_link('about_us.php')?>><img src=images/b02.gif width=248 height=30 border=0></a></td></tr>.

<tr><td><a href=<?=tep_href_link('products_new.php')?>><img src=images/b03.gif width=248 height=30 border=0></a></td></tr>.

<tr><td><a href=<?=tep_href_link('account.php')?>><img src=images/b04.gif width=248 height=30 border=0></a></td></tr>.

<tr><td><a href=<?=tep_href_link('shopping_cart.php')?>><img src=images/b05.gif width=248 height=30 border=0></a></td></tr>.

<tr><td><a href=<?=tep_href_link('checkout_shipping.php')?>><img src=images/b06.gif width=248 height=30 border=0></a></td></tr>.

<tr><td><img src=images/m05.gif width=248 height=12></td></tr>.

</table>.

</td>.

<td><img src=images/m06.gif width=252 height=209><a href=<?=tep_href_link('products_new.php')?>><img src=images/m07.gif width=247 height=209 border=0></a></td></tr>.

</table>.

</td></tr>.

<tr><td>.

<table cellspacing=0 cellpadding=0>.

<tr><td width=248 valign=top>.

<table cellspacing=0 cellpadding=0 width=248>.

<tr><td bgcolor=#FBE3AC height=26 valign=top>.

<table cellspacing=0 cellpadding=0>.

<tr><td height=9></td></tr>.

<tr><td width=142 class=ch1 align=right>Choose your language:</td>.

<td> &nbsp;.

<? // LANGUAGES.

If (!isset($lng) || (isset($lng) && !is_object($lng))) {.

Include(DIR_WS_CLASSES'language.php');.

$lng = new language;.

}.

$languages_string = '';.

Reset($lng->catalog_languages);.

While (list($key, $value) = each($lng->catalog_languages)) {.

$languages_string .= ' <a href="'tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('language', 'currency'))'language='$key, $request_type)'">'tep_image(DIR_WS_LANGUAGES$value['directory']'/images/'$value['image'], $value['name'])'</a> ';.

}.

Echo $languages_string;.

?>.

</td></tr>.

</table>.

</td></tr>.

<tr><td background=images/m11.gif width=248 height=33 valign=top>.

<table cellspacing=0 cellpadding=0>.

<tr><td height=11></td></tr>.

<tr><td class=ch4><span class=ch3>Shop by brand</span></td></tr>.

</table>.

</td></tr>.

<tr><td bgcolor=#F2EADC width=248>.

<table cellspacing=0 cellpadding=0 width=239 align=center>.

<tr><td height=5></td></tr>.

<? // MANUFACTURERS STRING OUTPUT.

If ((USE_CACHE == 'true') && empty($SID)) {.

Echo tep_cache_manufacturers_box();.

} else {.

Include(DIR_WS_BOXES'manufacturers.php');.

}.

?>.

<tr><td height=5></td></tr>.

</table>.

</td></tr>.

<tr><td background=images/m14.gif width=248 height=29 valign=top>.

<table cellspacing=0 cellpadding=0>.

<tr><td height=8></td></tr>.

<tr><td class=ch4><span class=ch3>Product Categories</span></td></tr>.

</table>.

</td></tr>.

<tr><td bgcolor=#EEE3D0 width=248 valign=top align=center>.

<table cellspacing=0 cellpadding=0 width=239 align=center>.

<tr><td height=5></td></tr>.

<? // CATEGORIES.

Function tep_show_category($counter) {.

Global $tree, $categories_string, $cPath_array;.

If(!$tree[$counter]['level']){.

$categories_string .= $categories_string ? '<tr><td height=1></td></tr>' : '';.

$categories_string .= '<tr><td width=19 height=19><img src=images/m12.gif width=19 height=19></td><td bgcolor=#E7DCCB> &nbsp;&nbsp; <a class=ml2 href=';.

If ($tree[$counter]['parent'] == 0) {.

$cPath_new = 'cPath='$counter;.

} else {.

$cPath_new = 'cPath='$tree[$counter]['path'];.

}.

$categories_string .= tep_href_link('index.php', $cPath_new)'>';.

// display categry name.

$categories_string .= $tree[$counter]['name'];.

$categories_string .= '</a></td></tr>';.

}else{ // SUBCATEGORY.

$categories_string .= '<tr><td width=19 height=19><img src=images/m12.gif width=19 height=19></td><td bgcolor=#E7DCCB>&nbsp; &nbsp; ';.

For($i=0;$i<$tree[$counter]['le vel'];$i++).

$categories_string .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';.

$categories_string .= '&nbsp;&nbsp;&nbsp; <a class=ml2 style="font-weight:normal;" href=';.

If ($tree[$counter]['parent'] == 0) {.

$cPath_new = 'cPath='$counter;.

} else {.

$cPath_new = 'cPath='$tree[$counter]['path'];.

}.

$categories_string .= tep_href_link('index.php', $cPath_new)'>-';.

// display category name.

$categories_string .= $tree[$counter]['name'];.

$categories_string .= '</a></td></tr>';.

}.

If ($tree[$counter]['next_id'] != false) {.

Tep_show_category($tree[$counter]['next_id']);.

}.

}.

Define(TABLE_CATEGORIES, "categories");.

Define(TABLE_CATEGORIES_DESCRIPTION, "categories_description");.

$categories_string = '';.

$tree = array();.

$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from "TABLE_CATEGORIES" c, "TABLE_CATEGORIES_DESCRIPTION" cd where c.parent_id = '0' and c.categories_id = cd.categories_id and cd.language_id='"(int)$languages_id ."' order by sort_order, cd.categories_name");.

While ($categories = tep_db_fetch_array($categories_query)) {.

$tree[$categories['categories_id']] = array('name' => $categories['categories_name'],.

'parent' => $categories['parent_id'],.

'level' => 0,.

'path' => $categories['categories_id'],.

'next_id' => false);.

If (isset($parent_id)) {.

$tree[$parent_id]['next_id'] = $categories['categories_id'];.

}.

$parent_id = $categories['categories_id'];.

If (!isset($first_element)) {.

$first_element = $categories['categories_id'];.

}.

}.

//.

If ($cPath) {.

$new_path = '';.

Reset($cPath_array);.

While (list($key, $value) = each($cPath_array)) {.

Unset($parent_id);.

Unset($first_id);.

$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from "TABLE_CATEGORIES" c, "TABLE_CATEGORIES_DESCRIPTION" cd where c.parent_id = '"(int)$value"' and c.categories_id = cd.categories_id and cd.language_id='"(int)$languages_id ."' order by sort_order, cd.categories_name");.

If (tep_db_num_rows($categories_query)) {.

$new_path .= $value;.

While ($row = tep_db_fetch_array($categories_query)) {.

$tree[$row['categories_id']] = array('name' => $row['categories_name'],.

'parent' => $row['parent_id'],.

'level' => $key+1,.

'path' => $new_path'_'$row['categories_id'],.

'next_id' => false);.

If (isset($parent_id)) {.

$tree[$parent_id]['next_id'] = $row['categories_id'];.

}.

$parent_id = $row['categories_id'];.

If (!isset($first_id)) {.

$first_id = $row['categories_id'];.

}.

$last_id = $row['categories_id'];.

}.

$tree[$last_id]['next_id'] = $tree[$value]['next_id'];.

$tree[$value]['next_id'] = $first_id;.

$new_path .= '_';.

} else {.

Break;.

}.

}.

}.

$categories_string .= '';.

Tep_show_category($first_element);.

$categories_string .= '';.

Echo $categories_string;.

?>.

<tr><td height=5></td></tr>.

</table>.

</td></tr>.

</table>.

</td>.

<td width=499 valign=top>.

<table cellspacing=0 cellpadding=0>.

<tr><td><a href=<?=tep_href_link('index.php','cPath=61')?>><img src=images/m16.gif width=248 height=105 border=0></a><a href=<?=tep_href_link('index.php','cPath=63')?>><img src=images/m17.gif width=251 height=105 height=105 border=0></a></td></tr>.

</table>.

Thanks for the help..

Comment #5

Hi Burt, I was not actually too sure if javascript would be usuable within the php code! Any way Germ has been kind enough to help me with some php script. Thanx for the input though..

Comment #6

Is that what was needed to be posted?.

Is 2 instead of 4 images cause an issue?..

Comment #7

Backup the file..

Then replace this line:.

<tr><td><a href=<?=tep_href_link('index.php','cPath=61')?>><img src=images/m16.gif width=248 height=105 border=0></a><a href=<?=tep_href_link('index.php','cPath=63')?>><img src=images/m17.gif width=251 height=105 height=105 border=0></a></td></tr>.

With this code:.

<?php.

// load the images in the array here.

$img = array("image1.gif", "image2.gif", "image3.gif", "image4.gif", "image5.gif", "image6.gif", "image7.gif", "image8.gif");.

// load the categories to be used here.

$lnk = array("cPath=1", "cPath=2", "cPath=3", "cPath=4", "cPath=5", "cPath=6", "cPath=7", "cPath=8");.

// randomize the arrays.

Shuffle($img);.

Shuffle($lnk);.

// pick 1st image and category.

$img1 = array_pop($img);.

$lnk1 = array_pop($lnk);.

// pick 2nd image and category.

$img2 = array_pop($img);.

$lnk2 = array_pop($lnk);.

Echo '<tr><td>'"\n";.

Echo '<a href="'tep_href_link(FILENAME_DEFAULT, $lnk1)'">'tep_image(DIR_WS_IMAGES$img1,'','248','105','border=0')'</a>'"\n";.

Echo '<a href="'tep_href_link(FILENAME_DEFAULT, $lnk2)'">'tep_image(DIR_WS_IMAGES$img2,'','251','105','border=0')'</a>'"\n";.

Echo '</td></tr>'"\n";.

?>.

In the code I posted you must first change this line:.

$img = array("image1.gif", "image2.gif", "image3.gif", "image4.gif", "image5.gif", "image6.gif", "image7.gif", "image8.gif");.

In that line put the names of the images you want the code to randomly select..

And also change this line:.

$lnk = array("cPath=1", "cPath=2", "cPath=3", "cPath=4", "cPath=5", "cPath=6", "cPath=7", "cPath=8");.

Those are the categories you want to randomly associate with the images..

I think this is what you want..

I still feel like I'm being blindfolded and asked to put a puzzle together that has half the pieces missing.....

Comment #8

"Easy as pie" it already is so that is a bit of a red herring...

Comment #9

Hi germ your help is very much appreciated my next question maybe the missing pieces to that jigsaw, otherwise it's just my lack of knowledge in php that is causing the problem...lol.

What I want, maybe it is so that it will already be like this but your above comment suggests it's not.......

I would like image1 to have link to category1, image2 to have link to category2 and so on, but the images still loaded randomly so that there is a different image (and it's link to it's category) each time the page is loaded.............

Again I am sorry for any confusion and any lack of knowledge I have..

Comment #10

Replace this code:.

<tr><td><a href=<?=tep_href_link('index.php','cPath=61')?>><img src=images/m16.gif width=248 height=105 border=0></a><a href=<?=tep_href_link('index.php','cPath=63')?>><img src=images/m17.gif width=251 height=105 height=105 border=0></a></td></tr>.

With this code:.

<?php.

// load the images in the array here.

$img = array("image1.gif", "image2.gif", "image3.gif", "image4.gif", "image5.gif", "image6.gif", "image7.gif", "image8.gif");.

// randomize the array.

Shuffle($img);.

// pick 1st image.

$img1 = array_pop($img);.

// pick 2nd image.

$img2 = array_pop($img);.

Echo '<tr><td>'"\n";.

Echo '<a href="'tep_href_link(FILENAME_DEFAULT, 'cPath=61')'">'tep_image(DIR_WS_IMAGES$img1,'','248','105','border=0')'</a>'"\n";.

Echo '<a href="'tep_href_link(FILENAME_DEFAULT, 'cPath=63')'">'tep_image(DIR_WS_IMAGES$img2,'','251','105','border=0')'</a>'"\n";.

Echo '</td></tr>'"\n";.

?>..

Comment #11

Hi There,.

I may be missing something, however, I know you can get many scripts in various languages that randomise what images are shown when a page loads..

However I am after one that will do so within the header of an oscommerce store, that also carries different links with each image..

I have 3 graphical links within my header that promote various aspects of thre store, however as these are in the header they are the same regardless what page you are on or how many links you follow, so I want to randomise the images shown, with each image having it's own link.......

I know it's can be done as standard by something as easy as Javascript but is there something that can be used within an oscommerce store?..

Comment #12

Unfortunatley the suggested contribution is not addequate..

I have looked at 2 contributions:.

Random Header Image.

This contribution seems to focus on a radom entire header image. I have between 2 and 4 images that I want to randomise within header.php.

Random Images On Any Page.

This contribution has half the functionailty I need. The missing half is that I need each image to carry it's own link to the related area..

I am happy to reduce the number of images I want to be randomised (not the number to choose from but the physical number of images). I have 4 seperate images in header.php and each one carries it's own link. I would really like 2 of these images to have a set of images to be chosen from and randomly shown, but each images needs to be linked to a diferent catagory..

Hope I have explained this clearly (as my eyes are drooping shut at this early hour)..

Comment #13


This question was taken from a support group/message board and re-posted here so others can learn from it.

 

Categories: Home | Diet & Weight Management | Vitamins & Supplements | Herbs & Cleansing |

Sexual Health | Medifast Support | Nutrisystem Support | Medifast Questions |

Web Hosting | Web Hosts | Website Hosting | Hosting |

Web Hosting | GoDaddy | Digital Cameras | Best WebHosts |

Web Hosting FAQ | Web Hosts FAQ | Hosting FAQ | Hosting Group |

Hosting Questions | Camera Tips | Best Cameras To Buy | Best Cameras This Year |

Camera Q-A | Digital Cameras Q-A | Camera Forum | Nov 2010 - Cameras |

Oct 2010 - Cameras | Oct 2010 - DSLRs | Oct 2010 - Camera Tips | Sep 2010 - Cameras |

Sep 2010 - DSLRS | Sep 2010 - Camera Tips | Aug 2010 - Cameras | Aug 2010 - DSLR Tips |

Aug 2010 - Camera Tips | July 2010 - Cameras | July 2010 - Nikon Cameras | July 2010 - Canon Cameras |

July 2010 - Pentax Cameras | Medifast Recipes | Medifast Recipes Tips | Medifast Recipes Strategies |

Medifast Recipes Experiences | Medifast Recipes Group | Medifast Recipes Forum | Medifast Support Strategies |

Medifast Support Experiences |

 

(C) Copyright 2010 All rights reserved.