Categories
Blog Magento

Magento 2 installing new php library via composer

Hi,
I had to install php library phpoffice/phpexcel for reading and writing excel files with php. The easiest solution seemed to be to use composer. But running the command
composer require phpoffice/phpexcel
gave me an error:

composer require phpoffice/phpexcel

[Composer\Downloader\TransportException]
Invalid credentials for 'https://repo.magento.com/packages.json', aborting.

require [--dev] [--prefer-source] [--prefer-dist] [--no-plugins] [--no-progress] [--no-update] [--update-no-dev] [--update-with-dependencies] [-ignore-platform-reqs] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--] []...

There were a couple of things I had to do to make my composer install the needed library.

Add your public and private keys

In order to use the composer with magento 2 you first need to add the authentication details to your magento. That’s easy-peasy.

  • Go to magento marketplace and sing in to your account or if you have none, then sign up and create the account.
  • Click on Access Keys in your profile. And this will take you to the area with your access keys.
  • Here you’ll see a big orange button “Create new Access Key” – click on it and it will open a modal with input form. In the input field write down you project name (like “text.com”) and click on ok. This will generate both public and private keys.
  • You will now see your access keys in table below.

Now let’s add our access keys to our magento installation.

  • Go to admin area of your store
  • There go to System -> Tools -> Web Setup Wizard
  • Then click on System Configuration and it will open the form with private and public key input.
  • Fill in the needed data by copying the access keys from magento marketplace and click save config

And voila! You should be done now and should be able to run your composer command.

Not working even though i added the keys

If you’re like me, then there will be some difficulties. If you added the access keys and it still gives you the same error then check your composer by running:
composer diagnose

In my case running this gave me this notice:

composer diagnose
Checking composer.json: FAIL
The version field is present, it is recommended to leave it out if the package is published on Packagist.
Defining autoload.psr-0 with an empty namespace prefix is a bad idea for performance
require.composer/composer : unbound version constraints (@alpha) should be avoided
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com rate limit: OK
Checking disk free space: OK
Checking pubkeys:
Tags Public Key Fingerprint: xxxxxxxx xxxxxxxx xxxxxxx xxxxxxx
Dev Public Key Fingerprint: xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxx
OK
Checking composer version: FAIL
You are not running the latest stable version, run `composer self-update` to update (1.0.3 => 1.4.2)

It turned up that my composer version was old. So i simply run the next command:
composer self-update

And updated my composer to new stable version.
After it completed the update I again ran my line:

composer require phpoffice/phpexcel

And guess what – i worked! I finally installed the needed library.
I really hope this little post helps some one whose composer is not playing along.

Cheers!

Categories
Blog Magento

Magento 1 redirect to home page after login

Hi,
I had to do a simple redirect to home page after customer is logged in, instead of him going to customer account page. The way you do it is using an observer. Magento 1 has an event that fires after login is completed, and this is the event that we’d need. First change the customer settings in system configuration, set Redirect Customer to Account Dashboard after Logging in to No (it’s in the System->Configuration->Customer->Customer Configuration section).

Then make a small extension or if you already have made one add this part in the config.xml:


...
<frontend>
    <events>
        <observers>
            <controller_action_postdispatch_customer_account_loginPost>
                 <my_login_redirect>
                        <type>singleton</type>
                        <class>my_extension/observer</class>
                        <method>homeRedirect</method>
                 </my_login_redirect>
            </controller_action_postdispatch_customer_account_loginPost>
        </observers>
    </events>
</frontend>
...

This is the first part. We need to catch the event that signifies that login is finished, so we catch Magento’s controller postdispatch event on loginPostAction. Now we do the observer part that actually redirects our customer:

<?php
class My_Extension_Model_Observer{
    
    public function homeRedirect(Varien_Event_Observer $observer){
            Mage::app()->getResponse()->setRedirect(Mage::getUrl());
    }
}

And voila! Your customer will now be redirected to the home after he logs in. I will put the small extension for download later on.

Cheers 🙂

Categories
Plugins Wordpress

FastSpring WordPress Cart

Integrate FastSpring Cart to your WordPress page!

Buy now FastSpring Cart

This plugin allows you to integrate FastSpring with WordPress. It has a couple of things included:

  1. Products custom post type – post type for products is automatically generated on plugin installation, so all you need to do is fill in the needed data.
  2. Cart page – cart page for ajax cart mode is created upon the plugin installation. So no need to worry about making you own cart page.
  3. Mini cart widget – You can simply drag and drop the widget into your designated widget area. It is used for both modes – ajax or normal FastSpring
  4. Settings are where you choose the mode in which your now store will operate.

There are two possible mods that this plugin allows you – ajax mode or normal FastSpring mode.

Ajax mode

In ajax mode your customer stays on your wordpress page untill the checkout process. Upon clicking add to cart button the product is added to cart on wordpress. Customer can see the products in minicart and when clicking on Cart link in minicart can also see them in the cart page. When the customer is satisfied with the products he ordered. He then clicks on Checkout button (in mini cart or on cart page) and is taken to FastSpting order page, where he can finish the order.

