SEO Urls 5 by FWR Media & HT SEO 3 by Jack MCS

Today I had a client who needed HT SEO installed on a site – no real problems as it’s a nice contribution that is well maintained by Jack MCS. However this client is running a Template Monster template, which, as we all know, is the epitome of crap coding…

However, the installation was made. To find that it did not work. After some bug-hunting, I was 100% sure that the error lay with the FWR Media’s SEO Urls 5. So I turned it off. And HT SEO started working flawlessly. Turn it back on and it stopped working…

So, more investigations…led me to see that HT SEO depends greatly upon this: [php]basename($_SERVER[‘PHP_SELF’])[/php] to ascertain which page is being shown in the browser and hence which “tags” to load up and show. My thought was that SEO Urls was in some way blocking this from happening, which was causing the tags not to load, particularly on product_info.php.

So, I opened up /includes/header_tags.php and found this piece of code; [php]require_once(DIR_WS_FUNCTIONS . ‘clean_html_comments.php’); // Clean out HTML comments from ALT tags etc.[/php] Right below it, I added this: [php]echo basename($_SERVER[‘PHP_SELF’]);
exit;[/php] – then I reloaded the page.

With SEO Urls turned OFF, the resulting info was;

product_info.php

And with SEO Urls turned on, the result was something like;

baby-p-145

Now, I absolutely knew that the error was as I thought. I then went hunting and found a similar story on the old “Chemo” version of SEO Urls and so I took that code and inserted it in the header_tags.php file in place of the PRODUCT_INFO case.

And it worked! With SEO Urls turned on. I then emailed Jack MCS to see if this would impact on HT SEO. All well.

Anyway, Jack came up with some nicer code as follows;

1. open up /includes/header_tags.php
2. find EVERY occurence of basename($_SERVER[‘PHP_SELF’]) and replace this with $page
3. add this: [php]$pos = strripos($_SERVER[‘PHP_SELF’], “/”);
$page = ($pos !== FALSE) ? basename(substr($_SERVER[‘PHP_SELF’], 0, $pos)) : basename($_SERVER[‘PHP_SELF’]);[/php] right before [php]switch (true) {[/php]
4. save and upload

SEO Urls 5 and HT SEO now play nicely together.

Claudia’s struggle with osCommerce

Found a good blog that has made my bookmarks – Struggle With osCommerce – the blog of Claudia van Dijk who is a Stock Photographer who also runs a couple of osCommerce sites.

The blog is all about her struggles with osCommerce and is a good read, stick it in your bookmarks as you will learn something from Claudia…

Contribution Talk: SPPC 716

The second in my series of getting to know existing contributions.

Separate Pricing Per Customer

http://addons.oscommerce.com/info/716

This contribution gives the shopowner the ability to set up “groups” of customers, who have a better price than a normal customer. A typical exampe would be “retail customers” and “wholesale customers”. Wholesale customers would probably have a lower price than retail customers. There are also other options whereby the shopowner can activate and deactivate postage, payment methods etc.

This is a quite large and quite complex modification to make, especially on a store that may already have had lots of modifications. I spent over half a day installing this on a highly modified store (which included testing time). I did have a few difficulties, but got it working in the end.

Overall

Ease of Install: 5/10
Ease of Use: 5/10
How it looks: 10/10 (it does not make any major changes to how oscommerce looks)

Changes I would like to see

I felt that the customers_group page in the admin could do with a little tweak to actually show the customers that are in each group. A little like this:

You can see a list of clients (blanked out for privacy) who are part of the “trade” group. Although I have not coded this up, I have done almost the same thing on a different contribution, which is where the screenshot comes from.

Display Price in two different sizes?

At the official osCommerce forum, Matt asked;

How can I get the prices to display with two different sized fonts ie $129.95

You can plainly see that he is trying to show the cents in a different way than the dollars. This is very easy to accomplish;

Open up /includes/classes/currencies.php

Find:
[php]if ($calculate_currency_value == true) {
$rate = (tep_not_null($currency_value)) ? $currency_value : $this->currencies[$currency_type][‘value’];
$format_string = $this->currencies[$currency_type][‘symbol_left’] . number_format(tep_round($number * $rate, $this->currencies[$currency_type][‘decimal_places’]), $this->currencies[$currency_type][‘decimal_places’], $this->currencies[$currency_type][‘decimal_point’], $this->currencies[$currency_type][‘thousands_point’]) . $this->currencies[$currency_type][‘symbol_right’];
} else {
$format_string = $this->currencies[$currency_type][‘symbol_left’] . number_format(tep_round($number, $this->currencies[$currency_type][‘decimal_places’]), $this->currencies[$currency_type][‘decimal_places’], $this->currencies[$currency_type][‘decimal_point’], $this->currencies[$currency_type][‘thousands_point’]) . $this->currencies[$currency_type][‘symbol_right’];
}[/php]

Change to:
[php]if ($calculate_currency_value == true) {
$rate = (tep_not_null($currency_value)) ? $currency_value : $this->currencies[$currency_type][‘value’];
$format_string = $this->currencies[$currency_type][‘symbol_left’] . number_format(tep_round($number * $rate, $this->currencies[$currency_type][‘decimal_places’]), $this->currencies[$currency_type][‘decimal_places’], $this->currencies[$currency_type][‘decimal_point’], $this->currencies[$currency_type][‘thousands_point’]) . $this->currencies[$currency_type][‘symbol_right’];
$format_string = explode($this->currencies[$currency_type][‘decimal_point’], $format_string);
$format_string = $format_string[0] . $this->currencies[$currency_type][‘decimal_point’] . ‘‘ . $format_string[1] . ‘‘;
} else {
$format_string = $this->currencies[$currency_type][‘symbol_left’] . number_format(tep_round($number, $this->currencies[$currency_type][‘decimal_places’]), $this->currencies[$currency_type][‘decimal_places’], $this->currencies[$currency_type][‘decimal_point’], $this->currencies[$currency_type][‘thousands_point’]) . $this->currencies[$currency_type][‘symbol_right’];
$format_string = explode($this->currencies[$currency_type][‘decimal_point’], $format_string);
$format_string = $format_string[0] . $this->currencies[$currency_type][‘decimal_point’] . ‘‘ . $format_string[1] . ‘‘;
}[/php]

You can style the “sup” appropriately using css, this would be done in the stylesheet.css file.

Easy as 123.