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

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Please help with discounts

Thread began 11/22/2011 4:55 am by Lingo5 | Last modified 11/28/2011 2:53 pm by Jason Byrnes | 951 views | 10 replies |

Lingo5

Please help with discounts

Hi,
I have setup rules for volume discounts so that prices change according tothe number of products selected. This works fine, but the discounts are only visible on the total and what I want is the price per item in the basket to change when a discount rule applies.
For example, if an item costs 65,00 I want the item price in the basket to change to 60 when the discount is applied.

At the moment prices in the basket are displayd with echo "WA_eCart_DisplayMoney($marclear, $marclear->DisplayInfo("Price"));".

Thanks

Sign in to reply to this post

Dani Chankhour

Since discount is applied on the sub total of the cart, you will need to calculate the discount.

You will need to take the total discount and divided it up by the quantity of the product and subtract that from the price:

<?php echo WA_eCart_DisplayMoney($eCart1, ($eCart1->DisplayInfo("Price") - ($eCart1->GetDiscounts()/$eCart1->DisplayInfo("Quantity")))); ?>

Sign in to reply to this post

Lingo5

Originally Said By: Dani Chankhour
  Since discount is applied on the sub total of the cart, you will need to calculate the discount.

You will need to take the total discount and divided it up by the quantity of the product and subtract that from the price:

<?php echo WA_eCart_DisplayMoney($eCart1, ($eCart1->DisplayInfo("Price") - ($eCart1->GetDiscounts()/$eCart1->DisplayInfo("Quantity")))); ?>  



Thanks a lot, but this only works for a product of the same type. My problem is that I have the product in different colours, so when a product of a different colour is added to the cart, the code you supplied does not work and the prices start going crazy.

Any ideas?. Thanks.

Sign in to reply to this post

Dani Chankhour

I'm sure why it would be different, but try outputting the AdjustedPrice column instead of the Price:

<?php echo WA_eCart_DisplayMoney($WA_Store_Cart, $WA_Store_Cart->DisplayInfo("AdjustedPrice")); ?>

Sign in to reply to this post

Lingo5

Originally Said By: Dani Chankhour
  I'm sure why it would be different, but try outputting the AdjustedPrice column instead of the Price:

<?php echo WA_eCart_DisplayMoney($WA_Store_Cart, $WA_Store_Cart->DisplayInfo("AdjustedPrice")); ?>  



Thanks, but if I output AdjustedPrice, the price displayed is 0.

This is my code for the products list and for the cart.

<tr>
<td valign="bottom" class="TextCarritoRed"><?php echo $marclear->DisplayInfo("Name"); ?></td>
<td align="center" valign="bottom" nowrap="nowrap" class="TextCarritoBlue"><?php echo $marclear->DisplayInfo("Description"); ?></td>
<td align="center" valign="bottom" nowrap="nowrap" class="TextCarritoBlue" ><?php echo WA_eCart_DisplayMoney($marclear, $marclear->DisplayInfo("AdjustedPrice")); ?> <?php echo $row_productos_RS['currency_'.$_SESSION['session_idioma'].''];?></td>
<td align="center" valign="bottom" class="eC_FormItem" ><input name="marclear_Quantity_<?php echo $marclear->DisplayIndex; ?>" type="text" class="FieldQuantityCarrito" value="<?php echo $marclear->DisplayInfo("Quantity"); ?>" size="3" /></td>
<td align="center" valign="bottom" class="eC_FormItem" ><input type="checkbox" value="<?php echo $marclear->DisplayInfo("ID"); ?>" name="marclear_Delete_<?php echo $marclear->DisplayIndex; ?>" /></td>
<td align="right" valign="bottom" nowrap="nowrap" class="TextCarritoRed" ><?php echo WA_eCart_DisplayMoney($marclear, $marclear->DisplayInfo("TotalPrice")); ?> <?php echo $row_productos_RS['currency_'.$_SESSION['session_idioma'].''];?></td>
</tr>
<?php
$marclear->MoveNext();
}
$marclear->MoveFirst();
?>
</table>
<table width="100%" cellpadding="0" cellspacing="0" class="eC_ButtonWrapper">
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td><input type="image" name="marclear_Clear_100" id="marclear_Clear_100" src="WA_eCart/Images/Nautica/Btn5_EN_Clear_<?php echo ($_SESSION['session_idioma']);?>.gif" alt="Clear cart" />
<input type="image" name="marclear_Update_100" id="marclear_Update_100" src="WA_eCart/Images/Nautica/Btn5_EN_update_<?php echo ($_SESSION['session_idioma']);?>.gif" alt="Update cart" /></td>
</tr>
</table>
<h3><?=CNT_TXT_CARRITO_SUPEDIDO?>
</h3>

