1

I have one product that is a cause for concern when checking out. Whenever this product is in the cart the checkout throws many popup alerts.

I'll link images to help with visuals as I go through checkout with this product in my cart.

  1. Checkout Method (You have to be registered or you have to register).
  2. Shipping Information (standard fill out info then select mail class)
  3. Billing Information (standard fill out info)
  4. Order Review

enter image description here

Now I get to Order review. Additionally, if my email wasn't unique it wouldn't of let me even get to order review... and when I get to order review it's always going to ask me to change my email... even if it's unique.. this is where everything is broken.

enter image description here

Then it sends me back to change the email, if I change the email I'll get the same error above on final review "customer email is required". If I just close it and hit submit again it will ask me to select a shipping method.. but I've already selected a shipping method.. just like I've already added an email.

I believe it's saving everything early on billing.save() so when you get to submit on step 4 order review it's already saved.

This product has a module built for it and I think it's the cause of the issue. I can checkout fine with any other products. Please help.

If I turn off the required function for email it submits but it never saves to the order grid.

enter image description here

no email address is saved to the order grid.

I believe this file/files are in question.

Observer.php

<?php
/**
 * Yardmaster observer
 * Date: 1/5/16
 * Time: 12:13 PM
 */
class Swarming_Yardmaster_Model_Observer
{
    /**
     * Handles sign up of Yardmaster club on the sales_order_place_after event
     * @param $observer
     */
    public function yardmasterSignup($observer)
    {
        /**@var Mage_Sales_Model_Order $order */
        $order = $observer->getOrder();

        $items = $order->getAllItems();

        /**@var Mage_Sales_Model_Order_Item $item*/
        foreach ($items as $item) {
            if (is_int(strpos($item->getSku(), Mage::helper('swarming_yardmaster')->getYardmasterSku()))) {
                $targetGroup = Mage::getModel('customer/group');
                $targetGroup->load(
                    Swarming_Import_Model_Observer::YARDMASTER_CUSTOMER_GROUP_CODE,
                    'customer_group_code'
                );
                $customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
                $customer->setGroupId($targetGroup->getId());
                $customer->save();
            }
        }
    }

    public function productCollectionAddProductAttributes($observer)
    {
        $collection = $observer->getCollection();

        $collection->addAttributeToSelect('in_stock_status')
            ->addAttributeToFilter('bo_allowed')
            ->addAttributeToFilter('announced_date')
            ->addAttributeToFilter('adv_res')
            ->addAttributeToFilter('next_in_date')
            ->addAttributeToFilter('first_receive_date')
            ->addAttributeToFilter('create_date')
            ->addAttributeToFilter('special_from_date')
            ->addAttributeToFilter('special_to_date');
    }

    /**
     * Add the groupscatalog filter sql to product collections
     *
     * @param Varien_Event_Observer $observer
     * @return void
     */
    public function catalogProductCollectionLoadBefore(Varien_Event_Observer $observer)
    {
        /** @var Mana_Filters_Resource_Solr_Collection $collection */
        $collection = $observer->getCollection();
        $customer = Mage::getSingleton('customer/session')->getCustomer();

        $targetGroup = Mage::getModel('customer/group');
        $targetGroup->load(Swarming_Import_Model_Observer::YARDMASTER_CUSTOMER_GROUP_CODE, 'customer_group_code');
        $collection->addAttributeToSelect('yardmaster_private_catalog');
        if ($customer->getGroupId() != $targetGroup->getId()) {
            //$collection->addFieldToFilter('yardmaster_private_catalog_value', 'Active Items');
        }
    }
}

Dashboard/Hello.php

<?php
/**
 * Created by PhpStorm.
 * Date: 3/30/16
 * Time: 3:36 PM
 */ 
class Swarming_Yardmaster_Block_Customer_Account_Dashboard_Hello extends Mage_Customer_Block_Account_Dashboard_Hello {
    public function getCustomerName()
    {
        if (Mage::getSingleton('customer/session')->getCustomer()->getName()) {
            return Mage::getSingleton('customer/session')->getCustomer()->getName();
        } else {
            $parts = explode('@', Mage::getSingleton('customer/session')->getCustomer()->getEmail());
            $user = $parts[0];
            echo ', ' . $user;
        }
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.