close ad
Help us test the new Databridge BETA with MySQLi support
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

eCart Add to Cart Product Options Errors

Thread began 2/09/2012 5:49 pm by toni272059 | Last modified 2/13/2012 4:04 pm by Jason Byrnes | 3265 views | 13 replies |

toni272059

eCart Add to Cart Product Options Errors

I have been thru the Product Options tutorial several times.

So far I have managed to create a product_detail page that successfully shows different Color options specific to a product and a second option Plain or With Embroidery. With Embroidery would add $15 to item price. When I go thru the steps to search for an item, view its detail page and select the 2 options everything works, no error messages.

Problems begin when I select Add to Cart button. Page does not redirect and error message shows
Notice: Undefined index: eCart1_1_Color_Add in /Users/tonimills/Sites/Boomerang_Needleworks/product_detail.php on line 121
I have checked the various recordsets against the tutorial numerous times and cannot identify what it is looking for.

I also checked the eCart Object and checked the column settings and calculations.
And the Add to Cart bindings

If I manually open the shopping cart page cart.php the item has been added. However there are no results showing for the color or embroidery option selections. Also, no $15 price increase.

I did add fields to the cart.php repeat region
<?php echo $eCart1->DisplayInfo("Embroidery"); ?>
<?php echo $eCart1->DisplayInfo("Color"); ?>

I am attaching the detail_page and cart php files and the eCart object php

Thanks in advance for your help!

Attached Files
Archive.1.zip
Sign in to reply to this post

Jason ByrnesWebAssist

your page has 3 different form in it, one for each of the elements, quantity, color, and embroidery, not sure where the extra form tags came form, but there should only be one from with all the elements in the same form. When the form is submitted, it is not sending the value for the color or embroidery because those elements belong to a different form then the add to cart button.

Sign in to reply to this post

toni272059

product_detail.php
OK, so I put the three elements into one <form> and that stopped the error message. However it did not take me to the cart.php page. I checked both redirects in the eCart Add from Recordset and both on the General and Bindings screens I entered Redirect to cart.php

Now when I manually go to cart.php the item has been added and the embroidery fee added with a line of text "Embroidery: Embroidery ($15)". For the color, there is just a number which I worked out is the ProductOptionID from the productoptions table of the database.
Screen grab attached.
How do I change it so the actual color is displayed? In the case of the Dog Leash: Blue, the Market Bag Set: Navy Blue and the iPad Briefcase: Black.

My next challenge is to only have options show if they are available for a specific product. For instance Embroidery is not available on everything and some products only come in one color.
Screen grabs attached showing the Long Bungee Dog Leash only comes in Blue and does not offer Embroidery.
Some guidance on how to achieve that on the detail page would be appreciated. Maybe there is a tutorial somewhere?

Thanks

Sign in to reply to this post

Jason ByrnesWebAssist

see the product options with eCart tutorial on the eCart support page.

Sign in to reply to this post

toni272059

I have, that is what I was using to get to where I am now!

Sign in to reply to this post

Jason ByrnesWebAssist

you need to create a recordset that will query the productoptions table to return the color and embroidery options fro the current product. Then use the Show Region behavior to only show the option elements if the recordset is not empty.

Sign in to reply to this post

toni272059

I created recordsets for the color and embroidery options using the eCart Product Options tutorial. They correctly show the specific options available for each product on the detail_page and the price increase for Embroidery is successfully added on the Cart page.

I added the Show Region behavior if recordset not empty to the Embroidery Option and that is now working. Thank you!

Still having trouble with:
1. Redirect to Cart
The Add to Cart button on the detail_page is not redirecting to the Cart, though it is adding items to the Cart. I have to manually go to the Cart page to see the changes. I have checked the "eCart Add from Recordset" and it shows redirect to cart.php in both General and Bindings.

2. Option Name for Color on Shopping Cart page
On the cart page the Embroidery OptionName shows in the line item correctly, as in "Embroidery $15", or "Plain, no Embroidery". However the Color is showing the ProductOptionID not the OptionName from the database table

Should the eCart Add to Button Binding for Color have a default value? Screen grab attached. There is no reference to it in the tutorial, just to make Updatable as select list

Thanks

Sign in to reply to this post

Jason ByrnesWebAssist

1) could be a php error occurring, add the following code at line 1 of the page to turn error reporting on:

php:
<?php

error_reporting
(E_ALL);
ini_set('display_errors','on');
?>




2) does the color effect price? or only embroidery? if the color does not effect price, set the color select list to use the color name as the value.

Sign in to reply to this post

toni272059

I added the error coding and there was no result when I clicked Add to Cart. And still no redirect. I have checked the eCart Add from Recordset yet again and in both places (General and Bindings) the redirect value is set to cart.php which is in the same directory as the detail_page.php

As for the Color OptionName showing instead of the ProductOptionID. I think I followed correctly, see manually changed code noted below. The correct name is now showing in the shopping cart. I did not open and change any recordsets or server behaviors.

This is the code from the detail page for the color select list
<select name="eCart1_1_Color_Add">
<option value="" selected <?php if (!(strcmp("", $row_rsColor['OptionName']))) {echo "selected=\"selected\"";} ?>>Select Color</option>
<?php
do {
?>
<option value="<?php echo $row_rsColor['NOTE:changed ProductOptionID to OptionName']?>"<?php if (!(strcmp($row_rsColor['ProductOptionID'], $row_rsColor['OptionName']))) {echo "selected=\"selected\"";} ?>><?php echo $row_rsColor['OptionName']?></option>
<?php
} while ($row_rsColor = mysql_fetch_assoc($rsColor));
$rows = mysql_num_rows($rsColor);
if($rows > 0) {
mysql_data_seek($rsColor, 0);
$row_rsColor = mysql_fetch_assoc($rsColor);
}
?>
</select>

Sign in to reply to this post

Jason ByrnesWebAssist

for the select list, yes, that is the correct change. for the redirect, send a copy of the latest page, and a link where i can see the problem.

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