Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>After few days ago, i'm hard-working and know that: - Override app/code/core/Mage/Checkout/Model/Cart.php and edit function like that:</p> <pre><code> public function updateItems($data) { Mage::dispatchEvent('checkout_cart_update_items_before', array('cart'=&gt;$this, 'info'=&gt;$data)); foreach ($data as $itemId =&gt; $itemInfo) { $item = $this-&gt;getQuote()-&gt;getItemById($itemId); if (!$item) { continue; } if (!empty($itemInfo['remove']) || (isset($itemInfo['qty']) &amp;&amp; $itemInfo['qty']=='0')) { $this-&gt;removeItem($itemId); continue; } $qty = isset($itemInfo['qty']) ? (float) $itemInfo['qty'] : false; if ($qty &gt; 0) { $item-&gt;setQty($qty); } /* Start: Custom code added for license start date */ if(!empty($itemInfo['license_start_date'])) { $write = Mage::getSingleton('core/resource')-&gt;getConnection('core_write'); # make the frame_queue active $query = "UPDATE `sales_flat_quote_item` SET license_start_date = '".$itemInfo['license_start_date']."' where item_id = $itemId"; $write-&gt;query($query); $item-&gt;setLicense_start_date($itemInfo['license_start_date']); } /* End: Custom code added for licensee start date */ } Mage::dispatchEvent('checkout_cart_update_items_after', array('cart'=&gt;$this, 'info'=&gt;$data)); return $this; } </code></pre> <p>and copy app/code/core/Mage/Adminhtml/Block/Sales/Order/Items/Abstract.php to local (app/code/local/Mage/Adminhtml/Block/Sales/Order/Items/Abstract.php) and add this function:</p> <pre><code>public function getLicense_start_date($item) { $itemId = $item-&gt;getId(); $write = Mage::getSingleton('core/resource')-&gt;getConnection('core_write'); $query = "SELECT q.* FROM `sales_flat_order_item` o LEFT JOIN `sales_flat_quote_item` q on o.quote_item_id = q.item_id WHERE o.item_id = $itemId"; # For older versions of Magento /* $query = "SELECT q.* FROM `sales_order_entity_int` o LEFT JOIN `sales_flat_quote_item` q on o.value = q.entity_id WHERE o.entity_id = $itemId AND o.attribute_id = 343"; */ $res = $write-&gt;query($query); while ($row = $res-&gt;fetch() ) { if(key_exists('itemcomment',$row)) { echo nl2br($row['itemcomment']); } } } </code></pre> <p>To add the license time column to the items edit the .phtml file below: app/design/adminhtml/default/default/template/sales/order/view/items.phtml (you can add you theme in adminhtml to edit)</p> <p>Adding header for items to make it look like below:</p> <pre><code>&lt;tr class="headings"&gt; &lt;th&gt;&lt;?php echo $this-&gt;helper('sales')-&gt;__('Product') ?&gt;&lt;/th&gt; &lt;th&gt;&lt;?php echo $this-&gt;helper('sales')-&gt;__('Licens Time') ?&gt;&lt;/th&gt; &lt;th&gt;&lt;?php echo $this-&gt;helper('sales')-&gt;__('Item Status') ?&gt;&lt;/th&gt; </code></pre> <p>And adding Column with comments. app/design/adminhtml/default/default/template/sales/order/view/items/renderer/default.phtml Add a column for item comments juts before status columns to make it look a like below.</p> <pre><code>&lt;td&gt;&lt;?php echo $this-&gt;getLicense_start_date($_item) ?&gt;&lt;/td&gt; &lt;!-- New column added for item comments --&gt; &lt;td class="a-center"&gt;&lt;?php echo $_item-&gt;getStatus() ?&gt;&lt;/td&gt; </code></pre> <p>Note that: In your theme, for the file: template/checkout/cart.phtml Add the new heading along with other heading for cart items and in the file: template/checkout/cart/item/default.phtml use datepicker to selected date with code like below:</p> <pre><code>&lt;td class="a-center"&gt; &lt;input type="text" name="cart[&lt;?php echo $_item-&gt;getId() ?&gt;][license_start_date]" rows="3" cols="20"&gt;&lt;?php echo $_item-&gt;getLicense_start_date() ?&gt;&lt;/input&gt; &lt;/td&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload