Subscribe To RSS Feed


Mike D's SharpBlog

Just another Sharpdot weblog

Archive for February, 2010

Magento: Customer Desired Delivery Date Module

- Monday, February 22nd, 2010 -

This Magento Module allows you to add a date picker to the checkout process, which the customer can use to input a desired delivery date. There is minimal setup required. You will need to add the supplied code to your template pages in order to display the date-picker on the checkout process and add one line of code to the admin template. As soon as I find a convenient way to add the necessary block to the template files with out having to modify the template files I will remove the manual part of the Module.

Here is a link to the modules page: Delivery Date Plugin NOTE: Not compatible with Magento Ver 1.4.1 or above

To Add to email templates: (provided by Magento user: mrgniarf)
You can modify yourtheme/yourdesign/template/email/order/items.phtml and before :

<table cellspacing="0" cellpadding="0" border="0" width="100%" style="border:1px solid #bebcb7;background:#f8f7f5">
<thead>
<tr>
<th align="left" bgcolor="#d9e5ee">__('Sku') ?></th>
<th align="left" bgcolor="#d9e5ee">__('Item') ?></th>
<th align="right" bgcolor="#d9e5ee">__('Subtotal') ?></th>
<th align="center" bgcolor="#d9e5ee">__('Qty') ?></th>
</tr>
</thead>

Add:

<table cellspacing="0" cellpadding="0" border="0" width="100%">
<thead>
<tr>
<th align="left" width="100%" bgcolor="#d9e5ee">__('Desired Arrival Date') ?></th>
</tr>
</thead>
<tbody>
<tr>
<td valign="top" style="padding:7px 9px 9px 9px;border:1px solid #bebcb7;border-top:0;background:#f8f7f5">
helper('deliverydate')->getFormatedDeliveryDate($_order->getShippingArrivalDate()); ?>
</td>
</tr>
</tbody>
</table>
<br>

Here Is the Zip file for the module (DOWNLOAD).

Tags: , , ,
Posted in PHP, magento | 117 Comments »

Magento Error: You cannot define a correlation name … more than once.

- Thursday, February 4th, 2010 -

This will be a short post about an error I ran into when messing around with the Magento “Toolbar” that is displayed for search results and on category pages. I decided that i needed to extend the toolbar block in-order to achieve some custom functionality that a client needed. Then I noticed that when I sorted by price I got the following error “You cannot define a correlation name ‘_price_order_table’ more than once“.  In my case I had extended the setCollection function.

My problem(Error) began because I was calling the parent method then was setting the order on the collection again, and Magento did not like it.

     public function setCollection($collection)
    {
        parent::setCollection($collection);
        //The next three lines were what were causing the problem.
        //Because setOrder was called in the parent function it threw the error when it was called again.
        #if ($this->getCurrentOrder()) {
        #    $this->getCollection()->setOrder($this->getCurrentOrder(), $this->getCurrentDirection());
        #}
        //Custom code went here
        return $this;
    }

Tags: , ,
Posted in PHP, magento | 13 Comments »