<commit_before><?php
/**
 * MinTotalQty observer model
 *
 * @category Jvs
 * @package  Jvs_MinTotalQty
 * @author   <NAME> <<EMAIL>>
 */
class Jvs_MinTotalQty_Model_Observer extends Mage_CatalogInventory_Helper_Minsaleqty
{
    public function checkTotalQtyBeforeCheckout(Varien_Event_Observer $observer)
    {
        $quote    = $observer->getDataObject();
        $customer = Mage::helper('customer')->getCustomer();

        // If the minimun total quantity is not met
        // redirect to cart page with error message
        if ($minQty = Mage::helper('jvs_mintotalqty')->minimunOrderQty($quote, $customer)) {
            Mage::getSingleton('checkout/session')->addUniqueMessages(
                Mage::getSingleton('core/message')
                    ->error(
                        Mage::helper('cataloginventory')
                            ->__(
                                'The minimum quantity allowed for purchase is %s.',
                                $minQty
                            )<commit_msg>Add docblocks to observer function<commit_after><?php
/**
 * MinTotalQty observer model
 *
 * @category Jvs
 * @package  Jvs_MinTotalQty
 * @author   <NAME> <<EMAIL>>
 */
class Jvs_MinTotalQty_Model_Observer extends Mage_CatalogInventory_Helper_Minsaleqty
{
    /**
     * Check minimun order totals
     *
     * @param  Varien_Event_Observer $observer
     * @return void
     */
    public function checkTotalQtyBeforeCheckout(Varien_Event_Observer $observer)
    {
        $quote    = $observer->getDataObject();
        $customer = Mage::helper('customer')->getCustomer();

        // If the minimun total quantity is not met
        // redirect to cart page with error message
        if ($minQty = Mage::helper('jvs_mintotalqty')->minimunOrderQty($quote, $customer)) {
            Mage::getSingleton('checkout/session')->addUniqueMessages(
                Mage::getSingleton('core/message')
                    ->error(
                        Mage::helper('cataloginventory')
                            ->__(
                                'The minimum quantity allowed for purchase is %s.',
                                $minQty
                            )
{'fraction_non_alphanumeric': 0.10377787892580792, 'fraction_numerical': 0.0, 'mean_word_length': 2.010958904109589, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2137044', 'n_tokens_mistral': 597, 'n_tokens_neox': 578, 'n_words': 123}