close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Options and non-Option items?

Thread began 6/25/2013 3:58 pm by Art | Last modified 6/26/2013 3:25 pm by Jason Byrnes | 502 views | 10 replies |

Art

Options and non-Option items?

I have a page that lists items with Options. The user selects a drop-down addition That works.

However, on the same page, items with no options might appear and I'm having a hard time thinking of a creative way to have both.

What's the best way to handle this?

Sign in to reply to this post

Jason ByrnesWebAssist

if it is a dynamic page, you will need a nested recordset to look up the options for the product and use the recordset to populate the options list.

use a show if to only show the select list if the recordset is not empty.

Sign in to reply to this post

Art

Conditional Caluculation?

In order to make my life more difficult, I don't have a field for price "incrementation." I have skus that contain full price with options. So, when I calculate the price in the cart I do this:

([Price] + ([Option1Inc] - [Price])) * [Quantity]

This correctly increments the options price into the cart but when the item does not have an option, it predictably zero's out the price and only adds the qty into the cart.

My question now is how to do a calculation for those items that don't have options?

Sign in to reply to this post

Jason ByrnesWebAssist

([Price] + (abs([Option1Inc] > [Price])?[Option1Inc] - [Price]:0)) * [Quantity]

Sign in to reply to this post

Art

Perfect! I was just discovering the possibility of that solution so you saved me having to work too hard for it...

Of course I may still be back but thanks much!

Sign in to reply to this post

Art

([Price] + (abs([Option1] >+ 1)?[Option1Inc] - [Price]:0)) * [Quantity]

This variation is what ended up working...

The last problem is hiding the dropdown if no options exist... If I do the Hide if recordset option1 is empty, the page fails when I add an item with no options.

Notice: Undefined index: eCart2
$ATC_itemPrice = floatval("".$row_rsProduct['sku_price'] ."");// column binding

Sign in to reply to this post

Jason ByrnesWebAssist

send a copy of the page please.

Sign in to reply to this post

Art

Thanks...

Sign in to reply to this post

Jason ByrnesWebAssist

you used the cart is not empty around the options select list:


<?php
//WA eCart Show If Start
if (!$eCart2->IsEmpty()) {
?>
<select name="eCart2_1_Option1_Add">

<?php
do {
?>
<option value="<?php echo $row_rsOption['sku_price']?>"><?php echo $row_rsOption['option_name']?></option>
<?php
} while ($row_rsOption = mysql_fetch_assoc($rsOption));
$rows = mysql_num_rows($rsOption);
if($rows > 0) {
mysql_data_seek($rsOption, 0);
$row_rsOption = mysql_fetch_assoc($rsOption);
}
?>
</select>
<?php
//WA eCart Show If Middle
}
else {
?>



it should be the recordset is not empty instead.

also, create a hidden element of the same name as the select list, and use the Display if recordset is empty option.

That way, if the recordset is empty, it passes the hidden element, if not it passes the select list.

Sign in to reply to this post

Art

Once again, GREAT support.

I ended up setting the hidden field to a blank value and it didn't seem to mind:

<input name="eCart2_1_Option1_Add" type="hidden" id="hiddenField" value="">

Does it actually need a value?

Sign in to reply to this post
loading

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