Regeerakkoord Rutte III

Ik ben totaal niet politiek aktief, eerder politiek inactief. Ik ben geen lid van een politieke partij, ik bezoek geen bijeenkomsten van een politieke partij en ik ben nooit aanwezig bij politiek getinte demonstraties of manifestaties.

Ik heb wel een mening over wat de politiek allemaal bepaald. Een uitgesproken mening die ik laat horen in gesprekken, op feesten en verjaardagspartijtjes. Bij elke verkiezing stem ik consequent. Ik zie het als een plicht. Ik mag dan wel zeiken op de politiek, maar dan moet ik ook op het moment, dat ik mee mag bepalen wie er in de regering komt, mijn stem uitbrengen.

De laatste tijd denk ik dat dat niet genoeg is! Ik kan wel hard langs de zijlijn roepen en eens per 4 jaar mij stem uitbrengen, maar dat zet geen zoden aan de dijk. Ik moet in actie komen.

Magento hide or remove Delete Customer button in admin

Magento CMS website logoFor a customer we had to hide or remove the Delete customer button for non administrators. Just to avoid that CMS users could delete customers by accident.

This is done by extending the Mage_Adminhtml_Block_Customer_Edit clas

File: app/code/core/Mage/Adminhtml/Block/Customer/Edit.php

Code used to get current users role:


$admin_user_session = Mage::getSingleton('admin/session');
$adminuserId = $admin_user_session->getUser()->getUserId();
$role_data = Mage::getModel('admin/user')->load($adminuserId)->getRole()->getData();
$role_name = $role_data['role_name'];
if ($role_name != 'Administrators') {
$this->_removeButton('delete');
}

Add this code just below

if (!Mage::registry('current_customer')->isDeleteable()) {
$this->_removeButton('delete');
}

Magento import product images not showing up (solved)

Magento CMS website logoI imported products with the standard product import functionality System -> Import/Export -> Import

The products imported well but images didn’t. After some investigation we found out that it was due to missing columns in the cvs file. In my case we imported a single image per product.

The columns you need to import a single image are:

  • image -> /image_name.jpg which needs to be stored in folder media/import (don’t forget the “/” before the image_name).
  • image_label -> text
  • small_image -> /image_name.jpg
  • small_image_label-> text
  • thumbnail -> /image_name.jpg
  • thumbnail_label -> text
  • gallery -> empty
  • media_gallery -> empty
  • _media_image -> /image_name.jpg
  • _media_lable -> text (lable => this is not a typo!)
  • _media_attribute_id -> export one product and verify this id, for example “88”
  • _media_is_disabled -> value = 0
  • _media_position -> value = 1

Magento Index process is working now and won’t re-index (solved)

Via the Magento CMS I got the message:

Magento index process is working now 0

This is the general message when trying to index. The message will be specific if you try to index a specific table:

Stock Status Index process is working now
Product Attributes Index process is working now
Product Prices Index process is working now

My Magento installation was moved 24H ago to a new server. So probably an issue caused by old/new database or files locked. These are the solutions I found and tried.

1) Clear /var/locks folder

Magento writes out a lock file to the var/locks folder while processing the indexes. The files have the following format for each process you have

index_process_x.lock

The lock file prevents another user from starting an indexing process. If these files are stuck, this could prevent you from indexing. You can clear those files via FTP or SSH, depending whether you have sufficiënt rights.

