close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Carrying over a parent ID value and problmes with parent ID in general...

Thread began 5/26/2014 3:40 pm by Nathon Jones Web Design | Last modified 5/28/2014 12:30 pm by Nathon Jones Web Design | 6058 views | 5 replies

Nathon Jones Web Design

Carrying over a parent ID value and problmes with parent ID in general...

We have parent ID products listed on category pages on our website which, when selected, take users to a product detail page which they MUST make choices/selections on in order to proceed. When the choices are made (drop-down menus) the page updates using an onchange event so that the correct product code and, if applicable, price are updated and the customer can then add to cart. Great!

However, there are two issues with this...

Issue 1

The parent product has, like the actual products, colour (Multiple Options), dimmable (Yes/No) and sensor (Yes/No) fields which need to contain data. On the parent product pages (category pages) we are displaying a graphic for each of these values depending on what those values are so we need to use them to show, for example, whether or not a product is dimmable.

Here is an example. This is the parent product...
http://www.ledwarehouseuk.com/LED-Lights-Bulbs.php?lbid=687

It comes in 4 variables
Cool White / Dimmable
Warm White / Dimmable
Cool White / Non-Dimmable
Warm White / Non-Dimmable

So, in our database we have...

ID Title Colour Dimmable Sensor Price ParentID Delete

687 Light Bulb 1 Cool White Dimmable No Sensor £5.70 0 2
676 Light Bulb 1 Cool White Dimmable No Sensor £5.70 687 2
333 Light Bulb 1 Warm White Dimmable No Sensor £5.70 687 2
677 Light Bulb 1 Cool White Non-Dimmable No Sensor £5.00 687 2
675 Light Bulb 1 Warm White Non-Dimmable No Sensor £5.00 687 2

The parent product needs to show "Dimmable" is an option (even if it's corresponding product - 676 for example - isn't available) so we mark it as Yes. Same with Sensor (no, in this particular case). Colour is a little more problematic because the product is available in more than one colour.

Anyhoo, I feel that the issue is the same so...on our product detail page we have lookup tables set to check the database for products whose ID is either that of the querystring used to open the detail page or whose parentID is also that value. Here's an example of our dimmable lookup table...

$paramItem_rsDIMM = "-1";
if (isset($row_rsPROD['LEDid'])) {
$paramItem_rsDIMM = $row_rsPROD['LEDid'];
}
mysql_select_db($database_connLED, $connLED);
$query_rsDIMM = sprintf("SELECT DISTINCT LEDprods.LEDdimmable, LEDdimmablename FROM LEDprods INNER JOIN LEDdimm ON LEDprods.LEDdimmable = LEDdimm.LEDdimmable WHERE LEDid = %s OR LEDparentID = %s", GetSQLValueString($paramItem_rsDIMM, "int"), GetSQLValueString($paramItem_rsDIMM, "int"));
$rsDIMM = mysql_query($query_rsDIMM, $connLED) or die(mysql_error());
$row_rsDIMM = mysql_fetch_assoc($rsDIMM);
$totalRows_rsDIMM = mysql_num_rows($rsDIMM);

So this shows a list of options...
Dimmable
Non-Dimmable

However, if the dimmable products aren't available (products 676 and 333) "dimmable" will still show as a value in the lookup drop-down because the parent product has it marked as yes.
How do I ensure that the lookup tables ignore the parent product values?

Issue 2

When the user adds to cart, the correct product is added to the cart however I had created a link from the product thumbnail and product title back to the product detail page however, because the product code will not be the parent product ID it returns us to the product detail page but no drop-down menus are available. I've tried adding a "parentID" field to the cart object and, on add to cart, have it carry over to the basket page however when I do this I get a PHP error on the cart quantity....

Notice: Undefined variable: ATC_itemQuantity in /home/led2014/public_html/LED-Lights-Bulbs.php on line 148

Line 148 is…
$ATC_itemQuantity = floatval($ATC_itemQuantity);

Hope you can help.
Thank you.
NJ

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