Blog

  • Revisiting the PayPal Beta Module

    Well I discovered that I had two motivations for revisiting PayPal payments in Prestashop this week. One is a new site that I’m working on for a client (more news on that later) and the other is that I discovered I had some free time in between the festivities. Well, not really free time but I managed to squeeze in a few hours at the keyboard anyway.

    (more…)

  • 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

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


  • Customising Prestashop Module Templates

    Please don’t edit those originals!

    I came across this little gem a while ago on the Prestashop forum, and thought I would draw attention to it in the hopes that it will help someone, somewhere.

    (more…)

  • 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.


  • 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


  • Writing your own Prestashop Module – Part 5

    The finishing touches

    In this part of our basic module writing tutorial series we’ll look at the final steps to transform our Tutorialthird module class into a base template that we can use to kick start the writing of new modules. Rather than republish the same old code again we’ll only discuss the changes, but I’ve added a download link at the end of this part so you can grab the final code and use it as the basis for your own projects. We’re going to call this module “Skeleton” – a name that we’ll replace with our own when it comes to producing new modules based on it.

    Updated for Prestashop version 1.4 onwards.

    (more…)

  • 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


  • 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….

    (more…)

  • Writing your own Prestashop Module – Part 4

    Form Validation and Security

    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.

    Updated for Prestashop version 1.4 onwards.

    (more…)

  • 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.

    (more…)