Via FTP

  • Goto folder /var/locks/ and delete all entries

 Via SSH

  • Login with your SHH client
  • Goto your magento installlation: cd /path_to_magento/
  • Delete all file of var/locks folder: rm -rf var/locks/*
  • Make sure you have sufficient permissions to the

    var/locks folders (e.g. 777)

In my case the locks were removed but didn’t resolve the re-indexing via the CMS

2) Give /var/lock folder 777 permissions

Magento needs sufficient rights to the /var/locks folder.

  • Login with your SHH client
  • Goto your magento installlation: cd /path_to_magento/
  • Set folder permission: chmod 777 var/locks/*

3) Re-index via ssh

When Magento starts indexing of each item in the ‘Index Management’ list it sets ‘status’ field of correlative entire of ‘index_process’ table to ‘working’. If error happens during the indexing process script halts and status remains as ‘working’. You can re-run the index via SSH. Here is the command:

php shell/indexer.php reindexall

This is the SSH output screen I got after running this command.

Magento php indexer command
All my tables have been re-indexed and this is the resulting output in Magento CMS

Magento index process is working now 1 The status was still stuck in processing and the “Stock Status Index process is working now” message was still there.

4) Restart apache

I went to webmin and restarted the apache server. Finally this resulted in resetting the index management. I restarted Apache several times in the last 24H, but probably the actions in 1) to 3) supported this process.

Magento index management

Turnkey Linux Magento install with Redis

Magento CMS website logoFor a customer we need a fast webserver which we can completely configure to run Magento smoothly. We have chosen a Turnkeylinux Magento installlation with hosting provider YourHosting in the Netherlands. The unmanaged server is VPS4 with 4 GB ram. There are many dedicated Magento hosting parties available but we wanted to completely maintain the server ourselves. This is what we have done. 1) Installation Yourhosting account has options to install the desired server VNC module: make sure to use the ip-addres, not the url of your website for testing purposes Make sure Webadmin is up to date: Install these modules via the SSH console required to update webadmin

apt-get install apt-show-versions libapt-pkg-perl

Download the lates webadmin

wget http://prdownloads.sourceforge.net/webadmin/webmin_1.690_all.deb

Install the webadmin module

dpkg --install webmin_1.690_all.deb

Set up the FTP server
We picked proftpd

  1. Login to webmin at http://xx.xx.xx.xx:12321 (Yourhosting specific)
  2. Go to Webmin > Webmin Configuration -> Webmin Modules
  3. Select Standard module from www.webmin.com
  4. Click the button on the right of that option and choose: proftpd or just type “proftpd” in the field
  5. Click “Install Module”
  6. Go back to Webmin Configuration
  7. On the bottom of the page click “Refresh Modules”
  8. The server is installed

Create a usergroup so you can force setting to a group of users

  1. Got to System > Users and Groups and click “Local groups” and then “Create a new group”
  2. Name -. for example ftpusers
  3. Password -> Select Normal Password
  4. Click Create

Create a user

  1. Got to System > Users and Groups and click “Create a new user”
  2. Provide a username for what is to be your FTP account
  3. Home directory -> Select a home directory for example “/var/www”
  4. Password -> Select Normal Password and provide a unique, complex password for the account
  5. Shell -> bin/sh: we will set shell in ftp configuration for all users.
  6. Usergroup -> select ftpuser group
  7. Click Create

Now it seems the server is running but it isn’t. It needs to be installed by webmin also together with inetd

  1. Goto Servers -> Proftpd server: it will indicate the server is not found and displays a message to install it.
  2. Click on the message and install the Proftpd server, it will also install other modules it needs, like Inetd

Update 2014-06-09

Since Webmin version 1.690 following error occurs:

Fatal: LoadModule: error loading module 'mod_vroot.c': Operation not permitted on line 74

Solution is to install following module

apt-get update
 apt-get install proftpd-mod-vroot

Make changes to proftpd.conf

  1. ServerName “example.com”
  2. Restart the server: service proftpd restart

Test FTP

  1. Create a site in your preferred ftp client and connect with the indicated details.

Install Sudo

Install sudo with following command and implement extra security for ssh users

apt-get update
 apt-get install sudo

Install redis Use the foll0wing commands to install redis (http://redis.io/download)

wget http://download.redis.io/releases/redis-2.8.4.tar.gz
tar xzf redis-2.8.4.tar.gz
cd redis-2.8.4
make

First error due to missing make

-bash: make: command not found

Used this SSH command to install make

apt-get install make

Second error due to missing gcc

make[3]: gcc: Command not found

Used this SSH command to install gcc

apt-get install build-essential

Third error due to missing jemalloc

zmalloc.h:50:31: error: jemalloc/jemalloc.h: No such file or directory
zmalloc.h:55:2: error: #error "Newer version of jemalloc required"

Redis depends on Jemalloc and it is part of the redis download (http://download.redis.io/redis-stable/deps/). I Issued solution mentioned here (https://github.com/antirez/redis/issues/722).

cd deps
make hiredis lua jemalloc linenoise
cd ../
make

Run make test to verify installation

make test
Run make test to verify installation
make test

Error message in SSH

You need tcl 8.5 or newer in order to run the Redis test

Installed TCL 8.5 to run make test

apt-get install tcl8.5

Next step: check Magento installation and update

So far so good, the server is running with basic configuration. It needs further tweaking but we proceeded upgrading Magento version in the Turnkey Linyx from 1.7.0.2 to 1.8.1.

Upgrading to Magento 1.8.1.

  1. Log in to your Magento backend
  2. Goto Magento Connect via System -> Magento Connect -> Magento Connect Manager
  3. I got error message:
    CONNECT ERROR: Please check for sufficient write file permissions.
    Your Magento folder does not have sufficient write permissions, which downloader requires.
  4. Correct write permissions with this SSH command (http://www.magentocommerce.com/wiki/groups/227/magento_connect)find . -type d -exec chmod 777 {} \;
  5. Test Magento Connect Manager by switching back to Admin and then login again. When message disappear you are ready to go.

Copy Magento website

We had a Magento website runnning on a managed VPS at yourhosting. Managed VPS is a great out-of-the-box solution and delegates support and upgrades to the hosting provider. In our case we needed additional support (particulairly for Redis) and access to the VPS so we switched to unmanaged VPS.

We could copy the Magento installation to the new VPS but we decided to do a clean install, thus making sure sourcecode is fresh and clean and unused extensions are left out. Our primairy goal was to increase speed.

I will not go into the whole process. But during installation we needed IonCube installed on the Turnkey Linux and this is what we did.

IonCube installation

  1. Check if Ioncube is installed via php file with this code in a php file <?php phpinfo() ?>
  2. Reference blogpost: https://www.digitalocean.com/community/articles/how-to-install-ioncube-loader
  3. Download the nessecary files from this page: http://www.ioncube.com/loaders.php
    1. You need Loader Wizard files to verify your installation from the frontend (http://www.ioncube.com/loader-wizard/loader-wizard.tgz)
    2. You need the linux files for your Turnkey Linux (x86 or x64)
  4. Copy the Loader Wizard the files to your server via FTP. (Make a folder “Ioncube” in the main Magento folder where the App folder is located)
  5. Copy the Linux files to the same folder and untar
    cd /var/www/magento/ioncube
    wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
    tar xvfz ioncube_loaders_lin_x86-64.tar.gz
  6. Start the loader Wizard via http://YOUR.URL/ioncube/loader-wizard.php
    1. Select “Dedicated or VPS” installation

3 things you have to do

  1. Save 20-ioncube.ini in correct folder
    1. Now you will be asked to save “20-ioncube.ini” file in /etc/php5/apache2/conf.d
      mv /var/www/magento/20-ioncube.ini /etc/php5/apache2/conf.d/20-ioncube.ini
  2. Save ioncube_loader_lin_5.x.so in correct folder
    1. The usr/var/magento/ioncube folder now contains a list with loaders:
      ioncube_loader_lin_5.x.so.
    2. Copy the correct version to the PHP folder
      cd /var/www/magento/ioncube
      cp ioncube_loader_lin_5.3.so /usr/lib/php5/20090626/
      make additional folder
      mkdir 20090626+lfs
      copy files to that folder also
      cp /usr/lib/php5/20090626/ioncube_loader_lin_5.3.so /usr/lib/php5/20090626+lfs
    3. The ionCube Loader must be the first Zend extension listed in the configuration file xcache.ini
      open the file
      pico /etc/php5/apache2/conf.d/xcache.ini
      add following line as first line
      zend_extension = /usr/lib/php5/20090626+lfs/ioncube_loader_lin_5.3.so
    4. You would have to copy it over into your PHP modules folder, which you can find with (the path will also be provided by Loader Wizard):
      php -i | grep extension_dir
      You will get the following output:
      extension_dir => /usr/lib/php5/20090626+lfs => /usr/lib/php5/20090626+lfs
      or
      extension_dir => /usr/lib/php5/20090626 => /usr/lib/php5/20090626
  3. You would then have to restart Apache2 for module to be loaded:service apache2 restart
  4. mRefresh the webpage “http://YOUR.URL/ioncube/loader-wizard.php” and verify that Ioncube is installed

2014-06-09 Updated webmin versions

Wie liked mijn Facebook pagina?

Van diverse bezoekers de vraag gekregen waar je een overzicht kan zien van de personen die je Facebook pagina liken / leuk vinden.

Voorheen kon je die snel zien door op het aantal Likes / Personen vinden dit leuk te klikken:
Facebook likes vinden

Tegenwoordig moet je er via een omweg komen:

  1. Open je pagina als beheerder.
  2. Ga naar Pagina bewerken:
    Facebook geblokeerde gebruikers weergeven
  3. Kies Geblokkeerde gebruikers weergeven.
  4. In het volgende scherm open je de dropdown Geblokeerd en daarin zie je meer oties waaronder Likes / Personen die dit leuk vinden.
    Facebook likes en personen die dit leuk vinden bekijken

Veel plezier met het bekijken van je likes.

Bulk update Magento attributen

Magento CMS website logoAls je attributen gebruikt kan je die instellen voor het hele systeem (Global), per website of per winkelzicht (store). Er is geen functie om een groot aantal artikelen het vinkje “winkelzicht” aan of uit te zetten.

In mijn geval moest op alle artikelen het vinkje (weer) aan en de bulk update kan je zo doen:

  1. Ga naar attributen en kies gewenste attribuut
  2. Wijzig de instelling Scope van Winkelzicht naar Systeem en sla het op
  3. Wijzig aansluitend de instelling Scope van Systeem naar Winkelzicht en sla op.

Nu staan alle vinkjes weer aan bij de artikelen om gebruik te maken van de systeem waarde.

Magento group attributes on product page

Magento CMS website logoFor a Magento project I was looking for a way to group the attributes so the visitor can view the ‘Product features’ and ‘Technical features’ grouped together. The project involves the Magento Connector by Tinx-IT which synchronizes the data from Microsoft Dynamics to a Magento database.

Magento has default functionality to create attributes groups.

  1. Goto CMS-> Catalog->Attibutes->Manage attributes sets
  2. Choose an Attribute set
  3. The center window will show Attribute Groups. You can add Groups at you wish and drag and drop attributes in a specific group. In my case I made a group called ‘Technical’ and added the technical product attributes to that group.

I found this page which has code to group the attributes: http://www.magentocommerce.com/boards/viewthread/26167/.

The code is not fully functional in my case so this is my edited version. Features of my version:

  • Only show attributes from attribute groups defined in $listable_groups = array (‘group1′,’group2’).
  • Add the names of your attribute groups in the array.
  • Neglect all other attributes groups.
  • Add this code to in the page: app/design/frontend/default/theme/template/catalog/product/view/attributes.phtml. This will edit the standard attributes overview.
  • You can also add a new tab to the product page if you want to separate the attributes in two tabs.
<?php
 $_helper = $this->helper('catalog/output');
 $_product = $this->getProduct()
 ?>
 <?php
 $listable_groups = array('General','Technical'); //The attribute groups listed here will display as a single list beneath the group name
 $group_names = array();
 $active_group_name = null;
 $attributes = $_product->getAttributes();
 $new_group = true;

foreach ($attributes as $attribute) {
   $new_group = false;
   if ($attribute->getIsVisibleOnFront() ) {
      $group_id = $attribute->getData('attribute_set_info/' . $_product->getAttributeSetId() . '/group_id');
      if ( !isset($group_names[$group_id]) ) {
         $group_model = Mage::getModel('eav/entity_attribute_group');
         $group_model->load($group_id);
         // group names are cached to prevent having to check the DB on each iteration
         $group_names[$group_id] = $group_model->getAttributeGroupName();
      }
      if ( $group_names[$group_id] != $active_group_name ) {
         $active_group_name = $group_names[$group_id];
         $new_group = true;
      }
      $value = $attribute->getFrontend()->getValue($_product);
      if ( in_array($active_group_name, $listable_groups) ) { 
         // If a "listable" attribute
         if ($new_group) { //display the heading of a new group
         ?>
         <div class="product-attribute-title">
            <?php echo $active_group_name ?>
         </div>
         <?php
      }
      if (strlen($value) && $_product->hasData($attribute->getAttributeCode())) {
      ?>
      <div class="product-attribute-label">
         <?php echo $this->__($attribute->getFrontend()->getLabel()) ?>
      </div>
      <div class="product-attribute-data">
         <?php echo $_helper->productAttribute($_product, $value, $attribute->getAttributeCode()) ?>
       </div>
       <div style="clear:both;"></div>
       <?php
       }
    }
 }
?>

 

Styles used:

/* attributes tab */
 .product-attribute-title {
    width:400px;
    font-weight: bold;
    margin:12px 0 8px 0;
 }
 .product-attribute-label {
    display:inline-block;
    width:200px;
    font-weight: bold;
 }
    .product-attribute-data {
    display:inline;
 }

Magento webshop in het Nederlands

Magento CMS website logoHet Magento platform is eenvoudig in het Nederlands om te zetten.

Je kan zowel je Magento webshop als het Magento CMS vertalen met vertaalbestanden. Als je zelf je Magento webshop vertaling aan wilt passen dan kan dat ook.

In dit artikel sommen we de mogelijkheden op:

  1. Vertaalbestanden installeren
    1. Nederlandse vertaling installeren via Magento Connect
    2. Nederlandse taal downloaden en installeren
  2. Vertaling Magento aanpassen
    1. Aanpassen van geïnstalleerde Nederlandse vertalingen
    2. Zelf vertalen via de “Magento Inline Translations”
  3. Vertaling Magento webshop versus Magento CMS