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

Incremental pricing not updating price...

Thread began 4/07/2014 2:37 pm by Nathon Jones Web Design | Last modified 4/14/2014 12:42 pm by Nathon Jones Web Design | 562 views | 18 replies

Nathon Jones Web Design

I have:

Dimmable
DimmPriceInc
Sensor
SensorPriceInc

...in the cart object. Here are the select lists for those options on the add to cart page...

<?php if ($totalRows_rsDIMM > 0) { // Show if recordset not empty ?>
<label for"LEDCart_1_Dimmable_Add">Dimmable:</label>
<select name="LEDCart_1_Dimmable_Add" id="LEDCart_1_Dimmable_Add">
<?php
do {
?>
<option value="<?php echo $row_rsDIMM['LEDprodoptionsID']; ?>"><?php echo $row_rsDIMM['LEDvarname']?> +£<?php echo $row_rsDIMM['LEDprodoptionincr']; ?>&nbsp;&nbsp;</option>
<?php
} while ($row_rsDIMM = mysql_fetch_assoc($rsDIMM));
$rows = mysql_num_rows($rsDIMM);
if($rows > 0) {
mysql_data_seek($rsDIMM, 0);
$row_rsDIMM = mysql_fetch_assoc($rsDIMM);
}
?>
</select><br><br>
<?php } // Show if recordset not empty ?>


<!-- #Hidden dimmable field if no dimmable option available -->
<?php if ($totalRows_rsDIMM == 0) { // Show if recordset empty ?>
<input type="hidden" name="LEDCart_1_Dimmable_Add" id="LEDCart_1_Dimmable_Add" value="Non-Dimmable" >
<?php } // Show if recordset empty ?>
<!-- #Hidden dimmable field if no dimmable option available -->


<?php if ($totalRows_rsSENSOR > 0) { // Show if recordset not empty ?>
<label for"LEDCart_1_Sensor_Add">Sensor:</label>
<select name="LEDCart_1_Sensor_Add" id="LEDCart_1_Sensor_Add">
<?php
do {
?>
<option value="<?php echo $row_rsSENSOR['LEDprodoptionsID']; ?>"><?php echo $row_rsSENSOR['LEDvarname']?> +£<?php echo $row_rsSENSOR['LEDprodoptionincr']; ?>&nbsp;&nbsp;</option>
<?php
} while ($row_rsSENSOR = mysql_fetch_assoc($rsSENSOR));
$rows = mysql_num_rows($rsSENSOR);
if($rows > 0) {
mysql_data_seek($rsSENSOR, 0);
$row_rsSENSOR = mysql_fetch_assoc($rsSENSOR);
}
?>
</select><br><br>
<?php } // Show if recordset not empty ?>

<!-- #Hidden sensor field if no sensor option available -->
<?php if ($totalRows_rsSENSOR == 0) { // Show if recordset empty ?>
<input type="hidden" name="LEDCart_1_Sensor_Add" id="LEDCart_1_Sensor_Add" value="" >
<?php } // Show if recordset empty ?>
<!-- #Hidden sensor field if no sensor option available -->

Here are the recordsets...

$paramItem_rsDIMM = "-1";
if (isset($row_rsPROD['LEDid'])) {
$paramItem_rsDIMM = $row_rsPROD['LEDid'];
}
mysql_select_db($database_connLED, $connLED);
$query_rsDIMM = sprintf("SELECT LEDprodoptions.LEDprodoptionincr, LEDprodoptions.LEDprodoptionsID, LEDvars.LEDvarname, LEDvars.LEDprodvarID, LEDprodvars.LEDprodvarname FROM LEDvars INNER JOIN LEDprodoptions ON LEDvars.LEDvarID = LEDprodoptions.LEDvarID INNER JOIN LEDprodvars ON LEDvars.LEDprodvarID = LEDprodvars.LEDprodvarID WHERE LEDprodvars.LEDprodvarname = 'Dimmable' AND LEDprodoptions.LEDid = %s", 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);

