Zen Cart Logo
Forums / General Questions / How to remove the dummy values from sidebox?

How to remove the dummy values from sidebox?

Locked

Views: 1,517

Results 1 to 6 of 6
This thread is locked. New replies are disabled.
17 Nov 2007, 9:44 AM
#1
baljeet avatar

baljeet

New Zenner

Join Date:
Sep 2007
Posts:
18
Plugin Contributions:
0

How to remove the dummy values from sidebox?

I created a new sidebox(Droplet Character) on the top right side. It will show the message for a particular product. but when i click on the home link. it shows the dummy values(Values from the bottom left side Information sidebox). But it works fine for particular product.

How i can set the message when goes to home page. I want to display the message "No Message Available" in the Droplet Character sidebox when user is on home page or click on home page.

It is showing the Message With the values from the bottom left hand side sidebox(Information). I only want to display the message.

I am sending u the attachments for Correct message for a particular product .
And with the dummy values when click on home page.

Baljeet :frusty:

17 Nov 2007, 2:40 PM
#2
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: How to remove the dummy values from sidebox?

What we need is to see the code your sidebox is using to display the correct message. Post it between ```
[php] and [/php]


Do you have a reason to show the sidebox on the home page? You say you want it to say "no message available" - how about if it went away when there was no product message?
19 Nov 2007, 6:43 AM
#3
baljeet avatar

baljeet

New Zenner

Join Date:
Sep 2007
Posts:
18
Plugin Contributions:
0

Re: How to remove the dummy values from sidebox?

Actually there is a message for each product beco'z this is the client requirement.
i want to display the product message when user click on any product.It is running fine. but when user click on home link then it show the Message (No message available that i gave) with dummy values(from the bottom right hand site sidebox).
I don't know why this is happening. I am sending u the code that i made for displaying message on particular product. here it goes....

U can check the attachment and open it with wordpad. or u can just check here.

tpl_character.php

<?php

 
 
	$id=$_GET['products_id'];
	

	if($id!="")
	{
		 $query=mysql_query("select products_data from ".TABLE_PRODUCTS." where products_id=$id");
		$result=mysql_fetch_object($query);
		//echo mysql_error();
		 $data=$result->products_data;
    	$content = "";
	    $content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent centeredContent">';

	$content .= '<table cellpadding="0" cellspacing="0" border="0">
	<tr><td valign="top" >'.$data.'</td>
	<td valign="top"><img src="images/character_image.gif" alt="character_image.gif" width="65" height="94"></td>
	
	</tr>
	</table>';
     $content .= '</div>';
	 }
	
	else if($id==""||main_page=='index.php')	 
	{
	   $content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent centeredContent">';

	$content .= '<table cellpadding="0" cellspacing="0" border="0">
	<tr><td valign="top" >No Message Available</td>
	<td valign="top"><img src="images/character_image.gif" alt="character_image.gif" width="65" height="94"></td>
	
	</tr>
	</table>';
     $content .= '</div>';
		
	}
	 
?>
19 Nov 2007, 6:56 AM
#4
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: How to remove the dummy values from sidebox?

Reposting this in [php] [/php] tags so I can read it better...```php

<?php $id=$_GET['products_id']; if($id!="") { $query=mysql_query("select products_data from ".TABLE_PRODUCTS." where products_id=$id"); $result=mysql_fetch_object($query); //echo mysql_error(); $data=$result->products_data; $content = ""; $content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent centeredContent">'; $content .= '<table cellpadding="0" cellspacing="0" border="0"> <tr><td valign="top" >'.$data.'</td> <td valign="top"><img src="images/character_image.gif" alt="character_image.gif" width="65" height="94"></td> </tr> </table>'; $content .= '</div>'; } else if($id==""||main_page=='index.php') { $content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent centeredContent">'; $content .= '<table cellpadding="0" cellspacing="0" border="0"> <tr><td valign="top" >No Message Available</td> <td valign="top"><img src="images/character_image.gif" alt="character_image.gif" width="65" height="94"></td> </tr> </table>'; $content .= '</div>'; } ?>
main_page=='index.php'

I'm not sure this will be read properly in this context. A more positive way to do it would be to say 
else if($id==""||$this_is_home_page)
19 Nov 2007, 6:58 AM
#5
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: How to remove the dummy values from sidebox?

Move this line to the top, above your opening IF statement:```
$content = "";

19 Nov 2007, 7:09 AM
#6
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: How to remove the dummy values from sidebox?

In the first case you initialize $content to blank, but in the second case you do not:

else if($id==""||main_page=='index.php')
{
$content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent centeredContent">';
```Add
$content = "";
to get this:
```php
else if($id==""||main_page=='index.php')
{
$content = "";
$content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent centeredContent">';
```A more elegant method would be to initialize it at the top of the file:```php
$id=$_GET['products_id'];
$content = "";

if($id!="")
```Looks like DrByte beat me to it with the critical bit:)