close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Applying charges - only for products in a particular category?

Thread begun 8/03/2015 11:10 am by Nathon Jones Web Design | Last modified 8/06/2015 2:04 pm by Ray Borduin | 3931 views | 13 replies |

Nathon Jones Web Design

Applying charges - only for products in a particular category?

I want to apply a 5% surcharge to items from a particular category but the surcharge should only apply to those products, NOT to products in the cart that are not from that category.

I've created a category cart column and have bound that to the category field in my product table when adding to cart. When the product category is "2" I need the surcharge applied.

Can you help me with the calculation because nothing in the list of available options in the calculations section does this. Do I need a custom calculation?

Where it's complicated is, for example, we have the following scenario...

Basket Contents

Product Category Quantity Price Total
Whisky Bottle 1 1 1 £45.00 £45.00
Whisky Cask 1 2 1 £900.00 £900.00
Whisky Cask 2 2 1 £1100.00 £1100.00

The 5% surcharge should only be applied to the £2000.00 (£900 + £1100).

I'm sure this is simple but I've been going round and round with it all day and nothing I try does it.
Thank you.
NJ

Sign in to reply to this post

Ray BorduinWebAssist

You can add a calculation to the cart:

Surcharge = ([Category]==2)?[TotalPrice] * 0.05:0

Sign in to reply to this post
Did this help? Tips are appreciated...

Nathon Jones Web Design

I assume "Surcharge" is the title of the calculation?
I have set my output type to currency and have my calculation as:
([Category]==2)?[TotalPrice] * 0.05:0

...but it hasn't made a blind bit of difference:
http://www.nathonjoneswebdesign.co.uk/whiskybroker/buy-whisky-online-Scotland.php?wbid=12

Also, on the above page, I'm trying to display the price including the surcharge on the "Add to Basket" button using the following:
<?php echo($rsPROD->getColumnVal("wbprodPRICE")*1.05); ?>

...but it's not displaying the second decimal point. How do I force two decimal points?
Thank you Ray.
NJ

Sign in to reply to this post

Ray BorduinWebAssist

OK I thought this through more... instead of the surcharge calculation I think you should probably add a RealPrice calculation and update the TotalPrice.

RealPrice = ([Category]==2)?[Price] * 1.05:[Price]
TotalPrice = [Price] * [Quantity] * (([Category]==2)?1.05:1)

To display the decimals you can use number_format like:

php:
<?php echo(number_format($rsPROD->getColumnVal("wbprodPRICE")*1.05,2)); ?>
Sign in to reply to this post
Did this help? Tips are appreciated...

Nathon Jones Web Design

Thank you Ray. I've added those calculations and it all seems to be working correctly now.
Is it possible to add this as a charge though as I need to show, in the cart display and when saving to database, the original price of the product AND the price of the surcharge cost.

Thank you for the number_format advice.

Appreciate it.
NJ

Sign in to reply to this post

Ray BorduinWebAssist

You can add the surcharge calculation like I suggested before and use that and the Price column as the original and additional charge amounts.

If you didn't want it in the line items and wanted it as a charge you could leave the TotalPrice column as it is and add a charge in the charges area with the subtotal of the surcharge column.

Sign in to reply to this post
Did this help? Tips are appreciated...

Nathon Jones Web Design

Ray, I'm totally lost with this.

I need the original price of the product displayed in the line items, without the surcharge applied.

I need, below a sub-total, to display the surcharge amount and, ideally, to be able to give it a unique title so that the customer knows it's the surcharge (rather than it just saying "Charges").

I need the original price of the product and the surcharge amount as two separate entities so that when it comes to saving to database I can store the original product price and the surcharge amount in two different fields.

Upon removing the RealPrice calculation that you had me add above I note that the cart still does the calculation!? I assume this is because the TotalPrice calculation is still:
[Price] * [Quantity] * (([Category]==2)?1.05:1)

Which begs the question...if RealPrice doesn't affect anything then why did we add it?

I've spent 3 days trying to add this surcharge and, if anything, I'm going backwards with it.

Please help.
Thank you.
NJ

Sign in to reply to this post

Ray BorduinWebAssist

