Using Syntax Highligher Evolved with MarsEdit
The instructions are here: http://basilsalad.com/how-to/syntax-highlighting-marsedit-wordpress/
Categories: PHP/MySQL Tutorials Tags:
Categories: PHP/MySQL Tutorials Tags:
SunShop Modifications Part 6
In this section we look at my cache mechanism. It’s similar in principle to the WordPress “transient” concept. For example, the “top sellers in the last 30 days” does not need to be calculated every page load. Calculating once per hour should be more than sufficient. Doing both calculations (all time best sellers and best sellers last 30 days) takes 1-4 seconds depending on server load, and the Top Sellers page turns out to be one of the most popular pages. It is therefore a good candidate for caching.
I also found that a lot of the border/navigation items take a long time to generate, and again are good candidates for caching. Within SunShop we make all sorts of lists for navigation purposes, every page load, and then never use much of the result. With caching, I reduced the hundreds of queries per page load down to a dozen or so.
For example, if it takes a hundred queries to build up a sorted list, and we can safely cache the result for an hour or so, we have a huge page-performance gain. Why so many queries? In certain cases, SunShop does one query to get a sorted list of item IDs, and then loops through the list doing a separate query for each item in the list.
We’ll use the Top Sellers plugin as our use case. We cache the result of each top sellers calculation for 60 minutes. Read more…
Categories: PHP/MySQL Tutorials Tags:
SunShop Modifications Part 5
In this section we look at my Top Sellers plugin. This gives us a concrete example of writing a plugin. However, with this example we’ll use my full plugin “framework” which includes my Registered Object mechanism. We’ll also see my persistent-cache mechanism in use, which we’ll then explore in a later post.
Top Sellers Plugin Invocation
We invoke the two plugins as follows, in the Top Sellers page template. We use “bb_” as the prefix to avoid namespace collisions: Read more…
Categories: PHP/MySQL Tutorials Tags:
SunShop Modifications Part 4
Here in Part 4 I show another technique which I use to keep my custom code off to the side. I’m no longer a fan of the Singleton Design Pattern because of its difficulty in unit testing. However, it’s a good tool for SunShop modifications.
Our Top Sellers page has two tabs, one tab for All time top selling products, and another tab for top sellers over the past 30 days. I use “bb_” as my prefix to ensure no namespace collisions. Here is the page template: Read more…
Categories: PHP/MySQL Tutorials Tags:
SunShop Modifications Part 3
In this section we look at one of my custom SunShop pages, the SEO list. I’m assuming you have access to a SunShop admin area, and you know what an admin page looks like. Visit the SunShop Official Demo Page here to follow along if you need to.
The Customization
As part of our SEO (Search Engine Optimization) work, we are examining all product descriptions, short descriptions, meta descriptions, sample text, etc. I wrote code for the Edit Product page which creates a product preview, a Google-listing simulation, etc., with the target search terms highlighted.
In order to highlight the search terms, naturally, we need to know the list of target search terms. This quick-and-simple admin page allows us to enter each search term, its relative priority (1, 2, 3, etc.) on our list, and a CSS class defining the highlight color. You will recall our page support looks like this: Read more…
Categories: PHP/MySQL Tutorials Tags:
SunShop Modifications Part 2
In Part 2 I explain how to get the code modifications off to the side. We start by explaining why this is important.
Why We Need to Get Our Code Off To The Side
SunShop is actively supported software under active development. That means your SunShop installation could, at some point, be upgraded to a new software release. That generally means you lose your custom modifications – unless they are completely separate from the mainline code.
The SunShop installation instructions explain how to do this with the template/css/javascript files: Copy your preferred theme templates to a new folder and do your template modifications in the new folder. This way, when the software is upgraded and the standard template folder is replaced, your template files will not be overwritten.
Since this “SunShop Modifications” series is aimed at PHP developers, not tweaking templates, that’s all I have to say about managing the template files!
SunShop Admin Area Enhancements
My general strategy for the SunShop Admin Area is to create a new admin page. This doesn’t always work, for example, I added some additional fields to the Edit Product page. The best I could do in this case is add my name and date as a comment, so that I can search on my own name when it comes time to upgrade the software.
My custom admin page support looks like this: Read more…
Categories: PHP/MySQL Tutorials Tags:
SunShop Modifications Part 1
The SunShop software is a commercial product from Turnkey Web Tools. These tutorials do NOT expose any original SunShop code, only my own code.
The Project
My client commissioned me to make custom cart modifications to SunShop. I am sharing source code with my client’s permission. The modifications include:
- Feature/bug fixes
- New functionality aimed at enhancing the user experience
- SEO work (Search Engine Optimization) based on a consultant’s recommendations and my own recommendations. This became a number of areas including page load time, additional text, and layout changes. Read more…
Categories: PHP/MySQL Tutorials Tags: