close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Excluding certain items from sitewide discount event

Thread begun 1/24/2018 3:35 pm by graham | Last modified 1/27/2018 1:01 pm by Ray Borduin | 2210 views | 8 replies |

graham

Excluding certain items from sitewide discount event

Ray, ages ago we worked on the coding to allow for certain items, as designated by a line like this abs(in_array([ID], array('61','62','63','64','65','66','67')))?[DiscountableD]=1:0 , to be accumulated and identified for discount(s) - works fine when I have a reasonable number of items to be designated. But, what if I wanted a particular discount to apply all but a few items in my inventory? In my example above, assume DiscountableD was going to be every product in my store, except for a small array of productIDs I wanted to exclude ... I could go through and make the line above hold all my product ID's, but it would be more than 100 entries. Can you help me with the logic or shortcut from what I have described?

Thanks as always!!

Sign in to reply to this post

Ray BorduinWebAssist

You could probably do an alternative exclude array just like the include array we did previously. If you give me the code where that is implemented I could probably help you with how to do it. I don't really remember the project we worked on together, but I'm sure I can lend a hand, but I'd have to see the original code.

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

graham

Thanks for responding, Ray ... you made the coding pretty simple, we set up a new column in the eCart Object e.g. DiscountableD, added the new calculation from above to identify products to be counted/set their setDiscountableD to 1 e.g. abs(in_array([ID], array('61','62','63','64','65','66','67')))?[DiscountableD]=1:0, and created the discount rule (25% off here):

$totalDiscount = 0;
if (true && ($this->ConditionalTotal("Quantity", "DiscountableD", "1") > 0)) {
$totalDiscount += ($this->ConditionalTotal("TotalPrice", "DiscountableD", "1") * .25);//Result
}
return WA_eCart_FormatNumber($totalDiscount, $this->ForceDecimalsC, $this->DecimalPlacesC);
}

I just don't see the easy way to inverse this? Does this snippet help describe my issue better?

Sign in to reply to this post

Ray BorduinWebAssist

Do you want to continue using the old one and have a new discount group with other products applicable, or are you replacing the old one?

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

graham

replace, I think ... against your previous advice, maybe given in a long-ago screenshare, I have never deleted any of my discount rules, they just lie there inactive ... I am up to DiscountableP now :)

Sign in to reply to this post

Ray BorduinWebAssist

You could just add an exclamation point to do the opposite... for instance:

abs(!in_array([ID], array('61','62','63','64','65','66','67')))?[DiscountableD]=1:0

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

graham

really ... that simple? :s I need to brush up a bit ... thanks, Ray! May get in touch with you for a support session to replace Paypal with Square in my revised website ... maybe in February. Take care0

However, is it difficult to limit a valid itemID to only 1 unit? If 2 are ordered, only 1 qualifies in the DiscountableO total for 20% off ... the other stay in cart at full price.

Sign in to reply to this post

Ray BorduinWebAssist

You should be able to base the discount on the Price field instead of the TotalPrice if you only want it to apply to the first. If you mean the first item of the cart then it can be a bit more difficult and would probably require a premier support ticket.

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

graham

Working on a weekend? :) Thanks for responding, Ray. Of course, as I stood back for a minute, I realized I was making my issue too complicated .. I simply adding the product ID to the array of "not included" and created a unique discount for the product(s) I wanted to control the quantity of ... I am sure there is a more exotic solution, but this works. Again, thanks for responding, Ray.

Sign in to reply to this post

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