Nice and easy modification for a beer

A person searching for a way to ensure unique data came across this post which I made for a client a couple of years ago.

Within 20 minutes, that new client had paypal’d me a couple of beers, I had installed the modification, tested it and tweaked it a little ready for him to use. And this is something that he had been trying to find for over 6 months!

Developers; that is the exact point of keeping every single piece of code you ever write. If someone comes to you in the future you can dig it out and re-use.

How to Add a New INFORMATION page in osCommerce 2.4

How to add a new information page (like for example, the conditions page).

2.4 brings a new structure to osCommerce, and the base code is still being worked on – hence, this post might change when 2.4 is officially released. I’ll make sure I update it if I need to.

Step 1. Add the link to the new page in the information infobox

Open up /includes/modules/boxes/bm_information.php

Find this:

‘ <a href=”‘ . tep_href_link(‘info’, ‘contact’) . ‘”>’ . MODULE_BOXES_INFORMATION_BOX_CONTACT . ‘ </a>’ .

Change to:

‘ <a href=”‘ . tep_href_link(‘info’, ‘contact’) . ‘”>’ . MODULE_BOXES_INFORMATION_BOX_CONTACT . ‘ </a><br>’ .
‘ <a href=”‘ . tep_href_link(‘info’, ‘aboutus’) . ‘”>’ . MODULE_BOXES_INFORMATION_BOX_ABOUTUS . ‘ </a>’ .

Here we simply add a line break and a link to a new “aboutus” page.

Save the File.

Step 2. Create a new ACTION file.

Copy the code from pastebin and save into a new file called aboutus.php in the /includes/apps/info/actions/ folder.

Step 3. Create a new CONTENT file.

Copy the code from pastebin and save into a new file called aboutus.php in the /includes/apps/info/content/ folder.

Step 4. Add the necessary LANGUAGE bits

a. Open up includes/languages/english/info.php and add:

define(‘NAVBAR_TITLE_ABOUTUS’, ‘About Us’);
define(‘HEADING_TITLE_ABOUTUS’, ‘About Us’);
define(‘INFO_ABOUTUS’, ‘Put here your About Us information.’);

b. Open up includes/languages/english.php and add:

define(‘MODULE_BOXES_INFORMATION_BOX_ABOUTUS’, ‘About Us’);

Step 5. Visit your new “About Us” page

Click the “About us” link in the information infobox, and you will see your new page!

Easy as pie?

Sneak Preview of GREY theme

Here’s the latest template which is now complete:

amy_preview

This is a grey theme, perfect for any shop that is all about showing off the product and not showing off the look of the store. Of course, any aspect of the design can easily be changed to suit individual stores.

I’ll be updating the free choice page this afternoon, and so if you have not yet gotten the eBook, now’s the time!

Challenges on the osCommerce Forum

Quite often, in the osCommerce forum, I state my idea about something and am usually challenged by someone or other to show that what I have said can be done, can be done.

I must admit that sometimes what I come up with in theory, cannot be done as easily in practice. Here’s a couple of recent examples…

1. Making osCommerce invisible (link)

I have a page filled with images (and nothing else). User clicks on as many images as he wants and that makes (with help of javascript) changes to an invisible form. The form then gets submitted and all the selected products are inserted to the osCommerce system. In other words, can I insert several products from a html form to osCommerce all at once?

My answer was “yes”, as I have recently coded up a system that allows this. With some extra changes and some .js trickery, we cna show just the image, and have the image clickable to update the “count” to be purchased.

2. Hidden Price Module (link)

I need a way to hide the pricing of specific products on my site. Rather than show pricing, it should read something like add to cart to see pricing. Once the item has been added to the cart, the pricing should be visible

I thought (with thinking nor readin the question properly) that this could be done in 1 line of code. My general idea was to amend the display_price function in the currency class file. Of course, this would work for removing pricing across the entire site, with prices shown in the shopping_cart.php listing. Just return “NULL” or such in the display_price function.

Then I was reminded that the original poster needs to do this for some products and not others. To enable this is a lot more difficult;

