I’m currently working on a client-site which is using Magento 2, and realised there’s no full en_GB language pack for English (United Kingdom) available.

I’ve created the following package with full instructions that you can view on Github.
https://github.com/cubewebsites/magento2-language-en-gb

It’s free to download and use, all I ask is if you can create PRs for any mistakes that you might spot.

The project is forked from another Github project for the following reasons:

  1. The project wouldn’t install
  2. Once that was fixed, it wouldn’t load any translations
  3. Once that was fixed, it turned out that a lot of it was actually French

This version fixes all the above issues and also includes a lot more translations.

It has been developed and tested on Magento 2.1.7 (latest at time of posting)

Enjoy!

Introduction

This guide will show you how to setup a new project using Ember and Laravel, JSON-API and token based authentication.  The deployed version of your application will be a Laravel backend which serves up the Ember frontend using a Laravel route.

Software

At the time of writing the tools used are:

Prerequisites

  1. Ember CLI 2.4.1
  2. Laravel Requirements
  3. Composer
  4. Git or any other VCS that you prefer

Continue reading

The Code

// Inline Style Images
$content    =   preg_replace_callback('/!\[(.*)\]\s?\((.*)(.png|.gif|.jpg|.jpeg)(.*)\)/',function($match){
    return str_replace('your_search_term','your_replacement',$match[0]);
},$content);

// Reference Style Images
$content    =   preg_replace_callback('/\[(.*)\]:\s?(.*)(.png|.gif|.jpg|.jpeg)/',function($match){
    return str_replace('your_search_term','your_replacement',$match[0]);
},$content);

Why Would You Need This?

I had to use the above code in a Laravel project where the content is entered into a frontend form in Markdown format. When saving the data in my Laravel backend app I wanted to replace the image URL with a placeholder so that the sites URL itself isn’t hardcoded into the database. When displaying the data, the placeholder is replaced with the URL of the site again. This means that if the URL ever changes (different dev environment, staging, production etc) then the images would still load providing that the files still existed in the same location on the server.

Your use case might be different but the above regex should provide you with a decent starting point to actually find the image tags (both inline and reference style) and then manipulate them however you wish.

I normally use PuPHPet to configure my Vagrant boxes.
On my latest box using CentOS 5.6 the setup worked normally, but when trying to run my application I was getting the Class ‘Memcache’ not found error.

Usually this is a simple fix, just go in and type:

sudo yum install -y php-memcached

However, this time round the above was giving me the following error:

Transaction Check Error:
file /usr/lib64/libhashkit.so.2.0.0 conflicts between attempted installs of libmemcached-last-libs-1.0.18-2.el6.remi.x86_64 and libmemcached10-1.0.16-1.ius.centos6.x86_64
file /usr/lib64/libmemcached.so.11.0.0 conflicts between attempted installs of libmemcached-last-libs-1.0.18-2.el6.remi.x86_64 and libmemcached10-1.0.16-1.ius.centos6.x86_64
file /usr/lib64/libmemcachedutil.so.2.0.0 conflicts between attempted installs of libmemcached-last-libs-1.0.18-2.el6.remi.x86_64 and libmemcached10-1.0.16-1.ius.centos6.x86_64

After smashing my head against the desk a few times during numerous attempts at installing the module, reprovisioning the vagrant box and anything else I could think of doing to fix it, I tried something that hadn’t occurred to me before; to install the dependency it was complaining about first.

Using the following commands fixed my issue, and should also work for you:

sudo yum install -y libmemcached-last
sudo yum install -y php-memcached
sudo service php-fpm restart

Hope this helps!

I just came across an issue where I updated my vagrant config and tried to provision the box, but it kept erroring out with the following error:

==> default: Error: printf "\\n" | pecl -d preferred_state=stable install pecl_http returned 1 instead of one of [0]
==> default: Error: /Stage[main]/Puphpet_php/Puphpet::Php::Pecl[pecl_http]/Php::Pecl::Module[pecl_http]/Exec[pecl-pecl_http]/returns: change from notrun to 0 failed: printf "\\n" | pecl -d preferred_state=stable install pecl_http returned 1 instead of one of [0]
==> default: Warning: /Stage[main]/Puphpet_php/Service[php5-fpm]: Skipping because of failed dependencies

In order to fix this I logged into the server using SSH, and then manually ran the install pecl_http command that it was trying to run in the above error message.  In doing so I got a different error:

$ sudo pecl -d preferred_state=stable install pecl_http
pecl/pecl_http requires package "pecl/raphf" (version >= 1.1.0), installed version is 1.0.4
No valid packages found
install failed

It turns out that a pecl dependency was out of date and so it couldn’t install the pecl_http package.  In order to fix it I just ran the pecl upgrade command.