<table width="100%" border="0" cellpadding="4" cellspacing="0" class="eC_CartSummary">
<?php
//WA eCart Merchandizing Show Start
//ecart="marclear"
if ($marclear->GetDiscounts() > 0 || $marclear->GetCharges() > 0 || $marclear->GetShipping() > 0 || $marclear->GetTax() > 0) {
?>
<tr>
<td width="13%" class="TextPrecios"><?=CNT_TXT_CARRITO_SUBTOTAL?></td>
<td width="87%" class="TextPrecios"><?php echo WA_eCart_DisplayMoney($marclear, $marclear->TotalColumn("TotalPrice")); ?> <span class="TextCarritoRed"><?php echo $row_productos_RS['currency_'.$_SESSION['session_idioma'].''];?></span></td>
</tr>
<?php
//WA eCart Merchandizing Show End
//ecart="marclear"
}
?>
<?php
//WA eCart Merchandizing Show Start
//ecart="marclear"
if ($marclear->GetDiscounts() > 0) {
?>
<?php
if (!$marclear->Rules_EOF("Discounts")) {
while (!$marclear->Rules_EOF("Discounts")) {
if ($marclear->RuleLooperValue("Discounts") > 0) {
?>
<?php
}
$marclear->Rules_MoveNext("Discounts");
}
$marclear->Rules_MoveFirst("Discounts");
}
?>
<?php
//WA eCart Merchandizing Show End
//ecart="marclear"
}
?>
<?php
//WA eCart Merchandizing Show Start
//ecart="marclear"
if ($marclear->GetCharges() > 0) {
?>
<?php
//WA eCart Merchandizing Show End
//ecart="marclear"
}
?>
<?php
//WA eCart Merchandizing Show Start
//ecart="marclear"
if ($marclear->GetShipping() > 0) {
?>
<?php
//WA eCart Merchandizing Show End
//ecart="marclear"
}
?>
<?php
//WA eCart Merchandizing Show Start
//ecart="marclear"
if ($marclear->GetTax() > 0) {
?>
<?php
//WA eCart Merchandizing Show End
//ecart="marclear"
}

mysql_select_db($database_MySQLconnect, $MySQLconnect);
$query_productos_RS = "SELECT * FROM t_articulo";
$productos_RS = mysql_query($query_productos_RS, $MySQLconnect) or die(mysql_error());
$row_productos_RS = mysql_fetch_assoc($productos_RS);
$totalRows_productos_RS = mysql_num_rows($productos_RS);
?>


<tr class="TextTableDeliveries">
<td align="left" bgcolor="#FFFFFF"><?=CNT_TXT_CARRITO_TOTAL?>:</td>
<td align="left" bgcolor="#FFFFFF"><?php echo WA_eCart_DisplayMoney($marclear, $marclear->GrandTotal())?> <?php echo $row_productos_RS['currency_'.$_SESSION['session_idioma'].''];?> </td>
</tr>
<tr class="eC_ButtonWrapper">
<td height="45">&nbsp;</td>
<td align="right"><input type="image" name="marclear_Checkout" id="marclear_Checkout" src="WA_eCart/Images/Nautica/Btn5_EN_checkout_<?php echo ($_SESSION['session_idioma']);?>.gif" alt="Checkout" /></td>
</tr>
<tr class="eC_ButtonWrapper">
<td height="45" colspan="2">&nbsp;</td>
</tr>
</table>

</form>

Sign in to reply to this post

Lingo5

I can't find "AdjustedPrice" defined anywhere within my code.....I'm using eCart 4.

Sign in to reply to this post

Lingo5

Hi again,

I think I setup my discounts wrong. I set them up according to your suggestion in this post

showthread.php?t=23688

I think I set up the discount for an item when I should have set i up for a category.

My client sales these items:

- cans of paint (same price for all but they come in different colours)
- 1 litre can of paint thinner (no discount at all)
- 5 litre cans of paint thinner (no discount all)

The discounts for the paint are these:

1 to 3 = 64,99
4 to 23 = 59,99
24 to 99 = 54,99
100 and more= 49,99

How would I do this?

Sign in to reply to this post

Dani Chankhour

In this case what you need to do i added a column to eCart and call it discountedItem. The value for that will only be set to 1 if it is a paint item (You will need to add the bindings to the add to cart button). Then in eCart, for the discount url, you will need to use the Condition 'number of items with a specific column value' which has a value of 1 is > 0.

let me know if you still have an issue.

Sign in to reply to this post

Lingo5

Originally Said By: Dani Chankhour
  In this case what you need to do i added a column to eCart and call it discountedItem. The value for that will only be set to 1 if it is a paint item (You will need to add the bindings to the add to cart button). Then in eCart, for the discount url, you will need to use the Condition 'number of items with a specific column value' which has a value of 1 is > 0.

let me know if you still have an issue.  



Thanks but how do I add the bindings to the add to cart button?
This is the code for my add to cart button at the moment:

<input type="image" src="WA_eCart/Images/Pacifica/Btn5_EN_addtocart_<?php echo ($_SESSION['session_idioma']);?>.gif" border="0" value="Add to Cart" name="marclear_2_ATC">

Sign in to reply to this post

Lingo5

OK...I finally got the discounts working properly.
I have added the column discountedItem to my DB and managed to add the bindigs to the add to cart button.
What I need to do now is to show the individual price of the item in the cart with the discount applied. At the moment the discount only shows in the total, but I need the price per can in the basket to update automatically as the discount is applied.
So, basically I need to modify this line
echo WA_eCart_DisplayMoney($eCart, $eCart->DisplayInfo("Price"));
to show the price after discount.....how would I do that?

I also need to add 18% tax to all items and display Total Tax separatelly in the basket.
How can I do this?

Many thanks

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