close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Can a style influence what is passed onto the cart page?

Thread began 3/01/2011 12:49 pm by Roxana | Last modified 3/04/2011 9:40 am by Jason Byrnes | 1863 views | 5 replies |

Roxana

Can a style influence what is passed onto the cart page?

I am still working on hiding non-relevant select menus. For example, if items have no size option, the size selection menu should be hidden. The size value for these item is set to zero.

In order for the items still to be passed on to the cart page I used this code (suggested by Jason), with the respective recordsets put in place:

$ATC_itemSize = "".$row_rspricelookup['size'] .""?$row_rspricelookup['size']:($row_rspriceNoSize['size']!=""?$row_rspriceNoSize['size']:($row_rspriceNoVersion['size']!=""?$row_rspriceNoVersion['size']:$row_rspriceNoVersionNoSize['size']));// column binding

In order to hide the non-relevant menu, I am using a temporary style

<?php
if ( (!isset($row_rsversion['version_id'])) || ($row_rsversion['version_id'] == "13") )
{
$tmpElementClassVersion = "hide";
}
else
{
$tmpElementClassVersion = "show";
}
?>
<?php
if ( (!isset($row_rssizedefault['size_id'])) || ($row_rssizedefault['size_id'] == "8") )
{
$tmpElementClassSize = "hide";
}
else
{
$tmpElementClassSize = "show";
}
?>

8 and 13 represent the zero values.

With the style defined like this (I also tried display:none, display:block):
.hide {
visibility: hidden;}
.show {
visibility: visible}

And for the output:
<select class="<?php echo $tmpElementClassVersion; ?>
for the version select menu

and
<select class="<?php echo $tmpElementClassSize; ?>
for the size select menu.

The problem: with the style in place, the product is not correctly passed onto the cart (for example a product in sizes S, M and L, no matter what size I choose, size S is being passed on).

Is something wrong with the if-statement?


This was the original thread:
showthread.php?t=18996

Sign in to reply to this post

Roxana

I tried to replace the first line of the if statement with:

if ( $row_rsversion['version_id'] == "13" )

Still the product is not passed on to the cart page correctly.

Sign in to reply to this post

Jason ByrnesWebAssist

dont use a style to hide the list.


use an if statement around the list itself.

Sign in to reply to this post

Roxana

Hi Jason,

I tried hiding the select menu with with

php:
<?php if (!empty($row_rssizedefault['size'])) { // Show if recordset not empty ?>



and also with

php:
<?php if ($row_rsversion['version_id'] != "13") { // Show if recordset not empty ?>



Where id 13 is a zero value.

Both ways take the menu away and put the correct item in the cart. But they also take away a feature that price and item no. automatically adjust, when the user makes a version or size choice.

It seems like the select menu is made invisible not only to the browser, but also to some JavaScript, that seems to rely on a value (even a zero value) from the hidden select menu.

When using the style to hide the select menu, the adjusting feature still works, but the wrong item would be put into the cart, if a choice was made.

Sorry for being so confusing.

Just in case, I have attached a copy of the detail page.

Attached Files
detail_webassist.php.zip
Sign in to reply to this post

Roxana

Hi Jason,

I think I may have found the solution by combining the use of php and css. I duplicated the select menu, then hide the first select menu, if there is no version option, both with php and css. The other select menu only shows, if there is a version option (with php).

It is probably very unconventional, and took me a while to figure out. Serious programmers will probably cry out in horror, but here is the code I used. It works for me, but if there is something, that should not be done, could you please let me know?

php:
<p>

                  <?php if ($row_rsversion['version_id'] == "13") { // Show if recordset empty ?>
                    <select class="<?php echo $tmpElementClassVersion?> name="SelectVersion" id="SelectVersion" onchange="WA_FilterAndPopulateSubList(rssize_WAJA,MM_findObj('SelectVersion'),MM_findObj('SelectSize'),0,0,false,': ');showprice()">
                      <?php
do {  
?>
                      <option value="<?php echo $row_rsversion['version_id']?>"<?php if (!(strcmp($row_rsversion['version_id'], $row_rsversion['version']))) {echo "selected=\"selected\"";} ?>><?php echo $row_rsversion['version_compound']?></option>
                      <?php
} while ($row_rsversion mysql_fetch_assoc($rsversion));
  
$rows mysql_num_rows($rsversion);
  if(
$rows 0) {
      
mysql_data_seek($rsversion0);
      
$row_rsversion mysql_fetch_assoc($rsversion);
  }
?>
                    </select>
                    <?php // Show if recordset empty ?>
                    <?php if ($row_rsversion['version_id'] != "13") { // Show if recordset not empty ?>
                    <select name="SelectVersion" id="SelectVersion" onchange="WA_FilterAndPopulateSubList(rssize_WAJA,MM_findObj('SelectVersion'),MM_findObj('SelectSize'),0,0,false,': ');showprice()">
                      <?php
do {  
?>
                      <option value="<?php echo $row_rsversion['version_id']?>"<?php if (!(strcmp($row_rsversion['version_id'], $row_rsversion['version']))) {echo "selected=\"selected\"";} ?>><?php echo $row_rsversion['version_compound']?></option>
                      <?php
} while ($row_rsversion mysql_fetch_assoc($rsversion));
  
$rows mysql_num_rows($rsversion);
  if(
$rows 0) {
      
mysql_data_seek($rsversion0);
      
$row_rsversion mysql_fetch_assoc($rsversion);
  }
?>
                    </select>
                    <?php // Show if recordset not empty ?>   
                  </p>
                  <p>
                      <?php if ($row_rssizedefault['size_id'] == "8") { // Show if recordset empty ?>
                    <select class="<?php echo $tmpElementClassSize?> name="SelectSize" id="SelectSize" onchange="showprice()">
                      <?php
do {  
?>
                      <option value="<?php echo $row_rssizedefault['size_id']?>"<?php if (!(strcmp($row_rssizedefault['size_id'], $row_rssize['size']))) {echo "selected=\"selected\"";} ?>><?php echo $row_rssizedefault['size']?></option>
                      <?php
} while ($row_rssizedefault mysql_fetch_assoc($rssizedefault));
  
$rows mysql_num_rows($rssizedefault);
  if(
$rows 0) {
      
mysql_data_seek($rssizedefault0);
      
$row_rssizedefault mysql_fetch_assoc($rssizedefault);
  }
?>
                    </select>
                    <?php // Show if recordset empty ?>
                    <?php if ($row_rssizedefault['size_id'] != "8") { // Show if recordset not empty ?>
                    <select name="SelectSize" id="SelectSize" onchange="showprice()">
                      <?php
do {  
?>
                      <option value="<?php echo $row_rssizedefault['size_id']?>"<?php if (!(strcmp($row_rssizedefault['size_id'], $row_rssize['size']))) {echo "selected=\"selected\"";} ?>><?php echo $row_rssizedefault['size']?></option>
                      <?php
} while ($row_rssizedefault mysql_fetch_assoc($rssizedefault));
  
$rows mysql_num_rows($rssizedefault);
  if(
$rows 0) {
      
mysql_data_seek($rssizedefault0);
      
$row_rssizedefault mysql_fetch_assoc($rssizedefault);
  }
?>
                    </select>
                    <?php // Show if recordset not empty ?>
                  </p>
Sign in to reply to this post

Jason ByrnesWebAssist

excellent, glad to hear you have it working.

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