Magento – Move a category programmatically

Introduction

Our client has decided to change some categories path. He wanted to move some sub-category trees to different parent category.
This can be done quite simply in administration, because of drag and drop interface. But because of my own curiosity I started to wonder, what about doing that programmatically? How can this be done?

Preberi ostalo »

How to generate query string from PHP POST stream

Introduction

Every PHP developer should know about POST and GET global arrays and I won’t bother explaining how and when data is filled in these variables or when to use POST or GET stream. This article is not about that, it’s about generating a query string.
And where would this be useful you ask?
Well for instance I had to do a pagination for search results and form data was submitted by POST stream and I needed to generate query string which was then used in links for page navigation. Nothing fancy but it is a valid example.

Preberi ostalo »

Alerting user about changes when leaving a form

Intro

Article title and it’s meaning is maybe a little dubious for some people, so let me explain. What I want to present to you today is a neat trick to stop users from leaving a web form without submitting data.
Some of you experienced similar trick if you are using gmail. This message appears when you try to leave a page when there is small loading note present on top of the screen, this note shows when you are preforming some action (for instance: deleting or moving a lot of emails). Although i don’t know how they coded this, the principle should be the same as it is explained in this article.

Preberi ostalo »

Problems with displaying CMYK images in Internet Explorer

Problem description

This is another special IE “feature” which I stumbled upon just recently. The problem was, that images were not displayed in older IE versions(including and below 8) and Firefox 2.X in all other browsers everything was perfect.
In browsers which are to old to support CMYK image type there was just small red X in IE and empty space in Firefox even after confirming that HTML code was valid and image tag was inserted correctly. After this basic tests, I had no clue what the hell was going on, so I had no choice but to google it and soon after few missed hits I managed to get a jackpot:)

Preberi ostalo »

Magento – Fatal error: Call to a member function setQuote() with Paypal payment method

Error description

There is probably more then one situation where this error can display and cause headache for developers, in our case this error appeared when shop users payed with paypal payment method and then at the last step, when customer had already entered his paypal data and when order is confirmed by paypal and a redirect back to store took user to a page displaying this fatal error.

Preberi ostalo »

Magento – pravice na strežniku – prenos na novo gostovanje

Ste že kdaj prestavljali Magento? Se vam je naredilo, da je na prejšnjem gostovanju vse delovalo, po prenosu pa nič več? Preberi ostalo »

Sme (spletni) trgovec zaračunavati dodatno provizijo v primeru plačila s kreditno kartico?

Nekaj časa se že vleče dilema ali je zakonsko dovoljeno trgovcu – navadnemu ali spletnemu – zaračunavati dodatno provizijo v primeru, ko stranka izbere način plačila s kreditno kartico. Ker so bili odgovori različni in je to predstavljalo povsem sivo območje, ko nihče ni vedel točno, smo se odločili stvar raziskati in priti do dna! Preberi ostalo »

Magento – add attribute to attribute programmaticaly with sql

Sometimes you may need to add attribut to attribute set programmaticaly and not in cms. One of the reasons could be that you have too many products. In such case, adding new attribute to attribute set could fail due too many resources taken.
Preberi ostalo »

Magento override model

V tem tutorialu bom na kratko opisal kako narediti rewrite model v svojem modulu in na katere stvari je potrebno biti pozoren. Magento omogoča, da core datoteke prekopiramo v local in tam dodamo/spremenimo po svoje, kar je zelo dobro saj ne spremenimo samih core datotek.
Preberi ostalo »

Update magento produktov s sql stavki

Če želimo pohitriti izvajanje osvežitev produktov potem je boljše, da izvedemo to s sql stavki. Z njimi lahko osvežimo le atribute katere mi želimo, v tem blogu bom zapisal kako zapisati pravilen update za short in long description.
Preberi ostalo »