Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Hiding certain infoboxes until needed


Guest

Recommended Posts

Posted

I figured out how to hide the shopping cart infobox unless there is something in there, but can't seem to be able to come up with the correct coding for the review and specials box. Any help will be greatly appreciated.

Posted

Look at the code at the bottom of column_right.php to see when or when not the language and currency boxes are displayed. It'll give you ideas.

 

require(DIR_WS_BOXES . 'reviews.php');

 

if (substr(basename($PHP_SELF), 0, 8) != 'checkout') {

include(DIR_WS_BOXES . 'languages.php');

include(DIR_WS_BOXES . 'currencies.php');

}

?>

Local: Mac OS X 10.5.8 - Apache 2.2/php 5.3.0/MySQL 5.4.10 • Web Servers: Linux

Tools: BBEdit, Coda, Versions (Subversion), Sequel Pro (db management)

Posted
Look at the code at the bottom of column_right.php to see when or when not the language and currency boxes are displayed. It'll give you ideas.

 

require(DIR_WS_BOXES . 'reviews.php');

 

if (substr(basename($PHP_SELF), 0, 8) != 'checkout') {

include(DIR_WS_BOXES . 'languages.php');

include(DIR_WS_BOXES . 'currencies.php');

}

?>

I'm looking, I'm looking... and either my lightbulb is busted or extremely dim.

 

Here's what I have so far. I've majorly edited my right hand column so it is considerably shorter. I also put comments in the file so I know what does what. It's also a great way for me to track what I've changed/modified.

 

/* makes cart show only when item is in it */
 if ($cart->count_contents() > 0) include(DIR_WS_BOXES . 'shopping_cart.php');

/* in-page log-in box */
 require(DIR_WS_BOXES . 'memberlogin.php');


 require(DIR_WS_BOXES . 'reviews.php');

 if (isset($HTTP_GET_VARS['products_id'])) {
if (basename($PHP_SELF) != FILENAME_TELL_A_FRIEND) include(DIR_WS_BOXES . 'tell_a_friend.php');
 } else {
include(DIR_WS_BOXES . 'specials.php');
 }

Now, if I change the require on the "reviews.php" and "specials.php" call, I'm thinking that I need to encapsulate it like so...

  if (basename($PHP_SELF) !=FILENAME_PRODUCT_REVIEWS) include(DIR_WS_BOXES . 'reviews.php');

Am I on the right track or has my train derailed?

Posted

I thought about doing it that way, Vger. The only problem would then be that it would never appear. I would like to have it set up so that if there are no product reviews it's hidden, not completely gone.

 

Something similar to the way the shopping cart is set up now. Not there unless it's needed.

Posted

Erm?? (scratches head) The Reviews Info Box does not appear unless there are any reviews to go in it.

 

Vger

Posted
Erm?? (scratches head) The Reviews Info Box does not appear unless there are any reviews to go in it.

 

Vger

 

Wanna bet? This is from one copy of osC that I haven't modified anything other than the stylesheet and the catalog on.

 

reviewbox.jpg

And here's the page:

<?php
/*
 $Id: column_right.php,v 1.17 2003/06/09 22:06:41 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 require(DIR_WS_BOXES . 'shopping_cart.php');

 if (isset($HTTP_GET_VARS['products_id'])) include(DIR_WS_BOXES . 'manufacturer_info.php');

 if (tep_session_is_registered('customer_id')) include(DIR_WS_BOXES . 'order_history.php');

 if (isset($HTTP_GET_VARS['products_id'])) {
if (tep_session_is_registered('customer_id')) {
  $check_query = tep_db_query("select count(*) as count from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . (int)$customer_id . "' and global_product_notifications = '1'");
  $check = tep_db_fetch_array($check_query);
  if ($check['count'] > 0) {
	include(DIR_WS_BOXES . 'best_sellers.php');
  } else {
	include(DIR_WS_BOXES . 'product_notifications.php');
  }
} else {
  include(DIR_WS_BOXES . 'product_notifications.php');
}
 } else {
include(DIR_WS_BOXES . 'best_sellers.php');
 }

 if (isset($HTTP_GET_VARS['products_id'])) {
if (basename($PHP_SELF) != FILENAME_TELL_A_FRIEND) include(DIR_WS_BOXES . 'tell_a_friend.php');
 } else {
include(DIR_WS_BOXES . 'specials.php');
 }

 require(DIR_WS_BOXES . 'reviews.php');

 if (substr(basename($PHP_SELF), 0, 8) != 'checkout') {
include(DIR_WS_BOXES . 'languages.php');
include(DIR_WS_BOXES . 'currencies.php');
 }
?>

 

This is osCommerce 2.2 Milestone 2 Update 051113 - I even re-downloaded the zip before posting so I could check the date on the file. Same date, same coding. Searched the contrib section, the whole forum even and other than confirming that my plodding around hit upon the right code to "hide" the cart box, I've found nothing to hide this one. It "self-hides" the "Tell a Friend" box, the "Notifications" box, the "Hot Items" box, etc. but not this one.

 

I could always go in and put a product review in there, but that seems kinda cheesy, ya know.

Posted

Yes, sorry you are correct. I spend so much time modifying sites to remove things like Reviews that I rarely work with default osCommerce sites any more.

 

It may be cheesy, but what's wrong with adding a review or commenting it out until you have some genuine ones? It'd save the work.

 

Vger

Posted

Well, the customer wants it but currently doesn't have any reviews. And I really don't want to have to go back and check on a regular basis for when a review gets added to uncomment it. Paint me lazy.

 

And setting this cart up has become a lesson in PHP for me. I've been able to figure out a large percentage of what all the functions and calls do, but I'm still very much in the dark. I can walk you through the ins and outs of HTML, CSS, PERL, etc. without breaking a sweat. I understand and even write the occasional javascript. I'm trying to apply that to PHP and in some cases the knowledge is helpful, in others, I feel like a complete doofus. Chalk up wanting to know how to do it as a learning experience.

Posted
Well, the customer wants it but currently doesn't have any reviews. And I really don't want to have to go back and check on a regular basis for when a review gets added to uncomment it. Paint me lazy.

 

umm, do the obvious :devil:

 

Shill, plant some fake reviews, you wouldn't be the first. If he likes the feature but you hide it it'll never be used.

Local: Mac OS X 10.5.8 - Apache 2.2/php 5.3.0/MySQL 5.4.10 • Web Servers: Linux

Tools: BBEdit, Coda, Versions (Subversion), Sequel Pro (db management)

Posted

I'm about ready to, can't seem to come across the right wording to put in the "hide til I need ya" line.

 

Maybe I can con the person into sending me some of the candy they have. Let's see, yeah, I need it for research LOL

Archived

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

×
×
  • Create New...