Support » Plugin: Ready! Ecommerce Shopping Cart » Send mail to customer – Bug!

  • Resolved annoxoli

    (@annoxoli)


    Hi,

    follow problem.
    if some customer bought any item in my shop,
    the didn’t response some E-Mail about his order!

    i think some value are wrong in :
    “<wordpresspath>\wp-content\plugins\ready-ecommerce\modules\user\mod.php”
    Function:

    public function getCurrentEmail($order = array()) {
            $user = frame::_()->getModule('user')->getCurrent();
            $customerEmail = $user->user_email;
            if(empty($customerEmail) && empty($order))
                $order = frame::_()->getModule('order')->getCurrent();
            if(empty($customerEmail) && !empty($order)) {
    			if(!empty($order['shipping_address']) && is_string($order['shipping_address'])) {
    				$order['shipping_address'] = utils::jsonDecode($order['shipping_address']);
    			}
                if(!empty($order['shipping_address'])) {
                    foreach($order['shipping_address'] as $k => $v) {
                        if(preg_match('/^email/i', $k)) {
                            $customerEmail = $v;
                            break;
                        }
                    }
                }
    			if(!empty($order['billing_address']) && is_string($order['billing_address'])) {
    				$order['billing_address'] = utils::jsonDecode($order['billing_address']);
    			}
                if(empty($customerEmail) && !empty($order['billing_address'])) {
                    foreach($order['billing_address'] as $k => $v) {
                        if(preg_match('/^email/i', $k)) {
                            $customerEmail = $v;
                            break;
                        }
                    }
                }
            }
            return $customerEmail;
        }

    i search 2 hours to fix this bug, but i don’t find them!
    i hope you can help me! thanks.

    greetings

    http://wordpress.org/extend/plugins/ready-ecommerce/

Viewing 4 replies - 1 through 4 (of 4 total)
  • annoxoli

    (@annoxoli)

    Update:
    its work, but only if i create manual some user with their right email address!
    Code:

    public function addFromCheckout() {
            $url = '';
            $post = req::get('post');
            $res = $this->validateStep1($post);
    		//if registration from checkout is enabled and unregistered users don't allow to checkout
            if(isset($post['registration']) && !frame::_()->getModule('options')->get('allow_guest_checkout')) {
                $userAddErrors = frame::_()->getModule('user')->getModel()->validate($post['registration']);
                if(!empty($userAddErrors)) {
                    $regErrors = array();
                    foreach($userAddErrors as $key => $error)
                        $regErrors['registration['. $key. ']'] = lang::_('Registration: '). $error;     //To touch only registration fields
                    $res->pushError( $regErrors );
                }
            }
            if(!$res->error) {
                if(!frame::_()->getModule('user')->getCurrentID()) {
                    if(empty($post['registration']) && frame::_()->getModule('options')->get('checkout_force_create_user')) {
                        if(empty($post['registration']['password']))
                            $post['registration']['password'] = wp_generate_password(12, false);
                        $post['registration']['email'] = frame::_()->getModule('user')->getCurrentEmail();
                        if(empty($post['registration']['email'])) {
                            $post['registration']['username'] = utils::getRandStr();
                            $post['registration']['email'] = $post['registration']['username']. '@temp.com';
                        } else {
                            $userNameArr = explode('@', $post['registration']['email']);
                            $post['registration']['username'] = $userNameArr[0];
                        }
                    }
                    if(isset($post['registration'])) {                      //if registration from checkout is enabled
                        $post['registration']['forceLogin'] = true;         //make he logged right affter his add
                        req::setVar('loggedOnCheckoutRegister', true, 'session'); //to know that we logged him, @see checkoutView::getConfirnationPage()
                        frame::_()->getModule('user')->getModel()->post( $post['registration'], true /*This will skip validation*/ );
                    }
                }
                if($id = $this->getModel()->post($post)) {
                    $res->setHtml( frame::_()->getModule('checkout')->getView('checkout')->getConfirnationPage() );
                } else {
                    errors::push(lang::_('Can not add Order Record'));
                    $res->addError( errors::get() );
                }
            }
            return $res->ajaxExec();
        }

    Here:

    $post['registration']['email'] = $post['registration']['username']. '@temp.com';

    there create some user email with randome value! (Like: yHNIGotv8t@temp.com )
    you must select there user email on orders.php (billing_email)

    how can i do that ?

    greetings

    Plugin Author Ready! Developer

    (@ukrainecmk)

    Hello.
    “there create some user email with randome value! ” – please see code above:
    if(empty($post[‘registration’]) && frame::_()->getModule(‘options’)->get(‘checkout_force_create_user’))

    This mean that you have no registration fields for user and enabled option “Create user on checkout in any case”. If you don’t want to use registration box on checkout – add email to billing or shipping address section – and this should work.

    Regards,
    Alexey.

    Plugin Author Ready! Developer

    (@ukrainecmk)

    Hello.
    Was this helpful for you?

    Regards,
    Alexey.

    Plugin Author Ready! Developer

    (@ukrainecmk)

    Hello.
    Hope manipulations with option “Create user on checkout in any case” helped you.

    Regards,
    Alexey.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Send mail to customer – Bug!’ is closed to new replies.