$paramOption_rsDIMMLOOKUP = "-1";
if (isset($_POST['LEDCart_1_Dimmable_Add'])) {
$paramOption_rsDIMMLOOKUP = $_POST['LEDCart_1_Dimmable_Add'];
}
$paramItem_rsDIMMLOOKUP = "-1";
if (isset($_POST['LEDCart_1_ID_Add'])) {
$paramItem_rsDIMMLOOKUP = $_POST['LEDCart_1_ID_Add'];
}
mysql_select_db($database_connLED, $connLED);
$query_rsDIMMLOOKUP = sprintf("SELECT LEDprodoptions.LEDprodoptionincr, LEDprodoptions.LEDprodoptionsID, LEDvars.LEDvarname, LEDvars.LEDprodvarID, LEDprodvars.LEDprodvarname FROM LEDvars INNER JOIN LEDprodoptions ON LEDvars.LEDvarID = LEDprodoptions.LEDvarID INNER JOIN LEDprodvars ON LEDvars.LEDprodvarID = LEDprodvars.LEDprodvarID WHERE LEDprodvars.LEDprodvarname = 'Dimmable' AND LEDprodoptions.LEDprodoptionsID = %s AND LEDprodoptions.LEDid = %s", GetSQLValueString($paramOption_rsDIMMLOOKUP, "int"),GetSQLValueString($paramItem_rsDIMMLOOKUP, "int"));
$rsDIMMLOOKUP = mysql_query($query_rsDIMMLOOKUP, $connLED) or die(mysql_error());
$row_rsDIMMLOOKUP = mysql_fetch_assoc($rsDIMMLOOKUP);
$totalRows_rsDIMMLOOKUP = mysql_num_rows($rsDIMMLOOKUP);

$paramItem_rsSENSOR = "-1";
if (isset($row_rsPROD['LEDid'])) {
$paramItem_rsSENSOR = $row_rsPROD['LEDid'];
}
mysql_select_db($database_connLED, $connLED);
$query_rsSENSOR = sprintf("SELECT LEDprodoptions.LEDprodoptionincr, LEDprodoptions.LEDprodoptionsID, LEDvars.LEDvarname, LEDvars.LEDprodvarID, LEDprodvars.LEDprodvarname FROM LEDvars INNER JOIN LEDprodoptions ON LEDvars.LEDvarID = LEDprodoptions.LEDvarID INNER JOIN LEDprodvars ON LEDvars.LEDprodvarID = LEDprodvars.LEDprodvarID WHERE LEDprodvars.LEDprodvarname = 'Sensor' AND LEDprodoptions.LEDid = %s", GetSQLValueString($paramItem_rsSENSOR, "int"));
$rsSENSOR = mysql_query($query_rsSENSOR, $connLED) or die(mysql_error());
$row_rsSENSOR = mysql_fetch_assoc($rsSENSOR);
$totalRows_rsSENSOR = mysql_num_rows($rsSENSOR);

$paramOption_rsSENSORLOOKUP = "-1";
if (isset($_POST['LEDCart_1_Sensor_Add'])) {
$paramOption_rsSENSORLOOKUP = $_POST['LEDCart_1_Sensor_Add'];
}
$paramItem_rsSENSORLOOKUP = "-1";
if (isset($_POST['LEDCart_1_ID_Add'])) {
$paramItem_rsSENSORLOOKUP = $_POST['LEDCart_1_ID_Add'];
}
mysql_select_db($database_connLED, $connLED);
$query_rsSENSORLOOKUP = sprintf("SELECT LEDprodoptions.LEDprodoptionincr, LEDprodoptions.LEDprodoptionsID, LEDvars.LEDvarname, LEDvars.LEDprodvarID, LEDprodvars.LEDprodvarname FROM LEDvars INNER JOIN LEDprodoptions ON LEDvars.LEDvarID = LEDprodoptions.LEDvarID INNER JOIN LEDprodvars ON LEDvars.LEDprodvarID = LEDprodvars.LEDprodvarID WHERE LEDprodvars.LEDprodvarname = 'Sensor' AND LEDprodoptions.LEDprodoptionsID = %s AND LEDprodoptions.LEDid = %s", GetSQLValueString($paramOption_rsSENSORLOOKUP, "int"),GetSQLValueString($paramItem_rsSENSORLOOKUP, "int"));
$rsSENSORLOOKUP = mysql_query($query_rsSENSORLOOKUP, $connLED) or die(mysql_error());
$row_rsSENSORLOOKUP = mysql_fetch_assoc($rsSENSORLOOKUP);
$totalRows_rsSENSORLOOKUP = mysql_num_rows($rsSENSORLOOKUP);

