Forums

Image Store
[resolved] Store users are not included with regular site users (7 posts)

  1. shiyam06
    Member
    Posted 5 months ago #

    Hi
    people purchasing from the store must register with th site first. Is there any option for this in this plugin?

    Thanks
    Shiyam

    http://wordpress.org/extend/plugins/image-store/

  2. Prasath Mani
    Member
    Posted 5 months ago #

    Hey Shiyam,
    Please change bellow code in plugins/image-store/_store/cart.php

    Find & delete bellow code:

    //render buttons
    	foreach ((array)$this->opts['gateway'] as $key => $bol){
    		if( $this->in_array($key, array('wepaystage','wepayprod')) && $bol){
    
    			$data = array(
    				'type' => 'GOODS',
    				'account_id' => $this->opts['wepayaccountid'],
    				'amount' => $this->cart['total'],
    				'short_description' => __("Image Purchase"),
    				'reference_id' => $this->orderid,
    				'redirect_uri' => $this->get_permalink('receipt'),
    				'callback_uri' =>$this->get_permalink($this->imspage),
    			);
    
    			if ($this->cart['shippingcost'])
    				$data['require_shipping' ] = true;
    
    			try{ $checkout = $wepay->request('checkout/create', $data );
    			}catch(WePayException $e){ }
    
    			if(!empty( $checkout->checkout_uri ))
    				$this->gateways[$key]['url'] = $checkout->checkout_uri;
    		}
    		if ($bol){
    			$output .='<input name="' . $key . '" type="submit" value="' . esc_attr($this->gateways[$key]['name']) .
    			'" class="primary ims-google-checkout shop_btn" data-submit-url="' . esc_attr(urlencode($this->gateways[$key]['url'])) . '" /> ';
    		}
    	}

    Paste bellow code into cart.php

    global $user_ID;
    			$user_info = get_userdata($user_ID);
    			if( !is_user_logged_in() )
    			{
    				$output .='Please <a href="" class="shop_btn">Login</a> or <a href="" class="shop_btn">Register</a> to complete your shopping';
    			} else {
    	//render buttons
    	foreach ((array)$this->opts['gateway'] as $key => $bol){
    		if( $this->in_array($key, array('wepaystage','wepayprod')) && $bol){
    
    			$data = array(
    				'type' => 'GOODS',
    				'account_id' => $this->opts['wepayaccountid'],
    				'amount' => $this->cart['total'],
    				'short_description' => __("Image Purchase"),
    				'reference_id' => $this->orderid,
    				'redirect_uri' => $this->get_permalink('receipt'),
    				'callback_uri' =>$this->get_permalink($this->imspage),
    			);
    
    			if ($this->cart['shippingcost'])
    				$data['require_shipping' ] = true;
    
    			try{ $checkout = $wepay->request('checkout/create', $data );
    			}catch(WePayException $e){ }
    
    			if(!empty( $checkout->checkout_uri ))
    				$this->gateways[$key]['url'] = $checkout->checkout_uri;
    		}
    		if ($bol){
    			$output .='<input name="' . $key . '" type="submit" value="' . esc_attr($this->gateways[$key]['name']) .
    			'" class="primary ims-google-checkout shop_btn" data-submit-url="' . esc_attr(urlencode($this->gateways[$key]['url'])) . '" /> ';
    		}
    	}
       }
  3. shiyam06
    Member
    Posted 5 months ago #

    Hi prasathpree,

    Thanks for this,

    The code is working except one thing. When clicked login link in check out it does not takes me to the login page and just says cart update successfully. Can you help me on this.

    Thanks
    Shiyam

  4. Prasath Mani
    Member
    Posted 5 months ago #

    Hi Shiyam,

    Updated Code

    global $user_ID;
    			$user_info = get_userdata($user_ID);
    			if( !is_user_logged_in() )
    			{
    		$output .='Please <a href="'.wp_login_url(get_permalink()).'" title="Login">Login</a> or <a href="'.site_url('/wp-login.php?action=register').'" title="Register">Register</a> to complete your shopping';
    			} else {
    	//render buttons
    	foreach ((array)$this->opts['gateway'] as $key => $bol){
    		if( $this->in_array($key, array('wepaystage','wepayprod')) && $bol){
    
    			$data = array(
    				'type' => 'GOODS',
    				'account_id' => $this->opts['wepayaccountid'],
    				'amount' => $this->cart['total'],
    				'short_description' => __("Image Purchase"),
    				'reference_id' => $this->orderid,
    				'redirect_uri' => $this->get_permalink('receipt'),
    				'callback_uri' =>$this->get_permalink($this->imspage),
    			);
    
    			if ($this->cart['shippingcost'])
    				$data['require_shipping' ] = true;
    
    			try{ $checkout = $wepay->request('checkout/create', $data );
    			}catch(WePayException $e){ }
    
    			if(!empty( $checkout->checkout_uri ))
    				$this->gateways[$key]['url'] = $checkout->checkout_uri;
    		}
    		if ($bol){
    			$output .='<input name="' . $key . '" type="submit" value="' . esc_attr($this->gateways[$key]['name']) .
    			'" class="primary ims-google-checkout shop_btn" data-submit-url="' . esc_attr(urlencode($this->gateways[$key]['url'])) . '" /> ';
    		}
    	}
       }

    [ Signature moderated. ]

  5. shiyam06
    Member
    Posted 5 months ago #

    Hi Prasath Pree

    Thanks a lot it works great

  6. Prasath Mani
    Member
    Posted 5 months ago #

    Okay. Change the post status to resolved.

  7. shiyam06
    Member
    Posted 5 months ago #

    Ok sure. Thanks a lot

Reply

You must log in to post.

About this Plugin

About this Topic