Fixed version of the gsitemap module

There seems to have been a lot of problems with the Google XML Sitemap generator shipping with PrestaShop 1.2, so I’ve had a run through and re-written a fair bit of the code to fix these issues.

The main changes (in 1.4.2) are:

  • New XML generation code using the DOMDocument(*) class
  • Modified the logic to remove extra elements from the generated URLs
  • Added an xml-stylesheet reference to the output file, xsl included in download
  • Fixed the issues when “Friendly” urls are turned off
  • Add a new field to the cms table on install to track modified dates (auto updating)
  • Added removal of additional field on uninstall

(*)If your server doesn’t support this then sorry. Go elsewhere for hosting!

Updated to 1.4.3 — 10 August 2009

  • Added error checking and reporting

Updated to 1.4.4 — 18 August 2009

  • Added images to the sitemap (as introduced in the 1.4 version in the 1.2.1.0 distribution)
  • 1.2.1.0 including fixes to the Link class which broke 1.4.3, so fixed that
  • Added cross-compatibility so this version works in both 1.2.0.x and 1.2.1.x
  • Fixed a bug when __PS_BASE_DIR__ is set to other than the site root

Example output: with friendly urls and without friendly urls.

Download the Prestashop Google XML Sitemap Module v1.4.4 now.

  • StumbleUpon
  • Twitter
  • Digg
  • del.icio.us
  • Technorati
  • MySpace
  • Facebook
  • Google Bookmarks
  • MisterWong
  • Reddit
  • RSS

Tags: , , , ,

AddHeader – a sibling for AddStuff

Sometimes you just want to do something simple, and there doesn’t seem any way of achieving it easily. Then you find something like AddHeader.

This one adds the contents of your specified file into the header of your pages, so you can add or remove code without having to go and edit the template files (and it’s there regardless of which template you’re using too!). Simple.

Version 0.1.0 (Initial Release August 2009) : AddHeader module

  • StumbleUpon
  • Twitter
  • Digg
  • del.icio.us
  • Technorati
  • MySpace
  • Facebook
  • Google Bookmarks
  • MisterWong
  • Reddit
  • RSS

Tags: , ,

Storing complex configuration data

While porting the WP-Cumulus plugin to Prestashop I came across an interesting situation. In the original plugin the parameters for the Flash movie are stored in an array that is obtained from the Wordpress database using a get_option() call. In Prestashop the parameters can be retrieved in bulk using Configuration::getMultiple(), but in that case you have to specify the key names for all the parameters which is a pain.

What I decided to do was to use the serialize() and unserialize() php functions and store the options as a single configuration item in the database. That way we use:

// Get the options
$newoptions = unserialize(Configuration::get($this->name.'_options'));

// Save the options
Configuration::updateValue($this->name.'_options', serialize($newoptions));

The above works great in this situation, as the parameter names aren’t language dependent, but this technique isn’t suitable if your configuration data key needs to be defined in multiple languages.

  • StumbleUpon
  • Twitter
  • Digg
  • del.icio.us
  • Technorati
  • MySpace
  • Facebook
  • Google Bookmarks
  • MisterWong
  • Reddit
  • RSS

Tags: , ,

Moving Boxes Home Featured jQuery module

I thought it was about time for yet more free Prestashop eye candy, so here’s yet another home featured products module for you all to play with!

Just specify how many products you’d like to feature in the configuration screen and sit back and enjoy! Well, maybe not as I suspect you may also want to play with the css file in the module directory to modify the style to suite your stores. There are also a few images you may want to tweak too!

The javascript and markup is only gently modified from the original obtained from the superb CSS Tricks.

UPDATE: There was a slight error in the uninstall function which resulted in an error when you try to remove it. Updated is available below and should just be copied over the 0.1.0 version to fix.

Version 0.1.0 (Initial Release August 2009) : Moving Boxes “Featured Products” module

