Showing entries 1 to 4
Displaying posts with tag: PrestaShop (reset)
Resources for Database Clusters: New Chef Cookbook, New Devops Webinar for eCommerce and More

Check Out Our Latest Technical Resources for MySQL, MariaDB & MongoDB Clusters

Like every month this year, we have created new content and tools for you; here is a summary of what we’ve published this December. Please do check it out and let us know if you have any comments or feedback.

And thank you for following us in the past 12 months and for your fidelity; we look forward to “seeing” you next year as well and wish you a great start to 2015!

 

New Live Technical Webinars

 

Infrastructure automation isn’t easy, but it’s not rocket science either, says Riaan Nolan. Riaan has been in operations for the past decade, and has built over a dozen eCommerce …

[Read more]
How to setup High Availability PrestaShop on multiple servers with MariaDB Galera Cluster

November 7, 2014 By Severalnines

PrestaShop is a popular open source e-commerce software powering over 200,000 online stores, according to the company. We’ve seen a bit of interest into high availability PrestaShop setups, so this post will show you how to achieve that on multiple servers. Note that this setup not only caters for failures, but by load balancing traffic across multiple servers, it also allows the system to scale and handle more users.

This post is similar to our previous posts on web application scalability and high availability:

[Read more]
[PrestaShop] Carrier selection by postal code

To select the carrier / delivery method in PrestaShop by the postal code of the delivery address, create a file Address.php in /override/classes with this content:

<?php
class Address extends AddressCore
{
    protected static function getPostcodeByAddress($id_address) {
        $row = Db::getInstance()->getRow('
            SELECT `postcode`
            FROM '._DB_PREFIX_.'address a
            WHERE a.`id_address` = '.(int)($id_address));
        return $row['postcode'];
    }

    public static function getZoneById($id_address)
    {
        $postcode = self::getPostcodeByAddress($id_address);
        if (in_array($postcode, Array(1050)))
            return 1;
        elseif (in_array($postcode, Array(2000)))
            return 10;
        return 0;
    }
}

In this example, postal code 1050 is assigned to the carrier with ID 1 and postal code 2000 is assigned to carrier ID 10 (see the carrier list in …

[Read more]
[PrestaShop] Converting .htaccess to nginx include files

If you use PrestaShop and nginx, you may find this script to convert PrestaShop’s .htaccess rules into an nginx rule file useful:

#!/usr/local/bin/perl
print <<EOF;
fastcgi_buffers           16 128k;
fastcgi_busy_buffers_size 128k;
fastcgi_buffer_size       128k;
client_body_buffer_size   128k;
EOF
while (<>) {
    if (/^RewriteRule \^(.*) \[L\]$/) { print "rewrite ^/$1? break;\n"; }
    if (/^RewriteRule \^(.*) \[QSA,L\]$/) { print "rewrite ^/$1 break;\n"; }
    if (/^ErrorDocument (\d+) (.*)$/) { print "error_page $1 = $2;\n"; }
}

Save as convert-htaccess.pl and run with ./convert-htaccess.pl <.htaccess >.htaccess.nginx. Then don’t forget to include .htaccess.nginx into your nginx site configuration and reload nginx.

If you have multiple languages or an other configuration that includes { brackets }, you may have to adapt the script.

Tested with PrestaShop …

[Read more]
Showing entries 1 to 4