1. We need to be able to choose the products to not have the price displayed. This is similar to the admin function of my HAZMAT module. We’ll call this the “no display products”.
2. We need to be able to compare the product being displayed with the “no display products” & be able to remove the pricing for the “no display products” – this requires a change across multiple files to allow the passing of the product_id thru the display_price function. Then we can do some magic in the currencies class file based on the product id.

All in all, not straightforward. But still do-able, why not?

osCommerce 2.4 – intense work ongoing for 30 days

Here’s a sneak peek of 2.4 in action

As you can see, it looks very much like the 2.3 series, but under the hood it is a different beast. 960 grid has been removed in favour of Bootstrap and Stylesheets are LESS. Codewise, the system will be “App” controlled and pages will have Controllers & Content files, take for example the product_info page;

20130212

Here you can plainly see the “CONTROLLER” file and “CONTENT” files. By using Apps in this way it will be much easier to create new modules that can “hook” into existing modules. So, let’s imagine you want a coupon discount system…you upload the new “coupon” files via FTP and click a button to turn it on. Done.

The Impact of 2.4

osCommerce 2.4 is a halfway house between the “old school” coding of the 2.2/2.3 series that has been developed over the past decade, and the new style coding that osCom3 brings. 2.4 will bring with it some structured rules for developers which should make the whole system that much more professional.

Confused?

Don’t be. In general my advice is this;

Shop Owners:
if you are at 2.3, stay there
if you are an early adopter go 2.4

Developers:
if you are a developer who relies on clients to put bread on your table work with 2.3 as I believe most existing shops will stay with 2.3 and a good majority of new shops will go 2.3 (due to the lack of available addons).

Sneak Peek of Latest FREE template

Here’s a sneak-peek of the latest template available free of charge to the buyers of the eBook;

sneak-peek

Let me know what you think. I’ve still some work to do in the footer area, and on the product_info page. As well as some general cleaning up here and there.

There will also be a “grey” template before the end of February, again free of charge for buyers of the eBook.

osCommerce, Open Source and how to get to grips with Commercialism

osCommerce is not and never has been a “no money” entity. Don’t believe me? Let’s look at the facts;

1. osCommerce is supported by community sponsors. They pay for that pleasure.
2. osCommerce is supported by corporate sponsors. They pay for that pleasure.

Open Source is all about “freedom”, not “free”.

1. A freedom given to you is the freedom to do what you like with osCommerce
2. That freedom is also given to me as a developer

Never forget that we all have the same freedoms as each other.

Here’s a typical comment of the sort that I receive now and then, from “Joe Average” shopowners;

Its people like you that make money from a free product

OK. That is a freedom granted to me. My response to this type of comment is always;

Is your shop running on osCommerce making you money?

There is never a response to this, as with those 9 words I have rendered that entire argument null and void. Here’s another typical comment;

Whats not in your interest is to have a loaded osCommerce option as you would loose part of your income.

Let’s look at Magento which (for this blog post) consider as “osCommerce on Steroids” – by this I mean it has a lot of things built in to the admin section (loaded in other words, with goodies). What this means is that if the Joe Average shopowner wants to do something that exists as a “goodie” it’s very simple, he clicks a button…and it’s all working. If he wants to do something out of the ordinary, it’s impossible – he/she is forced to use a developer. So, on the face of it, I might lose business, but I believe that I would gain a lot more than I lose.

Me choose…

For me, Open Source is also all about CHOICE. The choice to use it, the choice to amend the code oneself, the choice to contract a developer to make code changes. Once choice gets taken away, the product is in trouble.

The more bloat you introduce to osCommerce, the less freedom one has in its use. I don’t know why some people find that concept hard to grasp and I for one find that quite sad.

You can CHOOSE to use osCommerce. You have that FREEDOM.
Remember this: so does the next man.

Conclusion

The next time you feel hindered by Open Source, think about a choice you have: the freedom to find a new Open Source product to use.

Comments are now powered by Disqus

As I have been getting so mcuh spam lately, I have updated the comment system to Disqus.

I’ve queue’d the existing comments for addition to Disqus which is why they are not presently showing. It takes upto 24 hours for the comments to be inserted in Disqus.