Normal mode

Upon clicking add to cart button, customer is taken to FastSpring cart page.. From there he can return to your wordpress site. Mini cart now is showing only the number of products in the cart, and has link to the FastSpring Cart page. The process of ordering is then completed by usual FastSpring process.

Settings Area

In settings area you can adjust your plugin and add your FastSpring name. FastSpring name is used in the communication with FaspSpring system to add the orders of your customers and products to the FastSpring cart.

  1. Insert your FastSpring name – this is required option. The plugin won\’t work without this. You wont be able to have any orders completed nor any products added to FastSpring cart.
  2. Use Ajax Cart – do you want the plugin to funtion in Ajax mode or normal mode
  3. Use bootstrap css shipped with plugin (works with ajax cart) – the plugin is currently using Bootstrap 3 modal for ajax mini cart. If you\’re using Bootstrap then this can be omitted. Also this may influence styles on your page.
  4. Customer can order only quantity 1 of one product – if your merchandise can be ordered only in quantity of one. Only quantity 1 of same product wil be available in the cart.

Installation

To install this extension, go to your admin area, plugins section.

  1. Click on Add new button
  2. Click on Upload plugin button
  3. Upload zip file and click on install
  4. wait till installation is complete and then click on Activate Plugin

Then go to Settings area and adjust the plugin’s settings

Check plugin’s full documentation: Documentation

Buy now!

Categories
Blog Kannel

DLRs queueing in Kannel after being injected in http smsc

Hi,
we are currently working on a kannel system that is using two kannel instances with two sqlbox instances and an php http router in the middle.

client –> opensmppbox –> sqlbox1 –> bearerbox1 –> http-router –> smsbox2 –> sqlbox2 –> bearerbox2 –> smsc

We’ve done everything according to the book. Made several adjustments along the way to fasten things up. And all was working nicely until our client got a higher traffic from his smpp client and our supplier failed to deliver some dlrs. He later delivered them via cms file but they never went through our kannel system. All of a sudden the traffic got slow, and dlrs started queuing up. Since we did a whole system revamp at that time we though that it was due to configuration. So we tried several things in order to get it fixed. At the end i found this post:
https://www.mail-archive.com/users@kannel.org/msg30978.html

It turned out to be a problem in dlr tables. I didn’t set the indexes in dlr tables since they were created by the kannel and opensmppbox. Well, the second i set the indexes on dlr tables, traffic started flowing again.

So tip of the day:

HAVE YOUR TABLES INDEXED. DLR TABLES SHOULD HAVE TS AND URL FIELDS SET AS INDEXES.

I hope this helps someone.

Categories
Blog Kannel

Kannel quick installation

kannel sms gateway

What is Kannel?

Kannel is an open source WAP and SMS gateway which runs on the Linux platform and provides a high level HTTP service for submitting SMS requests. It supports many protocols to connect with the SMSC and even supports the GSM modem.It is very popular because its very good performance to handle a huge SMS traffic.

Based on the results from Wapit’s test environment, we claim Kannel to be the fastest SMS and WAP gateway on the market, capable of handling several hundreds of requests per second.

This article explains how the gateway can be installed. The goal of this article is to get the gateway compiled and all the files in the correct places and one of the next articles will explain how the gateway is configured.

Instructions

In this article we will use commands for Ubuntu/Debian.

    First we need to install packages:

  • sudo apt-get update
  • sudo apt-get install build-essential
  • sudo apt-get install bison
  • sudo apt-get install libmysqld-dev
  • sudo apt-get install libxml2-dev
    Now you can download latest version from Kannel website and unzip it to folder of your choice (e.g. /home/kannel). After extracting go to the directory where it is unzipped and run following commands:

  • sudo ./configure –with-mysql
  • sudo make
  • sudo make bindir=/kannelpath/bin install
    Next step is to install sqlbox and opensmppbox. Both are located in addons folder inside your kannel folder so you need to enter in each folder and run these three commands:

  • sudo ./configure
  • sudo make
  • sudo make install

Kannel is installed and ready for the configuration.

Categories
Plugins Wordpress

Weather plugin

When Proodos was starting, we decided to develop a small wordpress plugin that would show the current conditions in our town. The plugin development started in 2013. but was stopped because of other obligations and the design of our webpage was changed so it didn’t include the plugin. This year we restarted the plugin development, and we’re finally ready to launch the first version.

Installation and settings

You can install plugin manually by:
1. copy it in plugin folder of your wordpress and extract there or
2. go to plugins area in administration, go to add new plugin, and click on upload plugin. Choose the downloaded zip file and click on upload.

After installation please make sure to setup the plugin in settings area. To show plugin on your page simply echo pdsWeather() in the designated place.

update: You can now go to widgets area in your sites administration and drag & drop the plugin to the widget area of your choice.

Versions

