Magento Programmatically Create Order

I just had to massively rework an interface to another shopping site for a customer. Therefore, I had to programmatically create orders in Magento, which is really an awful challenge. A pretty nice help for this was the code of Vinai Kopp, published under Pastebin.

A little extension for Vinai’s code: If you already have a customer object $customer and want to use the default billing and shipping address, you can set it like that (compare with line 42/43 of Vinai’s code):


Hope this helps someone 🙂

Magento Tier Prices for Configurable Products

The way Magento handles tier prices related to configurable products is a little bit strange. Assuming we have a basic T-Shirt which is available in red and blue and normally costs 10 Euro. If you purchase 10 or more shirts, the price is only 9 Euro. I (and many others of you out there, too!) would expect to get the cheaper price if you buy e.g. 6 blue and 4 red shirts. Anyways, this is not the case in Magento. In order to achieve this behaviour, the guys from Tridian wrote a nice piece of code. Unfortunately, it seems to be old and unsupported. So I updated the script to Magento and removed a little bug. The script from Tridian works fine for configurable products that have tiering prices. Sadly, there are problems with configurable products that do not have tier prices but a special price. In my version below, this bug is fixed. Magento Tier Prices for Configurable Products weiterlesen

Magento Code Snippet – Do not Show Homepage in Breadcrumbs

A few days ago, I faced the problem that I did not want to have the „Home“ link in the Magento breadcrumbs navigation. To avoid this, we simply have to insert an additional if-condition to app/design/frontend/[yourtheme]/[yourtemplate]/template/page/html/breadcrumbs.phtml

The new breadcrumbs.phtml looks like this (line 06!):

<?php if($crumbs && is_array($crumbs)): ?>
 <?php foreach($crumbs as $_crumbName=>$_crumbInfo): ?>
 <?php // do not show homepage in breadcrumbs ?>
 <?php if($this->getUrl('') != $_crumbInfo['link']): ?>
 <?php if($_crumbInfo['link']): ?>
 <a href="<?php echo $_crumbInfo['link'] ?>" title="<?php echo $this->htmlEscape($_crumbInfo['title']) ?>"><?php echo $this->htmlEscape($_crumbInfo['label']) ?></a>
 <?php elseif($_crumbInfo['last']): ?>
 <strong><?php echo $this->htmlEscape($_crumbInfo['label']) ?></strong>
 <?php else: ?>
 <?php echo $this->htmlEscape($_crumbInfo['label']) ?>
 <?php endif; ?>
 <?php if(!$_crumbInfo['last']): ?>
 <span>/ </span>
 <?php endif; ?>
 <?php endif; ?>
 <?php endforeach; ?>
<?php endif; ?>

Hope this helps someone.

Unirgy GiftCert Email Variables

Since Magento is developed by a company in the US and thus many english-speaking Magento developers exist, I thought I should write the Magento articles in English. No matter how I will write in future, this article is definitely in English and is about Unirgy GiftCert, a Magento extension adding gift certificate functionalities to Magento. I just installed and configured it in a shop of one of my clients and it was really a mess to set up the e-mail templates. So I thought I could help you with this 🙂 Unirgy GiftCert Email Variables weiterlesen

Magento: Barzahlung nur bei Selbstabholung aktivieren

Ich werde hier immer mal wieder Magento Module, die ich geschrieben habe, vorstellen. Heute geht es los mit einem kleinen Modul, das die Zahlungsart „Barzahlung“ nur dann aktiviert, wenn als Versandart „Selbstabholung“ ausgewählt wurde. Das Modul lässt sich einfach an individuelle Anforderungen anpassen.
Magento: Barzahlung nur bei Selbstabholung aktivieren weiterlesen