vagrant up
vagrant ssh
sudo pecl upgrade

After running the above, I tried my vagrant provision again, and hey presto! Everything was working again as normal

Over the weekend I was migrating several of my sites over to an nginx-based VPS.  Whilst the migration itself seemed to go fine, I was getting a weird issue with the WordPress admin where the styles and javascript was not fully loading.

After inspecting the requests with the Firebug Console, I saw that the culprit was the request:

/wp-admin/load-scripts.php?c=0&load%5B%5D=jquery-core,jquery-migrate,utils,plupload&ver=4.2.3

I tried the normal fixes such as checking permissions, updating everything, and even reinstalling WordPress but to no avail.  Then I started looking on Google for a potential fix and found this article which not only provides the solution, but also a detailed explanation of why the error occurs in the first place.

As soon as I made the recommended updates, all the sites started working properly with no issue whatsoever.

Full credit goes to the article author.  Just posting here for my own reference more than anything else!

UPDATE: As the original article no longer exists I’ve posted the instructions below:

It turns out the solution to this is quite simple. Nginx and php-fpm need to run as the same user and the directory /var/lib/nginx needs to be owned by that user. Personally I like to run all my web-related services under a www-data user, but running it under a nginx or apache user is also common. To change the user nginx runs under, edit the main nginx config file usually located at /etc/nginx/nginx.conf:

user www-data;
worker_processes 4;
pid runnginx.pid;

Now to change the user php-fpm runs under we need to edit its config file. On my Amazon Linux system this was located at /etc/php-fpm.d/www.conf while on my old Debian setup it was located at /etc/php5/fpm/pool.d/www.conf. There are two user-related settings in the config file. First, if php-fpm runs as a socket (as opposed to listening on a port), the user and group owner of the socket should be set to the same user as nginx so that nginx can access it to run php files. This is not relevant for our error, but can cause other issues if nginx doesnt have permissions to access the socket. Second, the user and group that the php-fpm process runs under needs to be the same as nginx.

    user  = www-data
    group = www-data
     
    listen = varrunphp5-fpm.sock
    listen.owner = www-data
    listen.group = www-dataL

To change the ownership of the nginx lib directory simply run the command chown -R www-data:www-data /var/lib/nginx as root (sudo will do on most systems). Finally, if we edited any config files, we need to restart the appropriate services for the changes to take effect. On most systems this can be done by running service nginx restart or /etc/init.d/nginx restart as root. For php-fpm the service name is php5-fpm.

Telegram messenger recently released an API that lets you easily create bots for their platform.  After deciding to have a bit of a play with it, I found that I had an issue where the webhooks would not send any updates to my server with no apparent error.

The Problem

I made all the following checks:

  1. Valid SSL certificate
  2. Webhook successfully registered using the Telegram setWebhook method
  3. The method responded properly when I sent a test request using a REST service tester
  4. Server access logs – look like Telegram had never even hit the server

The Solution

After a full day of searching, testing and bashing my head against the keyboard, I found this thread on Reddit, where the user described a problem where a full chained certificate was required on the server, not just the server certificate.

To create chained certificate you’ll need to have a look at what instructions your certificate issuer provides.

In my case the certificate being used was a Comodo PositiveSSL, for which I downloaded all the certificates that they sent, which contained:

  • Root CA Certificate – AddTrustExternalCARoot.crt
  • Intermediate CA Certificate – COMODORSAAddTrustCA.crt
  • Intermediate CA Certificate – COMODORSADomainValidationSecureServerCA.crt
  • Your PositiveSSL Certificate – my_domain.crt

I had to combine them all into a file in the following order:

  • my_domain.crt
  • COMODORSADomainValidationSecureServerCA.crt
  • COMODORSAAddTrustCA.crt
  • AddTrustExternalCARoot.crt

For the example above the command would have been:

cat my_domain.crt COMODORSADomainValidationSecureServerCA.crt AddTrustExternalCARoot.crt COMODORSAAddTrustCA.crt > bundle.crt

After that it was just a case of uploading the new bundle.crt to my server, updating the nginx config, and hey presto, within minutes I was receiving all the responses for my webhooks

Hi folks, I’m back with another freebie for you.  This time it’s a Concrete5 package that lets you create, manage and display testimonials on your website.

The following fields are available to you:

  • Title
  • Author
  • Department
  • Quote
  • URL
  • Display Order

When adding a block you can choose specific testimonials to display, or display all. Additionally, you can sort by display order, or in a random order.

Requirements

All you need is a Concrete5 website running on 5.5.0 or greater.

Usage

You can find full documentation on the Github page

License