The calculation in my eCart Object is...

TotalPrice = ([Price] + [DimmPriceInc] + [SensorPriceInc]) * [Quantity]
TruePrice = [Price] + [DimmPriceInc] + [SensorPriceInc]

Can you see what it is I'm doing wrong? The SensorPriceInc is being added but it's not displaying the correct variable name on the cart page?
Here's the add to cart button code:

<?php
// WA eCart AddToCart
if (isset($_POST["LEDCart_1_ATC"]) || isset($_POST["LEDCart_1_ATC_x"])) {
$ATC_itemID = $_POST["LEDCart_1_ID_Add"];
$ATC_AddIfIn = 0;
$ATC_RedirectAfter = "shopping-basket.php";
$ATC_RedirectIfIn = "";
if (isset($totalRows_rsPROD) && $totalRows_rsPROD > 0) {
$row_rsPROD = WAEC_findRecordMySQL($rsPROD, "LEDid", $ATC_itemID);
if ($row_rsPROD) {
$ATC_itemName = "".$row_rsPROD['LEDproductcode'] ."";// column binding
$ATC_itemDescription = "".$row_rsPROD['LEDtitle'] ."";// column binding
$ATC_itemThumbnail = "".$row_rsPROD['LEDimg'] ."";// column binding
$ATC_itemWeight = floatval("".$row_rsPROD['LEDnetweight'] ."");// column binding
$ATC_itemQuantity = "".$_POST["LEDCart_1_Quantity_Add"] ."";// column binding
$ATC_itemPrice = floatval("".$row_rsPROD['LEDprice'] ."");// column binding
$ATC_itemColour = "".$_POST["LEDCart_1_Colour_Add"] ."";// column binding
$ATC_itemDimmable = "".$row_rsDIMMLOOKUP['LEDprodvarname'] ."";// column binding
$ATC_itemDimmPriceInc = floatval("".$row_rsDIMMLOOKUP['LEDprodoptionincr'] ."");// column binding
$ATC_itemSensor = "".$row_rsSENSORLOOKUP['LEDprodvarname'] ."";// column binding
$ATC_itemSensorPriceInc = floatval("".$row_rsSENSORLOOKUP['LEDprodoptionincr'] ."");// column binding
mysql_data_seek($rsPROD, 0);
$row_rsPROD = mysql_fetch_assoc($rsPROD);
}
}
$ATC_itemQuantity = floatval($ATC_itemQuantity);
if (is_numeric($ATC_itemQuantity) && $ATC_itemQuantity != 0) {
$LEDCart->AddToCart($ATC_AddIfIn, $ATC_RedirectIfIn, $ATC_itemID, $ATC_itemName, $ATC_itemDescription, $ATC_itemThumbnail, $ATC_itemWeight, $ATC_itemQuantity, $ATC_itemPrice, $ATC_itemColour, $ATC_itemDimmable, $ATC_itemDimmPriceInc, $ATC_itemSensor, $ATC_itemSensorPriceInc);
if ($ATC_RedirectAfter != "" && $LEDCart->redirStr == "") {
$LEDCart->redirStr = $ATC_RedirectAfter;
}
if (isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING'] != "") {
$_SESSION['WAEC_ContinueRedirect'] = $_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING'];
}
else {
$_SESSION['WAEC_ContinueRedirect'] = $_SERVER['PHP_SELF'];
}
}
}
?>

I've changed the Price cart binding on our cart page to TruePrice, and that has worked correctly. Thank you.

On reflection, if I have the TruePrice shown above then I don't think it's as important to display the incremental price alongside the variable name, however when looking at all of that I notice the following code in the same column as my product title, variable list etc:

<p id="LEDCart_JSON_Display_Price_<?php echo $LEDCart->DisplayInfo("WAUID"); ?>" class="eC_ItemPrice max_tablet"><?php echo WA_eCart_DisplayMoney($LEDCart, $LEDCart->DisplayInfo("Price")); ?></p>
<p class="eC_ItemRemove_Link max_tablet"><a href="#" onclick="waec_update('Remove','LEDCart_Quantity_<?php echo $LEDCart->DisplayInfo("WAUID"); ?>',this);">Remove</a></p>

These things appear invisible on the cart page though? I don't see any "Remove" link, for a start. What are those references?

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