I would suggest you to achieve this from observer.
This event checkout_cart_product_add_after
should help you.
You will need to create a simple extension to fire this event.
In your config.xml have this:
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<DigitalCinema_Pos>
<version>1.0.8</version>
</DigitalCinema_Pos>
</modules>
<global>
<models>
<namespace>
<class>NameSpace_ModuleName_Model</class>
</namespace>
</models>
<events>
<checkout_cart_product_add_after>
<observers>
<update_qty_on_product_add_to_cart>
<type>singleton</type>
<class>NameSpace_ModuleName_Model_Observer</class>
<method>updateQty</method>
</update_qty_on_product_add_to_cart>
</observers>
</checkout_cart_product_add_after>
</events>
............
</global>
</config>
Now, your NameSpace/ModuleName/Model/Observer.php
<?php
class NameSpace_ModuleName_Model_Observer
{
public function updateQty(Varien_Event_Observer $observer)
{
$item = $observer->getEvent()->getQuoteItem();
$x= $item->getQty();
$minValue = 8;
if ($x>= $minValue) {
Mage::log('Proceed with number: '.$x, null, 'custom-log.log'); //check in var/log folder after product adding to cart
}
else {
$x = 8;
Mage::log('Minimum number is: '.$x, null, 'custom-log.log');
}
$item->setQty($x)->save();
}
?>
Check if file custom-log.log
is created in var/log
folder after you add product to cart. If it is then your event is firing.
Hope this helps.