It’s totally free and open-source so you can do whatever you like with it!  It’s quite easy to adapt into a management system for any other kind of object like people, books or even managing your own movie database.

Screenshots

Download

I’ve submitted the package to the Marketplace and will update this post will a link once it’s live.  In the meantime you can download from Github.

Download here

Support

If you have any issues or feature requests please get in touch via the comments, Twitter, or email

I’ve just finished work on a Ruby Gem which provides an interface for the HotUKDeals (HUKD) REST API.

This gem provides all the following search methods:

  • hottest deals
  • newest deals
  • discussed deals
  • deals by username
  • deals by tag name
  • deals by merchant name
  • online deals only
  • offline deals only
  • keyword search
Each search method also allows you to filter results by category, forum, limit the number of results.
It’s dead easy to install and run:
    require 'hukd'
    hukd	=	Hukd.new("YOUR_API_KEY_HERE")
    deals	=	hukd.hottest('deals')
    deals.each |deal| do
    	puts(deal.title)
    end
Full documentation can be found on the Github page.

Source code on Github
Gem on rubygems.org 

If you have any issues or requests then feel free to get in touch 🙂

Over a year ago, I released a free Magento Featured Products Widget which groups the featured products by category.  Since releasing it I’ve had a lot of traffic, and a lot of pleasant feedback from users.  Now I’ve finally been able to get round to upgrading the widget to be even better with a lot of rewritten code, testing and few new features too.

New Features

  • Creates featured attribute on installation
  • Displays Review Summary
  • Displays Add to Cart button
  • Shows path to categories when selecting categories in admin (easier to distinguish between different stores with same category names)
  • Caching
  • Code rewrite (better documented and better Magento conventions)
  • Compatibility checked on 1.4.0.0 to 1.6.2.0
  • More flexible styling (font colours are now theme defaults)
  • Included Minimum price for Bundled Products
  • Products only fetched from current store
  • Mixed template is now a lot cleaner

Screenshots

Grouped by category

Configuration Options

Mixed Display

Installation and Documentation

Installation

Copy the app and skin directories into your Magento installation

Usage

CMS Pages

  1. Login to your Magento admin
  2. Go to CMS > Pages
  3. Select the page you want to use
  4. Click the Content tab
  5. In the WYSIWYG Editor, click the Insert Widget button (for me it’s top row, second from the left)
  6. As Widget Type select Cube Websites - Category Featured Products
  7. Configure your Widget using the available options

Frontend Template
Categorised – Displays the products grouped by the category they belong in
Mixed – Displays all the products in a single block with no grouping

Categories (only applies if Categorised Frontend Template is selected)
The categories to select products from

Number of Products
If Categorised – the number of products from each category
If Mixed – the total number of products

Products Per Row
How many products will be displayed on each row in the frontend

Products to Display
Featured – Displays featured products only
All – Displays all available products

Featured Attribute Code (optional)
By default this is cube_category_featured but if you’ve created your own featured attribute code then you can use that instead.

Within your template

  1. Open your favourite text editor
  2. Within find the Layout XML you want to add the block to within the app/design/frontend directory
  3. In your .xml file, add the following in the relevant position
     <block type="categoryfeatured/list" name="featured_products" as="featuredProducts" template="categoryfeatured/block.phtml">
     <action method="setData"><name>categories</name><value>1,2,3,4</value></action>
     <action method="setData"><name>num_products</name><value>4</value></action>
     <action method="setData"><name>products_per_row</name><value>4</value></action>
     <action method="setData"><name>product_type</name><value>featured</value></action>
     <action method="setData"><name>featured_code</name><value>cube_category_featured</value></action>
    </block>

template
categoryfeatured/block.phtml – Displays the products grouped by the category they belong in
categoryfeatured/mixed.phtml – Displays all the products in a single block with no grouping

categories (only applies if categoryfeatured/block.phtml template is selected)
The categories to select products from (comma separated)

num_products
If categoryfeatured/block.phtml – the number of products from each category
If categoryfeatured/mixed.phtml – the total number of products

products_per_row
How many products will be displayed on each row in the frontend

product_type
featured – Displays featured products only
all – Displays all available products

featured_code (optional)
By default this is cube_category_featured but if you’ve created your own featured attribute code then you can use that instead.

If you need to output the block in a certain location of your template, then make sure you include the following in your .phtml file <?php echo $this->getChildHtml('featuredProducts') ?>

Downloads

I’m currently awaiting approval from the Magento Connect site, but I’ve also made this project available free on GitHub.

Download from Magento Connect (awaiting approval)
Download latest version

Download 2.0.1

Fork on GitHub

Feedback and Support

If you have any questions or issues please feel free to post in the comments.