Version 3.1
– removed printt of the results after save
– tested on 4.5
– implement selective refresh for widget

Version 3.0
– solved more bugs
– add input field for API key to the settings area
– made sure that api key is required in order for widget to be shown
– added drag & drop widget in widgets secions

Version 2.0
– solved some bugs
– added input field for API key
– added uninstall functions
– show weather label yes/no

Version 1.1.1
-another little bug solved

version 1.1
– solving bugs
– added temperature signs (F & °C)

Version 1.0. includes:
– current conditions at setup location every hour
– show/hide conditions string
– show/hide feels like string
– show temperature(s) in degrees celsius or fahrenheit, or both
– show/hide icon
– choose between icons provided from weather underground or use weather font by erik flowers

Planned changes for version 3.x:
– current conditions checkup frequency setup

If you have some other things that you would like to include first, please write to us.

Legal

The plugin uses Weather underground API for checkup of weather conditions. It also includes weather icons font developed by Erik Flowers.

Download

The plugin is now approved by WordPress team and is hosted on wordpress svn, o you can simply go to plugins section of your WordPress site, click add new and search for Weather
or you can download the plugin from wordpress page:
pdsweather

And here/s the official wordpress pdsweather page:
weather

Bugs

Please let us know if you find any bugs.

Categories
Blog Tidbits

Testing the candidates

Hello,
for all those who sent us their CV’s before and on 27th May 2015. we’d like you to solve one of the two tests and bring the answer to your job interview.

1. Html/CSS test

Please download the zip file containing the materials. Then do the simple html/css web page with those materials. Doesn’t need to be fancy, just give us your idea so we can see what you know. Also HTML5 use is a bonus.
Download link: testing materials

2. Backend test

Write a code snippet that prints out (echoes) numbers from 0-100. For every number that is divisible with 3 write “three”, for every number divisible with 5 write “five”. The last number write in words on language of your choice. Please take care that there are numbers divisible with 5 and 3. You can solve this test via pseudocode, c++, php, javascript or any other programming language.

As you can see the tests are not hard to solve. Even if you don’t solve them come to your job interview.

See you on your job interview. 🙂

Categories
Blog Tidbits

We’re looking for new apprentices

Hello!

If you want to learn web programming, here’s your chance! We’re looking for two apprentices to learn and work with us here in Osijek. These are the terms:

  • know how to use computer
  • foreign language (english, german, etc…) at least basic knowledge
  • be willing to use that foreign language, no matter your knowledge of it, in daily communication
  • have a degree from university – bacc., or mag., or ing., or dipl. ing., whatever
  • have no work experience

If you satisfy all of the terms, then contact us.

and here the link to official job offering: http://burzarada.hzz.hr/RadnoMjesto_Ispis.aspx?WebSifra=70046669

Cheers! 🙂

Categories
Blog Magento

Magento “Wrong tab configuration ….”

I made myself this problem today, and lost a half an hour trying to figure out what was wrong. So I decided to write a blog post about it, just so I don’t forget.

I had to add new tab to order view in admin area of Magento. I did everything by the book, but for some reason, when I refreshed the order view I got an error report screen. And the report said:

a:5:{i:0;s:24:”Wrong tab configuration.”;i:1;s:2023:”#0 [internal function]: Mage_Adminhtml_Block_Widget_Tabs->addTab(‘user_upload_ima…’, ‘mymodule/sale…’)

Whaaaat?!?!?! But, but, but…. I’ve set up everything correctly! Then next half an hour I was changing this and that before I decided to open Mage_Adminhtml_Block_Widget_Tabs and put echo “here” in various places in function addTab. At the end I saw that when I dumped the $tab variable it was:

boolean(false)

So I remembered. I didn’t have any blocks defined in this module prior to this one – have I even set up block class in my config.xml? I checked the config.xml and of course there was no block class setup.

So to solve the error. all I had to do is add this to my config.xml file:

<global>
    ....
    <blocks>
            <mymodule>
                <class>My_Module_Block</class>
            </mymodule>
     </blocks>
     .....
</global>

Cheers 🙂

Categories
Blog Magento

Magento 1.9.1.0 and 500 Internal server error

HI,
we recently begun working on a web shop whose owner wanted color swatch option for her store. We felt very lucky that Magento CE 1.9.1 came with that functionality. So we upgraded store from 1.9.0.1 to 1.9.1.0 But as usual, Magento upgrade didn’t go without problems. After the upgrading was finish, we coldn’t open the store. All we saw was a blank screen with 500 Internal server error displayed.

We tried making a downgrade back to 1.9.0.1. and then again upgrade to 1.9.1.0 As soon as we downgraded the store it was working normally. But the minute we upgraded it, it again displayed error 500. This only ment that there was something wrong with Magento installation. After looking at the server logs, we found out the problem – permissions on index.php. The permissions on index.php were set to 664 meaning the group was able to write to the file. The minute we changed the permissions on index.php to 644 the store was working again.

Hope this helps 🙂