View RSS Feed

Code Tips

  1. Is your plugin code safe for PHP 5.4 and 5.5 and 5.6?

    This is a follow-up post to my previous post about readying your plugins for PHP 5.3, this time addressing PHP 5.4, 5.5 and 5.6.

    NOTE: This post assumes some pretty solid PHP knowledge, because all the changes listed will require adapting your code to find a new way to do whatever it was doing before.

    NOTE: This is not the complete official list of changes. I've edited this list down to the basics, catering mostly to the topics that might affect people writing plugins for ...
    Code Tips
  2. Creating an Observer Class: send a specialized additional email during Create Account

    • Storeowner wants to send the customer an email with a unique code when the customer creates an account.
    • The code pattern is "ABC00001", where ABC is fixed text, and 00001 is the customer number, with leading zeros up to exactly 5 digits.
    • There is no need to build a database of already-issued codes, since the customer ID number is already unique per customer.
    • The store is using v1.5.0 code.

    The thinking and coding process:
    First, since this must ...
    Code Tips , Best Practices
  3. Is your plugin code safe to use on PHP 5.3?

    When PHP 5.3 was released, some older features were retired (some removed, some "deprecated", etc).

    And if your custom code or your addons/plugins are using those features, things will break and you'll encounter the dreaded "white screen of death".

    What do you need to change?

    Here's the list I generally follow, along with how I usually remedy it:

    ereg('searchtext', 'a_string', $optionalVar) becomes preg_match('/searchtext/ ...
    Code Tips
Zen-Cart, Internet Selling Services, Klamath Falls, OR