Hi
people purchasing from the store must register with th site first. Is there any option for this in this plugin?
Thanks
Shiyam
Hi
people purchasing from the store must register with th site first. Is there any option for this in this plugin?
Thanks
Shiyam
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'])) . '" /> ';
}
}
}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
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. ]
Hi Prasath Pree
Thanks a lot it works great
Okay. Change the post status to resolved.
Ok sure. Thanks a lot
You must log in to post.