The RealPrice was added so you could display it if you wanted to.

You could still display the Price (orignial price), Surcharge (additional charge) and RealPrice (added together) independently or save them independently in the database.

If you remove it from the TotalPrice, then you can add it as a charge instead by using the total of the Surcharge column. You don't need the RealPrice calculation if you aren't displaying it.

Once you add the charge, you can add whatever label you want to it. The default "Charges" text is just text on the page that is freely editable.

If you want to sign up for a premium support ticket we can get through all of this in an hour session and I can answer any remaining questions and make sure it is all working correctly.

Sign in to reply to this post
Did this help? Tips are appreciated...

Nathon Jones Web Design

Originally Said By: Ray Borduin
  The RealPrice was added so you could display it if you wanted to.  



So that has nothing to do with the 5% surcharge then, I assume?

Originally Said By: Ray Borduin
  You could still display the Price (orignial price), Surcharge (additional charge) and RealPrice (added together) independently or save them independently in the database.  



How? I don't have Surcharge or RealPrice in my cart, for a start.

[QUOTE=194240;Ray Borduin]If you remove it from the TotalPrice, then you can add it as a charge instead by using the total of the Surcharge column.[QUOTE]

If I remove what?

I don't have a Surcharge column. :( I thought columns were product data - populated by static or database values? Name, Description, Quantity, Price...what value would a Surcharge column have in this scenario? In other words, how would it be populated?

Originally Said By: Ray Borduin
  Once you add the charge, you can add whatever label you want to it. The default "Charges" text is just text on the page that is freely editable.  



I don't know how to add the charge.

Originally Said By: Ray Borduin
  If you want to sign up for a premium support ticket we can get through all of this in an hour session and I can answer any remaining questions and make sure it is all working correctly.  



This isn't a technical support issue I am simply asking how to achieve particular functionality, which eCart is well capable of. I was under the impression that it was "FREE {outstanding} TECHNICAL SUPPORT" (http://www.webassist.com/dreamweaver-extensions).

From what I can see, and maybe it's a bug with my version I'm not sure, there is nothing in the charges section that applies to adding 5% to the price of items from a certain category only.

These are the calculations that I currently have:

TotalWeight - [Weight] * [Quantity]
TotalPrice - [Price] * [Quantity]
FullDetails - [Quantity] . ' ' . [Name] . ' (' . [ID] . ')'

I'm looking for guidance on how to get eCart to perform the 5% calculation/charge.

Oh, and I need to run the ckeckout wizard and get all this saving to database AND get it communicating with SagePay so I'm pretty sure that you'll be getting plenty of Premier Support ticket sessions out of me in the future.

Hope you can help. Thank you.
NJ

PS. Jason would have had this sorted first post (no offence), no questions asked. I just need help on how to configure eCart. Nothing more.

Sign in to reply to this post

Ray BorduinWebAssist

Calculations work just like columns. Once you have added a calculation you can just drag/drop it into your cart display wherever you want it displayed just like you would any other column.

The calculations can be used for anything you want. Adding calculations can be done for any reason. The only one that will actually effect the price is the TotalPrice calculation. The others can be used to supplement charges or display values when you want but won't actually be added to anything automatically.

I was referring to removing the surcharge calculation from the TotalPrice and setting it back to Price*Quanity, which it appears you have.

If you go to the shopping cart object definition and click on the "Charges" tab, you can add a charge and set it to the total of the Surcharge calculated column.

You don't need to re-run the wizard, you can just update the "Store cart details in database" server behaviors on the confirm.php page and the pp_confirm.php page (if using express checkout).

I try to give free outstanding support through the forums. That is what I'm trying to give you, but may not have the skills that Jason had to satisfy your queries instantly. I can only do my best, and I apologize if it isn't as good as you have come to expect from Jason. He is truly the best.

If you want to do things more quickly however, we can do hourly premier support where we do screen sharing and actually help build your application for you hands-on. An hour of premier support would have certainly saved you the time you have struggled with this so far, but I'm happy to keep trying to explain it to you here as best as I can.

Sign in to reply to this post
Did this help? Tips are appreciated...
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...