The correct stored format is "<module_title>: <coupon_code>".
Just a couple warnings about your code:
- The module title is not static (and may vary depending upon store language and / or modifications).
- Indexes on an array are not checked to verify they exist before using them (PHP 5.4+ potential issue).
- It will break when the correct full title is passed (such as a order created by the checkout process).
Most users have not had any problems understanding the warning which is printed on the top of the screen by Edit Orders and taking the appropriate action. On the other hand, I do like the idea of allowing the entry of just the coupon code. With the upcoming 4.1.3 release, I have been focusing on usability, compatibility, and automatically finding / fixing certain common database issues (caused by errant code in OTHER modules).
I'll add the updating the handling of ot_coupon to the list for Edit Orders 4.1.3. :o)
Not a bug. These are core database entries relating to attributes in the Zen Cart database. Means the store you are working on has some serious database damage... You should re-add the appropriate entries to the database (and verify the SBA code is not incorrectly removing these).
Not needed if you fix the core database entries relating to attributes. Also why did you change the code to use the "product's option's type" name instead of id? What happens if in the future the names are in a localized language? Or someone changes the name?
Other Thoughts
Sounds like your client's store has a large number of modifications (both to the database and files) including damage to some of the core Zen Cart database entries relating to attributes... I cannot say what introduced these "changes", but I would make sure it was not the SBA module you are using...
You will probably want to correct the current issues in the specific store you are working on instead of modifying the "Edit Orders" code (to work around the issues specific to the client's site). Applying bandages instead of stopping the root cause could cause problems down the road (such as when a new version of Zen Cart or Edit Orders is released).
NOTES: If the SBA module includes something to indicate it's presence (like EO_VERSION identifies Edit Orders is installed and which version)... And the SBA module does not break existing Zen Cart core attribute handling... I'm more than willing to add some additional code / code blocks to help "support" the SBA module... So if you do find what exactly is changed by the SBA module during the product selection and checkout process... Contributions are welcome (but expect them to be looked at to ensure they do not introduce unnecessary risks). :o)



Reply With Quote
