close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Discount Rule Help

Thread began 9/21/2010 6:29 am by Dave Buchholz | Last modified 9/22/2010 6:01 pm by Jason Byrnes | 1910 views | 22 replies |

Dave BuchholzBeta Tester

Discount Rule Help

I have a discount rule for buy 6 and get the cheapest free that looks like this:

php:
//eCart Rule

function WAEC_eCart1_Buyany6TTProductsandgettheCheapest1Free()  {
  $totalDiscount = 0;
  if (true && ((sizeof($this->Items) > 0) && (( ((($this->ConditionalTotal("Quantity", "TypeID", "1")) + ($this->ConditionalTotal("Quantity", "TypeID", "2")) + ($this->ConditionalTotal("Quantity", "TypeID", "3")) + ($this->ConditionalTotal("Quantity", "TypeID", "4")) + ($this->ConditionalTotal("Quantity", "TypeID", "5")) + ($this->ConditionalTotal("Quantity", "TypeID", "7")) + ($this->ConditionalTotal("Quantity", "TypeID", "8")) + ($this->ConditionalTotal("Quantity", "TypeID", "9")) + ($this->ConditionalTotal("Quantity", "TypeID", "10")) + ($this->ConditionalTotal("Quantity", "TypeID", "12")) + ($this->ConditionalTotal("Quantity", "TypeID", "16")) + ($this->ConditionalTotal("Quantity", "TypeID", "17")) + ($this->ConditionalTotal("Quantity", "TypeID", "18")) + ($this->ConditionalTotal("Quantity", "TypeID", "19"))) >= 6) )))) {
    $totalDiscount += $_SESSION['tt6get1'];//Result
  }
  return WA_eCart_FormatNumber($totalDiscount, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule



where I am checking the quantity of the Product Type ID column in the cart which works great if a single line total of the Product Type ID is greater than or equal to 6 BUT I would like it to work if the sum of the Product Type ID line totals is greater than or equal to 6.

How can I make a rule that can do this please.

Sign in to reply to this post

CraigRBeta Tester

Hi Dave,

I must be a bit slow today (not interpreting the question)

I copied the rule onto one of my test stores, and reduced the item types to 1, 2 or 3, (to fit in with my own data)
if i have a total of 6 items from any combination of these itemtypes, the rule seems to trigger.

i assume that isn't what you want to do.

Sign in to reply to this post

Dave BuchholzBeta Tester

That is exactly what I want to do but for some reason it isn't working for me, I wonder if the order of discounts makes a difference ?

Sign in to reply to this post

CraigRBeta Tester

it shouldn't make any difference, but i just changed my order to 2,1,3 and it still works.

i presume you checked the obvious stuff, like all the ItemTypes have the expected Id's and you have copied the eCart folder to the server ?

;-)

Sign in to reply to this post

Jason ByrnesWebAssist

one thing I always when I have rule that is not behaving as expected is create a second cart display page on this page, I set the display manager to show all columns from the cart, seeing all the information stored in the cart often helps me find the cause often problem.

Sign in to reply to this post

Dave BuchholzBeta Tester

Originally Said By: Jason Byrnes
  one thing I always when I have rule that is not behaving as expected is create a second cart display page on this page, I set the display manager to show all columns from the cart, seeing all the information stored in the cart often helps me find the cause often problem.  



Good advice Jason, I will do just that

Sign in to reply to this post

Dave BuchholzBeta Tester

ok I have uploaded the new test files to my development server, if I add 6 of one item to the cart the discount rule is triggered correctly



if I add two quantities of the same product type (the number after the product type is the ID that I am checking for) then the discount rule doesn't get triggered



If I add two quantities of different product types (both covered by the rule) the discount rule still isn't triggered



I am obviously missing something simple, but what ?

Sign in to reply to this post

Jason ByrnesWebAssist

can you send a copy of the cart include file so i can try testing on my end.

Sign in to reply to this post

Dave BuchholzBeta Tester

Jason,

here you go, thanks

Attached Files
eCart1_PHP.php.zip
Sign in to reply to this post

Jason ByrnesWebAssist

in my test i created two add to cart buttons, one set the TypeID to 1, the other set the TypeID to 2, I can add three of one item and 3 of the other and the discount comes through. It is working in my tests.

did you create the cart page to show all columns that I suggested? can you send a link to that cart page?

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