Including a file in a PHP class

I was trying to figure out how I could manage the premium logic for my freemium Better Together for OpenCart module.  You can’t just require a block of code in the middle of a PHP Class:

class SomeClass {  
  // NOT ALLOWED! 
  premium_file = "premium.php";
  if (file_exists($premium_file)) {
    require($premium_file);
  }

So I cooked up another method that I documented in this StackOverflow post about how to include code into a PHP class.

 

Better Together Admin for OpenCart

Better Together Admin for Opencart, the web based configuration UI for OpenCart Better Together, has just been released.

Better Together Admin allows you to easily create “buy one, get one” discounts for your OpenCart based store.  And it works right through your regular admin panel; no need to edit code to create the discounts.  Here’s a video:

OpenCart Discount Chooser Released!

I have released Discount Chooser for OpenCart (a port of the Discount Chooser / Free Gift Chooser algorithm from Zen Cart). I’m excited about this software and hope it really helps OpenCart store operators.

Discount Chooser goes beyond the standard BOGO discounts to permit the creation of much broader offers.  For example, you can create “Buy 2, get 1”, “Buy 3 get 1,” or “Buy some number, get a choice of some number.”

Here’s a video if you haven’t seen it yet:

 

You may buy OpenCart Discount Chooser from my store, or if you prefer, you may buy OpenCart Discount Chooser on the OpenCart Marketplace.

Testing CSS and JS changes in Chrome

Google’s Chrome browser has a nice feature that’s handy when you’re testing css and Javascript, and want to constantly refresh these files as you change them.

If you open the stacked three dots menu in your browser (to the right of the address bar) and open “More Tools -> Developer Tools”, then press the stacked three dot menu on that dialog, you’ll see a checkbox under Network with the label “Disable cache (while DevTools is open)”.  Check this, and you’ll always be using the freshest copies of your css and js files.