Version 0.1.1 (Bugfix Release August 2009) : Moving Boxes “Featured Products” module

  • StumbleUpon
  • Twitter
  • Digg
  • del.icio.us
  • Technorati
  • MySpace
  • Facebook
  • Google Bookmarks
  • MisterWong
  • Reddit
  • RSS

Tags: , ,

AddStuff is almost 1 Year old!!

Who would have believed it! Well to celebrate, and also to fix a few problems it’s recently been updated. You can grab the latest version, as always, from the Addstuff page

  • StumbleUpon
  • Twitter
  • Digg
  • del.icio.us
  • Technorati
  • MySpace
  • Facebook
  • Google Bookmarks
  • MisterWong
  • Reddit
  • RSS

Tags: ,

PS_Cumulus a WP-Cumulus port to Prestashop

I was looking to write a cool module to use in future tutorial articles when I came across the nifty looking WP-Cumulus Wordpress plugin by Roy Tanck. It had all the elements I was looking for, and he has kindly released the code (including the flash source) under the GPL license. Approximately 2 hours later PS_Cumulus was born!

Before anyone asks, the name has to use an underscore as a hyphen isn’t allowed in PrestaShop class names….

Full article »

  • StumbleUpon
  • Twitter
  • Digg
  • del.icio.us
  • Technorati
  • MySpace
  • Facebook
  • Google Bookmarks
  • MisterWong
  • Reddit
  • RSS

Tags: , , ,

Writing your own Prestashop Module – Part 4

Form Validation and Security

Introduction

While being sufficiently functional for what it does, the module we created in Part 2 does present us with some issues to consider when implementing “real world” modules to extend Prestashop. In particular the user input we captured with our form was written directly to the configuration entry without any checking to determine whether it was valid, nor did we take account of the type of data being entered.

In this tutorial we will look at the general issue of form input checking and security, both for Back Office and Front Office forms and user input as well as looking at improving our code both functionally and aesthetically.

Full article »

  • StumbleUpon
  • Twitter
  • Digg
  • del.icio.us
  • Technorati
  • MySpace
  • Facebook
  • Google Bookmarks
  • MisterWong
  • Reddit
  • RSS

Tags: , , , , , ,

Paypal WPP (Example) – PayPal Direct API

Development Release

I’ve been asked several times about this, so I guess I’d better release the code. This was written some time ago, and the target PrestaShop version was 1.1, however it should work with later releases.

The archive contains additional code to support PayPal Express Checkout, as this was originally developed as a shared library. A PayPal Express Checkout example will also be published here shortly.

Please note that this is intended for “development” purposes only as an example and was written to test out various concepts in PrestaShop, not as a robust payment method for use in commercial stores.

Full article »

  • StumbleUpon
  • Twitter
  • Digg
  • del.icio.us
  • Technorati
  • MySpace
  • Facebook
  • Google Bookmarks
  • MisterWong
  • Reddit
  • RSS

Tags: , , , ,

Writing your own Prestashop Module – Part 3

Storing Module Configuration

Introduction

In the third part of this series we’ll look at how we can store configuration data for our modules in the Prestashop database, and how we can allow users to interact with this data to control the module’s behaviour. We will also briefly touch on how we can generate output from our module to provide visual feedback of the configuration changes.

Full article »

  • StumbleUpon
  • Twitter
  • Digg
  • del.icio.us
  • Technorati
  • MySpace
  • Facebook
  • Google Bookmarks
  • MisterWong
  • Reddit
  • RSS

Tags: , , , ,

Writing your own Prestashop Module – Part 2

Creating a basic module

Introduction

In this second part of the series we will look at creating our first basic Prestashop module that can be controlled from the Back Office.

The Module class

Similar to the ObjectModel base class, all Prestashop modules are extended from a common base class used to define their basic functionality. The “Module” class provides the interface between the administration screens and your module as well as providing internationalisation and “hook” management functionality.

Full article »

  • StumbleUpon
  • Twitter
  • Digg
  • del.icio.us
  • Technorati
  • MySpace
  • Facebook
  • Google Bookmarks
  • MisterWong
  • Reddit
  • RSS

Tags: , , ,