close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

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 Eric Mittman | 2189 views | 3 replies |

J7HNW

E Cart 5 show/hide columns customization

I am running E Cart 5 and would like some help. The cart sells 3 types of product. I have added extra fields into the cart definition so I can pull out the fields on the varying displays. So if you buy a standard product - you dont use the extra fields for Wig Colour, Wig length etc.

To overcome the different types of products having different fields which need to be displayed - have made three different forms carrying varying cart displays - but want to make sure this is OK before I run the Checkout Wizard as I am not sure if what I have done will cause problems.

If you add a standard items to the cart - you are transferred to a form called cart.php.
Standard accessories uses the std layout of NAME PRICE TOTAL in cart
To see this add a product from here..
product_info.php?ProductID=19


If you add a STOCK wig to the cart - you are transferred to a form called cartwig.php.
Stock Wigs - uses NAME PRICE TOTAL and 3 custom fields - which display in the Cart
To see this add a product from here..
product_info_wigsstock.php?ProductID=35

If you add a CUSTOM wig to the cart - you are transferred to a form called cartwig_custom.php.
Custom Wigs uses NAME PRICE TOTAL and 5 custom fields - which display in the Cart
To see this add a product from here..
product_info_wigs_custom.php?ProductID=36

IS there an easier way I can use just one form to accomplish this - maybe using show and hide regions on the cart display ?

Thank you

Sign in to reply to this post

Eric Mittman

There is not a built in server behavior or property for this but it could be done with some custom coding. The idea is that you can do a check to see if there are any values for a particular column, if not then do not print the column or anything in it. This would be implemented with some if statements around the table header and column <td>'s in the cart display page.

There are a lot of internal eCart values and functions that you can make use of, you can check them out in the <cartname>_php.php file in the WA_eCart folder. You will need a way to check on each of these cart columns and if any items have values for these columns you should display that column.

Sign in to reply to this post

J7HNW

Please explain

Please can you give me a sample code of how to hide columns which will work with E Cart ?

If not Can I simply point all 3 Cart views to 3 different checkout forms ( so each will carry the relevant data as per the Cart, Cartwig and Cartwigcustom pages now ?

Thanks

John

Sign in to reply to this post

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.

Sign in to reply to this post

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...