Closed joelbrock closed 10 years ago
but when i key in 0049999955555 the register does nothing. No beeps, nothing, just stays at the general transaction screen.
UPDATE: Apparently i'm no longer getting an "item not found" error for anything. Actual PLUs/UPCs scan OK, but bogus PLUs/UPCs have the same behavior as i described when entering 49999955555. Which is to say, nada.
What did i break?
Good question. Error logs and/or http://path/to/is4c-nf/test/ might shed some light on it.
As to the original question, if it's member based I think the right answer is to take it away from the cashiers entirely and adjust custdata.Discount to give those members a 5% (or additional 5%) discount.
The coupon issue I'd guess: needs to be enabled on the Scanning tab or the NULLs are causing some kind of problem.
I'd probably do it as a plugin. I don't know if it's really necessary to redirect to another page.
class NeedDiscountParser extends Parser {
function check($str){
if ($str == "FF") return True;
else return False;
}
function parse($str){
global $CORE_LOCAL;
$CORE_LOCAL->set('NeedDiscountFlag',1);
// add comment/informational line to transaction?
return $this->default_json();
}
}
class NeedDiscountModule extends DiscountModule {
function calculate(){
global $CORE_LOCAL;
$discount = parent::calculate();
if ($CORE_LOCAL->get('NeedDiscountFlag')===1){
$extra = 0.05 * $CORE_LOCAL->get('discountableTotal');
$discount = MiscLib::truncate2($discount + $extra);
}
return $discount;
}
}
class NeedDiscountPlugin extends Plugin {
function plugin_transaction_reset(){
global $CORE_LOCAL;
$CORE_LOCAL->set('NeedDiscountFlag', 0);
}
}
[16-Aug-2013 18:18:55] PHP Fatal error: Call to undefined method MemberCard::is_special() in /pos/CORE/pos/is4c-nf/parser-class-lib/parse/UPC.php on line 105
I do see that the SpecialUPC sublass is called MemberBarcode. Not sure that that matters though.
Is there a reference to MemberCard in ini.php? Might be an artifact from the earlier thing where you had two files named MemberCard.php
now that the membercard thing is resolved....
With your suggested code 'FF' produces an "input unknown" message. Unfortunately there's no output in the logs when this happens.
e16d0e341c7260efe71e40a1686457150476b609
My guesses would be either the plugin needs to be enabled or you need to log out/in (or maybe restart browser) to pick up the new modules provided via the plugin.
a fine suggestion, but i tried that already. Also no log output for this one.
in ini.php the enabled plugin appears as NeedBasedDiscount which is what i named the plugin subclass in NeedBasedDiscount.php, do the names need to match the function names in NeedBasedDiscountParser.php (NeedDiscountPlugin, NeedDiscountModule, etc.)?
The class names need to match the file names (e.g., NeedBasedDiscountParser in NeedBasedDiscountParser.php) but otherwise it shouldn't matter. Function should be automatically detected by base class (e.g., if it extends Parser, it's used for parsing).
Does the discount module show up as an option on the Extra Config tab?
Yup. Theres a pulldown with only one option in it.
There's another naming convention that I forgot about: the directory and the plugin class need to have the same name. This one works for me. db958bb5f4acce5ce2186c528ae3a150e6fd6ade
ooo. i so wanted that to work...... but alas. No joy.
I switched the DiscountModule to NeedBasedDiscount, signed out and in and restarted the browser.
I no longer get the "input unknown" box but there's no change to the trans. upon FF{ENTER}. No log output either.
Tested with DiscountModule == DiscountModule as well, same result.
Not sure how you can help troubleshoot further, unless you want to pull down the NOFC_CORE/master repo. https://github.com/joelbrock/NOFC_CORE I've committed the current ini.php as ini.php.nofc
Bonus question: So what happens by switching the DiscountModule to NeedBased? Does that have any effect on any other discount structures?
FF doesn't do anything visually. I don't what's right. With the NeedBased discount module, if you've pressed FF at some point during the transaction, the discount is increased by 5%.
SUCCESS: i populated the parse function with some stuff to add into the transaction and its working now... still testing it out but it now adds a line to the trans and a discount. eda388dc9478a2e0bdb95ae108150023d2ce114d
OK, it's totally working now, i iterated it to make a MAD plugin as well. Mostly for backwards compatibility.
2 Questions:
OK 3 questions:
RE: make a new footer that's aware of the setting 6b5c8a1755fbf69a87db2e488dea470cba4073a8
RE: taxes: I'm honestly not sure. It could vary by locality.
RE: restricting. I don't think you need to, strictly speaking. It's just an on/off setting so running it multiple times won't increase the discount. But if you want to, I'm pretty sure this would be simpler:
if ($CORE_LOCAL->get('NeedDiscountFlag')==1){
// already applied
}
RE: footer / TransPercentDiscount: Not updating the footer box. :-(
Here's what it currently looks like: https://github.com/joelbrock/NOFC_CORE/blob/master/pos/is4c-nf/plugins/NeedBasedDiscount/NeedDiscountFooter.php
I've tried restarting, logging in/out, fiddling w/ DiscountModule in extra_configs. No log output.
UPDATE: Also tried renaming function_header_content --> header_content since it looks like thats what it should be but that doesnt work either...
This gives the correct footer info for me: 9d4329de23a79b3a0a9e8888d88c11b5adcfe8fa
Closed for housekeeping purposes. Done as far as I know. Feel free to re-open if issues continue.
Applying a flat percentage to the transaction. Members enroll in program to rcv. the discount. Cashiers manually apply to the transaction.
I suppose this could be a houseCoupon. Or would it make more sense as a plugin?
I made a copy of the PriceCheck plugin and have been hacking against that, you can see my progress here: https://github.com/joelbrock/NOFC_CORE/tree/needbaseddiscount/pos/is4c-nf/plugins/NeedBasedDiscount
Additionally, i tried to set this up as a houseCoupon, here is the entry in opdata.houseCoupons
but when i key in 0049999955555 the register does nothing. No beeps, nothing, just stays at the general transaction screen.