close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

E Cart 5 show/hide columns customization

Thread began 5/31/2010 2:21 am by J7HNW | Last modified 6/03/2010 3:39 pm by J7HNW | 2187 views | 3 replies

Eric Mittman

This is a more advanced technique but it could be done by checking to see if there are any values for a particular column and if so setting a variable to true. Then down in your code you could put some if statements around the column headers and columns themselves to show or hide these columns depending on weather or not the variable is set to true.

Here is an example of some code that does something like this, in this example I'm using my cart with the name of $eCart and the column I'm testing with is description. I put this code just above the doctype declaration for the html portion of the page.

php:
<?php

$has_description 
false;
foreach(
$eCart1->Items as $key => $value){
    if(
$eCart1->Items[$key]->Description != ""){
        
$has_description true;
    }
}
?>



So it starts by setting the variable to false, then it loops over every item in the cart and checks to see if there is a description that is not "" for each item. If any item has a description it will set the $has_description to true.

Later down in the code for the cart display you would put in an if statement around the column header and value like this:

header

php:
<?php if($has_description){ ?><th class="eC_GroupColumn" >Description</th><?php ?>



value

php:
<?php if($has_description){ ?><td  class="eC_ItemDescription">Description:&nbsp;<?php echo $eCart1->DisplayInfo("Description"); ?></td><?php ?>



You would need to account for all of the columns you are trying to conditionally hide in the foreach loop, then make sure to add in the if statements around the column headers and values for each of them.

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...